Browse Source

- ModelImporter changes to allow animations without a skinned meshes

Johnny 9 years ago
parent
commit
38b6c0e19a
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>();
             AnimatedModel* animatedModel = importNode_->GetComponent<AnimatedModel>();
             AnimationController* controller = importNode_->GetComponent<AnimationController>();
             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());
             ATOMIC_LOGINFOF("Import Info: %s : %s", info.name_.CString(), fileName.CString());
         }
         }