remove method
- Node node
Removes the child node.
Returns true if the node was owned by this node and its removal was
accepted. Removing a parentless node, a node not owned by this node, or a
node already awaiting removal, is a no-op that returns false.
A node still awaiting its own addition is cancelled outright, so an add and a remove queued in the same frame settle to nothing.
Implementation
bool remove(Node node) {
if (identical(node._pendingParent, this)) {
node._pendingParent = null; // Cancels the addition queued this frame.
return true;
}
if (node._pendingRemoval) return false; // Already being removed.
if (!owns(node)) return false; // Not our node, not our problem.
if (isMounted) {
node._pendingRemoval = true;
scene._tree._remove(node, this);
} else {
_disown(node);
}
return true;
}