From f552785da013e01dbff8cbf38cc3a86b23b30d25 Mon Sep 17 00:00:00 2001 From: Rodz Labs Date: Fri, 20 Dec 2024 21:23:13 +0100 Subject: [PATCH] Updated the View menu in the 2D preview panel --- material_maker/panels/preview_2d/lines.gd | 118 ++++++------------ .../panels/preview_2d/preview_2d_panel.gd | 45 +++---- .../panels/preview_2d/preview_2d_panel.tscn | 99 +++++++-------- material_maker/panels/preview_2d/view_menu.gd | 32 ++--- 4 files changed, 111 insertions(+), 183 deletions(-) diff --git a/material_maker/panels/preview_2d/lines.gd b/material_maker/panels/preview_2d/lines.gd index 96525c3fc..b27233b67 100644 --- a/material_maker/panels/preview_2d/lines.gd +++ b/material_maker/panels/preview_2d/lines.gd @@ -1,120 +1,74 @@ extends Control @export var config_var_suffix : String = "" -var _real_style : int = 1 -@export var style : int : - get: - return _real_style +@export var style : int = 1: set(s): - set_style(s) + s = clamp(s, 0, 3) + if s != style: + style = s + queue_redraw() + mm_globals.set_config("preview"+config_var_suffix+"_guides_style", style) -var _real_grid_size : float = 0.0 -@export var grid_size : float : - get: - return _real_grid_size +@export var grid_size : float = 0.0: set(s): - set_grid_size(s) + if s != grid_size: + grid_size = s + queue_redraw() + mm_globals.set_config("preview"+config_var_suffix+"_guides_grid_size", grid_size) + mm_renderer.set_global_parameter("mm_grid_size"+config_var_suffix, grid_size) -var _real_color : Color = Color(0.5, 0.5, 0.5) -@export var color : Color : - get: - return _real_color +@export var color : Color = Color(0.5, 0.5, 0.5): set(c): - set_color(c) + if c != color: + color = c + queue_redraw() + mm_globals.set_config("preview"+config_var_suffix+"_guides_color", color) -const STYLES : Array = [ "None", "Corners", "Lines", "Grid4x4", "Grid8x8", "Grid10x10", "Grid16x16" ] +const STYLES : Array = [ "None", "Corners", "Lines", "Grid" ] + func _ready(): config_var_suffix = get_parent().config_var_suffix if mm_globals.has_config("preview"+config_var_suffix+"_guides_style"): - _real_style = mm_globals.get_config("preview"+config_var_suffix+"_guides_style") + style = mm_globals.get_config("preview"+config_var_suffix+"_guides_style") if mm_globals.has_config("preview"+config_var_suffix+"_guides_grid_size"): - _real_grid_size = mm_globals.get_config("preview"+config_var_suffix+"_guides_grid_size") + grid_size = mm_globals.get_config("preview"+config_var_suffix+"_guides_grid_size") if mm_globals.has_config("preview"+config_var_suffix+"_guides_color"): - _real_color = mm_globals.get_config("preview"+config_var_suffix+"_guides_color") - set_grid_size(_real_grid_size, false) - set_color(_real_color, false) - set_style(_real_style) + color = mm_globals.get_config("preview"+config_var_suffix+"_guides_color") func draw_grid(s : int) -> void: - _real_grid_size = s var parent = get_parent() for i in range(s+1): var x = float(i) / float(s) - 0.5 var p : Vector2 = parent.value_to_pos(Vector2(x, x)) - draw_line(Vector2(p.x, 0), Vector2(p.x, size.y), _real_color) - draw_line(Vector2(0, p.y), Vector2(size.x, p.y), _real_color) + draw_line(Vector2(p.x, 0), Vector2(p.x, size.y), color) + draw_line(Vector2(0, p.y), Vector2(size.x, p.y), color) func _draw() -> void: var parent = get_parent() var p - match _real_style: + match style: + 0: + pass 1: p = parent.value_to_pos(Vector2(-0.5, -0.52)) - draw_line(p, Vector2(p.x, 0), _real_color) + draw_line(p, Vector2(p.x, 0), color) p = parent.value_to_pos(Vector2(0.5, -0.52)) - draw_line(p, Vector2(p.x, 0), _real_color) + draw_line(p, Vector2(p.x, 0), color) p = parent.value_to_pos(Vector2(-0.52, -0.5)) - draw_line(p, Vector2(0, p.y), _real_color) + draw_line(p, Vector2(0, p.y), color) p = parent.value_to_pos(Vector2(-0.52, 0.5)) - draw_line(p, Vector2(0, p.y), _real_color) + draw_line(p, Vector2(0, p.y), color) p = parent.value_to_pos(Vector2(-0.5, 0.52)) - draw_line(p, Vector2(p.x, size.y), _real_color) + draw_line(p, Vector2(p.x, size.y), color) p = parent.value_to_pos(Vector2(0.5, 0.52)) - draw_line(p, Vector2(p.x, size.y), _real_color) + draw_line(p, Vector2(p.x, size.y), color) p = parent.value_to_pos(Vector2(0.52, -0.5)) - draw_line(p, Vector2(size.x, p.y), _real_color) + draw_line(p, Vector2(size.x, p.y), color) p = parent.value_to_pos(Vector2(0.52, 0.5)) - draw_line(p, Vector2(size.x, p.y), _real_color) + draw_line(p, Vector2(size.x, p.y), color) 2: draw_grid(1) - 3: - draw_grid(4) - 4: - draw_grid(8) - 5: - draw_grid(10) - 6: - draw_grid(16) - 1000: - draw_grid(int(_real_grid_size)) - -func set_style(s : int) -> void: - _real_style = s - queue_redraw() - mm_globals.set_config("preview"+config_var_suffix+"_guides_style", s) - var mm_grid_size : int - match _real_style: - 2: - mm_grid_size = 1 - 3: - mm_grid_size = 4 - 4: - mm_grid_size = 8 - 5: - mm_grid_size = 10 - 6: - mm_grid_size = 16 - 1000: - # warning-ignore:narrowing_conversion - mm_grid_size = _real_grid_size _: - mm_grid_size = 128 - mm_renderer.set_global_parameter("mm_grid_size"+config_var_suffix, mm_grid_size) - -func show_grid(value) -> void: - set_grid_size(value, false) - set_style(1000) - -func set_color(c : Color, up : bool = true) -> void: - _real_color = c - if up: - queue_redraw() - mm_globals.set_config("preview"+config_var_suffix+"_guides_color", c) - -func set_grid_size(s : float, up : bool = true) -> void: - _real_grid_size = s - if up: - queue_redraw() - mm_globals.set_config("preview"+config_var_suffix+"_guides_grid_size", s) + draw_grid(int(grid_size)) diff --git a/material_maker/panels/preview_2d/preview_2d_panel.gd b/material_maker/panels/preview_2d/preview_2d_panel.gd index 07a8a48d3..997b8e8eb 100644 --- a/material_maker/panels/preview_2d/preview_2d_panel.gd +++ b/material_maker/panels/preview_2d/preview_2d_panel.gd @@ -21,9 +21,22 @@ var preview_mode := Modes.CUSTOM_PREVIEW: var center : Vector2 = Vector2(0.5, 0.5) var view_scale : float = 1.2 -var view_mode : int = 2 +var view_mode : int = 2: + set(v): + if v == view_mode: + return + view_mode = v + material.set_shader_parameter("mode", view_mode) + mm_globals.set_config("preview"+config_var_suffix+"_view_mode", view_mode) + +var view_filter : int = 0: + set(v): + if v == view_filter: + return + view_filter = v + set_generator(generator, output, true) + mm_globals.set_config("preview"+config_var_suffix+"_view_postprocess", view_filter) -var current_postprocess_option := 0 const POSTPROCESS_OPTIONS : Array = [ { name="None", function="preview_2d(uv)" }, { name="Lowres 32x32", function="preview_2d((floor(uv*32.0)+vec2(0.5))/32.0)" }, @@ -37,6 +50,10 @@ const POSTPROCESS_OPTIONS : Array = [ func _ready(): clear() reset_view() + if mm_globals.has_config("preview"+config_var_suffix+"_view_mode"): + view_mode = mm_globals.get_config("preview"+config_var_suffix+"_view_mode") + if mm_globals.has_config("preview"+config_var_suffix+"_view_postprocess"): + view_filter = mm_globals.get_config("preview"+config_var_suffix+"_view_postprocess") func _notification(what: int) -> void: @@ -53,7 +70,7 @@ func clear() -> void: func get_shader_custom_functions(): - return "vec4 preview_2d_postprocessed(vec2 uv) { return %s; }\n" % POSTPROCESS_OPTIONS[current_postprocess_option].function + return "vec4 preview_2d_postprocessed(vec2 uv) { return %s; }\n" % POSTPROCESS_OPTIONS[view_filter].function func set_generator(g : MMGenBase, o : int = 0, force : bool = false) -> void: @@ -261,28 +278,6 @@ func reset_view() -> void: view_scale = 1.2 update_shader_options() - -func set_view_mode(id:int) -> void: - if id == view_mode: - return - view_mode = id - material.set_shader_parameter("mode", view_mode) - mm_globals.set_config("preview"+config_var_suffix+"_view_mode", view_mode) - - -func get_view_mode() -> int: - return view_mode - - -func set_post_processing(id:int) -> void: - current_postprocess_option = id - set_generator(generator, output, true) - mm_globals.set_config("preview"+config_var_suffix+"_view_postprocess", current_postprocess_option) - - -func get_post_processing() -> int: - return current_postprocess_option - #endregion diff --git a/material_maker/panels/preview_2d/preview_2d_panel.tscn b/material_maker/panels/preview_2d/preview_2d_panel.tscn index 0d2b8c4c8..2f63c79ea 100644 --- a/material_maker/panels/preview_2d/preview_2d_panel.tscn +++ b/material_maker/panels/preview_2d/preview_2d_panel.tscn @@ -413,56 +413,55 @@ script = ExtResource("12_nrhap") icon_name = "view" [node name="ViewMenuPanel" type="PanelContainer" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu" index="0"] -visible = false top_level = true layout_mode = 0 -offset_left = -53.0 -offset_top = 34.0 -offset_right = 92.0 -offset_bottom = 115.0 +offset_left = 493.0 +offset_top = 9.0 +offset_right = 817.0 +offset_bottom = 145.0 theme_type_variation = &"MM_PanelMenuSubPanel" script = ExtResource("13_5w2hy") -[node name="VBox" type="GridContainer" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" index="0"] -layout_mode = 2 - -[node name="Control" type="Control" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="0"] -visible = false +[node name="VBoxContainer" type="VBoxContainer" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" index="0"] layout_mode = 2 -[node name="ResetViewButton" type="Button" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="1"] +[node name="ResetViewButton" type="Button" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer" index="0"] unique_name_in_owner = true layout_mode = 2 shortcut = SubResource("Shortcut_fwcfb") text = "Center View" -[node name="ViewModeLabel" type="Label" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="2"] +[node name="VBox" type="GridContainer" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer" index="1"] +layout_mode = 2 +columns = 2 + +[node name="Control" type="Control" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox" index="0"] +visible = false +layout_mode = 2 + +[node name="ViewModeLabel" type="Label" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox" index="1"] layout_mode = 2 theme_type_variation = &"MM_PanelMenuSubPanelLabel" -text = "View Mode" +text = "View" -[node name="ViewMode" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="3" instance=ExtResource("12_4017l")] +[node name="ViewMode" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox" index="2" instance=ExtResource("12_4017l")] unique_name_in_owner = true layout_mode = 2 selected = 0 -item_count = 5 +item_count = 3 popup/item_0/text = "Extend" popup/item_0/id = 0 popup/item_1/text = "Repeat" popup/item_1/id = 1 popup/item_2/text = "Clamp" popup/item_2/id = 2 -popup/item_3/text = "Temporal AA" -popup/item_3/id = 3 -popup/item_4/text = "Remporal AA 2.2" -popup/item_4/id = 4 -[node name="PostProcessingLabel" type="Label" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="4"] +[node name="PostProcessingLabel" type="Label" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox" index="3"] layout_mode = 2 theme_type_variation = &"MM_PanelMenuSubPanelLabel" -text = "Post Processing" +text = "Filter" -[node name="PostProcessing" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="5" instance=ExtResource("12_4017l")] +[node name="PostProcessing" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox" index="4" instance=ExtResource("12_4017l")] unique_name_in_owner = true layout_mode = 2 selected = 0 @@ -480,49 +479,30 @@ popup/item_4/id = 4 popup/item_5/text = "Lowres 512x512" popup/item_5/id = 5 -[node name="GuidesLabel" type="Label" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="6"] +[node name="GuidesLabel" type="Label" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox" index="5"] layout_mode = 2 theme_type_variation = &"MM_PanelMenuSubPanelLabel" text = "Guides" -[node name="BoxContainer" type="BoxContainer" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="7"] +[node name="BoxContainer" type="BoxContainer" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox" index="6"] layout_mode = 2 -[node name="Guides" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/BoxContainer" index="0" instance=ExtResource("12_4017l")] +[node name="Guides" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/BoxContainer" index="0" instance=ExtResource("12_4017l")] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 selected = 0 -item_count = 8 +item_count = 4 popup/item_0/text = "None" popup/item_0/id = 0 popup/item_1/text = "Corners" popup/item_1/id = 1 popup/item_2/text = "Lines" popup/item_2/id = 2 -popup/item_3/text = "Grid 4x4" +popup/item_3/text = "Grid" popup/item_3/id = 3 -popup/item_4/text = "Grid 8x8" -popup/item_4/id = 4 -popup/item_5/text = "Grid 10x10" -popup/item_5/id = 5 -popup/item_6/text = "Grid 16x16" -popup/item_6/id = 6 -popup/item_7/text = "Grid Custom" -popup/item_7/id = 7 - -[node name="GuidesColor" type="ColorPickerButton" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/BoxContainer" index="1"] -unique_name_in_owner = true -custom_minimum_size = Vector2(25, 0) -layout_mode = 2 - -[node name="CustomGridSizeLabel" type="Label" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="8"] -unique_name_in_owner = true -layout_mode = 2 -theme_type_variation = &"MM_PanelMenuSubPanelLabel" -text = "Custom Grid Size" -[node name="CustomGridSize" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox" index="9" instance=ExtResource("14_qr76f")] +[node name="CustomGridSize" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/BoxContainer" index="1" instance=ExtResource("14_qr76f")] unique_name_in_owner = true layout_mode = 2 value = 10.0 @@ -531,6 +511,11 @@ max_value = 32.0 step = 1.0 float_only = true +[node name="GuidesColor" type="ColorPickerButton" parent="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/BoxContainer" index="2"] +unique_name_in_owner = true +custom_minimum_size = Vector2(32, 0) +layout_mode = 2 + [node name="ExportMenu" type="Button" parent="MenuBar/HBox/MainMenu/HBox" index="1" node_paths=PackedStringArray("shortcut_context")] unique_name_in_owner = true custom_minimum_size = Vector2(40, 25) @@ -547,10 +532,10 @@ icon_name = "export" top_level = true custom_minimum_size = Vector2(320, 0) layout_mode = 0 -offset_left = -74.0 -offset_top = 36.0 -offset_right = 252.0 -offset_bottom = 341.0 +offset_left = 491.0 +offset_top = 189.0 +offset_right = 817.0 +offset_bottom = 594.0 theme_type_variation = &"MM_PanelMenuSubPanel" script = ExtResource("16_0fl4g") @@ -725,12 +710,12 @@ layout_mode = 2 [connection signal="unhandled_event" from="SplinesEditor" to="." method="_on_gui_input"] [connection signal="unhandled_event" from="PixelsEditor" to="." method="_on_gui_input"] [connection signal="unhandled_event" from="LatticeEditor" to="." method="_on_gui_input"] -[connection signal="pressed" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/ResetViewButton" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_reset_view_button_pressed"] -[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/ViewMode" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_view_mode_item_selected"] -[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/PostProcessing" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_post_processing_item_selected"] -[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/BoxContainer/Guides" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_guides_item_selected"] -[connection signal="color_changed" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/BoxContainer/GuidesColor" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_guides_color_color_changed"] -[connection signal="value_changed" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBox/CustomGridSize" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_custom_grid_size_value_changed"] +[connection signal="pressed" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/ResetViewButton" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_reset_view_button_pressed"] +[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/ViewMode" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_view_mode_item_selected"] +[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/PostProcessing" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_post_processing_item_selected"] +[connection signal="item_selected" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/BoxContainer/Guides" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_guides_item_selected"] +[connection signal="value_changed" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/BoxContainer/CustomGridSize" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_custom_grid_size_value_changed"] +[connection signal="color_changed" from="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel/VBoxContainer/VBox/BoxContainer/GuidesColor" to="MenuBar/HBox/MainMenu/HBox/ViewMenu/ViewMenuPanel" method="_on_guides_color_color_changed"] [connection signal="text_changed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/ExportFolder/ExportFolder" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_export_folder_text_changed"] [connection signal="pressed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/ExportFolder/ExportFolderButton" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_export_folder_button_pressed"] [connection signal="text_changed" from="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel/VBox/ExportFile/ExportFile" to="MenuBar/HBox/MainMenu/HBox/ExportMenu/ExportMenuPanel" method="_on_export_file_text_changed"] diff --git a/material_maker/panels/preview_2d/view_menu.gd b/material_maker/panels/preview_2d/view_menu.gd index 90b6fe720..5d8684527 100644 --- a/material_maker/panels/preview_2d/view_menu.gd +++ b/material_maker/panels/preview_2d/view_menu.gd @@ -1,16 +1,15 @@ extends PanelContainer -const GUIDES_CUSTOM_GRID := 7 +const GUIDES_GRID := 3 func _open() -> void: - %ViewMode.selected = owner.get_view_mode() - %PostProcessing.selected = owner.get_post_processing() + %ViewMode.selected = owner.view_mode + %PostProcessing.selected = owner.view_filter %Guides.selected = owner.get_node("Guides").style - if owner.get_node("Guides").style == 1000: - %Guides.selected = GUIDES_CUSTOM_GRID - %CustomGridSize.visible = %Guides.selected == GUIDES_CUSTOM_GRID - %CustomGridSizeLabel.visible = %Guides.selected == GUIDES_CUSTOM_GRID + %CustomGridSize.visible = %Guides.selected == GUIDES_GRID + %CustomGridSize.value = owner.get_node("Guides").grid_size + #%CustomGridSizeLabel.visible = %Guides.selected == GUIDES_GRID %GuidesColor.color = owner.get_node("Guides").color @@ -22,27 +21,22 @@ func _on_reset_view_button_pressed() -> void: func _on_view_mode_item_selected(index: int) -> void: - owner.set_view_mode(index) + owner.view_mode = index func _on_post_processing_item_selected(index: int) -> void: - owner.set_post_processing(index) + owner.view_filter = index func _on_guides_item_selected(index: int) -> void: - %CustomGridSize.visible = index == GUIDES_CUSTOM_GRID - %CustomGridSizeLabel.visible = index == GUIDES_CUSTOM_GRID - if index == GUIDES_CUSTOM_GRID: - owner.get_node("Guides").show_grid(%CustomGridSize.get_value()) - owner.get_node("Guides").style = 1000 - else: - owner.get_node("Guides").style = index + %CustomGridSize.visible = index == GUIDES_GRID + if index == GUIDES_GRID: + %CustomGridSize.value = owner.get_node("Guides").grid_size + owner.get_node("Guides").style = index size = Vector2() - func _on_guides_color_color_changed(color: Color) -> void: owner.get_node("Guides").color = color - func _on_custom_grid_size_value_changed(value: Variant) -> void: - owner.get_node("Guides").show_grid(value) + owner.get_node("Guides").grid_size = value