From fef8f02fb4d1140c8d1f7ae8dded1f29625defce Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Wed, 4 Oct 2023 18:19:28 +0300 Subject: [PATCH] Change color spaces in gradients --- Translations/Translations.pot | 8 ++++++++ src/UI/Nodes/GradientEdit.gd | 4 ++++ src/UI/Nodes/GradientEdit.tscn | 30 ++++++++++++++++++++++++++---- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Translations/Translations.pot b/Translations/Translations.pot index e9040d48f..c0eb0b6b2 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -615,6 +615,14 @@ msgstr "" msgid "Constant" msgstr "" +#. Refers to https://en.wikipedia.org/wiki/Color_space +msgid "Color space:" +msgstr "" + +#. A type of color space. +msgid "Linear sRGB" +msgstr "" + msgid "General" msgstr "" diff --git a/src/UI/Nodes/GradientEdit.gd b/src/UI/Nodes/GradientEdit.gd index da1ab9d8a..73d7405ba 100644 --- a/src/UI/Nodes/GradientEdit.gd +++ b/src/UI/Nodes/GradientEdit.gd @@ -178,6 +178,10 @@ func _on_InterpolationOptionButton_item_selected(index: Gradient.InterpolationMo gradient.interpolation_mode = index +func _on_color_space_option_button_item_selected(index: Gradient.ColorSpace) -> void: + gradient.interpolation_color_space = index + + func _on_DivideButton_pressed() -> void: divide_dialog.popup_centered() diff --git a/src/UI/Nodes/GradientEdit.tscn b/src/UI/Nodes/GradientEdit.tscn index fd05faef8..f0dc71822 100644 --- a/src/UI/Nodes/GradientEdit.tscn +++ b/src/UI/Nodes/GradientEdit.tscn @@ -34,10 +34,10 @@ offset_bottom = 7.0 [node name="Popup" type="PopupPanel" parent="."] [node name="ColorPicker" type="ColorPicker" parent="Popup"] -offset_left = 4.0 -offset_top = 4.0 -offset_right = 294.0 -offset_bottom = 572.0 +offset_left = 12.0 +offset_top = 8.0 +offset_right = 298.0 +offset_bottom = 576.0 [node name="InterpolationContainer" type="HBoxContainer" parent="."] layout_mode = 2 @@ -60,6 +60,27 @@ popup/item_1/id = 1 popup/item_2/text = "Cubic" popup/item_2/id = 2 +[node name="ColorSpaceContainer" type="HBoxContainer" parent="."] +layout_mode = 2 + +[node name="Label" type="Label" parent="ColorSpaceContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Color space:" + +[node name="ColorSpaceOptionButton" type="OptionButton" parent="ColorSpaceContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +mouse_default_cursor_shape = 2 +item_count = 3 +selected = 0 +popup/item_0/text = "sRGB" +popup/item_0/id = 0 +popup/item_1/text = "Linear sRGB" +popup/item_1/id = 1 +popup/item_2/text = "Oklab" +popup/item_2/id = 2 + [node name="DivideButton" type="Button" parent="."] layout_mode = 2 mouse_default_cursor_shape = 2 @@ -103,5 +124,6 @@ text = "Add point at the end" [connection signal="resized" from="." to="." method="_on_GradientEdit_resized"] [connection signal="color_changed" from="Popup/ColorPicker" to="." method="_on_ColorPicker_color_changed"] [connection signal="item_selected" from="InterpolationContainer/InterpolationOptionButton" to="." method="_on_InterpolationOptionButton_item_selected"] +[connection signal="item_selected" from="ColorSpaceContainer/ColorSpaceOptionButton" to="." method="_on_color_space_option_button_item_selected"] [connection signal="pressed" from="DivideButton" to="." method="_on_DivideButton_pressed"] [connection signal="confirmed" from="DivideConfirmationDialog" to="." method="_on_DivideConfirmationDialog_confirmed"]