godot icon indicating copy to clipboard operation
godot copied to clipboard

Update canvas layer size and control after project settings changed.

Open EAinsley opened this issue 1 year ago • 1 comments

Fix #69208

https://github.com/godotengine/godot/assets/63407648/95c1b9a0-84c0-4fe5-a3bc-b31f325c4648

In canvas_item_editor_plugin: Call update_viewport() in _project_setting_changed to redraw viewport after project settings changed.

In control: Add a new private function _project_settings_changed to update the size and redraw the control. Connect/Disconnect this function to "settings_changed" of ProjectSettings when the control enters/exits the canvas.

NOTE 0: The signal name used here is string literal, but some other names are wrapped by SNAME or SceneStringName. Not sure if we have to make any modifications to keep consistency.

NOTE 1: I'm a bit worried about the performance here. We use "settings_changed" signal here, so any change unrelated to viewport will also trigger a redraw. Should the signal be more fine-grained?

EAinsley avatar Jun 28 '24 20:06 EAinsley

We use "settings_changed" signal here, so any change unrelated to viewport will also trigger a redraw. Should the signal be more fine-grained?

If we make this editor-only, it should be fine. This is what we did for Camera2D: https://github.com/godotengine/godot/pull/92992

Calinou avatar Jun 28 '24 21:06 Calinou