Browse Source

Add GetSkeletonBoneNode to allow getting node without exposing skeleton and bone to script

Matt Benic 9 years ago
parent
commit
7477233ff5

+ 6 - 0
Source/Atomic/Graphics/AnimatedModel.cpp

@@ -688,6 +688,12 @@ void AnimatedModel::ResetMorphWeights()
     MarkNetworkUpdate();
 }
 
+Node* AnimatedModel::GetSkeletonBoneNode(const String & boneName)
+{
+    Bone* bone = skeleton_.GetBone(boneName);
+    return (bone) ? bone->node_ : NULL;
+}
+
 float AnimatedModel::GetMorphWeight(unsigned index) const
 {
     return index < morphs_.Size() ? morphs_[index].weight_ : 0.0f;

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

@@ -99,6 +99,8 @@ public:
 
     /// Return skeleton.
     Skeleton& GetSkeleton() { return skeleton_; }
+    /// Return the node of a skeleton bone (for script access)
+    Node* GetSkeletonBoneNode(const String& boneName);
 
     /// Return all animation states.
     const Vector<SharedPtr<AnimationState> >& GetAnimationStates() const { return animationStates_; }