diff --git a/cocos/2d/CCProtectedNode.cpp b/cocos/2d/CCProtectedNode.cpp index ddfaabbc3f..58ce8ff5f4 100644 --- a/cocos/2d/CCProtectedNode.cpp +++ b/cocos/2d/CCProtectedNode.cpp @@ -381,9 +381,9 @@ void ProtectedNode::updateDisplayedOpacity(GLubyte parentOpacity) for(auto child : _children){ child->updateDisplayedOpacity(_displayedOpacity); } - for(auto child : _protectedChildren){ - child->updateDisplayedOpacity(_displayedOpacity); - } + } + for(auto child : _protectedChildren){ + child->setOpacity(_realOpacity); } } @@ -399,9 +399,9 @@ void ProtectedNode::updateDisplayedColor(const Color3B& parentColor) for(const auto &child : _children){ child->updateDisplayedColor(_displayedColor); } - for(const auto &child : _protectedChildren){ - child->updateDisplayedColor(_displayedColor); - } + } + for(const auto &child : _protectedChildren){ + child->setColor(_realColor); } } @@ -411,7 +411,7 @@ void ProtectedNode::disableCascadeColor() child->updateDisplayedColor(Color3B::WHITE); } for(auto child : _protectedChildren){ - child->updateDisplayedColor(Color3B::WHITE); + child->setColor(Color3B::WHITE); } } diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 6de3360581..57ed9331a7 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -208,9 +208,6 @@ bool Widget::init() this->setAnchorPoint(Vec2(0.5f, 0.5f)); ignoreContentAdaptWithSize(true); - - this->setCascadeColorEnabled(true); - this->setCascadeOpacityEnabled(true); return true; }