mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13578 from geron-cn/v3.8
bone's color and opacity cannot cascade to bone
This commit is contained in:
commit
405e6c24c8
|
@ -74,14 +74,14 @@ BoneNode* BoneNode::create(int length)
|
|||
|
||||
void BoneNode::addChild(cocos2d::Node* child, int localZOrder, int tag)
|
||||
{
|
||||
Node::addChild(child, localZOrder, tag);
|
||||
addToChildrenListHelper(child);
|
||||
Node::addChild(child, localZOrder, tag);
|
||||
}
|
||||
|
||||
void BoneNode::addChild(Node* child, int localZOrder, const std::string &name)
|
||||
{
|
||||
Node::addChild(child, localZOrder, name);
|
||||
addToChildrenListHelper(child);
|
||||
Node::addChild(child, localZOrder, name);
|
||||
}
|
||||
|
||||
void BoneNode::addSkin(SkinNode* skin, bool isDisplay, bool hideOthers)
|
||||
|
@ -441,6 +441,44 @@ void BoneNode::updateColor()
|
|||
_transformUpdated = _transformDirty = _inverseDirty = _contentSizeDirty = true;
|
||||
}
|
||||
|
||||
void BoneNode::updateDisplayedColor(const cocos2d::Color3B& parentColor)
|
||||
{
|
||||
if (_cascadeColorEnabled)
|
||||
{
|
||||
for (const auto &child : _boneSkins)
|
||||
{
|
||||
child->updateDisplayedColor(_displayedColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BoneNode::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
if (_cascadeOpacityEnabled)
|
||||
{
|
||||
for (const auto& child : _boneSkins)
|
||||
{
|
||||
child->updateDisplayedOpacity(_displayedOpacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BoneNode::disableCascadeOpacity()
|
||||
{
|
||||
for (const auto& child : _boneSkins)
|
||||
{
|
||||
child->updateDisplayedOpacity(255);
|
||||
}
|
||||
}
|
||||
|
||||
void BoneNode::disableCascadeColor()
|
||||
{
|
||||
for (const auto& child : _boneSkins)
|
||||
{
|
||||
child->updateDisplayedColor(cocos2d::Color3B::WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
void BoneNode::onDraw(const cocos2d::Mat4 &transform, uint32_t flags)
|
||||
{
|
||||
getGLProgram()->use();
|
||||
|
|
|
@ -185,6 +185,12 @@ protected:
|
|||
virtual void updateVertices();
|
||||
virtual void updateColor() override;
|
||||
|
||||
// bone's color and opacity cannot cascade to bone
|
||||
virtual void updateDisplayedColor(const cocos2d::Color3B& parentColor) override;
|
||||
virtual void updateDisplayedOpacity(GLubyte parentOpacity) override;
|
||||
virtual void disableCascadeOpacity() override;
|
||||
virtual void disableCascadeColor() override;
|
||||
|
||||
virtual void onDraw(const cocos2d::Mat4 &transform, uint32_t flags);
|
||||
|
||||
// override Node::visit, just visit bones in children
|
||||
|
|
Loading…
Reference in New Issue