From fd80248416e931a0193e8aef1fa2d22136ca0a54 Mon Sep 17 00:00:00 2001 From: RorotoSic <70805756+RorotoSic@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:25:41 +0100 Subject: [PATCH] Collapsible Container change "expend buton" to the pixelorama custum node "CollapsibleContainer" --- src/Tools/BaseDraw.gd | 13 ++++---- src/Tools/BaseDraw.tscn | 40 +++++++++++++++--------- src/Tools/DesignTools/EllipseTool.tscn | 17 +++++++--- src/Tools/DesignTools/Eraser.tscn | 16 +++++----- src/Tools/DesignTools/LineTool.tscn | 19 +++++++---- src/Tools/DesignTools/Pencil.tscn | 22 ++++++------- src/Tools/DesignTools/RectangleTool.tscn | 17 +++++++--- src/Tools/DesignTools/Shading.tscn | 22 ++++++------- 8 files changed, 98 insertions(+), 68 deletions(-) diff --git a/src/Tools/BaseDraw.gd b/src/Tools/BaseDraw.gd index ebd898de9e5..beb0720d8e3 100644 --- a/src/Tools/BaseDraw.gd +++ b/src/Tools/BaseDraw.gd @@ -130,11 +130,11 @@ func set_config(config: Dictionary) -> void: func update_config() -> void: $Brush/BrushSize.value = _brush_size $ColorInterpolation.value = _brush_interpolate - $Flip/FlipX.button_pressed = _brush_flip_x - $Flip/FlipY.button_pressed = _brush_flip_y - $Rotate/Rotate90.button_pressed = _brush_rotate_90 - $Rotate/Rotate180.button_pressed = _brush_rotate_180 - $Rotate/Rotate270.button_pressed = _brush_rotate_270 + $RotationOptions/Flip/FlipX.button_pressed = _brush_flip_x + $RotationOptions/Flip/FlipY.button_pressed = _brush_flip_y + $RotationOptions/Rotate/Rotate90.button_pressed = _brush_rotate_90 + $RotationOptions/Rotate/Rotate180.button_pressed = _brush_rotate_180 + $RotationOptions/Rotate/Rotate270.button_pressed = _brush_rotate_270 update_brush() @@ -172,8 +172,7 @@ func update_brush() -> void: _polylines = _create_polylines(_indicator) $Brush/Type/Texture.texture = _brush_texture $ColorInterpolation.visible = _brush.type in [Brushes.FILE, Brushes.RANDOM_FILE, Brushes.CUSTOM] - $Flip.visible = _brush.type in [Brushes.FILE, Brushes.RANDOM_FILE, Brushes.CUSTOM] - $Rotate.visible = _brush.type in [Brushes.FILE, Brushes.RANDOM_FILE, Brushes.CUSTOM] + $RotationOptions.visible = _brush.type in [Brushes.FILE, Brushes.RANDOM_FILE, Brushes.CUSTOM] func update_random_image() -> void: diff --git a/src/Tools/BaseDraw.tscn b/src/Tools/BaseDraw.tscn index d7295df2a27..13c9ecd5603 100644 --- a/src/Tools/BaseDraw.tscn +++ b/src/Tools/BaseDraw.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=7 format=3 uid="uid://ubyatap3sylf"] +[gd_scene load_steps=8 format=3 uid="uid://ubyatap3sylf"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="2"] [ext_resource type="Script" path="res://src/Tools/BaseDraw.gd" id="3"] +[ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="3_76bek"] [sub_resource type="ButtonGroup" id="ButtonGroup_7u3x0"] resource_name = "rotate" @@ -29,44 +30,53 @@ anti_aliasing = false [node name="ToolOptions" instance=ExtResource("2")] script = ExtResource("3") -[node name="Flip" type="HBoxContainer" parent="." index="2"] +[node name="RotationOptions" type="VBoxContainer" parent="." index="2"] +visible = false layout_mode = 2 +theme_type_variation = &"CollapsibleContainer" +script = ExtResource("3_76bek") +text = "Rotation options" -[node name="FlipX" type="CheckBox" parent="Flip" index="0"] +[node name="Flip" type="HBoxContainer" parent="RotationOptions" index="1"] +visible = false +layout_mode = 2 + +[node name="FlipX" type="CheckBox" parent="RotationOptions/Flip" index="0"] layout_mode = 2 mouse_default_cursor_shape = 2 text = "Flip X" -[node name="FlipY" type="CheckBox" parent="Flip" index="1"] +[node name="FlipY" type="CheckBox" parent="RotationOptions/Flip" index="1"] layout_mode = 2 mouse_default_cursor_shape = 2 text = "Flip Y" -[node name="Rotate" type="HBoxContainer" parent="." index="3"] +[node name="Rotate" type="HBoxContainer" parent="RotationOptions" index="2"] +visible = false layout_mode = 2 -[node name="Rotate90" type="CheckBox" parent="Rotate" index="0"] +[node name="Rotate90" type="CheckBox" parent="RotationOptions/Rotate" index="0"] layout_mode = 2 tooltip_text = "rotate the brush 90 degrees" mouse_default_cursor_shape = 2 button_group = SubResource("ButtonGroup_7u3x0") text = "R 90" -[node name="Rotate180" type="CheckBox" parent="Rotate" index="1"] +[node name="Rotate180" type="CheckBox" parent="RotationOptions/Rotate" index="1"] layout_mode = 2 tooltip_text = "rotate the brush 180 degrees" mouse_default_cursor_shape = 2 button_group = SubResource("ButtonGroup_7u3x0") text = "R 180" -[node name="Rotate270" type="CheckBox" parent="Rotate" index="2"] +[node name="Rotate270" type="CheckBox" parent="RotationOptions/Rotate" index="2"] layout_mode = 2 tooltip_text = "rotate the brush 270 degrees" mouse_default_cursor_shape = 2 button_group = SubResource("ButtonGroup_7u3x0") text = "R 270" -[node name="Brush" type="HBoxContainer" parent="." index="4"] +[node name="Brush" type="HBoxContainer" parent="." index="3"] layout_mode = 2 alignment = 1 @@ -100,17 +110,17 @@ suffix = "px" global_increment_action = "brush_size_increment" global_decrement_action = "brush_size_decrement" -[node name="ColorInterpolation" parent="." index="5" instance=ExtResource("1")] +[node name="ColorInterpolation" parent="." index="4" instance=ExtResource("1")] visible = false layout_mode = 2 tooltip_text = "0: Color from the brush itself, 100: the currently selected color" prefix = "Brush color from:" -[connection signal="toggled" from="Flip/FlipX" to="." method="_on_flip_x_toggled"] -[connection signal="toggled" from="Flip/FlipY" to="." method="_on_flip_y_toggled"] -[connection signal="toggled" from="Rotate/Rotate90" to="." method="_on_rotate_90_toggled"] -[connection signal="toggled" from="Rotate/Rotate180" to="." method="_on_rotate_180_toggled"] -[connection signal="toggled" from="Rotate/Rotate270" to="." method="_on_rotate_270_toggled"] +[connection signal="toggled" from="RotationOptions/Flip/FlipX" to="." method="_on_flip_x_toggled"] +[connection signal="toggled" from="RotationOptions/Flip/FlipY" to="." method="_on_flip_y_toggled"] +[connection signal="toggled" from="RotationOptions/Rotate/Rotate90" to="." method="_on_rotate_90_toggled"] +[connection signal="toggled" from="RotationOptions/Rotate/Rotate180" to="." method="_on_rotate_180_toggled"] +[connection signal="toggled" from="RotationOptions/Rotate/Rotate270" to="." method="_on_rotate_270_toggled"] [connection signal="pressed" from="Brush/Type" to="." method="_on_BrushType_pressed"] [connection signal="value_changed" from="Brush/BrushSize" to="." method="_on_BrushSize_value_changed"] [connection signal="value_changed" from="ColorInterpolation" to="." method="_on_InterpolateFactor_value_changed"] diff --git a/src/Tools/DesignTools/EllipseTool.tscn b/src/Tools/DesignTools/EllipseTool.tscn index 269786387d4..59f20adee7f 100644 --- a/src/Tools/DesignTools/EllipseTool.tscn +++ b/src/Tools/DesignTools/EllipseTool.tscn @@ -1,13 +1,20 @@ -[gd_scene load_steps=3 format=3 uid="uid://4hp76lf38bc7"] +[gd_scene load_steps=4 format=3 uid="uid://4hp76lf38bc7"] [ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"] [ext_resource type="Script" path="res://src/Tools/DesignTools/EllipseTool.gd" id="2"] +[sub_resource type="ButtonGroup" id="ButtonGroup_q7ttl"] +resource_name = "rotate" +allow_unpress = true + [node name="ToolOptions" instance=ExtResource("1")] script = ExtResource("2") -[node name="Flip" parent="." index="4"] -visible = false +[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] +button_group = SubResource("ButtonGroup_q7ttl") + +[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] +button_group = SubResource("ButtonGroup_q7ttl") -[node name="Rotate" parent="." index="5"] -visible = false +[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] +button_group = SubResource("ButtonGroup_q7ttl") diff --git a/src/Tools/DesignTools/Eraser.tscn b/src/Tools/DesignTools/Eraser.tscn index 74d3c412ccd..f161245e06f 100644 --- a/src/Tools/DesignTools/Eraser.tscn +++ b/src/Tools/DesignTools/Eraser.tscn @@ -4,23 +4,23 @@ [ext_resource type="Script" path="res://src/Tools/DesignTools/Eraser.gd" id="2"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] -[sub_resource type="ButtonGroup" id="ButtonGroup_mdp2d"] +[sub_resource type="ButtonGroup" id="ButtonGroup_kkavr"] resource_name = "rotate" allow_unpress = true [node name="ToolOptions" instance=ExtResource("1")] script = ExtResource("2") -[node name="Rotate90" parent="Rotate" index="0"] -button_group = SubResource("ButtonGroup_mdp2d") +[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] +button_group = SubResource("ButtonGroup_kkavr") -[node name="Rotate180" parent="Rotate" index="1"] -button_group = SubResource("ButtonGroup_mdp2d") +[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] +button_group = SubResource("ButtonGroup_kkavr") -[node name="Rotate270" parent="Rotate" index="2"] -button_group = SubResource("ButtonGroup_mdp2d") +[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] +button_group = SubResource("ButtonGroup_kkavr") -[node name="OpacitySlider" parent="." index="7" instance=ExtResource("3")] +[node name="OpacitySlider" parent="." index="5" instance=ExtResource("3")] layout_mode = 2 max_value = 255.0 value = 255.0 diff --git a/src/Tools/DesignTools/LineTool.tscn b/src/Tools/DesignTools/LineTool.tscn index 1353388c971..08777f19cb4 100644 --- a/src/Tools/DesignTools/LineTool.tscn +++ b/src/Tools/DesignTools/LineTool.tscn @@ -1,9 +1,13 @@ -[gd_scene load_steps=4 format=3 uid="uid://ceahf2toaq47l"] +[gd_scene load_steps=5 format=3 uid="uid://ceahf2toaq47l"] [ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="1"] [ext_resource type="Script" path="res://src/Tools/DesignTools/LineTool.gd" id="2"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] +[sub_resource type="ButtonGroup" id="ButtonGroup_ko8wf"] +resource_name = "rotate" +allow_unpress = true + [node name="ToolOptions" instance=ExtResource("1")] script = ExtResource("2") @@ -16,13 +20,16 @@ suffix = "px" global_increment_action = "brush_size_increment" global_decrement_action = "brush_size_decrement" -[node name="Flip" parent="." index="3"] -visible = false +[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] +button_group = SubResource("ButtonGroup_ko8wf") -[node name="Rotate" parent="." index="4"] -visible = false +[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] +button_group = SubResource("ButtonGroup_ko8wf") + +[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] +button_group = SubResource("ButtonGroup_ko8wf") -[node name="Brush" parent="." index="5"] +[node name="Brush" parent="." index="4"] visible = false [connection signal="value_changed" from="ThicknessSlider" to="." method="_on_Thickness_value_changed"] diff --git a/src/Tools/DesignTools/Pencil.tscn b/src/Tools/DesignTools/Pencil.tscn index 3cab910b0a2..af81dc0a499 100644 --- a/src/Tools/DesignTools/Pencil.tscn +++ b/src/Tools/DesignTools/Pencil.tscn @@ -4,39 +4,39 @@ [ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Pencil.gd" id="3"] -[sub_resource type="ButtonGroup" id="ButtonGroup_easm4"] +[sub_resource type="ButtonGroup" id="ButtonGroup_clato"] resource_name = "rotate" allow_unpress = true [node name="ToolOptions" instance=ExtResource("1")] script = ExtResource("3") -[node name="Rotate90" parent="Rotate" index="0"] -button_group = SubResource("ButtonGroup_easm4") +[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] +button_group = SubResource("ButtonGroup_clato") -[node name="Rotate180" parent="Rotate" index="1"] -button_group = SubResource("ButtonGroup_easm4") +[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] +button_group = SubResource("ButtonGroup_clato") -[node name="Rotate270" parent="Rotate" index="2"] -button_group = SubResource("ButtonGroup_easm4") +[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] +button_group = SubResource("ButtonGroup_clato") -[node name="Overwrite" type="CheckBox" parent="." index="7"] +[node name="Overwrite" type="CheckBox" parent="." index="5"] layout_mode = 2 tooltip_text = "Overwrites color instead of blending it. This option is only relevant with colors that are not fully opaque" mouse_default_cursor_shape = 2 text = "Overwrite color" -[node name="FillInside" type="CheckBox" parent="." index="8"] +[node name="FillInside" type="CheckBox" parent="." index="6"] layout_mode = 2 mouse_default_cursor_shape = 2 text = "Fill inside" -[node name="SpacingMode" type="CheckBox" parent="." index="9"] +[node name="SpacingMode" type="CheckBox" parent="." index="7"] layout_mode = 2 mouse_default_cursor_shape = 2 text = "Spacing" -[node name="Spacing" parent="." index="10" instance=ExtResource("2")] +[node name="Spacing" parent="." index="8" instance=ExtResource("2")] visible = false layout_mode = 2 allow_greater = true diff --git a/src/Tools/DesignTools/RectangleTool.tscn b/src/Tools/DesignTools/RectangleTool.tscn index 195afdbb539..461bc8e0980 100644 --- a/src/Tools/DesignTools/RectangleTool.tscn +++ b/src/Tools/DesignTools/RectangleTool.tscn @@ -1,13 +1,20 @@ -[gd_scene load_steps=3 format=3 uid="uid://dhlab4q2dwu0a"] +[gd_scene load_steps=4 format=3 uid="uid://dhlab4q2dwu0a"] [ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"] [ext_resource type="Script" path="res://src/Tools/DesignTools/RectangleTool.gd" id="2"] +[sub_resource type="ButtonGroup" id="ButtonGroup_cyxrj"] +resource_name = "rotate" +allow_unpress = true + [node name="ToolOptions" instance=ExtResource("1")] script = ExtResource("2") -[node name="Flip" parent="." index="4"] -visible = false +[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] +button_group = SubResource("ButtonGroup_cyxrj") + +[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] +button_group = SubResource("ButtonGroup_cyxrj") -[node name="Rotate" parent="." index="5"] -visible = false +[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] +button_group = SubResource("ButtonGroup_cyxrj") diff --git a/src/Tools/DesignTools/Shading.tscn b/src/Tools/DesignTools/Shading.tscn index f798d21e59f..4b87b3a48d9 100644 --- a/src/Tools/DesignTools/Shading.tscn +++ b/src/Tools/DesignTools/Shading.tscn @@ -4,23 +4,23 @@ [ext_resource type="Script" path="res://src/Tools/DesignTools/Shading.gd" id="2"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] -[sub_resource type="ButtonGroup" id="ButtonGroup_if3yb"] +[sub_resource type="ButtonGroup" id="ButtonGroup_se02m"] resource_name = "rotate" allow_unpress = true [node name="ToolOptions" instance=ExtResource("1")] script = ExtResource("2") -[node name="Rotate90" parent="Rotate" index="0"] -button_group = SubResource("ButtonGroup_if3yb") +[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] +button_group = SubResource("ButtonGroup_se02m") -[node name="Rotate180" parent="Rotate" index="1"] -button_group = SubResource("ButtonGroup_if3yb") +[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] +button_group = SubResource("ButtonGroup_se02m") -[node name="Rotate270" parent="Rotate" index="2"] -button_group = SubResource("ButtonGroup_if3yb") +[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] +button_group = SubResource("ButtonGroup_se02m") -[node name="LightenDarken" type="OptionButton" parent="." index="7"] +[node name="LightenDarken" type="OptionButton" parent="." index="5"] custom_minimum_size = Vector2(92, 0) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -31,7 +31,7 @@ popup/item_0/id = 0 popup/item_1/text = "Darken" popup/item_1/id = 1 -[node name="ShadingMode" type="OptionButton" parent="." index="8"] +[node name="ShadingMode" type="OptionButton" parent="." index="6"] layout_mode = 2 mouse_default_cursor_shape = 2 item_count = 2 @@ -41,13 +41,13 @@ popup/item_0/id = 0 popup/item_1/text = "Hue Shifting" popup/item_1/id = 1 -[node name="AmountSlider" parent="." index="9" instance=ExtResource("3")] +[node name="AmountSlider" parent="." index="7" instance=ExtResource("3")] layout_mode = 2 tooltip_text = "Lighten/Darken amount" value = 10.0 prefix = "Amount:" -[node name="HueShiftingOptions" type="VBoxContainer" parent="." index="10"] +[node name="HueShiftingOptions" type="VBoxContainer" parent="." index="8"] visible = false layout_mode = 2