From 5cca8cc87d25a747fc90489f27461d2667c50c3a Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 3 Sep 2014 17:26:50 +0800 Subject: [PATCH] remove Node::_setLocalZOrder() --- cocos/2d/CCNode.cpp | 12 ++---------- cocos/2d/CCNode.h | 4 +--- cocos/2d/CCParticleBatchNode.cpp | 4 ++-- cocos/2d/CCProtectedNode.cpp | 4 ++-- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index cbd4b97f31..08f5d779e3 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -280,14 +280,6 @@ void Node::setSkewY(float skewY) _transformUpdated = _transformDirty = _inverseDirty = true; } - -/// zOrder setter : private method -/// used internally to alter the zOrder variable. DON'T call this method manually -void Node::_setLocalZOrder(int z) -{ - _localZOrder = z; -} - void Node::setLocalZOrder(int z) { if (_localZOrder == z) @@ -1170,7 +1162,7 @@ void Node::insertChild(Node* child, int z) _transformUpdated = true; _reorderChildDirty = true; _children.pushBack(child); - child->_setLocalZOrder(z); + child->_localZOrder = z; } void Node::reorderChild(Node *child, int zOrder) @@ -1178,7 +1170,7 @@ void Node::reorderChild(Node *child, int zOrder) CCASSERT( child != nullptr, "Child must be non-nil"); _reorderChildDirty = true; child->setOrderOfArrival(s_globalOrderOfArrival++); - child->_setLocalZOrder(zOrder); + child->_localZOrder = zOrder; } void Node::sortAllChildren() diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 8f24f2d09d..efa3ff5fc4 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -150,9 +150,7 @@ public: virtual void setLocalZOrder(int localZOrder); CC_DEPRECATED_ATTRIBUTE virtual void setZOrder(int localZOrder) { setLocalZOrder(localZOrder); } - /* Helper function used by `setLocalZOrder`. Don't use it unless you know what you are doing. - */ - virtual void _setLocalZOrder(int z); + /** * Gets the local Z order of this node. * diff --git a/cocos/2d/CCParticleBatchNode.cpp b/cocos/2d/CCParticleBatchNode.cpp index 58097d529d..dee4af61df 100644 --- a/cocos/2d/CCParticleBatchNode.cpp +++ b/cocos/2d/CCParticleBatchNode.cpp @@ -218,7 +218,7 @@ int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, co else child->setName(name); - child->_setLocalZOrder(z); + child->setLocalZOrder(z); child->setParent(this); @@ -285,7 +285,7 @@ void ParticleBatchNode::reorderChild(Node * aChild, int zOrder) } } - child->_setLocalZOrder(zOrder); + child->setLocalZOrder(zOrder); } void ParticleBatchNode::getCurrentIndex(int* oldIndex, int* newIndex, Node* child, int z) diff --git a/cocos/2d/CCProtectedNode.cpp b/cocos/2d/CCProtectedNode.cpp index 38382b03f6..d65ca6a7b5 100644 --- a/cocos/2d/CCProtectedNode.cpp +++ b/cocos/2d/CCProtectedNode.cpp @@ -249,7 +249,7 @@ void ProtectedNode::insertProtectedChild(cocos2d::Node *child, int z) { _reorderProtectedChildDirty = true; _protectedChildren.pushBack(child); - child->_setLocalZOrder(z); + child->setLocalZOrder(z); } void ProtectedNode::sortAllProtectedChildren() @@ -265,7 +265,7 @@ void ProtectedNode::reorderProtectedChild(cocos2d::Node *child, int localZOrder) CCASSERT( child != nullptr, "Child must be non-nil"); _reorderProtectedChildDirty = true; child->setOrderOfArrival(s_globalOrderOfArrival++); - child->_setLocalZOrder(localZOrder); + child->setLocalZOrder(localZOrder); } void ProtectedNode::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags)