MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / addChild

Method addChild

Source/Node/Node.cpp:480–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478}
479
480void Node::addChild(Node* child, int order, String tag) {
481 AssertIf(child == nullptr, "add invalid child (nullptr) to node.");
482 AssertIf(child->_parent, "child already added. It can't be added again.");
483 AssertIf(child->_flags.isOn(Node::Cleanup), "add invalid child (disposed) to node.");
484
485 if (child->_flags.isOn(Node::UnManaged)) {
486 child->_flags.setOff(Node::UnManaged);
487 }
488
489 if (child->_flags.isOn(Node::InWaitingList)) {
490 child->_flags.setOff(Node::InWaitingList);
491 SharedDirector.removeFromWaitingList(child);
492 }
493
494 child->setTag(tag);
495 child->setOrder(order);
496 if (!_children) {
497 _children = Array::create();
498 }
499 Node* last = nullptr;
500 if (!_children->isEmpty()) {
501 last = _children->getLast()->to<Node>();
502 }
503 _children->add(Value::alloc(child));
504 if (last && last->getOrder() > child->getOrder()) {
505 _flags.setOn(Node::Reorder);
506 }
507 child->_parent = this;
508 child->updateRealColor3();
509 child->updateRealOpacity();
510 if (_flags.isOn(Node::Running)) {
511 child->onEnter();
512 }
513}
514
515void Node::addChild(Node* child, int order) {
516 AssertIf(child == nullptr, "add invalid child(nullptr) to node.");

Callers 15

addChildFunction · 0.45
toNodeFunction · 0.45
createHostNodeFunction · 0.45
addChildToParentFunction · 0.45
YarnTester.tsFile · 0.45
displayClipsFunction · 0.45
generateClipsFunction · 0.45
_addDisplayMethod · 0.45
_replaceDisplayMethod · 0.45
setSlotMethod · 0.45
addToMethod · 0.45
moveToParentMethod · 0.45

Calls 15

addChildFunction · 0.85
isOnMethod · 0.80
setOffMethod · 0.80
removeFromWaitingListMethod · 0.80
setTagMethod · 0.80
getOrderMethod · 0.80
setOnMethod · 0.80
setOrderMethod · 0.65
addMethod · 0.65
createFunction · 0.50
allocFunction · 0.50
isEmptyMethod · 0.45

Tested by

no test coverage detected