From f81ef37e9252a879e0cfc3ce9e46b399de4690a2 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 27 Dec 2019 02:28:36 +0200 Subject: [PATCH] Added guide color in Preferences --- Prefabs/PreferencesDialog.tscn | 20 +++++++++++++++++++- Scripts/Global.gd | 2 ++ Scripts/PreferencesDialog.gd | 7 +++++++ Scripts/Rulers/Guides.gd | 1 + Scripts/Rulers/HorizontalRuler.gd | 1 - Scripts/Rulers/VerticalRuler.gd | 1 - 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Prefabs/PreferencesDialog.tscn b/Prefabs/PreferencesDialog.tscn index a74e8d599..2885467f7 100644 --- a/Prefabs/PreferencesDialog.tscn +++ b/Prefabs/PreferencesDialog.tscn @@ -37,10 +37,11 @@ size_flags_horizontal = 3 [node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/ScrollContainer"] margin_right = 205.0 -margin_bottom = 282.0 +margin_bottom = 454.0 size_flags_horizontal = 3 [node name="Languages" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] +editor/display_folded = true margin_right = 205.0 margin_bottom = 282.0 @@ -117,6 +118,7 @@ custom_fonts/font = ExtResource( 3 ) text = "繁體中文 [zh_TW]" [node name="Themes" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] +editor/display_folded = true margin_right = 40.0 margin_bottom = 40.0 @@ -162,6 +164,7 @@ mouse_default_cursor_shape = 2 text = "Light" [node name="Grid&Guides" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] +editor/display_folded = true visible = false margin_top = 24.0 margin_right = 151.0 @@ -223,7 +226,22 @@ margin_top = 56.0 margin_right = 124.0 margin_bottom = 76.0 rect_min_size = Vector2( 64, 20 ) + +[node name="GuideColorLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"] +margin_top = 59.0 +margin_right = 46.0 +margin_bottom = 73.0 +text = "Guide color:" + +[node name="GuideColor" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"] +margin_left = 50.0 +margin_top = 56.0 +margin_right = 124.0 +margin_bottom = 76.0 +rect_min_size = Vector2( 64, 20 ) +color = Color( 0.63, 0.13, 0.94, 1 ) [connection signal="item_selected" from="HSplitContainer/Tree" to="." method="_on_Tree_item_selected"] [connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridWidthValue" to="." method="_on_GridWidthValue_value_changed"] [connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridHeightValue" to="." method="_on_GridHeightValue_value_changed"] [connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridColor" to="." method="_on_GridColor_color_changed"] +[connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GuideColor" to="." method="_on_GuideColor_color_changed"] diff --git a/Scripts/Global.gd b/Scripts/Global.gd index 3c7fed195..d0d078139 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -29,6 +29,8 @@ var grid_width := 1 var grid_height := 1 # warning-ignore:unused_class_variable var grid_color := Color.black +# warning-ignore:unused_class_variable +var guide_color := Color.purple # Tools & options # warning-ignore:unused_class_variable diff --git a/Scripts/PreferencesDialog.gd b/Scripts/PreferencesDialog.gd index 586a70089..33b1e8f20 100644 --- a/Scripts/PreferencesDialog.gd +++ b/Scripts/PreferencesDialog.gd @@ -161,3 +161,10 @@ func _on_GridHeightValue_value_changed(value : float) -> void: func _on_GridColor_color_changed(color : Color) -> void: Global.grid_color = color + +func _on_GuideColor_color_changed(color : Color) -> void: + Global.guide_color = color + for canvas in Global.canvases: + for guide in canvas.get_children(): + if guide is Guide: + guide.default_color = color diff --git a/Scripts/Rulers/Guides.gd b/Scripts/Rulers/Guides.gd index f75fa8a6b..5c3be7fa1 100644 --- a/Scripts/Rulers/Guides.gd +++ b/Scripts/Rulers/Guides.gd @@ -11,6 +11,7 @@ var type = TYPE.HORIZONTAL func _ready() -> void: width = 0.1 + default_color = Global.guide_color # warning-ignore:unused_argument func _process(delta : float) -> void: diff --git a/Scripts/Rulers/HorizontalRuler.gd b/Scripts/Rulers/HorizontalRuler.gd index b0c443ef6..fa93ddaa2 100644 --- a/Scripts/Rulers/HorizontalRuler.gd +++ b/Scripts/Rulers/HorizontalRuler.gd @@ -67,7 +67,6 @@ func _on_HorizontalRuler_pressed() -> void: Global.vertical_ruler._on_VerticalRuler_pressed() var guide := Guide.new() guide.type = guide.TYPE.HORIZONTAL - guide.default_color = Color.purple guide.add_point(Vector2(-99999, Global.canvas.current_pixel.y)) guide.add_point(Vector2(99999, Global.canvas.current_pixel.y)) Global.canvas.add_child(guide) diff --git a/Scripts/Rulers/VerticalRuler.gd b/Scripts/Rulers/VerticalRuler.gd index ee9b308c6..220e40e94 100644 --- a/Scripts/Rulers/VerticalRuler.gd +++ b/Scripts/Rulers/VerticalRuler.gd @@ -62,7 +62,6 @@ func _on_VerticalRuler_pressed() -> void: return var guide := Guide.new() guide.type = guide.TYPE.VERTICAL - guide.default_color = Color.purple guide.add_point(Vector2(Global.canvas.current_pixel.x, -99999)) guide.add_point(Vector2(Global.canvas.current_pixel.x, 99999)) Global.canvas.add_child(guide)