From 60997723e265298c3b39b8181a58ae57fbcb3a84 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Tue, 4 Apr 2023 04:19:18 +0300 Subject: [PATCH] Create a parent scene for the image effects This helps with shared nodes, such as the preview, the affect selection, cels etc options, and the animation properties --- src/Classes/ImageEffect.gd | 12 +- .../ImageEffects/DesaturateDialog.tscn | 93 +++--- .../Dialogs/ImageEffects/DropShadowDialog.gd | 4 +- .../ImageEffects/DropShadowDialog.tscn | 126 +++------ .../Dialogs/ImageEffects/FlipImageDialog.gd | 4 +- .../Dialogs/ImageEffects/FlipImageDialog.tscn | 101 +++---- src/UI/Dialogs/ImageEffects/GradientDialog.gd | 2 +- .../Dialogs/ImageEffects/GradientDialog.tscn | 190 ++++++------- .../ImageEffects/GradientMapDialog.tscn | 69 +---- src/UI/Dialogs/ImageEffects/HSVDialog.gd | 45 +-- src/UI/Dialogs/ImageEffects/HSVDialog.tscn | 135 +-------- .../ImageEffects/ImageEffectParent.tscn | 95 +++++++ .../ImageEffects/InvertColorsDialog.tscn | 82 ++---- src/UI/Dialogs/ImageEffects/OutlineDialog.gd | 4 +- .../Dialogs/ImageEffects/OutlineDialog.tscn | 200 ++++++------- src/UI/Dialogs/ImageEffects/RotateImage.gd | 19 +- src/UI/Dialogs/ImageEffects/RotateImage.tscn | 264 +++++++----------- src/UI/Nodes/ValueSlider.gd | 2 +- 18 files changed, 549 insertions(+), 898 deletions(-) create mode 100644 src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn diff --git a/src/Classes/ImageEffect.gd b/src/Classes/ImageEffect.gd index 2bb39f7fa..acfb8acca 100644 --- a/src/Classes/ImageEffect.gd +++ b/src/Classes/ImageEffect.gd @@ -16,7 +16,7 @@ var affect_option_button: OptionButton var animate_options_container: Node var animate_menu: PopupMenu var initial_button: Button -var animate_bool = [] +var animate_bool := [] var initial_values: PoolRealArray = [] var selected_idx: int = 0 # the current selected cel to apply animation to var confirmed := false @@ -136,12 +136,11 @@ func set_initial_values() -> void: pass -func get_animated_value(project: Project, final: float, property_idx: int): +func get_animated_value(project: Project, final: float, property_idx: int) -> float: if animate_bool[property_idx] == true and confirmed: - var first: Vector2 = Vector2(initial_values[property_idx], 0) - var second: Vector2 = Vector2(final, 0) - var interpolation = float(selected_idx) / project.selected_cels.size() - return first.linear_interpolate(second, interpolation).x + var first := initial_values[property_idx] + var interpolation := float(selected_idx) / project.selected_cels.size() + return lerp(first, final, interpolation) else: return final @@ -153,7 +152,6 @@ func _update_animate_flags(id: int) -> void: func _commit_undo(action: String, undo_data: Dictionary, project: Project) -> void: var redo_data := _get_undo_data(project) - project.undos += 1 project.undo_redo.create_action(action) for image in redo_data: diff --git a/src/UI/Dialogs/ImageEffects/DesaturateDialog.tscn b/src/UI/Dialogs/ImageEffects/DesaturateDialog.tscn index 2ef9f73a2..adce96bb2 100644 --- a/src/UI/Dialogs/ImageEffects/DesaturateDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/DesaturateDialog.tscn @@ -1,57 +1,27 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/DesaturateDialog.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=2] -[node name="DesaturateDialog" type="ConfirmationDialog"] -margin_right = 294.0 -margin_bottom = 296.0 -rect_min_size = Vector2( 172, 60.2 ) +[node name="DesaturateDialog" instance=ExtResource( 2 )] window_title = "Desaturation" -resizable = true script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 286.0 -margin_bottom = 260.0 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] +[node name="AspectRatioContainer" parent="VBoxContainer" index="0"] margin_right = 278.0 -margin_bottom = 200.0 -size_flags_vertical = 3 -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] +[node name="Preview" parent="VBoxContainer/AspectRatioContainer" index="0"] margin_left = 39.0 margin_right = 239.0 -margin_bottom = 200.0 -rect_min_size = Vector2( 200, 200 ) -expand = true -stretch_mode = 5 -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="RGBAContainer" type="HBoxContainer" parent="VBoxContainer"] +[node name="RGBAContainer" type="HBoxContainer" parent="VBoxContainer" index="1"] margin_top = 204.0 margin_right = 278.0 margin_bottom = 224.0 alignment = 1 -[node name="RButton" type="Button" parent="VBoxContainer/RGBAContainer"] -margin_left = 91.0 -margin_right = 111.0 +[node name="RButton" type="Button" parent="VBoxContainer/RGBAContainer" index="0"] +margin_right = 66.0 margin_bottom = 20.0 hint_tooltip = "Modify Red Channel" mouse_default_cursor_shape = 2 @@ -60,8 +30,8 @@ toggle_mode = true pressed = true text = "R" -[node name="GButton" type="Button" parent="VBoxContainer/RGBAContainer"] -margin_left = 115.0 +[node name="GButton" type="Button" parent="VBoxContainer/RGBAContainer" index="1"] +margin_left = 70.0 margin_right = 137.0 margin_bottom = 20.0 hint_tooltip = "Modify Green Channel" @@ -71,9 +41,9 @@ toggle_mode = true pressed = true text = "G" -[node name="BButton" type="Button" parent="VBoxContainer/RGBAContainer"] +[node name="BButton" type="Button" parent="VBoxContainer/RGBAContainer" index="2"] margin_left = 141.0 -margin_right = 162.0 +margin_right = 207.0 margin_bottom = 20.0 hint_tooltip = "Modify Blue Channel" mouse_default_cursor_shape = 2 @@ -82,9 +52,9 @@ toggle_mode = true pressed = true text = "B" -[node name="AButton" type="Button" parent="VBoxContainer/RGBAContainer"] -margin_left = 166.0 -margin_right = 187.0 +[node name="AButton" type="Button" parent="VBoxContainer/RGBAContainer" index="3"] +margin_left = 211.0 +margin_right = 278.0 margin_bottom = 20.0 hint_tooltip = "Modify Alpha Channel" mouse_default_cursor_shape = 2 @@ -92,28 +62,29 @@ size_flags_horizontal = 3 toggle_mode = true text = "A" -[node name="OptionsContainer" type="HBoxContainer" parent="VBoxContainer"] +[node name="OptionsContainer" parent="VBoxContainer" index="2"] margin_top = 228.0 margin_right = 278.0 margin_bottom = 252.0 -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_right = 160.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" - -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 164.0 +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +margin_right = 278.0 + +[node name="AnimationOptions" parent="VBoxContainer" index="3"] +visible = false +margin_top = 256.0 +margin_right = 278.0 +margin_bottom = 290.0 + +[node name="PanelContainer" parent="VBoxContainer/AnimationOptions" index="1"] +margin_right = 157.0 + +[node name="AnimateMenu" parent="VBoxContainer/AnimationOptions/PanelContainer" index="0"] +margin_right = 88.0 + +[node name="InitalButton" parent="VBoxContainer/AnimationOptions" index="2"] +margin_left = 161.0 margin_right = 278.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" -items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 [connection signal="toggled" from="VBoxContainer/RGBAContainer/RButton" to="." method="_on_RButton_toggled"] [connection signal="toggled" from="VBoxContainer/RGBAContainer/GButton" to="." method="_on_GButton_toggled"] diff --git a/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd b/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd index 6f12fdcbd..54111dac4 100644 --- a/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd +++ b/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd @@ -5,7 +5,7 @@ var offset := Vector2(5, 5) var color := Color.black var shader: Shader = load("res://src/Shaders/DropShadow.tres") -onready var shadow_color := $VBoxContainer/OptionsContainer/ShadowColor as ColorPickerButton +onready var shadow_color := $VBoxContainer/ShadowOptions/ShadowColor as ColorPickerButton func _ready() -> void: @@ -64,6 +64,6 @@ func _on_OffsetSliders_value_changed(value: Vector2) -> void: update_preview() -func _on_OutlineColor_color_changed(value: Color) -> void: +func _on_ShadowColor_color_changed(value: Color) -> void: color = value update_preview() diff --git a/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn b/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn index 4149a0344..73e8cd910 100644 --- a/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn @@ -1,47 +1,27 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=1] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=1] [ext_resource path="res://src/UI/Dialogs/ImageEffects/DropShadowDialog.gd" type="Script" id=2] [ext_resource path="res://src/UI/Nodes/ValueSliderV2.tscn" type="PackedScene" id=3] -[node name="DropShadowDialog" type="ConfirmationDialog"] -margin_right = 294.0 -margin_bottom = 352.0 -rect_min_size = Vector2( 172, 60.2 ) +[node name="DropShadowDialog" instance=ExtResource( 1 )] window_title = "Drop Shadow" -resizable = true script = ExtResource( 2 ) -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 286.0 +[node name="VBoxContainer" parent="." index="3"] margin_bottom = 340.0 -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 279.0 -margin_bottom = 200.0 -size_flags_vertical = 3 +[node name="AspectRatioContainer" parent="VBoxContainer" index="0"] +margin_right = 278.0 -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 39.5 -margin_right = 239.5 -margin_bottom = 200.0 -rect_min_size = Vector2( 200, 200 ) -expand = true -stretch_mode = 5 +[node name="Preview" parent="VBoxContainer/AspectRatioContainer" index="0"] +margin_left = 39.0 +margin_right = 239.0 -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 1 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] +[node name="ShadowOptions" type="GridContainer" parent="VBoxContainer" index="1"] margin_top = 204.0 -margin_right = 279.0 -margin_bottom = 308.0 +margin_right = 278.0 +margin_bottom = 280.0 custom_constants/vseparation = 4 custom_constants/hseparation = 4 columns = 2 @@ -49,16 +29,16 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Label" type="Label" parent="VBoxContainer/OptionsContainer"] +[node name="Label" type="Label" parent="VBoxContainer/ShadowOptions" index="0"] margin_top = 19.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 33.0 size_flags_horizontal = 3 text = "Offset:" -[node name="OffsetSliders" parent="VBoxContainer/OptionsContainer" instance=ExtResource( 3 )] -margin_left = 164.0 -margin_right = 279.0 +[node name="OffsetSliders" parent="VBoxContainer/ShadowOptions" index="1" instance=ExtResource( 3 )] +margin_left = 141.0 +margin_right = 278.0 value = Vector2( 5, 5 ) min_value = Vector2( -64, -64 ) max_value = Vector2( 64, 64 ) @@ -68,75 +48,45 @@ show_ratio = true suffix_x = "px" suffix_y = "px" -[node name="ShadowColorLabel" type="Label" parent="VBoxContainer/OptionsContainer"] +[node name="ShadowColorLabel" type="Label" parent="VBoxContainer/ShadowOptions" index="2"] margin_top = 59.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 73.0 size_flags_horizontal = 3 text = "Shadow color:" -[node name="ShadowColor" type="ColorPickerButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 164.0 +[node name="ShadowColor" type="ColorPickerButton" parent="VBoxContainer/ShadowOptions" index="3"] +margin_left = 141.0 margin_top = 56.0 -margin_right = 279.0 +margin_right = 278.0 margin_bottom = 76.0 rect_min_size = Vector2( 64, 20 ) size_flags_horizontal = 3 color = Color( 0.0823529, 0.0823529, 0.0823529, 0.627451 ) -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_top = 80.0 -margin_right = 160.0 -margin_bottom = 104.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" +[node name="OptionsContainer" parent="VBoxContainer" index="2"] +margin_top = 284.0 +margin_right = 278.0 +margin_bottom = 308.0 -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 164.0 -margin_top = 80.0 -margin_right = 279.0 -margin_bottom = 104.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +margin_right = 278.0 items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 -[node name="AnimationOptions" type="HBoxContainer" parent="VBoxContainer"] +[node name="AnimationOptions" parent="VBoxContainer" index="3"] margin_top = 312.0 -margin_right = 279.0 +margin_right = 278.0 margin_bottom = 346.0 -[node name="Label" type="Label" parent="VBoxContainer/AnimationOptions"] -margin_top = 10.0 -margin_right = 62.0 -margin_bottom = 24.0 -text = "Animate :" +[node name="PanelContainer" parent="VBoxContainer/AnimationOptions" index="1"] +margin_right = 157.0 -[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/AnimationOptions"] -margin_left = 66.0 -margin_right = 158.0 -margin_bottom = 34.0 -size_flags_horizontal = 3 +[node name="AnimateMenu" parent="VBoxContainer/AnimationOptions/PanelContainer" index="0"] +margin_right = 88.0 -[node name="AnimateMenu" type="MenuButton" parent="VBoxContainer/AnimationOptions/PanelContainer"] -unique_name_in_owner = true -margin_left = 7.0 -margin_top = 7.0 -margin_right = 85.0 -margin_bottom = 27.0 -focus_mode = 2 -text = "Properties" -flat = false +[node name="InitalButton" parent="VBoxContainer/AnimationOptions" index="2"] +margin_left = 161.0 +margin_right = 278.0 -[node name="InitalButton" type="Button" parent="VBoxContainer/AnimationOptions"] -unique_name_in_owner = true -margin_left = 162.0 -margin_right = 279.0 -margin_bottom = 34.0 -text = "Set initial values" - -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/OffsetSliders" to="." method="_on_OffsetSliders_value_changed"] -[connection signal="color_changed" from="VBoxContainer/OptionsContainer/ShadowColor" to="." method="_on_OutlineColor_color_changed"] +[connection signal="value_changed" from="VBoxContainer/ShadowOptions/OffsetSliders" to="." method="_on_OffsetSliders_value_changed"] +[connection signal="color_changed" from="VBoxContainer/ShadowOptions/ShadowColor" to="." method="_on_ShadowColor_color_changed"] diff --git a/src/UI/Dialogs/ImageEffects/FlipImageDialog.gd b/src/UI/Dialogs/ImageEffects/FlipImageDialog.gd index cdaacd860..4d0c5817d 100644 --- a/src/UI/Dialogs/ImageEffects/FlipImageDialog.gd +++ b/src/UI/Dialogs/ImageEffects/FlipImageDialog.gd @@ -1,7 +1,7 @@ extends ImageEffect -onready var flip_h: CheckBox = $VBoxContainer/OptionsContainer/FlipHorizontal -onready var flip_v: CheckBox = $VBoxContainer/OptionsContainer/FlipVertical +onready var flip_h := $VBoxContainer/FlipOptions/FlipHorizontal as CheckBox +onready var flip_v := $VBoxContainer/FlipOptions/FlipVertical as CheckBox func set_nodes() -> void: diff --git a/src/UI/Dialogs/ImageEffects/FlipImageDialog.tscn b/src/UI/Dialogs/ImageEffects/FlipImageDialog.tscn index 81e09ab04..53351d60b 100644 --- a/src/UI/Dialogs/ImageEffects/FlipImageDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/FlipImageDialog.tscn @@ -1,86 +1,67 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/FlipImageDialog.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=2] -[node name="FlipImageDialog" type="ConfirmationDialog"] -margin_right = 283.0 -margin_bottom = 300.0 -rect_min_size = Vector2( 172, 60.2 ) +[node name="FlipImageDialog" instance=ExtResource( 2 )] window_title = "Mirror Image" -resizable = true script = ExtResource( 1 ) -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 286.0 -margin_bottom = 264.0 -__meta__ = { -"_edit_use_anchors_": false -} +[node name="VBoxContainer" parent="." index="3"] +margin_bottom = 288.0 -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 283.0 -margin_bottom = 200.0 -size_flags_vertical = 3 +[node name="AspectRatioContainer" parent="VBoxContainer" index="0"] +margin_right = 278.0 -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 41.5 -margin_right = 241.5 -margin_bottom = 200.0 -rect_min_size = Vector2( 200, 200 ) -expand = true -stretch_mode = 5 +[node name="Preview" parent="VBoxContainer/AspectRatioContainer" index="0"] +margin_left = 39.0 +margin_right = 239.0 -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] +[node name="FlipOptions" type="GridContainer" parent="VBoxContainer" index="1"] margin_top = 204.0 -margin_right = 283.0 -margin_bottom = 256.0 +margin_right = 278.0 +margin_bottom = 228.0 columns = 2 -[node name="FlipHorizontal" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_right = 160.0 +[node name="FlipHorizontal" type="CheckBox" parent="VBoxContainer/FlipOptions" index="0"] +margin_right = 137.0 margin_bottom = 24.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 pressed = true text = "Horizontal" -[node name="FlipVertical" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_left = 164.0 -margin_right = 283.0 +[node name="FlipVertical" type="CheckBox" parent="VBoxContainer/FlipOptions" index="1"] +margin_left = 141.0 +margin_right = 278.0 margin_bottom = 24.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 text = "Vertical" -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_top = 28.0 -margin_right = 160.0 -margin_bottom = 52.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" +[node name="OptionsContainer" parent="VBoxContainer" index="2"] +margin_top = 232.0 +margin_right = 278.0 +margin_bottom = 256.0 -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 164.0 -margin_top = 28.0 -margin_right = 283.0 -margin_bottom = 52.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" -items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +margin_right = 278.0 -[connection signal="toggled" from="VBoxContainer/OptionsContainer/FlipHorizontal" to="." method="_on_FlipHorizontal_toggled"] -[connection signal="toggled" from="VBoxContainer/OptionsContainer/FlipVertical" to="." method="_on_FlipVertical_toggled"] +[node name="AnimationOptions" parent="VBoxContainer" index="3"] +visible = false +margin_top = 260.0 +margin_right = 278.0 +margin_bottom = 294.0 + +[node name="PanelContainer" parent="VBoxContainer/AnimationOptions" index="1"] +margin_right = 157.0 + +[node name="AnimateMenu" parent="VBoxContainer/AnimationOptions/PanelContainer" index="0"] +margin_right = 88.0 + +[node name="InitalButton" parent="VBoxContainer/AnimationOptions" index="2"] +margin_left = 161.0 +margin_right = 278.0 + +[connection signal="toggled" from="VBoxContainer/FlipOptions/FlipHorizontal" to="." method="_on_FlipHorizontal_toggled"] +[connection signal="toggled" from="VBoxContainer/FlipOptions/FlipVertical" to="." method="_on_FlipVertical_toggled"] diff --git a/src/UI/Dialogs/ImageEffects/GradientDialog.gd b/src/UI/Dialogs/ImageEffects/GradientDialog.gd index b9e6d814e..194d7ccd7 100644 --- a/src/UI/Dialogs/ImageEffects/GradientDialog.gd +++ b/src/UI/Dialogs/ImageEffects/GradientDialog.gd @@ -14,7 +14,7 @@ var dither_matrices := [ ] var selected_dither_matrix: DitherMatrix = dither_matrices[0] -onready var options_cont: Container = $VBoxContainer/OptionsContainer +onready var options_cont: Container = $VBoxContainer/GradientOptions onready var gradient_edit: GradientEditNode = $VBoxContainer/GradientEdit onready var shape_option_button: OptionButton = $"%ShapeOptionButton" onready var dithering_label: Label = $"%DitheringLabel" diff --git a/src/UI/Dialogs/ImageEffects/GradientDialog.tscn b/src/UI/Dialogs/ImageEffects/GradientDialog.tscn index 433acc3e2..ee0de4639 100644 --- a/src/UI/Dialogs/ImageEffects/GradientDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/GradientDialog.tscn @@ -1,71 +1,48 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/GradientDialog.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=2] [ext_resource path="res://src/UI/Nodes/GradientEdit.tscn" type="PackedScene" id=3] [ext_resource path="res://src/UI/Nodes/ValueSlider.gd" type="Script" id=4] -[node name="GradientDialog" type="ConfirmationDialog"] -margin_right = 334.0 -margin_bottom = 444.0 -rect_min_size = Vector2( 334, 444 ) +[node name="GradientDialog" instance=ExtResource( 2 )] window_title = "Gradient" -resizable = true script = ExtResource( 1 ) -[node name="VBoxContainer" type="VBoxContainer" parent="."] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 8.0 -margin_top = 8.0 -margin_right = -8.0 -margin_bottom = -36.0 +[node name="VBoxContainer" parent="." index="3"] +margin_bottom = 468.0 -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 318.0 -margin_bottom = 164.0 -size_flags_vertical = 3 +[node name="AspectRatioContainer" parent="VBoxContainer" index="0"] +margin_right = 278.0 -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 77.0 -margin_right = 241.0 -margin_bottom = 164.0 -size_flags_horizontal = 5 -size_flags_vertical = 3 -expand = true -stretch_mode = 5 +[node name="Preview" parent="VBoxContainer/AspectRatioContainer" index="0"] +margin_left = 39.0 +margin_right = 239.0 -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="GradientEdit" parent="VBoxContainer" instance=ExtResource( 3 )] +[node name="GradientEdit" parent="VBoxContainer" index="1" instance=ExtResource( 3 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 168.0 -margin_right = 318.0 -margin_bottom = 246.0 +margin_top = 204.0 +margin_right = 278.0 +margin_bottom = 282.0 -[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] -margin_top = 250.0 -margin_right = 318.0 -margin_bottom = 400.0 +[node name="GradientOptions" type="GridContainer" parent="VBoxContainer" index="2"] +margin_top = 286.0 +margin_right = 278.0 +margin_bottom = 408.0 columns = 2 -[node name="ShapeLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] +[node name="ShapeLabel" type="Label" parent="VBoxContainer/GradientOptions" index="0" groups=["gradient_common"]] margin_top = 3.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 17.0 size_flags_horizontal = 3 text = "Shape:" -[node name="ShapeOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] +[node name="ShapeOptionButton" type="OptionButton" parent="VBoxContainer/GradientOptions" index="1" groups=["gradient_common"]] unique_name_in_owner = true -margin_left = 164.0 -margin_right = 318.0 +margin_left = 141.0 +margin_right = 278.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 @@ -73,52 +50,52 @@ text = "Linear" items = [ "Linear", null, false, 0, null, "Radial", null, false, 1, null ] selected = 0 -[node name="DitheringLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] +[node name="DitheringLabel" type="Label" parent="VBoxContainer/GradientOptions" index="2" groups=["gradient_common"]] unique_name_in_owner = true margin_top = 27.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 41.0 text = "Dithering pattern:" -[node name="DitheringOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] +[node name="DitheringOptionButton" type="OptionButton" parent="VBoxContainer/GradientOptions" index="3" groups=["gradient_common"]] unique_name_in_owner = true -margin_left = 164.0 +margin_left = 141.0 margin_top = 24.0 -margin_right = 318.0 +margin_right = 278.0 margin_bottom = 44.0 mouse_default_cursor_shape = 2 text = "None" items = [ "None", null, false, 0, null ] selected = 0 -[node name="RepeatLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] +[node name="RepeatLabel" type="Label" parent="VBoxContainer/GradientOptions" index="4" groups=["gradient_common"]] margin_top = 51.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 65.0 text = "Repeat:" -[node name="RepeatOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] +[node name="RepeatOptionButton" type="OptionButton" parent="VBoxContainer/GradientOptions" index="5" groups=["gradient_common"]] unique_name_in_owner = true -margin_left = 164.0 +margin_left = 141.0 margin_top = 48.0 -margin_right = 318.0 +margin_right = 278.0 margin_bottom = 68.0 mouse_default_cursor_shape = 2 text = "None" items = [ "None", null, false, 0, null, "Repeat", null, false, 1, null, "Mirror", null, false, 2, null, "Truncate", null, false, 3, null ] selected = 0 -[node name="PositionLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear", "gradient_step"]] +[node name="PositionLabel" type="Label" parent="VBoxContainer/GradientOptions" index="6" groups=["gradient_dithering", "gradient_linear", "gradient_step"]] margin_top = 72.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 86.0 text = "Position:" -[node name="PositionSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear"]] +[node name="PositionSlider" type="TextureProgress" parent="VBoxContainer/GradientOptions" index="7" groups=["gradient_dithering", "gradient_linear"]] unique_name_in_owner = true -margin_left = 164.0 +margin_left = 141.0 margin_top = 72.0 -margin_right = 318.0 +margin_right = 278.0 margin_bottom = 86.0 mouse_default_cursor_shape = 2 theme_type_variation = "ValueSlider" @@ -133,17 +110,17 @@ stretch_margin_bottom = 3 script = ExtResource( 4 ) suffix = "%" -[node name="SizeLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear", "gradient_step"]] +[node name="SizeLabel" type="Label" parent="VBoxContainer/GradientOptions" index="8" groups=["gradient_dithering", "gradient_linear", "gradient_step"]] margin_top = 90.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 104.0 text = "Size:" -[node name="SizeSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear"]] +[node name="SizeSlider" type="TextureProgress" parent="VBoxContainer/GradientOptions" index="9" groups=["gradient_dithering", "gradient_linear"]] unique_name_in_owner = true -margin_left = 164.0 +margin_left = 141.0 margin_top = 90.0 -margin_right = 318.0 +margin_right = 278.0 margin_bottom = 104.0 mouse_default_cursor_shape = 2 theme_type_variation = "ValueSlider" @@ -159,17 +136,17 @@ stretch_margin_bottom = 3 script = ExtResource( 4 ) suffix = "%" -[node name="AngleLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear", "gradient_step"]] +[node name="AngleLabel" type="Label" parent="VBoxContainer/GradientOptions" index="10" groups=["gradient_dithering", "gradient_linear", "gradient_step"]] margin_top = 108.0 -margin_right = 160.0 +margin_right = 137.0 margin_bottom = 122.0 text = "Angle:" -[node name="AngleSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear"]] +[node name="AngleSlider" type="TextureProgress" parent="VBoxContainer/GradientOptions" index="11" groups=["gradient_dithering", "gradient_linear"]] unique_name_in_owner = true -margin_left = 164.0 +margin_left = 141.0 margin_top = 108.0 -margin_right = 318.0 +margin_right = 278.0 margin_bottom = 122.0 mouse_default_cursor_shape = 2 theme_type_variation = "ValueSlider" @@ -182,20 +159,20 @@ stretch_margin_bottom = 3 script = ExtResource( 4 ) suffix = "°" -[node name="CenterLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] +[node name="CenterLabel" type="Label" parent="VBoxContainer/GradientOptions" index="12" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] visible = false margin_top = 60.0 margin_right = 160.0 margin_bottom = 74.0 text = "Center:" -[node name="CenterContainer" type="HBoxContainer" parent="VBoxContainer/OptionsContainer" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] +[node name="CenterContainer" type="HBoxContainer" parent="VBoxContainer/GradientOptions" index="13" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] visible = false margin_top = 60.0 margin_right = 154.0 margin_bottom = 84.0 -[node name="XCenterSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer/CenterContainer"] +[node name="XCenterSlider" type="TextureProgress" parent="VBoxContainer/GradientOptions/CenterContainer" index="0"] unique_name_in_owner = true margin_right = 75.0 margin_bottom = 24.0 @@ -214,7 +191,7 @@ script = ExtResource( 4 ) prefix = "X:" suffix = "%" -[node name="YCenterSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer/CenterContainer"] +[node name="YCenterSlider" type="TextureProgress" parent="VBoxContainer/GradientOptions/CenterContainer" index="1"] unique_name_in_owner = true margin_left = 79.0 margin_right = 154.0 @@ -234,21 +211,21 @@ script = ExtResource( 4 ) prefix = "Y:" suffix = "%" -[node name="RadiusLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] +[node name="RadiusLabel" type="Label" parent="VBoxContainer/GradientOptions" index="14" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] visible = false margin_top = 193.0 margin_right = 160.0 margin_bottom = 207.0 text = "Radius:" -[node name="RadiusContainer" type="HBoxContainer" parent="VBoxContainer/OptionsContainer" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] +[node name="RadiusContainer" type="HBoxContainer" parent="VBoxContainer/GradientOptions" index="15" groups=["gradient_radial", "gradient_radial_dithering", "gradient_radial_step"]] visible = false margin_top = 60.0 margin_right = 154.0 margin_bottom = 84.0 size_flags_vertical = 3 -[node name="XRadiusSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer/RadiusContainer"] +[node name="XRadiusSlider" type="TextureProgress" parent="VBoxContainer/GradientOptions/RadiusContainer" index="0"] unique_name_in_owner = true margin_right = 75.0 margin_bottom = 24.0 @@ -268,7 +245,7 @@ stretch_margin_bottom = 3 script = ExtResource( 4 ) prefix = "X:" -[node name="YRadiusSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer/RadiusContainer"] +[node name="YRadiusSlider" type="TextureProgress" parent="VBoxContainer/GradientOptions/RadiusContainer" index="1"] unique_name_in_owner = true margin_left = 79.0 margin_right = 154.0 @@ -289,32 +266,39 @@ stretch_margin_bottom = 3 script = ExtResource( 4 ) prefix = "Y:" -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] -margin_top = 126.0 -margin_right = 160.0 -margin_bottom = 150.0 -mouse_default_cursor_shape = 2 -pressed = true -text = "Only affect selection" +[node name="OptionsContainer" parent="VBoxContainer" index="3"] +margin_top = 412.0 +margin_right = 278.0 +margin_bottom = 436.0 -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] -margin_left = 164.0 -margin_top = 126.0 -margin_right = 318.0 -margin_bottom = 150.0 -mouse_default_cursor_shape = 2 -text = "Selected cels" +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +margin_right = 278.0 items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 + +[node name="AnimationOptions" parent="VBoxContainer" index="4"] +visible = false +margin_top = 440.0 +margin_right = 278.0 +margin_bottom = 474.0 + +[node name="PanelContainer" parent="VBoxContainer/AnimationOptions" index="1"] +margin_right = 157.0 + +[node name="AnimateMenu" parent="VBoxContainer/AnimationOptions/PanelContainer" index="0"] +margin_right = 88.0 + +[node name="InitalButton" parent="VBoxContainer/AnimationOptions" index="2"] +margin_left = 161.0 +margin_right = 278.0 [connection signal="updated" from="VBoxContainer/GradientEdit" to="." method="_on_GradientEdit_updated"] -[connection signal="item_selected" from="VBoxContainer/OptionsContainer/ShapeOptionButton" to="." method="_on_ShapeOptionButton_item_selected"] -[connection signal="item_selected" from="VBoxContainer/OptionsContainer/DitheringOptionButton" to="." method="_on_DitheringOptionButton_item_selected"] -[connection signal="item_selected" from="VBoxContainer/OptionsContainer/RepeatOptionButton" to="." method="_on_RepeatOptionButton_item_selected"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/PositionSlider" to="." method="_value_changed"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/SizeSlider" to="." method="_value_changed"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/AngleSlider" to="." method="_value_changed"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/CenterContainer/XCenterSlider" to="." method="_value_changed"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/CenterContainer/YCenterSlider" to="." method="_value_changed"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/RadiusContainer/XRadiusSlider" to="." method="_value_changed"] -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/RadiusContainer/YRadiusSlider" to="." method="_value_changed"] +[connection signal="item_selected" from="VBoxContainer/GradientOptions/ShapeOptionButton" to="." method="_on_ShapeOptionButton_item_selected"] +[connection signal="item_selected" from="VBoxContainer/GradientOptions/DitheringOptionButton" to="." method="_on_DitheringOptionButton_item_selected"] +[connection signal="item_selected" from="VBoxContainer/GradientOptions/RepeatOptionButton" to="." method="_on_RepeatOptionButton_item_selected"] +[connection signal="value_changed" from="VBoxContainer/GradientOptions/PositionSlider" to="." method="_value_changed"] +[connection signal="value_changed" from="VBoxContainer/GradientOptions/SizeSlider" to="." method="_value_changed"] +[connection signal="value_changed" from="VBoxContainer/GradientOptions/AngleSlider" to="." method="_value_changed"] +[connection signal="value_changed" from="VBoxContainer/GradientOptions/CenterContainer/XCenterSlider" to="." method="_value_changed"] +[connection signal="value_changed" from="VBoxContainer/GradientOptions/CenterContainer/YCenterSlider" to="." method="_value_changed"] +[connection signal="value_changed" from="VBoxContainer/GradientOptions/RadiusContainer/XRadiusSlider" to="." method="_value_changed"] +[connection signal="value_changed" from="VBoxContainer/GradientOptions/RadiusContainer/YRadiusSlider" to="." method="_value_changed"] diff --git a/src/UI/Dialogs/ImageEffects/GradientMapDialog.tscn b/src/UI/Dialogs/ImageEffects/GradientMapDialog.tscn index 9c81a076e..f2379d466 100644 --- a/src/UI/Dialogs/ImageEffects/GradientMapDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/GradientMapDialog.tscn @@ -1,78 +1,25 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=1] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=1] [ext_resource path="res://src/UI/Nodes/GradientEdit.tscn" type="PackedScene" id=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/GradientMapDialog.gd" type="Script" id=3] -[node name="GradientMapDialog" type="ConfirmationDialog"] -margin_right = 200.0 -margin_bottom = 70.0 +[node name="GradientMapDialog" instance=ExtResource( 1 )] window_title = "Gradient Map" -resizable = true script = ExtResource( 3 ) -[node name="VBoxContainer" type="VBoxContainer" parent="."] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 8.0 -margin_top = 8.0 -margin_right = -8.0 -margin_bottom = -36.0 -__meta__ = { -"_edit_use_anchors_": false -} +[node name="VBoxContainer" parent="." index="3"] +margin_bottom = 318.0 -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 278.0 -margin_bottom = 200.0 -size_flags_vertical = 3 - -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 39.0 -margin_right = 239.0 -margin_bottom = 200.0 -rect_min_size = Vector2( 200, 200 ) -size_flags_horizontal = 5 -size_flags_vertical = 3 -expand = true -stretch_mode = 5 - -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 1 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="GradientEdit" parent="VBoxContainer" instance=ExtResource( 2 )] +[node name="GradientEdit" parent="VBoxContainer" index="1" instance=ExtResource( 2 )] anchor_right = 0.0 anchor_bottom = 0.0 margin_top = 204.0 margin_right = 278.0 margin_bottom = 282.0 -[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] -margin_top = 286.0 -margin_right = 278.0 -margin_bottom = 310.0 -columns = 2 - -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] -margin_right = 160.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" - -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]] -margin_left = 164.0 -margin_right = 278.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 -[connection signal="updated" from="VBoxContainer/GradientEdit" to="." method="_on_GradientEdit_updated"] +[node name="AnimationOptions" parent="VBoxContainer" index="3"] +visible = false diff --git a/src/UI/Dialogs/ImageEffects/HSVDialog.gd b/src/UI/Dialogs/ImageEffects/HSVDialog.gd index 5be0d08ef..f3dd549ba 100644 --- a/src/UI/Dialogs/ImageEffects/HSVDialog.gd +++ b/src/UI/Dialogs/ImageEffects/HSVDialog.gd @@ -2,13 +2,10 @@ extends ImageEffect enum Animate { HUE, SATURATION, VALUE } var shader: Shader = preload("res://src/Shaders/HSV.shader") -var live_preview := true -onready var hue_slider: ValueSlider = $VBoxContainer/HueSlider -onready var sat_slider: ValueSlider = $VBoxContainer/SaturationSlider -onready var val_slider: ValueSlider = $VBoxContainer/ValueSlider -onready var wait_apply_timer: Timer = $WaitApply -onready var wait_time_slider: ValueSlider = $VBoxContainer/WaitTime +onready var hue_slider := $VBoxContainer/HueSlider as ValueSlider +onready var sat_slider := $VBoxContainer/SaturationSlider as ValueSlider +onready var val_slider := $VBoxContainer/ValueSlider as ValueSlider func _ready() -> void: @@ -24,8 +21,8 @@ func _about_to_show() -> void: func set_nodes() -> void: preview = $VBoxContainer/AspectRatioContainer/Preview - selection_checkbox = $VBoxContainer/AffectHBoxContainer/SelectionCheckBox - affect_option_button = $VBoxContainer/AffectHBoxContainer/AffectOptionButton + selection_checkbox = $VBoxContainer/OptionsContainer/SelectionCheckBox + affect_option_button = $VBoxContainer/OptionsContainer/AffectOptionButton animate_options_container = $VBoxContainer/AnimationOptions animate_menu = $"%AnimateMenu".get_popup() initial_button = $"%InitalButton" @@ -72,7 +69,6 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi func _reset() -> void: - wait_apply_timer.wait_time = wait_time_slider.value / 1000.0 hue_slider.value = 0 sat_slider.value = 0 val_slider.value = 0 @@ -80,35 +76,12 @@ func _reset() -> void: func _on_HueSlider_value_changed(_value: float) -> void: - if live_preview: - update_preview() - else: - wait_apply_timer.start() - - -func _on_SaturationSlider_value_changed(_value: float) -> void: - if live_preview: - update_preview() - else: - wait_apply_timer.start() - - -func _on_ValueSlider_value_changed(_value: float) -> void: - if live_preview: - update_preview() - else: - wait_apply_timer.start() - - -func _on_WaitApply_timeout() -> void: update_preview() -func _on_WaitTime_value_changed(value: float) -> void: - wait_apply_timer.wait_time = value / 1000.0 +func _on_SaturationSlider_value_changed(_value: float) -> void: + update_preview() -func _on_LiveCheckbox_toggled(button_pressed: bool) -> void: - live_preview = button_pressed - wait_time_slider.editable = !live_preview - wait_time_slider.visible = !live_preview +func _on_ValueSlider_value_changed(_value: float) -> void: + update_preview() diff --git a/src/UI/Dialogs/ImageEffects/HSVDialog.tscn b/src/UI/Dialogs/ImageEffects/HSVDialog.tscn index d8ae7b898..f6b4db507 100644 --- a/src/UI/Dialogs/ImageEffects/HSVDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/HSVDialog.tscn @@ -1,75 +1,17 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/HSVDialog.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=2] [ext_resource path="res://src/UI/Nodes/ValueSlider.tscn" type="PackedScene" id=3] -[node name="HSVDialog" type="ConfirmationDialog"] -margin_left = 1.0 -margin_top = -1.0 -margin_right = 349.0 -margin_bottom = 415.0 -rect_min_size = Vector2( 348, 416 ) +[node name="HSVDialog" instance=ExtResource( 2 )] window_title = "Adjust HSV" -resizable = true script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 340.0 -margin_bottom = 380.0 +[node name="VBoxContainer" parent="." index="3"] +margin_bottom = 344.0 -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 332.0 -margin_bottom = 200.0 -size_flags_vertical = 3 - -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 66.0 -margin_right = 266.0 -margin_bottom = 200.0 -rect_min_size = Vector2( 200, 200 ) -expand = true -stretch_mode = 5 - -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="LiveSettings" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 204.0 -margin_right = 332.0 -margin_bottom = 228.0 -alignment = 1 - -[node name="LiveCheckbox" type="CheckBox" parent="VBoxContainer/LiveSettings"] -margin_left = 112.0 -margin_right = 220.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -pressed = true -text = "Live Preview" - -[node name="WaitTime" parent="VBoxContainer" instance=ExtResource( 3 )] -visible = false -margin_top = 236.0 -margin_right = 332.0 -margin_bottom = 260.0 -min_value = 1.0 -max_value = 1000.0 -value = 200.0 -editable = false -prefix = "Preview delay:" -suffix = "ms" - -[node name="HueSlider" parent="VBoxContainer" instance=ExtResource( 3 )] +[node name="HueSlider" parent="VBoxContainer" index="1" instance=ExtResource( 3 )] margin_top = 232.0 margin_right = 332.0 margin_bottom = 256.0 @@ -77,84 +19,23 @@ min_value = -180.0 max_value = 180.0 prefix = "Hue:" -[node name="SaturationSlider" parent="VBoxContainer" instance=ExtResource( 3 )] +[node name="SaturationSlider" parent="VBoxContainer" index="2" instance=ExtResource( 3 )] margin_top = 260.0 margin_right = 332.0 margin_bottom = 284.0 min_value = -100.0 prefix = "Saturation:" -[node name="ValueSlider" parent="VBoxContainer" instance=ExtResource( 3 )] +[node name="ValueSlider" parent="VBoxContainer" index="3" instance=ExtResource( 3 )] margin_top = 288.0 margin_right = 332.0 margin_bottom = 312.0 min_value = -100.0 prefix = "Value:" -[node name="AffectHBoxContainer" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 316.0 -margin_right = 332.0 -margin_bottom = 340.0 - -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/AffectHBoxContainer"] -margin_right = 164.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" - -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/AffectHBoxContainer"] -margin_left = 168.0 -margin_right = 332.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 -[node name="AnimationOptions" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 388.0 -margin_right = 326.0 -margin_bottom = 422.0 - -[node name="Label" type="Label" parent="VBoxContainer/AnimationOptions"] -margin_top = 10.0 -margin_right = 62.0 -margin_bottom = 24.0 -text = "Animate :" - -[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/AnimationOptions"] -margin_left = 66.0 -margin_right = 205.0 -margin_bottom = 34.0 -size_flags_horizontal = 3 - -[node name="AnimateMenu" type="MenuButton" parent="VBoxContainer/AnimationOptions/PanelContainer"] -unique_name_in_owner = true -margin_left = 7.0 -margin_top = 7.0 -margin_right = 132.0 -margin_bottom = 27.0 -focus_mode = 2 -text = "Properties" -flat = false - -[node name="InitalButton" type="Button" parent="VBoxContainer/AnimationOptions"] -unique_name_in_owner = true -margin_left = 209.0 -margin_right = 326.0 -margin_bottom = 34.0 -text = "Set initial values" - -[node name="WaitApply" type="Timer" parent="."] -wait_time = 0.1 -one_shot = true - -[connection signal="toggled" from="VBoxContainer/LiveSettings/LiveCheckbox" to="." method="_on_LiveCheckbox_toggled"] -[connection signal="value_changed" from="VBoxContainer/WaitTime" to="." method="_on_WaitTime_value_changed"] [connection signal="value_changed" from="VBoxContainer/HueSlider" to="." method="_on_HueSlider_value_changed"] [connection signal="value_changed" from="VBoxContainer/SaturationSlider" to="." method="_on_SaturationSlider_value_changed"] [connection signal="value_changed" from="VBoxContainer/ValueSlider" to="." method="_on_ValueSlider_value_changed"] -[connection signal="timeout" from="WaitApply" to="." method="_on_WaitApply_timeout"] diff --git a/src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn b/src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn new file mode 100644 index 000000000..f0e89958c --- /dev/null +++ b/src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn @@ -0,0 +1,95 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] + +[node name="ImageEffectParent" type="ConfirmationDialog"] +margin_right = 294.0 +margin_bottom = 296.0 +rect_min_size = Vector2( 172, 60.2 ) +resizable = true + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +margin_left = 8.0 +margin_top = 8.0 +margin_right = 286.0 +margin_bottom = 260.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] +margin_right = 279.0 +margin_bottom = 200.0 +size_flags_vertical = 3 + +[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] +margin_left = 39.5 +margin_right = 239.5 +margin_bottom = 200.0 +rect_min_size = Vector2( 200, 200 ) +expand = true +stretch_mode = 5 + +[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] +show_behind_parent = true +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = 0.0 +margin_bottom = 0.0 + +[node name="OptionsContainer" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 204.0 +margin_right = 279.0 +margin_bottom = 228.0 + +[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] +margin_right = 160.0 +margin_bottom = 24.0 +mouse_default_cursor_shape = 2 +size_flags_horizontal = 3 +pressed = true +text = "Only affect selection" + +[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] +margin_left = 164.0 +margin_right = 279.0 +margin_bottom = 24.0 +mouse_default_cursor_shape = 2 +size_flags_horizontal = 3 +text = "Selected cels" +items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] +selected = 0 + +[node name="AnimationOptions" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 232.0 +margin_right = 279.0 +margin_bottom = 266.0 + +[node name="Label" type="Label" parent="VBoxContainer/AnimationOptions"] +margin_top = 10.0 +margin_right = 58.0 +margin_bottom = 24.0 +text = "Animate:" + +[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/AnimationOptions"] +margin_left = 62.0 +margin_right = 158.0 +margin_bottom = 34.0 +size_flags_horizontal = 3 + +[node name="AnimateMenu" type="MenuButton" parent="VBoxContainer/AnimationOptions/PanelContainer"] +unique_name_in_owner = true +margin_left = 7.0 +margin_top = 7.0 +margin_right = 89.0 +margin_bottom = 27.0 +focus_mode = 2 +text = "Properties" +flat = false + +[node name="InitalButton" type="Button" parent="VBoxContainer/AnimationOptions"] +unique_name_in_owner = true +margin_left = 162.0 +margin_right = 279.0 +margin_bottom = 34.0 +text = "Set initial values" diff --git a/src/UI/Dialogs/ImageEffects/InvertColorsDialog.tscn b/src/UI/Dialogs/ImageEffects/InvertColorsDialog.tscn index df1158e0d..5063d75df 100644 --- a/src/UI/Dialogs/ImageEffects/InvertColorsDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/InvertColorsDialog.tscn @@ -1,55 +1,26 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/InvertColorsDialog.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=2] -[node name="InvertColorsDialog" type="ConfirmationDialog"] -margin_right = 294.0 -margin_bottom = 296.0 -rect_min_size = Vector2( 172, 60.2 ) +[node name="InvertColorsDialog" instance=ExtResource( 2 )] window_title = "Invert Colors" -resizable = true script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 286.0 -margin_bottom = 260.0 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] +[node name="AspectRatioContainer" parent="VBoxContainer" index="0"] margin_right = 278.0 -margin_bottom = 200.0 -size_flags_vertical = 3 -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] +[node name="Preview" parent="VBoxContainer/AspectRatioContainer" index="0"] margin_left = 39.0 margin_right = 239.0 -margin_bottom = 200.0 -rect_min_size = Vector2( 200, 200 ) -expand = true -stretch_mode = 5 -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="RGBAContainer" type="HBoxContainer" parent="VBoxContainer"] +[node name="RGBAContainer" type="HBoxContainer" parent="VBoxContainer" index="1"] margin_top = 204.0 margin_right = 278.0 margin_bottom = 224.0 alignment = 1 -[node name="RButton" type="Button" parent="VBoxContainer/RGBAContainer"] +[node name="RButton" type="Button" parent="VBoxContainer/RGBAContainer" index="0"] margin_right = 66.0 margin_bottom = 20.0 hint_tooltip = "Modify Red Channel" @@ -59,7 +30,7 @@ toggle_mode = true pressed = true text = "R" -[node name="GButton" type="Button" parent="VBoxContainer/RGBAContainer"] +[node name="GButton" type="Button" parent="VBoxContainer/RGBAContainer" index="1"] margin_left = 70.0 margin_right = 137.0 margin_bottom = 20.0 @@ -70,7 +41,7 @@ toggle_mode = true pressed = true text = "G" -[node name="BButton" type="Button" parent="VBoxContainer/RGBAContainer"] +[node name="BButton" type="Button" parent="VBoxContainer/RGBAContainer" index="2"] margin_left = 141.0 margin_right = 207.0 margin_bottom = 20.0 @@ -81,7 +52,7 @@ toggle_mode = true pressed = true text = "B" -[node name="AButton" type="Button" parent="VBoxContainer/RGBAContainer"] +[node name="AButton" type="Button" parent="VBoxContainer/RGBAContainer" index="3"] margin_left = 211.0 margin_right = 278.0 margin_bottom = 20.0 @@ -91,28 +62,29 @@ size_flags_horizontal = 3 toggle_mode = true text = "A" -[node name="OptionsContainer" type="HBoxContainer" parent="VBoxContainer"] +[node name="OptionsContainer" parent="VBoxContainer" index="2"] margin_top = 228.0 margin_right = 278.0 margin_bottom = 252.0 -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_right = 160.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" - -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 164.0 +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +margin_right = 278.0 + +[node name="AnimationOptions" parent="VBoxContainer" index="3"] +visible = false +margin_top = 256.0 +margin_right = 278.0 +margin_bottom = 290.0 + +[node name="PanelContainer" parent="VBoxContainer/AnimationOptions" index="1"] +margin_right = 157.0 + +[node name="AnimateMenu" parent="VBoxContainer/AnimationOptions/PanelContainer" index="0"] +margin_right = 88.0 + +[node name="InitalButton" parent="VBoxContainer/AnimationOptions" index="2"] +margin_left = 161.0 margin_right = 278.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" -items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 [connection signal="toggled" from="VBoxContainer/RGBAContainer/RButton" to="." method="_on_RButton_toggled"] [connection signal="toggled" from="VBoxContainer/RGBAContainer/GButton" to="." method="_on_GButton_toggled"] diff --git a/src/UI/Dialogs/ImageEffects/OutlineDialog.gd b/src/UI/Dialogs/ImageEffects/OutlineDialog.gd index b3e04352f..bfd7b81e8 100644 --- a/src/UI/Dialogs/ImageEffects/OutlineDialog.gd +++ b/src/UI/Dialogs/ImageEffects/OutlineDialog.gd @@ -1,13 +1,13 @@ extends ImageEffect enum Animate { THICKNESS } -var color := Color.red +var color := Color.black var thickness := 1 var pattern := 0 var inside_image := false var shader: Shader -onready var outline_color = $VBoxContainer/OptionsContainer/OutlineColor +onready var outline_color := $VBoxContainer/OutlineOptions/OutlineColor as ColorPickerButton func _ready() -> void: diff --git a/src/UI/Dialogs/ImageEffects/OutlineDialog.tscn b/src/UI/Dialogs/ImageEffects/OutlineDialog.tscn index 82f222d14..9fdaa4e98 100644 --- a/src/UI/Dialogs/ImageEffects/OutlineDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/OutlineDialog.tscn @@ -1,49 +1,27 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/OutlineDialog.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/UI/Nodes/ValueSlider.gd" type="Script" id=2] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=3] -[node name="OutlineDialog" type="ConfirmationDialog"] -margin_right = 543.0 -margin_bottom = 511.0 -rect_min_size = Vector2( 172, 60.2 ) +[node name="OutlineDialog" instance=ExtResource( 3 )] window_title = "Outline" -resizable = true script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 8.0 -margin_top = 8.0 -margin_right = 535.0 -margin_bottom = 475.0 +[node name="VBoxContainer" parent="." index="3"] +margin_bottom = 354.0 -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 527.0 -margin_bottom = 301.0 -size_flags_vertical = 3 +[node name="AspectRatioContainer" parent="VBoxContainer" index="0"] +margin_right = 278.0 -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 113.0 -margin_right = 414.0 -margin_bottom = 301.0 -rect_min_size = Vector2( 200, 200 ) -expand = true -stretch_mode = 5 +[node name="Preview" parent="VBoxContainer/AspectRatioContainer" index="0"] +margin_left = 39.0 +margin_right = 239.0 -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"] -margin_top = 305.0 -margin_right = 527.0 -margin_bottom = 429.0 +[node name="OutlineOptions" type="GridContainer" parent="VBoxContainer" index="1"] +margin_top = 204.0 +margin_right = 278.0 +margin_bottom = 294.0 custom_constants/vseparation = 4 custom_constants/hseparation = 4 columns = 2 @@ -51,121 +29,103 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="ThickLabel" type="Label" parent="VBoxContainer/OptionsContainer"] -margin_top = 5.0 -margin_right = 262.0 -margin_bottom = 19.0 +[node name="ThickLabel" type="Label" parent="VBoxContainer/OutlineOptions" index="0"] +margin_right = 137.0 +margin_bottom = 14.0 size_flags_horizontal = 3 text = "Thickness:" -[node name="ThickValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"] -margin_left = 266.0 -margin_right = 527.0 -margin_bottom = 24.0 +[node name="ThickValue" type="TextureProgress" parent="VBoxContainer/OutlineOptions" index="1"] +margin_left = 141.0 +margin_right = 278.0 +margin_bottom = 14.0 mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 +theme_type_variation = "ValueSlider" min_value = 1.0 -max_value = 16384.0 value = 1.0 +allow_greater = true +nine_patch_stretch = true +stretch_margin_left = 3 +stretch_margin_top = 3 +stretch_margin_right = 3 +stretch_margin_bottom = 3 +script = ExtResource( 2 ) suffix = "px" -[node name="OutlineColorLabel" type="Label" parent="VBoxContainer/OptionsContainer"] -margin_top = 31.0 -margin_right = 262.0 -margin_bottom = 45.0 +[node name="OutlineColorLabel" type="Label" parent="VBoxContainer/OutlineOptions" index="2"] +margin_top = 21.0 +margin_right = 137.0 +margin_bottom = 35.0 size_flags_horizontal = 3 text = "Fill with color:" -[node name="OutlineColor" type="ColorPickerButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 266.0 -margin_top = 28.0 -margin_right = 527.0 -margin_bottom = 48.0 +[node name="OutlineColor" type="ColorPickerButton" parent="VBoxContainer/OutlineOptions" index="3"] +margin_left = 141.0 +margin_top = 18.0 +margin_right = 278.0 +margin_bottom = 38.0 rect_min_size = Vector2( 64, 20 ) size_flags_horizontal = 3 -color = Color( 1, 0, 0, 1 ) -[node name="PatternLabel" type="Label" parent="VBoxContainer/OptionsContainer"] -margin_top = 55.0 -margin_right = 262.0 -margin_bottom = 69.0 +[node name="PatternLabel" type="Label" parent="VBoxContainer/OutlineOptions" index="4"] +margin_top = 45.0 +margin_right = 137.0 +margin_bottom = 59.0 size_flags_horizontal = 3 text = "Pattern:" -[node name="PatternOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 266.0 -margin_top = 52.0 -margin_right = 527.0 -margin_bottom = 72.0 +[node name="PatternOptionButton" type="OptionButton" parent="VBoxContainer/OutlineOptions" index="5"] +margin_left = 141.0 +margin_top = 42.0 +margin_right = 278.0 +margin_bottom = 62.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 text = "Diamond" items = [ "Diamond", null, false, 0, null, "Circle", null, false, 1, null, "Square", null, false, 2, null ] selected = 0 -[node name="InsideImageCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_top = 76.0 -margin_right = 262.0 -margin_bottom = 100.0 -mouse_default_cursor_shape = 2 +[node name="InsideImageLabel" type="Label" parent="VBoxContainer/OutlineOptions" index="6"] +margin_top = 71.0 +margin_right = 137.0 +margin_bottom = 85.0 size_flags_horizontal = 3 text = "Place inside image" -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_left = 266.0 -margin_top = 76.0 -margin_right = 527.0 -margin_bottom = 100.0 +[node name="InsideImageCheckBox" type="CheckBox" parent="VBoxContainer/OutlineOptions" index="7"] +margin_left = 141.0 +margin_top = 66.0 +margin_right = 278.0 +margin_bottom = 90.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" +text = "On" -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] -margin_top = 104.0 -margin_right = 262.0 -margin_bottom = 124.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" +[node name="OptionsContainer" parent="VBoxContainer" index="2"] +margin_top = 298.0 +margin_right = 278.0 +margin_bottom = 322.0 + +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +margin_right = 278.0 items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 -[node name="AnimationOptions" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 388.0 -margin_right = 326.0 -margin_bottom = 422.0 +[node name="AnimationOptions" parent="VBoxContainer" index="3"] +margin_top = 326.0 +margin_right = 278.0 +margin_bottom = 360.0 -[node name="Label" type="Label" parent="VBoxContainer/AnimationOptions"] -margin_top = 10.0 -margin_right = 62.0 -margin_bottom = 24.0 -text = "Animate :" +[node name="PanelContainer" parent="VBoxContainer/AnimationOptions" index="1"] +margin_right = 157.0 -[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/AnimationOptions"] -margin_left = 66.0 -margin_right = 205.0 -margin_bottom = 34.0 -size_flags_horizontal = 3 +[node name="AnimateMenu" parent="VBoxContainer/AnimationOptions/PanelContainer" index="0"] +margin_right = 88.0 -[node name="AnimateMenu" type="MenuButton" parent="VBoxContainer/AnimationOptions/PanelContainer"] -unique_name_in_owner = true -margin_left = 7.0 -margin_top = 7.0 -margin_right = 132.0 -margin_bottom = 27.0 -focus_mode = 2 -text = "Properties" -flat = false +[node name="InitalButton" parent="VBoxContainer/AnimationOptions" index="2"] +margin_left = 161.0 +margin_right = 278.0 -[node name="InitalButton" type="Button" parent="VBoxContainer/AnimationOptions"] -unique_name_in_owner = true -margin_left = 209.0 -margin_right = 326.0 -margin_bottom = 34.0 -text = "Set initial values" - -[connection signal="value_changed" from="VBoxContainer/OptionsContainer/ThickValue" to="." method="_on_ThickValue_value_changed"] -[connection signal="color_changed" from="VBoxContainer/OptionsContainer/OutlineColor" to="." method="_on_OutlineColor_color_changed"] -[connection signal="item_selected" from="VBoxContainer/OptionsContainer/PatternOptionButton" to="." method="_on_PatternOptionButton_item_selected"] -[connection signal="toggled" from="VBoxContainer/OptionsContainer/InsideImageCheckBox" to="." method="_on_InsideImageCheckBox_toggled"] +[connection signal="value_changed" from="VBoxContainer/OutlineOptions/ThickValue" to="." method="_on_ThickValue_value_changed"] +[connection signal="color_changed" from="VBoxContainer/OutlineOptions/OutlineColor" to="." method="_on_OutlineColor_color_changed"] +[connection signal="item_selected" from="VBoxContainer/OutlineOptions/PatternOptionButton" to="." method="_on_PatternOptionButton_item_selected"] +[connection signal="toggled" from="VBoxContainer/OutlineOptions/InsideImageCheckBox" to="." method="_on_InsideImageCheckBox_toggled"] diff --git a/src/UI/Dialogs/ImageEffects/RotateImage.gd b/src/UI/Dialogs/ImageEffects/RotateImage.gd index d9577b599..918de35e8 100644 --- a/src/UI/Dialogs/ImageEffects/RotateImage.gd +++ b/src/UI/Dialogs/ImageEffects/RotateImage.gd @@ -12,8 +12,7 @@ var drag_pivot := false onready var type_option_button: OptionButton = $VBoxContainer/HBoxContainer2/TypeOptionButton onready var pivot_indicator: Control = $VBoxContainer/AspectRatioContainer/Indicator -onready var x_pivot: ValueSlider = $VBoxContainer/PivotOptions/XPivot -onready var y_pivot: ValueSlider = $VBoxContainer/PivotOptions/YPivot +onready var pivot_sliders := $VBoxContainer/PivotOptions/Pivot as ValueSliderV2 onready var angle_slider: ValueSlider = $VBoxContainer/AngleSlider onready var smear_options: Container = $VBoxContainer/SmearOptions onready var init_angle_slider: ValueSlider = smear_options.get_node("InitialAngleSlider") @@ -98,8 +97,8 @@ func _calculate_pivot() -> void: if int(selection_rectangle.end.y - selection_rectangle.position.y) % 2 == 0: pivot.y -= 0.5 - x_pivot.value = pivot.x - y_pivot.value = pivot.y + pivot_sliders.value = pivot + _on_Pivot_value_changed(pivot) func commit_action(cel: Image, _project: Project = Global.current_project) -> void: @@ -298,11 +297,8 @@ func _on_Centre_pressed() -> void: _calculate_pivot() -func _on_Pivot_value_changed(value: float, is_x: bool) -> void: - if is_x: - pivot.x = value - else: - pivot.y = value +func _on_Pivot_value_changed(value: Vector2) -> void: + pivot = value # Refresh the indicator pivot_indicator.update() if angle_slider.value != 0: @@ -346,6 +342,5 @@ func _on_Indicator_gui_input(event: InputEvent) -> void: else: conversion_scale = ratio.y var new_pos := mouse_pos * conversion_scale - x_pivot.value = new_pos.x - y_pivot.value = new_pos.y - pivot_indicator.update() + pivot_sliders.value = new_pos + _on_Pivot_value_changed(new_pos) diff --git a/src/UI/Dialogs/ImageEffects/RotateImage.tscn b/src/UI/Dialogs/ImageEffects/RotateImage.tscn index 6218ba363..9c1f6307a 100644 --- a/src/UI/Dialogs/ImageEffects/RotateImage.tscn +++ b/src/UI/Dialogs/ImageEffects/RotateImage.tscn @@ -1,66 +1,47 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://src/UI/Dialogs/ImageEffects/RotateImage.gd" type="Script" id=1] -[ext_resource path="res://src/UI/Nodes/TransparentChecker.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/UI/Dialogs/ImageEffects/ImageEffectParent.tscn" type="PackedScene" id=2] [ext_resource path="res://src/UI/Nodes/ValueSlider.tscn" type="PackedScene" id=3] +[ext_resource path="res://src/UI/Nodes/ValueSliderV2.tscn" type="PackedScene" id=4] -[node name="RotateImage" type="ConfirmationDialog"] -margin_right = 342.0 -margin_bottom = 466.0 -rect_min_size = Vector2( 342, 450 ) +[node name="RotateImage" instance=ExtResource( 2 )] window_title = "Rotate Image" -resizable = true script = ExtResource( 1 ) -[node name="VBoxContainer" type="VBoxContainer" parent="."] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 8.0 -margin_top = 8.0 -margin_right = -8.0 -margin_bottom = -36.0 +[node name="VBoxContainer" parent="." index="3"] +margin_bottom = 458.0 -[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"] -margin_right = 326.0 -margin_bottom = 200.0 -size_flags_vertical = 3 +[node name="AspectRatioContainer" parent="VBoxContainer" index="0"] +margin_right = 278.0 +margin_bottom = 228.0 -[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 63.0 -margin_right = 263.0 -margin_bottom = 200.0 -rect_min_size = Vector2( 200, 200 ) -expand = true -stretch_mode = 5 +[node name="Preview" parent="VBoxContainer/AspectRatioContainer" index="0"] +margin_left = 25.0 +margin_right = 253.0 +margin_bottom = 228.0 -[node name="TransparentChecker" parent="VBoxContainer/AspectRatioContainer/Preview" instance=ExtResource( 2 )] -show_behind_parent = true -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_right = 0.0 -margin_bottom = 0.0 - -[node name="Indicator" type="Control" parent="VBoxContainer/AspectRatioContainer"] -margin_left = 63.0 -margin_right = 263.0 -margin_bottom = 200.0 +[node name="Indicator" type="Control" parent="VBoxContainer/AspectRatioContainer" index="1"] +margin_left = 25.0 +margin_right = 253.0 +margin_bottom = 228.0 mouse_default_cursor_shape = 2 -[node name="LiveSettings" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 204.0 -margin_right = 326.0 -margin_bottom = 228.0 +[node name="LiveSettings" type="HBoxContainer" parent="VBoxContainer" index="1"] +margin_top = 232.0 +margin_right = 278.0 +margin_bottom = 256.0 alignment = 1 -[node name="LiveCheckbox" type="CheckBox" parent="VBoxContainer/LiveSettings"] -margin_left = 109.0 -margin_right = 217.0 +[node name="LiveCheckbox" type="CheckBox" parent="VBoxContainer/LiveSettings" index="0"] +margin_left = 85.0 +margin_right = 193.0 margin_bottom = 24.0 mouse_default_cursor_shape = 2 pressed = true text = "Live Preview" -[node name="WaitTime" parent="VBoxContainer" instance=ExtResource( 3 )] +[node name="WaitTime" parent="VBoxContainer" index="2" instance=ExtResource( 3 )] visible = false margin_top = 232.0 margin_right = 326.0 @@ -72,134 +53,130 @@ editable = false prefix = "Preview delay:" suffix = "ms" -[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 232.0 -margin_right = 326.0 -margin_bottom = 252.0 +[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer" index="3"] +margin_top = 260.0 +margin_right = 278.0 +margin_bottom = 280.0 -[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"] +[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2" index="0"] margin_top = 3.0 margin_right = 34.0 margin_bottom = 17.0 text = "Type:" -[node name="TypeOptionButton" type="OptionButton" parent="VBoxContainer/HBoxContainer2"] +[node name="TypeOptionButton" type="OptionButton" parent="VBoxContainer/HBoxContainer2" index="1"] margin_left = 38.0 -margin_right = 326.0 +margin_right = 278.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] -margin_top = 256.0 -margin_right = 326.0 -margin_bottom = 260.0 - -[node name="PivotOptions" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 264.0 -margin_right = 326.0 +[node name="HSeparator" type="HSeparator" parent="VBoxContainer" index="4"] +margin_top = 284.0 +margin_right = 278.0 margin_bottom = 288.0 -[node name="XPivot" parent="VBoxContainer/PivotOptions" instance=ExtResource( 3 )] -margin_right = 132.0 +[node name="PivotOptions" type="HBoxContainer" parent="VBoxContainer" index="5"] +margin_top = 292.0 +margin_right = 278.0 +margin_bottom = 316.0 + +[node name="Pivot" parent="VBoxContainer/PivotOptions" index="0" instance=ExtResource( 4 )] +margin_right = 220.0 +margin_bottom = 24.0 +size_flags_horizontal = 3 step = 0.5 allow_greater = true allow_lesser = true -prefix = "Pivot x:" +grid_columns = 2 +prefix_x = "Pivot x:" +prefix_y = "Pivot y:" -[node name="YPivot" parent="VBoxContainer/PivotOptions" instance=ExtResource( 3 )] -margin_left = 136.0 -margin_right = 268.0 -step = 0.5 -allow_greater = true -allow_lesser = true -prefix = "Pivot y:" - -[node name="Centre" type="Button" parent="VBoxContainer/PivotOptions"] -margin_left = 272.0 -margin_right = 326.0 +[node name="Centre" type="Button" parent="VBoxContainer/PivotOptions" index="1"] +margin_left = 224.0 +margin_right = 278.0 margin_bottom = 24.0 hint_tooltip = "Places the pivot at the center of the image, or at the center of the selection, if it is present." mouse_default_cursor_shape = 2 text = "Center" -[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"] -margin_top = 292.0 -margin_right = 326.0 -margin_bottom = 296.0 - -[node name="AngleSlider" parent="VBoxContainer" instance=ExtResource( 3 )] -margin_top = 300.0 -margin_right = 326.0 +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer" index="6"] +margin_top = 320.0 +margin_right = 278.0 margin_bottom = 324.0 + +[node name="AngleSlider" parent="VBoxContainer" index="7" instance=ExtResource( 3 )] +margin_top = 328.0 +margin_right = 278.0 +margin_bottom = 352.0 max_value = 359.0 prefix = "Angle:" suffix = "°" snap_step = 45.0 -[node name="QuickRotations" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 328.0 -margin_right = 326.0 -margin_bottom = 348.0 +[node name="QuickRotations" type="HBoxContainer" parent="VBoxContainer" index="8"] +margin_top = 356.0 +margin_right = 278.0 +margin_bottom = 376.0 alignment = 1 -[node name="Deduct90" type="Button" parent="VBoxContainer/QuickRotations"] -margin_right = 62.0 +[node name="Deduct90" type="Button" parent="VBoxContainer/QuickRotations" index="0"] +margin_right = 52.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 text = "-90" -[node name="Deduct45" type="Button" parent="VBoxContainer/QuickRotations"] -margin_left = 66.0 -margin_right = 128.0 +[node name="Deduct45" type="Button" parent="VBoxContainer/QuickRotations" index="1"] +margin_left = 56.0 +margin_right = 108.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 text = "-45" -[node name="Zero" type="Button" parent="VBoxContainer/QuickRotations"] -margin_left = 132.0 -margin_right = 194.0 +[node name="Zero" type="Button" parent="VBoxContainer/QuickRotations" index="2"] +margin_left = 112.0 +margin_right = 165.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 text = "0" -[node name="Add45" type="Button" parent="VBoxContainer/QuickRotations"] -margin_left = 198.0 -margin_right = 260.0 +[node name="Add45" type="Button" parent="VBoxContainer/QuickRotations" index="3"] +margin_left = 169.0 +margin_right = 221.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 text = "+45" -[node name="Add90" type="Button" parent="VBoxContainer/QuickRotations"] -margin_left = 264.0 -margin_right = 326.0 +[node name="Add90" type="Button" parent="VBoxContainer/QuickRotations" index="4"] +margin_left = 225.0 +margin_right = 278.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 text = "+90" -[node name="SmearOptions" type="VBoxContainer" parent="VBoxContainer"] +[node name="SmearOptions" type="VBoxContainer" parent="VBoxContainer" index="9"] visible = false margin_top = 352.0 margin_right = 326.0 margin_bottom = 430.0 -[node name="HSeparator" type="HSeparator" parent="VBoxContainer/SmearOptions"] +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/SmearOptions" index="0"] margin_right = 326.0 margin_bottom = 4.0 -[node name="Label" type="Label" parent="VBoxContainer/SmearOptions"] +[node name="Label" type="Label" parent="VBoxContainer/SmearOptions" index="1"] margin_top = 8.0 margin_right = 326.0 margin_bottom = 22.0 text = "Smear options:" -[node name="ToleranceSlider" parent="VBoxContainer/SmearOptions" instance=ExtResource( 3 )] +[node name="ToleranceSlider" parent="VBoxContainer/SmearOptions" index="2" instance=ExtResource( 3 )] margin_top = 26.0 margin_right = 326.0 margin_bottom = 50.0 @@ -207,7 +184,7 @@ max_value = 255.0 value = 100.0 prefix = "Tolerance:" -[node name="InitialAngleSlider" parent="VBoxContainer/SmearOptions" instance=ExtResource( 3 )] +[node name="InitialAngleSlider" parent="VBoxContainer/SmearOptions" index="3" instance=ExtResource( 3 )] margin_top = 54.0 margin_right = 326.0 margin_bottom = 78.0 @@ -217,76 +194,43 @@ prefix = "Initial angle:" suffix = "°" snap_step = 45.0 -[node name="HSeparator3" type="HSeparator" parent="VBoxContainer"] -margin_top = 352.0 -margin_right = 326.0 -margin_bottom = 356.0 - -[node name="OptionsContainer" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 360.0 -margin_right = 326.0 +[node name="HSeparator3" type="HSeparator" parent="VBoxContainer" index="10"] +margin_top = 380.0 +margin_right = 278.0 margin_bottom = 384.0 -[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"] -margin_right = 161.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -pressed = true -text = "Only affect selection" - -[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"] -margin_left = 165.0 -margin_right = 326.0 -margin_bottom = 24.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 3 -text = "Selected cels" -items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -selected = 0 - -[node name="AnimationOptions" type="HBoxContainer" parent="VBoxContainer"] +[node name="OptionsContainer" parent="VBoxContainer" index="11"] margin_top = 388.0 -margin_right = 326.0 -margin_bottom = 422.0 +margin_right = 278.0 +margin_bottom = 412.0 -[node name="Label" type="Label" parent="VBoxContainer/AnimationOptions"] -margin_top = 10.0 -margin_right = 62.0 -margin_bottom = 24.0 -text = "Animate :" +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +margin_right = 278.0 +items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] -[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/AnimationOptions"] -margin_left = 66.0 -margin_right = 205.0 -margin_bottom = 34.0 -size_flags_horizontal = 3 +[node name="AnimationOptions" parent="VBoxContainer" index="12"] +margin_top = 416.0 +margin_right = 278.0 +margin_bottom = 450.0 -[node name="AnimateMenu" type="MenuButton" parent="VBoxContainer/AnimationOptions/PanelContainer"] -unique_name_in_owner = true -margin_left = 7.0 -margin_top = 7.0 -margin_right = 132.0 -margin_bottom = 27.0 -text = "Properties" -flat = false +[node name="PanelContainer" parent="VBoxContainer/AnimationOptions" index="1"] +margin_right = 157.0 -[node name="InitalButton" type="Button" parent="VBoxContainer/AnimationOptions"] -unique_name_in_owner = true -margin_left = 209.0 -margin_right = 326.0 -margin_bottom = 34.0 -text = "Set initial values" +[node name="AnimateMenu" parent="VBoxContainer/AnimationOptions/PanelContainer" index="0"] +margin_right = 88.0 -[node name="WaitApply" type="Timer" parent="."] +[node name="InitalButton" parent="VBoxContainer/AnimationOptions" index="2"] +margin_left = 161.0 +margin_right = 278.0 + +[node name="WaitApply" type="Timer" parent="." index="4"] [connection signal="draw" from="VBoxContainer/AspectRatioContainer/Indicator" to="." method="_on_Indicator_draw"] [connection signal="gui_input" from="VBoxContainer/AspectRatioContainer/Indicator" to="." method="_on_Indicator_gui_input"] [connection signal="toggled" from="VBoxContainer/LiveSettings/LiveCheckbox" to="." method="_on_LiveCheckbox_toggled"] [connection signal="value_changed" from="VBoxContainer/WaitTime" to="." method="_on_WaitTime_value_changed"] [connection signal="item_selected" from="VBoxContainer/HBoxContainer2/TypeOptionButton" to="." method="_on_TypeOptionButton_item_selected"] -[connection signal="value_changed" from="VBoxContainer/PivotOptions/XPivot" to="." method="_on_Pivot_value_changed" binds= [ true ]] -[connection signal="value_changed" from="VBoxContainer/PivotOptions/YPivot" to="." method="_on_Pivot_value_changed" binds= [ false ]] +[connection signal="value_changed" from="VBoxContainer/PivotOptions/Pivot" to="." method="_on_Pivot_value_changed"] [connection signal="pressed" from="VBoxContainer/PivotOptions/Centre" to="." method="_on_Centre_pressed"] [connection signal="value_changed" from="VBoxContainer/AngleSlider" to="." method="_on_AngleSlider_value_changed"] [connection signal="pressed" from="VBoxContainer/QuickRotations/Deduct90" to="." method="_on_quick_change_angle_pressed" binds= [ -90 ]] diff --git a/src/UI/Nodes/ValueSlider.gd b/src/UI/Nodes/ValueSlider.gd index f2320a0d6..21b64ce21 100644 --- a/src/UI/Nodes/ValueSlider.gd +++ b/src/UI/Nodes/ValueSlider.gd @@ -266,7 +266,7 @@ func _reset_display(theme_changed := false) -> void: tint_progress = Color.transparent _line_edit.text = str(tr(prefix), " ", value, " ", tr(suffix)).strip_edges() var line_edit_color := _line_edit.get_color("font_color") - var line_edit_disabled_col: Color = get_color("read_only", "LineEdit") + var line_edit_disabled_col := get_color("read_only", "LineEdit") if editable: _line_edit.add_color_override("font_color_uneditable", line_edit_color) else: