diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp index 731f1e312d..79f36d0543 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp @@ -112,6 +112,10 @@ void BoneNode::removeChild(Node* child, bool cleanup /* = true */) void BoneNode::removeFromBoneList(BoneNode* bone) { _childBones.eraseObject(bone); + auto skeletonNode = dynamic_cast(bone); + if (bone != nullptr) // nested skeleton + return; + bone->_rootSkeleton = nullptr; auto subBones = bone->getAllSubBones(); subBones.pushBack(bone); @@ -424,9 +428,12 @@ cocos2d::Vector BoneNode::getAllSubSkins() const void BoneNode::sortAllChildren() { - Node::sortAllChildren(); - std::sort(_childBones.begin(), _childBones.end(), cocos2d::nodeComparisonLess); - std::sort(_boneSkins.begin(), _boneSkins.end(), cocos2d::nodeComparisonLess); + if (_reorderChildDirty) + { + std::sort(_childBones.begin(), _childBones.end(), cocos2d::nodeComparisonLess); + std::sort(_boneSkins.begin(), _boneSkins.end(), cocos2d::nodeComparisonLess); + Node::sortAllChildren(); + } } SkeletonNode* BoneNode::getRootSkeletonNode() const diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp index a95256207c..f5f78c93ea 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp @@ -340,7 +340,7 @@ void SkeletonNode::updateAllDrawBones() std::stack boneStack; for (const auto& bone : _childBones) { - if (bone->isVisible()) + if (bone->isVisible() && bone->isDebugDrawEnabled()) boneStack.push(bone); } @@ -352,7 +352,7 @@ void SkeletonNode::updateAllDrawBones() auto topChildren = top->getChildBones(); for (const auto& childbone : topChildren) { - if (childbone->isVisible()) + if (childbone->isVisible() && childbone->isDebugDrawEnabled()) boneStack.push(childbone); } }