Merge pull request #7939 from minggo/remove-_setLocalZOrder

remove Node::_setLocalZOrder()
This commit is contained in:
minggo 2014-09-09 10:49:09 +08:00
commit 6b99ce6ec0
4 changed files with 7 additions and 17 deletions

View File

@ -281,14 +281,6 @@ void Node::setSkewY(float skewY)
_transformUpdated = _transformDirty = _inverseDirty = true; _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) void Node::setLocalZOrder(int z)
{ {
if (_localZOrder == z) if (_localZOrder == z)
@ -1172,7 +1164,7 @@ void Node::insertChild(Node* child, int z)
_transformUpdated = true; _transformUpdated = true;
_reorderChildDirty = true; _reorderChildDirty = true;
_children.pushBack(child); _children.pushBack(child);
child->_setLocalZOrder(z); child->_localZOrder = z;
} }
void Node::reorderChild(Node *child, int zOrder) void Node::reorderChild(Node *child, int zOrder)
@ -1180,7 +1172,7 @@ void Node::reorderChild(Node *child, int zOrder)
CCASSERT( child != nullptr, "Child must be non-nil"); CCASSERT( child != nullptr, "Child must be non-nil");
_reorderChildDirty = true; _reorderChildDirty = true;
child->setOrderOfArrival(s_globalOrderOfArrival++); child->setOrderOfArrival(s_globalOrderOfArrival++);
child->_setLocalZOrder(zOrder); child->_localZOrder = zOrder;
} }
void Node::sortAllChildren() void Node::sortAllChildren()

View File

@ -150,9 +150,7 @@ public:
virtual void setLocalZOrder(int localZOrder); virtual void setLocalZOrder(int localZOrder);
CC_DEPRECATED_ATTRIBUTE virtual void setZOrder(int localZOrder) { setLocalZOrder(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. * Gets the local Z order of this node.
* *

View File

@ -218,7 +218,7 @@ int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, co
else else
child->setName(name); child->setName(name);
child->_setLocalZOrder(z); child->setLocalZOrder(z);
child->setParent(this); 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) void ParticleBatchNode::getCurrentIndex(int* oldIndex, int* newIndex, Node* child, int z)

View File

@ -249,7 +249,7 @@ void ProtectedNode::insertProtectedChild(cocos2d::Node *child, int z)
{ {
_reorderProtectedChildDirty = true; _reorderProtectedChildDirty = true;
_protectedChildren.pushBack(child); _protectedChildren.pushBack(child);
child->_setLocalZOrder(z); child->setLocalZOrder(z);
} }
void ProtectedNode::sortAllProtectedChildren() void ProtectedNode::sortAllProtectedChildren()
@ -265,7 +265,7 @@ void ProtectedNode::reorderProtectedChild(cocos2d::Node *child, int localZOrder)
CCASSERT( child != nullptr, "Child must be non-nil"); CCASSERT( child != nullptr, "Child must be non-nil");
_reorderProtectedChildDirty = true; _reorderProtectedChildDirty = true;
child->setOrderOfArrival(s_globalOrderOfArrival++); child->setOrderOfArrival(s_globalOrderOfArrival++);
child->_setLocalZOrder(localZOrder); child->setLocalZOrder(localZOrder);
} }
void ProtectedNode::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags) void ProtectedNode::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags)