Browse Source

Added possibility to read animation state start bone as String for handcrafted XML files.

Lasse Öörni 13 years ago
parent
commit
363e9139de
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Engine/Graphics/AnimatedModel.cpp

+ 6 - 1
Engine/Graphics/AnimatedModel.cpp

@@ -747,7 +747,12 @@ void AnimatedModel::SetAnimationStatesAttr(VariantVector value)
         AnimationState* state = AddAnimationState(cache->GetResource<Animation>(animRef.id_));
         if (state)
         {
-            state->SetStartBone(skeleton_.GetBone(value[index++].GetStringHash()));
+            const Variant& startBone = value[index++];
+            // Allow bone name also as String for handcrafted XML data
+            if (startBone.GetType() == VAR_INT)
+                state->SetStartBone(skeleton_.GetBone(startBone.GetStringHash()));
+            else if (startBone.GetType() == VAR_STRING)
+                state->SetStartBone(skeleton_.GetBone(startBone.GetString()));
             state->SetLooped(value[index++].GetBool());
             state->SetWeight(value[index++].GetFloat());
             state->SetTime(value[index++].GetFloat());