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 cannot update remote after disabling use_global_coordinates in RemoteTransform2D #83323

Merged
Show file tree
Hide file tree
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
23 changes: 22 additions & 1 deletion scene/2d/remote_transform_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void RemoteTransform2D::_notification(int p_what) {
_update_cache();
} break;

case NOTIFICATION_LOCAL_TRANSFORM_CHANGED:
case NOTIFICATION_TRANSFORM_CHANGED: {
if (!is_inside_tree()) {
break;
Expand All @@ -127,6 +128,10 @@ void RemoteTransform2D::_notification(int p_what) {
}

void RemoteTransform2D::set_remote_node(const NodePath &p_remote_node) {
if (remote_node == p_remote_node) {
return;
}

remote_node = p_remote_node;
if (is_inside_tree()) {
_update_cache();
Expand All @@ -141,7 +146,13 @@ NodePath RemoteTransform2D::get_remote_node() const {
}

void RemoteTransform2D::set_use_global_coordinates(const bool p_enable) {
if (use_global_coordinates == p_enable) {
return;
}
Rindbee marked this conversation as resolved.
Show resolved Hide resolved

use_global_coordinates = p_enable;
set_notify_transform(use_global_coordinates);
set_notify_local_transform(!use_global_coordinates);
_update_remote();
}

Expand All @@ -150,6 +161,9 @@ bool RemoteTransform2D::get_use_global_coordinates() const {
}

void RemoteTransform2D::set_update_position(const bool p_update) {
if (update_remote_position == p_update) {
return;
}
update_remote_position = p_update;
_update_remote();
}
Expand All @@ -159,6 +173,9 @@ bool RemoteTransform2D::get_update_position() const {
}

void RemoteTransform2D::set_update_rotation(const bool p_update) {
if (update_remote_rotation == p_update) {
return;
}
update_remote_rotation = p_update;
_update_remote();
}
Expand All @@ -168,6 +185,9 @@ bool RemoteTransform2D::get_update_rotation() const {
}

void RemoteTransform2D::set_update_scale(const bool p_update) {
if (update_remote_scale == p_update) {
return;
}
update_remote_scale = p_update;
_update_remote();
}
Expand Down Expand Up @@ -215,6 +235,7 @@ void RemoteTransform2D::_bind_methods() {
}

RemoteTransform2D::RemoteTransform2D() {
set_notify_transform(true);
set_notify_transform(use_global_coordinates);
set_notify_local_transform(!use_global_coordinates);
set_hide_clip_children(true);
}
25 changes: 24 additions & 1 deletion scene/3d/remote_transform_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ void RemoteTransform3D::_notification(int p_what) {
_update_cache();
} break;

case NOTIFICATION_LOCAL_TRANSFORM_CHANGED:
case NOTIFICATION_TRANSFORM_CHANGED: {
if (!is_inside_tree()) {
break;
Expand All @@ -126,6 +127,10 @@ void RemoteTransform3D::_notification(int p_what) {
}

void RemoteTransform3D::set_remote_node(const NodePath &p_remote_node) {
if (remote_node == p_remote_node) {
return;
}

remote_node = p_remote_node;
if (is_inside_tree()) {
_update_cache();
Expand All @@ -140,14 +145,25 @@ NodePath RemoteTransform3D::get_remote_node() const {
}

void RemoteTransform3D::set_use_global_coordinates(const bool p_enable) {
if (use_global_coordinates == p_enable) {
return;
}

use_global_coordinates = p_enable;

set_notify_transform(use_global_coordinates);
set_notify_local_transform(!use_global_coordinates);
Rindbee marked this conversation as resolved.
Show resolved Hide resolved
_update_remote();
}

bool RemoteTransform3D::get_use_global_coordinates() const {
return use_global_coordinates;
}

void RemoteTransform3D::set_update_position(const bool p_update) {
if (update_remote_position == p_update) {
return;
}
update_remote_position = p_update;
_update_remote();
}
Expand All @@ -157,6 +173,9 @@ bool RemoteTransform3D::get_update_position() const {
}

void RemoteTransform3D::set_update_rotation(const bool p_update) {
if (update_remote_rotation == p_update) {
return;
}
update_remote_rotation = p_update;
_update_remote();
}
Expand All @@ -166,6 +185,9 @@ bool RemoteTransform3D::get_update_rotation() const {
}

void RemoteTransform3D::set_update_scale(const bool p_update) {
if (update_remote_scale == p_update) {
return;
}
update_remote_scale = p_update;
_update_remote();
}
Expand Down Expand Up @@ -213,5 +235,6 @@ void RemoteTransform3D::_bind_methods() {
}

RemoteTransform3D::RemoteTransform3D() {
set_notify_transform(true);
set_notify_transform(use_global_coordinates);
set_notify_local_transform(!use_global_coordinates);
}
Loading