Explorar el Código

Extract AnimatedModel::ApplyAnimation method to force animation update. Make AnimationController::Update virtual.

Eugene Kozlov hace 9 años
padre
commit
705c5a17fa

+ 5 - 0
Source/Urho3D/Graphics/AnimatedModel.cpp

@@ -1260,6 +1260,11 @@ void AnimatedModel::UpdateAnimation(const FrameInfo& frame)
             animationLodTimer_ = 0.0f;
     }
 
+    ApplyAnimation();
+}
+
+void AnimatedModel::ApplyAnimation()
+{
     // Make sure animations are in ascending priority order
     if (animationOrderDirty_)
     {

+ 2 - 0
Source/Urho3D/Graphics/AnimatedModel.h

@@ -96,6 +96,8 @@ public:
     void SetMorphWeight(StringHash nameHash, float weight);
     /// Reset all vertex morphs to zero.
     void ResetMorphWeights();
+    /// Apply all animation states to nodes.
+    void ApplyAnimation();
 
     /// Return skeleton.
     Skeleton& GetSkeleton() { return skeleton_; }

+ 1 - 1
Source/Urho3D/Graphics/AnimationController.h

@@ -97,7 +97,7 @@ public:
     virtual void OnSetEnabled();
 
     /// Update the animations. Is called from HandleScenePostUpdate().
-    void Update(float timeStep);
+    virtual void Update(float timeStep);
     /// Play an animation and set full target weight. Name must be the full resource name. Return true on success.
     bool Play(const String& name, unsigned char layer, bool looped, float fadeInTime = 0.0f);
     /// Play an animation, set full target weight and fade out all other animations on the same layer. Name must be the full resource name. Return true on success.