summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yevdokimov <robert.yevdokimov@autStand.com>2024-03-07 16:02:33 -0500
committerRobert Yevdokimov <robert.yevdokimov@autStand.com>2024-03-07 16:21:23 -0500
commitf99de3f024394e8fa567e9c0ee4295bb3629b732 (patch)
treec7f96801c91ef4649ca9958652b56744de225acd
parentaef11a14274f6f9e74ad91ead1d7c07ea1dd7f5f (diff)
downloadredot-engine-f99de3f024394e8fa567e9c0ee4295bb3629b732.tar.gz
Move `snap_controls_to_pixels` from process to projects settings changed method
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp7
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 2ab53effed..a7112f3f60 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -3911,16 +3911,19 @@ void CanvasItemEditor::_update_editor_settings() {
warped_panning = bool(EDITOR_GET("editors/panning/warped_mouse_panning"));
}
+void CanvasItemEditor::_project_settings_changed() {
+ EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels"));
+}
+
void CanvasItemEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
EditorRunBar::get_singleton()->connect("play_pressed", callable_mp(this, &CanvasItemEditor::_update_override_camera_button).bind(true));
EditorRunBar::get_singleton()->connect("stop_pressed", callable_mp(this, &CanvasItemEditor::_update_override_camera_button).bind(false));
+ ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &CanvasItemEditor::_project_settings_changed));
} break;
case NOTIFICATION_PROCESS: {
- EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels"));
-
int nb_having_pivot = 0;
// Update the viewport if the canvas_item changes
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 723dbc7f59..073e67d8b2 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -483,6 +483,8 @@ private:
void _focus_selection(int p_op);
void _reset_drag();
+ void _project_settings_changed();
+
SnapTarget snap_target[2];
Transform2D snap_transform;
void _snap_if_closer_float(