mirror of https://github.com/axmolengine/axmol.git
setCameraMask for cocostudio-ui
This commit is contained in:
parent
6304a89462
commit
ee03bb8eea
|
@ -1575,7 +1575,7 @@ public:
|
|||
|
||||
/** get & set camera mask, the node is visible by the camera whose camera flag & node's camera mask is true */
|
||||
unsigned short getCameraMask() const { return _cameraMask; }
|
||||
void setCameraMask(unsigned short mask, bool applyChildren = true);
|
||||
virtual void setCameraMask(unsigned short mask, bool applyChildren = true);
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
// Nodes should be created using create();
|
||||
|
|
|
@ -431,4 +431,17 @@ void ProtectedNode::disableCascadeOpacity()
|
|||
}
|
||||
}
|
||||
|
||||
void ProtectedNode::setCameraMask(unsigned short mask, bool applyChildren)
|
||||
{
|
||||
Node::setCameraMask(mask, applyChildren);
|
||||
if (applyChildren)
|
||||
{
|
||||
for (auto& iter: _protectedChildren)
|
||||
{
|
||||
iter->setCameraMask(mask);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -163,6 +163,7 @@ public:
|
|||
virtual void updateDisplayedColor(const Color3B& parentColor) override;
|
||||
virtual void disableCascadeColor() override;
|
||||
virtual void disableCascadeOpacity()override;
|
||||
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
ProtectedNode();
|
||||
virtual ~ProtectedNode();
|
||||
|
|
|
@ -1335,4 +1335,17 @@ namespace ui {
|
|||
return this->getScaleX();
|
||||
}
|
||||
|
||||
void Scale9Sprite::setCameraMask(unsigned short mask, bool applyChildren)
|
||||
{
|
||||
Node::setCameraMask(mask, applyChildren);
|
||||
|
||||
if(_scale9Image)
|
||||
_scale9Image->setCameraMask(mask,applyChildren);
|
||||
|
||||
for(auto& iter: _protectedChildren)
|
||||
{
|
||||
iter->setCameraMask(mask);
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
@ -376,6 +376,7 @@ namespace ui {
|
|||
virtual float getScaleY() const override;
|
||||
virtual float getScale() const override;
|
||||
using Node::getScaleZ;
|
||||
virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override;
|
||||
protected:
|
||||
void updateCapInset();
|
||||
void updatePositions();
|
||||
|
|
Loading…
Reference in New Issue