|
@@ -2329,7 +2329,11 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
|
|
Array samplers = d["samplers"];
|
|
Array samplers = d["samplers"];
|
|
|
|
|
|
if (d.has("name")) {
|
|
if (d.has("name")) {
|
|
- animation.name = _sanitize_scene_name(d["name"]);
|
|
|
|
|
|
+ String name = d["name"];
|
|
|
|
+ if (name.begins_with("loop") || name.ends_with("loop") || name.begins_with("cycle") || name.ends_with("cycle")) {
|
|
|
|
+ animation.loop = true;
|
|
|
|
+ }
|
|
|
|
+ animation.name = _sanitize_scene_name(name);
|
|
}
|
|
}
|
|
|
|
|
|
for (int j = 0; j < channels.size(); j++) {
|
|
for (int j = 0; j < channels.size(); j++) {
|
|
@@ -2735,6 +2739,10 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
|
|
animation.instance();
|
|
animation.instance();
|
|
animation->set_name(name);
|
|
animation->set_name(name);
|
|
|
|
|
|
|
|
+ if (anim.loop) {
|
|
|
|
+ animation->set_loop(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
float length = 0;
|
|
float length = 0;
|
|
|
|
|
|
for (Map<int, GLTFAnimation::Track>::Element *E = anim.tracks.front(); E; E = E->next()) {
|
|
for (Map<int, GLTFAnimation::Track>::Element *E = anim.tracks.front(); E; E = E->next()) {
|