diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index dd909eef25..5f13d70cc7 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -95,7 +95,7 @@ void Animate3D::startWithTarget(Node *target) _boneCurves.clear(); auto skin = sprite->getSkin(); - for (unsigned int i = 0; i < skin->getSkinBoneCount(); i++) { + for (unsigned int i = 0; i < skin->getBoneCount(); i++) { auto bone = skin->getBoneByIndex(i); auto curve = _animation->getBoneCurveByName(bone->getName()); if (curve) diff --git a/cocos/3d/CCMeshSkin.cpp b/cocos/3d/CCMeshSkin.cpp index e9d4dd2c93..64add14d67 100644 --- a/cocos/3d/CCMeshSkin.cpp +++ b/cocos/3d/CCMeshSkin.cpp @@ -324,9 +324,9 @@ bool MeshSkin::initFromSkinData(const SkinData& skindata) return true; } -ssize_t MeshSkin::getSkinBoneCount() const +ssize_t MeshSkin::getBoneCount() const { - return _skinBones.size(); + return _skinBones.size() + _nodeBones.size(); } //get bone diff --git a/cocos/3d/CCMeshSkin.h b/cocos/3d/CCMeshSkin.h index 172eb2062e..eaeaa03467 100644 --- a/cocos/3d/CCMeshSkin.h +++ b/cocos/3d/CCMeshSkin.h @@ -189,8 +189,8 @@ public: /**create a new meshskin if do not want to share meshskin*/ static MeshSkin* create(const std::string& filename, const std::string& name); - /**get skin bone count*/ - ssize_t getSkinBoneCount() const; + /**get total bone count, skin bone + node bone*/ + ssize_t getBoneCount() const; /**get bone*/ Bone* getBoneByIndex(unsigned int index) const;