Skip to content

Commit

Permalink
Merge pull request godotengine#89264 from ryevdokimov/don't-update-sn…
Browse files Browse the repository at this point in the history
…ap-every-scan

Move `snap_controls_to_pixels` from process to projects settings changed method
  • Loading branch information
akien-mga committed Mar 8, 2024
2 parents 694d4f8 + f99de3f commit a658621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/canvas_item_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ class CanvasItemEditor : public VBoxContainer {
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(
Expand Down

0 comments on commit a658621

Please sign in to comment.