mirror of https://github.com/axmolengine/axmol.git
add SkeletonNode Nest test case
This commit is contained in:
parent
d2de5b1c85
commit
fa5d70fc04
|
@ -112,6 +112,10 @@ void BoneNode::removeChild(Node* child, bool cleanup /* = true */)
|
|||
void BoneNode::removeFromBoneList(BoneNode* bone)
|
||||
{
|
||||
_childBones.eraseObject(bone);
|
||||
auto skeletonNode = dynamic_cast<SkeletonNode*>(bone);
|
||||
if (bone != nullptr) // nested skeleton
|
||||
return;
|
||||
|
||||
bone->_rootSkeleton = nullptr;
|
||||
auto subBones = bone->getAllSubBones();
|
||||
subBones.pushBack(bone);
|
||||
|
@ -424,9 +428,12 @@ cocos2d::Vector<SkinNode*> BoneNode::getAllSubSkins() const
|
|||
|
||||
void BoneNode::sortAllChildren()
|
||||
{
|
||||
Node::sortAllChildren();
|
||||
if (_reorderChildDirty)
|
||||
{
|
||||
std::sort(_childBones.begin(), _childBones.end(), cocos2d::nodeComparisonLess);
|
||||
std::sort(_boneSkins.begin(), _boneSkins.end(), cocos2d::nodeComparisonLess);
|
||||
Node::sortAllChildren();
|
||||
}
|
||||
}
|
||||
|
||||
SkeletonNode* BoneNode::getRootSkeletonNode() const
|
||||
|
|
|
@ -340,7 +340,7 @@ void SkeletonNode::updateAllDrawBones()
|
|||
std::stack<BoneNode*> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue