1
0
Fork 0

Fix false warning when renaming Joint2D's node

This commit is contained in:
kobewi 2022-10-21 15:37:36 +02:00
parent 91fcc3986e
commit 3e730c4277
1 changed files with 12 additions and 2 deletions

View File

@ -133,8 +133,14 @@ void Joint2D::set_node_a(const NodePath &p_node_a) {
} }
a = p_node_a; a = p_node_a;
if (Engine::get_singleton()->is_editor_hint()) {
// When in editor, the setter may be called as a result of node rename.
// It happens before the node actually changes its name, which triggers false warning.
callable_mp(this, &Joint2D::_update_joint).call_deferred();
} else {
_update_joint(); _update_joint();
} }
}
NodePath Joint2D::get_node_a() const { NodePath Joint2D::get_node_a() const {
return a; return a;
@ -150,8 +156,12 @@ void Joint2D::set_node_b(const NodePath &p_node_b) {
} }
b = p_node_b; b = p_node_b;
if (Engine::get_singleton()->is_editor_hint()) {
callable_mp(this, &Joint2D::_update_joint).call_deferred();
} else {
_update_joint(); _update_joint();
} }
}
NodePath Joint2D::get_node_b() const { NodePath Joint2D::get_node_b() const {
return b; return b;