Browse Source

Merge pull request #1105 from LumaDigital/JS-SkeletonOnlyAnimation

Allow animation generation for skeleton hierarchies without skinned meshes
JoshEngebretson 9 years ago
parent
commit
369b89cdaa
1 changed files with 7 additions and 4 deletions
  1. 7 4
      Source/ToolCore/Assets/ModelImporter.cpp

+ 7 - 4
Source/ToolCore/Assets/ModelImporter.cpp

@@ -131,12 +131,15 @@ bool ModelImporter::ImportAnimation(const String& filename, const String& name,
 
             AnimatedModel* animatedModel = importNode_->GetComponent<AnimatedModel>();
             AnimationController* controller = importNode_->GetComponent<AnimationController>();
-            if (animatedModel && controller)
+            if (!controller)
             {
-                SharedPtr<Animation> animation = cache->GetTempResource<Animation>(fileName + extension);
-                if (animation)
-                    controller->AddAnimationResource(animation);
+                importNode_->CreateComponent<AnimationController>();
+                controller = importNode_->GetComponent<AnimationController>();
             }
+            SharedPtr<Animation> animation = cache->GetTempResource<Animation>(fileName + extension);
+
+            if (animation)
+                controller->AddAnimationResource(animation);
 
             ATOMIC_LOGINFOF("Import Info: %s : %s", info.name_.CString(), fileName.CString());
         }