Browse Source

Stop existing weight fade when AnimationController::SetWeight() is called, to ensure the set weight is not overridden one frame later. Closes #1583.

Lasse Öörni 9 years ago
parent
commit
00f0a87dc5
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Source/Urho3D/Graphics/AnimationController.cpp

+ 4 - 0
Source/Urho3D/Graphics/AnimationController.cpp

@@ -367,6 +367,10 @@ bool AnimationController::SetWeight(const String& name, float weight)
     animations_[index].setWeight_ = (unsigned char)(weight * 255.0f);
     animations_[index].setWeight_ = (unsigned char)(weight * 255.0f);
     animations_[index].setWeightTtl_ = COMMAND_STAY_TIME;
     animations_[index].setWeightTtl_ = COMMAND_STAY_TIME;
     ++animations_[index].setWeightRev_;
     ++animations_[index].setWeightRev_;
+    // Cancel any ongoing weight fade
+    animations_[index].targetWeight_ = weight;
+    animations_[index].fadeTime_ = 0.0f;
+
     MarkNetworkUpdate();
     MarkNetworkUpdate();
     return true;
     return true;
 }
 }