Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix false warning when renaming Joint2D's node #67713

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions scene/2d/joint_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down