Merge pull request #13383 from geron-cn/3.7.1

add blendfunc cascade to its skin in BoneNode
This commit is contained in:
pandamicro 2015-08-17 17:12:04 +08:00
commit d0580f09e8
1 changed files with 17 additions and 1 deletions

View File

@ -182,6 +182,11 @@ void BoneNode::addToBoneList(BoneNode* bone)
void BoneNode::addToSkinList(SkinNode* skin) void BoneNode::addToSkinList(SkinNode* skin)
{ {
_boneSkins.pushBack(skin); _boneSkins.pushBack(skin);
auto blendSkin = dynamic_cast<BlendProtocol*>(skin);
if (nullptr != blendSkin && _blendFunc != blendSkin->getBlendFunc())
{
blendSkin->setBlendFunc(_blendFunc);
}
} }
void BoneNode::removeFromSkinList(SkinNode* skin) void BoneNode::removeFromSkinList(SkinNode* skin)
@ -281,7 +286,18 @@ cocos2d::Rect BoneNode::getVisibleSkinsRect() const
void BoneNode::setBlendFunc(const cocos2d::BlendFunc& blendFunc) void BoneNode::setBlendFunc(const cocos2d::BlendFunc& blendFunc)
{ {
if (_blendFunc != blendFunc)
{
_blendFunc = blendFunc; _blendFunc = blendFunc;
for (auto & skin : _boneSkins)
{
auto blendSkin = dynamic_cast<BlendProtocol*>(skin);
if (nullptr != blendSkin)
{
blendSkin->setBlendFunc(_blendFunc);
}
}
}
} }
void BoneNode::setDebugDrawLength(float length) void BoneNode::setDebugDrawLength(float length)