1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-12 16:53:07 +00:00
Pixelorama/src/UI/Dialogs/ImageEffects/GradientDialog.tscn
Emmanouil Papadeas 201992fa72 Add multi-color support for gradients, remove step gradients
Gradients are no longer limited to two colors, but can now instead have as many as we want, with each color having its own offset. Step gradients have now been removed; to generate the same effect, you can now generate a linear gradient with constant interpolation. Cubic interpolation in gradients is now also possible.

The dithering shaders were by far the biggest challenge and they had to be re-written in order for them to support multiple colors, with each one having a difference offset. I have noticed that some colors may disappear when Constant interpolation is used, though, so it can be buggy sometimes. Thanks to https://godotshaders.com/shader/dither-gradient-shader/ for the reference.

ValueSliders are now also used in the gradient window.
2023-01-27 04:23:48 +02:00

280 lines
9.3 KiB
Plaintext

[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/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 )
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="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"]
margin_right = 318.0
margin_bottom = 230.0
size_flags_vertical = 3
[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"]
margin_left = 44.0
margin_right = 274.0
margin_bottom = 230.0
size_flags_horizontal = 5
size_flags_vertical = 3
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="GradientEdit" parent="VBoxContainer" instance=ExtResource( 3 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 234.0
margin_right = 318.0
margin_bottom = 312.0
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
margin_top = 316.0
margin_right = 318.0
margin_bottom = 400.0
columns = 2
[node name="TypeLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]]
margin_top = 3.0
margin_right = 160.0
margin_bottom = 17.0
size_flags_horizontal = 3
text = "Type:"
[node name="TypeOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]]
margin_left = 164.0
margin_right = 318.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
text = "Linear"
items = [ "Linear", null, false, 0, null, "Radial", null, false, 1, null, "Linear Dithering", null, false, 4, null, "Radial Dithering", null, false, 5, null ]
selected = 0
[node name="ColorsLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]]
visible = false
margin_top = 3.0
margin_right = 160.0
margin_bottom = 17.0
text = "Colors:"
[node name="PositionLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear", "gradient_step"]]
margin_top = 24.0
margin_right = 160.0
margin_bottom = 38.0
text = "Position:"
[node name="PositionSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear"]]
unique_name_in_owner = true
margin_left = 164.0
margin_top = 24.0
margin_right = 318.0
margin_bottom = 38.0
mouse_default_cursor_shape = 2
theme_type_variation = "ValueSlider"
value = 50.0
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource( 4 )
suffix = "%"
[node name="AngleLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear", "gradient_step"]]
margin_top = 42.0
margin_right = 160.0
margin_bottom = 56.0
text = "Angle:"
[node name="AngleSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_linear"]]
unique_name_in_owner = true
margin_left = 164.0
margin_top = 42.0
margin_right = 318.0
margin_bottom = 56.0
mouse_default_cursor_shape = 2
theme_type_variation = "ValueSlider"
max_value = 360.0
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
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"]]
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"]]
visible = false
margin_top = 60.0
margin_right = 154.0
margin_bottom = 84.0
[node name="XCenterSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer/CenterContainer"]
unique_name_in_owner = true
margin_right = 75.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
theme_type_variation = "ValueSlider"
value = 50.0
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource( 4 )
prefix = "X:"
suffix = "%"
[node name="YCenterSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer/CenterContainer"]
unique_name_in_owner = true
margin_left = 79.0
margin_right = 154.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
theme_type_variation = "ValueSlider"
value = 50.0
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource( 4 )
prefix = "Y:"
suffix = "%"
[node name="RadiusLabel" type="Label" parent="VBoxContainer/OptionsContainer" 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"]]
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"]
unique_name_in_owner = true
margin_right = 75.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
theme_type_variation = "ValueSlider"
min_value = 0.01
max_value = 10.0
step = 0.01
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( 4 )
prefix = "X:"
[node name="YRadiusSlider" type="TextureProgress" parent="VBoxContainer/OptionsContainer/RadiusContainer"]
unique_name_in_owner = true
margin_left = 79.0
margin_right = 154.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
theme_type_variation = "ValueSlider"
min_value = 0.01
max_value = 10.0
step = 0.01
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( 4 )
prefix = "Y:"
[node name="DitheringLabel" type="Label" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_radial_dithering"]]
visible = false
margin_top = 89.0
margin_right = 114.0
margin_bottom = 103.0
text = "Dithering pattern:"
[node name="DitheringOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_dithering", "gradient_radial_dithering"]]
visible = false
margin_left = 164.0
margin_top = 84.0
margin_right = 278.0
margin_bottom = 104.0
mouse_default_cursor_shape = 2
text = "Bayer 2x2"
[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]]
margin_top = 60.0
margin_right = 160.0
margin_bottom = 84.0
mouse_default_cursor_shape = 2
pressed = true
text = "Only affect selection"
[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer" groups=["gradient_common"]]
margin_left = 164.0
margin_top = 60.0
margin_right = 318.0
margin_bottom = 84.0
mouse_default_cursor_shape = 2
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="updated" from="VBoxContainer/GradientEdit" to="." method="_on_GradientEdit_updated"]
[connection signal="item_selected" from="VBoxContainer/OptionsContainer/TypeOptionButton" to="." method="_on_TypeOptionButton_item_selected"]
[connection signal="value_changed" from="VBoxContainer/OptionsContainer/PositionSlider" 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/OptionsContainer/DitheringOptionButton" to="." method="_on_DitheringOptionButton_item_selected"]