Skip to content

Commit

Permalink
Collapsible Container
Browse files Browse the repository at this point in the history
change "expend buton" to the pixelorama custum node "CollapsibleContainer"
  • Loading branch information
RorotoSic committed Mar 15, 2024
1 parent 423885a commit fd80248
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 68 deletions.
13 changes: 6 additions & 7 deletions src/Tools/BaseDraw.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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:
Expand Down
40 changes: 25 additions & 15 deletions src/Tools/BaseDraw.tscn
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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

Expand Down Expand Up @@ -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"]
17 changes: 12 additions & 5 deletions src/Tools/DesignTools/EllipseTool.tscn
Original file line number Diff line number Diff line change
@@ -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")
16 changes: 8 additions & 8 deletions src/Tools/DesignTools/Eraser.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 13 additions & 6 deletions src/Tools/DesignTools/LineTool.tscn
Original file line number Diff line number Diff line change
@@ -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")

Expand All @@ -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"]
22 changes: 11 additions & 11 deletions src/Tools/DesignTools/Pencil.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions src/Tools/DesignTools/RectangleTool.tscn
Original file line number Diff line number Diff line change
@@ -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")
22 changes: 11 additions & 11 deletions src/Tools/DesignTools/Shading.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit fd80248

Please sign in to comment.