Closed jamie-pate closed 4 years ago
I can confirm this is causing the first test to pass when it shouldn't in case p_node
is not the direct parent, causing the move_child
method to use an invalid index in some cases.
Minimal reproduction project: add-below-node.zip
In the editor, when checking Add node
in the inspector for the root node, this error appears:
ERROR: Invalid new child position: 3.
At: scene/main/node.cpp:330
When it should log this warning instead:
WARNING: add_child_below_node: Cannot move under node Child-05 as Child-new does not share a parent.
At: scene/main/node.cpp:1195
It only needs to be fixed on 3.2, because add_child_below_node
was replaced with add_sibling
on master in #38695.
Fixed by #40300.
Godot version: 3.2.2
OS/device including version:
GeForce GTX 1070 with Max-Q Design/PCIe/SSE2 No LSB modules are available. Distributor ID: Pop Description: Pop!_OS 20.04 LTS Release: 20.04 Codename: focal
Issue description:
The check to see if p_node is our child is incorrect.
is_a_parent_of()
is actually an ancestry check (poorly named?) which checks if the node is a child, or ancestor ofthis
node. Should checkp_node->parent == this
instead.Steps to reproduce:
Open vscode and read the code ;)
Minimal reproduction project:
Not actually required? (just don't have time for a PR atm)