! \return True if the node has been removed */
| 133 | |
| 134 | /*! \return True if the node has been removed */ |
| 135 | bool SceneNode::removeChildNode(SceneNode* childNode) |
| 136 | { |
| 137 | // Can't remove yourself or a `nullptr` from your children |
| 138 | if (childNode == this || childNode == nullptr) { |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | bool hasBeenRemoved = false; |
| 143 | if (!children_.empty() && // Avoid checking if this node has no children |
| 144 | childNode->parent_ == this) // Avoid checking if the child doesn't belong to this node |
| 145 | { |
| 146 | for (unsigned int i = 0; i < children_.size(); i++) { |
| 147 | if (children_[i] == childNode) { |
| 148 | hasBeenRemoved = removeChildNodeAt(i); |
| 149 | break; |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | return hasBeenRemoved; |
| 155 | } |
| 156 | |
| 157 | /*! \return True if the node has been removed */ |
| 158 | bool SceneNode::removeChildNodeAt(std::uint32_t index) |
no test coverage detected