summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-10-21 15:37:36 +0200
committerkobewi <kobewi4e@gmail.com>2022-11-15 13:31:44 +0100
commit3e730c4277c8af99d1b51bcb85a2cd86337c466b (patch)
tree8150fb49848f8847c12b8483c08d0943b8ade957 /scene/2d
parent91fcc3986eca5331b4cc44a67adcc2f29a49eb66 (diff)
Fix false warning when renaming Joint2D's node
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/joint_2d.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/scene/2d/joint_2d.cpp b/scene/2d/joint_2d.cpp
index 6000508f36..8de4c281f4 100644
--- a/scene/2d/joint_2d.cpp
+++ b/scene/2d/joint_2d.cpp
@@ -133,7 +133,13 @@ void Joint2D::set_node_a(const NodePath &p_node_a) {
}
a = p_node_a;
- _update_joint();
+ 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();
+ }
}
NodePath Joint2D::get_node_a() const {
@@ -150,7 +156,11 @@ void Joint2D::set_node_b(const NodePath &p_node_b) {
}
b = p_node_b;
- _update_joint();
+ if (Engine::get_singleton()->is_editor_hint()) {
+ callable_mp(this, &Joint2D::_update_joint).call_deferred();
+ } else {
+ _update_joint();
+ }
}
NodePath Joint2D::get_node_b() const {