mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Add ValueSliders to Rotate and HSV dialogs
This commit is contained in:
parent
0c954e65d8
commit
9230f35d89
|
@ -154,7 +154,10 @@ msgstr ""
|
|||
msgid "Rotate Image"
|
||||
msgstr ""
|
||||
|
||||
msgid "Pivot (x, y):"
|
||||
msgid "Pivot x:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Pivot y:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Smear options:"
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
extends ImageEffect
|
||||
|
||||
var shader: Shader = preload("res://src/Shaders/HSV.shader")
|
||||
var live_preview := true
|
||||
|
||||
var live_preview: bool = true
|
||||
|
||||
onready var hue_slider = $VBoxContainer/HBoxContainer/Sliders/Hue
|
||||
onready var sat_slider = $VBoxContainer/HBoxContainer/Sliders/Saturation
|
||||
onready var val_slider = $VBoxContainer/HBoxContainer/Sliders/Value
|
||||
|
||||
onready var hue_spinbox = $VBoxContainer/HBoxContainer/TextBoxes/Hue
|
||||
onready var sat_spinbox = $VBoxContainer/HBoxContainer/TextBoxes/Saturation
|
||||
onready var val_spinbox = $VBoxContainer/HBoxContainer/TextBoxes/Value
|
||||
onready var wait_apply_timer = $WaitApply
|
||||
onready var wait_time_spinbox = $VBoxContainer/WaitSettings/WaitTime
|
||||
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
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -22,7 +17,7 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _about_to_show() -> void:
|
||||
reset()
|
||||
_reset()
|
||||
._about_to_show()
|
||||
|
||||
|
||||
|
@ -54,58 +49,29 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi
|
|||
yield(gen, "done")
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
disconnect_signals()
|
||||
wait_apply_timer.wait_time = wait_time_spinbox.value / 1000.0
|
||||
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
|
||||
hue_spinbox.value = 0
|
||||
sat_spinbox.value = 0
|
||||
val_spinbox.value = 0
|
||||
reconnect_signals()
|
||||
confirmed = false
|
||||
|
||||
|
||||
func disconnect_signals() -> void:
|
||||
hue_slider.disconnect("value_changed", self, "_on_Hue_value_changed")
|
||||
sat_slider.disconnect("value_changed", self, "_on_Saturation_value_changed")
|
||||
val_slider.disconnect("value_changed", self, "_on_Value_value_changed")
|
||||
hue_spinbox.disconnect("value_changed", self, "_on_Hue_value_changed")
|
||||
sat_spinbox.disconnect("value_changed", self, "_on_Saturation_value_changed")
|
||||
val_spinbox.disconnect("value_changed", self, "_on_Value_value_changed")
|
||||
|
||||
|
||||
func reconnect_signals() -> void:
|
||||
hue_slider.connect("value_changed", self, "_on_Hue_value_changed")
|
||||
sat_slider.connect("value_changed", self, "_on_Saturation_value_changed")
|
||||
val_slider.connect("value_changed", self, "_on_Value_value_changed")
|
||||
hue_spinbox.connect("value_changed", self, "_on_Hue_value_changed")
|
||||
sat_spinbox.connect("value_changed", self, "_on_Saturation_value_changed")
|
||||
val_spinbox.connect("value_changed", self, "_on_Value_value_changed")
|
||||
|
||||
|
||||
func _on_Hue_value_changed(value: float) -> void:
|
||||
hue_spinbox.value = value
|
||||
hue_slider.value = value
|
||||
func _on_HueSlider_value_changed(_value: float) -> void:
|
||||
if live_preview:
|
||||
update_preview()
|
||||
else:
|
||||
wait_apply_timer.start()
|
||||
|
||||
|
||||
func _on_Saturation_value_changed(value: float) -> void:
|
||||
sat_spinbox.value = value
|
||||
sat_slider.value = value
|
||||
func _on_SaturationSlider_value_changed(_value: float) -> void:
|
||||
if live_preview:
|
||||
update_preview()
|
||||
else:
|
||||
wait_apply_timer.start()
|
||||
|
||||
|
||||
func _on_Value_value_changed(value: float) -> void:
|
||||
val_spinbox.value = value
|
||||
val_slider.value = value
|
||||
func _on_ValueSlider_value_changed(_value: float) -> void:
|
||||
if live_preview:
|
||||
update_preview()
|
||||
else:
|
||||
|
@ -122,5 +88,5 @@ func _on_WaitTime_value_changed(value: float) -> void:
|
|||
|
||||
func _on_LiveCheckbox_toggled(button_pressed: bool) -> void:
|
||||
live_preview = button_pressed
|
||||
wait_time_spinbox.editable = !live_preview
|
||||
wait_time_spinbox.get_parent().visible = !live_preview
|
||||
wait_time_slider.editable = !live_preview
|
||||
wait_time_slider.visible = !live_preview
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[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/TransparentChecker.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
|
||||
|
@ -21,19 +22,16 @@ margin_left = 8.0
|
|||
margin_top = 8.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 380.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="VBoxContainer"]
|
||||
margin_right = 332.0
|
||||
margin_bottom = 228.0
|
||||
margin_bottom = 232.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Preview" type="TextureRect" parent="VBoxContainer/AspectRatioContainer"]
|
||||
margin_left = 52.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 228.0
|
||||
margin_left = 50.0
|
||||
margin_right = 282.0
|
||||
margin_bottom = 232.0
|
||||
rect_min_size = Vector2( 200, 200 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
@ -46,140 +44,52 @@ margin_right = 0.0
|
|||
margin_bottom = 0.0
|
||||
|
||||
[node name="LiveSettings" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 232.0
|
||||
margin_top = 236.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 256.0
|
||||
margin_bottom = 260.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="WaitSettings" type="HBoxContainer" parent="VBoxContainer"]
|
||||
[node name="WaitTime" parent="VBoxContainer" instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
margin_top = 232.0
|
||||
margin_top = 236.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 256.0
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/WaitSettings"]
|
||||
margin_left = 3.0
|
||||
margin_top = 5.0
|
||||
margin_right = 251.0
|
||||
margin_bottom = 19.0
|
||||
text = "Update preview delay (in milliseconds)"
|
||||
|
||||
[node name="WaitTime" type="SpinBox" parent="VBoxContainer/WaitSettings"]
|
||||
margin_left = 255.0
|
||||
margin_right = 329.0
|
||||
margin_bottom = 24.0
|
||||
margin_bottom = 260.0
|
||||
min_value = 1.0
|
||||
max_value = 1000.0
|
||||
value = 200.0
|
||||
editable = false
|
||||
suffix = "msec"
|
||||
prefix = "Preview delay:"
|
||||
suffix = "ms"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 260.0
|
||||
[node name="HueSlider" parent="VBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_top = 264.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 288.0
|
||||
min_value = -180.0
|
||||
max_value = 180.0
|
||||
prefix = "Hue:"
|
||||
|
||||
[node name="SaturationSlider" parent="VBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_top = 292.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 316.0
|
||||
min_value = -100.0
|
||||
prefix = "Saturation:"
|
||||
|
||||
[node name="ValueSlider" parent="VBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_top = 320.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 344.0
|
||||
custom_constants/separation = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Names" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_right = 68.0
|
||||
margin_bottom = 50.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
size_flags_stretch_ratio = 0.9
|
||||
|
||||
[node name="Hue" type="Label" parent="VBoxContainer/HBoxContainer/Names"]
|
||||
margin_right = 68.0
|
||||
margin_bottom = 14.0
|
||||
text = "Hue:"
|
||||
align = 2
|
||||
|
||||
[node name="Saturation" type="Label" parent="VBoxContainer/HBoxContainer/Names"]
|
||||
margin_top = 18.0
|
||||
margin_right = 68.0
|
||||
margin_bottom = 32.0
|
||||
text = "Saturation:"
|
||||
align = 2
|
||||
|
||||
[node name="Value" type="Label" parent="VBoxContainer/HBoxContainer/Names"]
|
||||
margin_top = 36.0
|
||||
margin_right = 68.0
|
||||
margin_bottom = 50.0
|
||||
text = "Value:"
|
||||
align = 2
|
||||
|
||||
[node name="Sliders" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 78.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 84.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 3.0
|
||||
custom_constants/separation = 10
|
||||
alignment = 1
|
||||
|
||||
[node name="Hue" type="HSlider" parent="VBoxContainer/HBoxContainer/Sliders"]
|
||||
margin_top = 8.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = -180.0
|
||||
max_value = 180.0
|
||||
|
||||
[node name="Saturation" type="HSlider" parent="VBoxContainer/HBoxContainer/Sliders"]
|
||||
margin_top = 34.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 50.0
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = -100.0
|
||||
|
||||
[node name="Value" type="HSlider" parent="VBoxContainer/HBoxContainer/Sliders"]
|
||||
margin_top = 60.0
|
||||
margin_right = 170.0
|
||||
margin_bottom = 76.0
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = -100.0
|
||||
|
||||
[node name="TextBoxes" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 258.0
|
||||
margin_right = 332.0
|
||||
margin_bottom = 84.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.0
|
||||
custom_constants/separation = 6
|
||||
|
||||
[node name="Hue" type="SpinBox" parent="VBoxContainer/HBoxContainer/TextBoxes"]
|
||||
margin_right = 74.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 1
|
||||
min_value = -180.0
|
||||
max_value = 180.0
|
||||
|
||||
[node name="Saturation" type="SpinBox" parent="VBoxContainer/HBoxContainer/TextBoxes"]
|
||||
margin_top = 30.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 54.0
|
||||
mouse_default_cursor_shape = 1
|
||||
min_value = -100.0
|
||||
|
||||
[node name="Value" type="SpinBox" parent="VBoxContainer/HBoxContainer/TextBoxes"]
|
||||
margin_top = 60.0
|
||||
margin_right = 74.0
|
||||
margin_bottom = 84.0
|
||||
mouse_default_cursor_shape = 1
|
||||
min_value = -100.0
|
||||
prefix = "Value:"
|
||||
|
||||
[node name="AffectHBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 348.0
|
||||
|
@ -187,17 +97,19 @@ margin_right = 332.0
|
|||
margin_bottom = 372.0
|
||||
|
||||
[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/AffectHBoxContainer"]
|
||||
margin_right = 160.0
|
||||
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 = 164.0
|
||||
margin_right = 278.0
|
||||
margin_left = 168.0
|
||||
margin_right = 332.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
|
||||
|
@ -207,11 +119,8 @@ 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/WaitSettings/WaitTime" to="." method="_on_WaitTime_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Hue" to="." method="_on_Hue_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Saturation" to="." method="_on_Saturation_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/Sliders/Value" to="." method="_on_Value_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/TextBoxes/Hue" to="." method="_on_Hue_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/TextBoxes/Saturation" to="." method="_on_Saturation_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/HBoxContainer/TextBoxes/Value" to="." method="_on_Value_value_changed"]
|
||||
[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"]
|
||||
|
|
|
@ -8,17 +8,14 @@ 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: SpinBox = $VBoxContainer/TitleButtons/XPivot
|
||||
onready var y_pivot: SpinBox = $VBoxContainer/TitleButtons/YPivot
|
||||
onready var angle_hslider: HSlider = $VBoxContainer/AngleOptions/AngleHSlider
|
||||
onready var angle_spinbox: SpinBox = $VBoxContainer/AngleOptions/AngleSpinBox
|
||||
onready var x_pivot: ValueSlider = $VBoxContainer/PivotOptions/XPivot
|
||||
onready var y_pivot: ValueSlider = $VBoxContainer/PivotOptions/YPivot
|
||||
onready var angle_slider: ValueSlider = $VBoxContainer/AngleSlider
|
||||
onready var smear_options: Container = $VBoxContainer/SmearOptions
|
||||
onready var init_angle_hslider: HSlider = smear_options.get_node("AngleOptions/InitialAngleHSlider")
|
||||
onready var init_angle_spinbox: SpinBox = smear_options.get_node("AngleOptions/InitialAngleSpinBox")
|
||||
onready var tolerance_hslider: HSlider = smear_options.get_node("Tolerance/ToleranceHSlider")
|
||||
onready var tolerance_spinbox: SpinBox = smear_options.get_node("Tolerance/ToleranceSpinBox")
|
||||
onready var init_angle_slider: ValueSlider = smear_options.get_node("InitialAngleSlider")
|
||||
onready var tolerance_slider: ValueSlider = smear_options.get_node("ToleranceSlider")
|
||||
onready var wait_apply_timer: Timer = $WaitApply
|
||||
onready var wait_time_spinbox: SpinBox = $VBoxContainer/WaitSettings/WaitTime
|
||||
onready var wait_time_slider: ValueSlider = $VBoxContainer/WaitTime
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -45,8 +42,8 @@ func _about_to_show() -> void:
|
|||
decide_pivot()
|
||||
confirmed = false
|
||||
._about_to_show()
|
||||
wait_apply_timer.wait_time = wait_time_spinbox.value / 1000.0
|
||||
angle_hslider.value = 0
|
||||
wait_apply_timer.wait_time = wait_time_slider.value / 1000.0
|
||||
angle_slider.value = 0
|
||||
|
||||
|
||||
func decide_pivot() -> void:
|
||||
|
@ -78,7 +75,7 @@ func decide_pivot() -> void:
|
|||
|
||||
|
||||
func commit_action(cel: Image, _project: Project = Global.current_project) -> void:
|
||||
var angle: float = deg2rad(angle_hslider.value)
|
||||
var angle: float = deg2rad(angle_slider.value)
|
||||
|
||||
var selection_size := cel.get_size()
|
||||
var selection_tex := ImageTexture.new()
|
||||
|
@ -107,9 +104,9 @@ func commit_action(cel: Image, _project: Project = Global.current_project) -> vo
|
|||
match type_option_button.text:
|
||||
"Rotxel with Smear":
|
||||
var params := {
|
||||
"initial_angle": init_angle_hslider.value,
|
||||
"ending_angle": angle_hslider.value,
|
||||
"tolerance": tolerance_hslider.value,
|
||||
"initial_angle": init_angle_slider.value,
|
||||
"ending_angle": angle_slider.value,
|
||||
"tolerance": tolerance_slider.value,
|
||||
"selection_tex": selection_tex,
|
||||
"origin": pivot / cel.get_size(),
|
||||
"selection_size": selection_size
|
||||
|
@ -173,42 +170,27 @@ func _on_TypeOptionButton_item_selected(_id: int) -> void:
|
|||
update_preview()
|
||||
|
||||
|
||||
func _on_AngleHSlider_value_changed(_value: float) -> void:
|
||||
angle_spinbox.value = angle_hslider.value
|
||||
func _on_AngleSlider_value_changed(_value: float) -> void:
|
||||
if live_preview:
|
||||
update_preview()
|
||||
else:
|
||||
wait_apply_timer.start()
|
||||
|
||||
|
||||
func _on_AngleSpinBox_value_changed(_value: float) -> void:
|
||||
angle_hslider.value = angle_spinbox.value
|
||||
|
||||
|
||||
func _on_InitialAngleHSlider_value_changed(_value: float) -> void:
|
||||
init_angle_spinbox.value = init_angle_hslider.value
|
||||
func _on_InitialAngleSlider_value_changed(_value: float) -> void:
|
||||
if live_preview:
|
||||
update_preview()
|
||||
else:
|
||||
wait_apply_timer.start()
|
||||
|
||||
|
||||
func _on_InitialAngleSpinBox_value_changed(_value: float) -> void:
|
||||
init_angle_hslider.value = init_angle_spinbox.value
|
||||
|
||||
|
||||
func _on_ToleranceHSlider_value_changed(_value: float) -> void:
|
||||
tolerance_spinbox.value = tolerance_hslider.value
|
||||
func _on_ToleranceSlider_value_changed(_value: float) -> void:
|
||||
if live_preview:
|
||||
update_preview()
|
||||
else:
|
||||
wait_apply_timer.start()
|
||||
|
||||
|
||||
func _on_ToleranceSpinBox_value_changed(_value: float) -> void:
|
||||
tolerance_hslider.value = tolerance_spinbox.value
|
||||
|
||||
|
||||
func _on_WaitApply_timeout() -> void:
|
||||
update_preview()
|
||||
|
||||
|
@ -219,14 +201,14 @@ func _on_WaitTime_value_changed(value: float) -> void:
|
|||
|
||||
func _on_LiveCheckbox_toggled(button_pressed: bool) -> void:
|
||||
live_preview = button_pressed
|
||||
wait_time_spinbox.editable = !live_preview
|
||||
wait_time_spinbox.get_parent().visible = !live_preview
|
||||
wait_time_slider.editable = !live_preview
|
||||
wait_time_slider.visible = !live_preview
|
||||
if !button_pressed:
|
||||
rect_size.y += 1 # Reset rect_size of dialog
|
||||
|
||||
|
||||
func _on_quick_change_angle_pressed(angle_value: int) -> void:
|
||||
var current_angle := angle_hslider.value
|
||||
var current_angle := angle_slider.value
|
||||
var new_angle := current_angle + angle_value
|
||||
if angle_value == 0:
|
||||
new_angle = 0
|
||||
|
@ -235,7 +217,7 @@ func _on_quick_change_angle_pressed(angle_value: int) -> void:
|
|||
new_angle = new_angle + 360
|
||||
elif new_angle >= 360:
|
||||
new_angle = new_angle - 360
|
||||
angle_hslider.value = new_angle
|
||||
angle_slider.value = new_angle
|
||||
|
||||
|
||||
func _on_Centre_pressed() -> void:
|
||||
|
@ -249,7 +231,7 @@ func _on_Pivot_value_changed(value: float, is_x: bool) -> void:
|
|||
pivot.y = value
|
||||
# Refresh the indicator
|
||||
pivot_indicator.update()
|
||||
if angle_hslider.value != 0:
|
||||
if angle_slider.value != 0:
|
||||
update_preview()
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/UI/Dialogs/ImageEffects/RotateImage.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/UI/Nodes/ValueSlider.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="RotateImage" type="ConfirmationDialog"]
|
||||
margin_right = 342.0
|
||||
|
@ -59,31 +60,17 @@ mouse_default_cursor_shape = 2
|
|||
pressed = true
|
||||
text = "Live Preview"
|
||||
|
||||
[node name="WaitSettings" type="HBoxContainer" parent="VBoxContainer"]
|
||||
[node name="WaitTime" parent="VBoxContainer" instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
margin_top = 232.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 256.0
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/WaitSettings"]
|
||||
margin_top = 5.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 19.0
|
||||
text = "Update preview delay (in milliseconds)"
|
||||
|
||||
[node name="WaitTime" type="SpinBox" parent="VBoxContainer/WaitSettings"]
|
||||
margin_left = 252.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 24.0
|
||||
min_value = 1.0
|
||||
max_value = 1000.0
|
||||
value = 200.0
|
||||
editable = false
|
||||
suffix = "msec"
|
||||
prefix = "Preview delay:"
|
||||
suffix = "ms"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 254.0
|
||||
|
@ -109,44 +96,27 @@ margin_top = 278.0
|
|||
margin_right = 326.0
|
||||
margin_bottom = 282.0
|
||||
|
||||
[node name="TitleButtons" type="HBoxContainer" parent="VBoxContainer"]
|
||||
[node name="PivotOptions" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 286.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 310.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/TitleButtons"]
|
||||
margin_top = 5.0
|
||||
margin_right = 70.0
|
||||
margin_bottom = 19.0
|
||||
text = "Pivot (x, y):"
|
||||
align = 2
|
||||
valign = 1
|
||||
|
||||
[node name="XPivot" type="SpinBox" parent="VBoxContainer/TitleButtons"]
|
||||
margin_left = 74.0
|
||||
margin_right = 169.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
min_value = -10000.0
|
||||
max_value = 10000.0
|
||||
[node name="XPivot" parent="VBoxContainer/PivotOptions" instance=ExtResource( 3 )]
|
||||
margin_right = 132.0
|
||||
step = 0.5
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
prefix = "Pivot x:"
|
||||
|
||||
[node name="YPivot" type="SpinBox" parent="VBoxContainer/TitleButtons"]
|
||||
margin_left = 173.0
|
||||
[node name="YPivot" parent="VBoxContainer/PivotOptions" instance=ExtResource( 3 )]
|
||||
margin_left = 136.0
|
||||
margin_right = 268.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
min_value = -10000.0
|
||||
max_value = 10000.0
|
||||
step = 0.5
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
prefix = "Pivot y:"
|
||||
|
||||
[node name="Centre" type="Button" parent="VBoxContainer/TitleButtons"]
|
||||
[node name="Centre" type="Button" parent="VBoxContainer/PivotOptions"]
|
||||
margin_left = 272.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 24.0
|
||||
|
@ -159,36 +129,14 @@ margin_top = 314.0
|
|||
margin_right = 326.0
|
||||
margin_bottom = 318.0
|
||||
|
||||
[node name="AngleOptions" type="HBoxContainer" parent="VBoxContainer"]
|
||||
[node name="AngleSlider" parent="VBoxContainer" instance=ExtResource( 3 )]
|
||||
margin_top = 322.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 346.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/AngleOptions"]
|
||||
margin_top = 5.0
|
||||
margin_right = 40.0
|
||||
margin_bottom = 19.0
|
||||
text = "Angle:"
|
||||
|
||||
[node name="AngleHSlider" type="HSlider" parent="VBoxContainer/AngleOptions"]
|
||||
margin_left = 44.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
max_value = 359.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AngleSpinBox" type="SpinBox" parent="VBoxContainer/AngleOptions"]
|
||||
margin_left = 252.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
max_value = 359.0
|
||||
prefix = "Angle:"
|
||||
suffix = "°"
|
||||
snap_step = 45.0
|
||||
|
||||
[node name="QuickRotations" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 350.0
|
||||
|
@ -197,45 +145,49 @@ margin_bottom = 370.0
|
|||
alignment = 1
|
||||
|
||||
[node name="Deduct90" type="Button" parent="VBoxContainer/QuickRotations"]
|
||||
margin_left = 76.0
|
||||
margin_right = 109.0
|
||||
margin_right = 62.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 = 113.0
|
||||
margin_right = 146.0
|
||||
margin_left = 66.0
|
||||
margin_right = 128.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 = 150.0
|
||||
margin_right = 170.0
|
||||
margin_left = 132.0
|
||||
margin_right = 194.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 = 174.0
|
||||
margin_right = 210.0
|
||||
margin_left = 198.0
|
||||
margin_right = 260.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 = 214.0
|
||||
margin_right = 250.0
|
||||
margin_left = 264.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 20.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "+90"
|
||||
|
||||
[node name="SmearOptions" type="VBoxContainer" parent="VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 376.0
|
||||
margin_top = 352.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 454.0
|
||||
margin_bottom = 430.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/SmearOptions"]
|
||||
margin_right = 326.0
|
||||
|
@ -247,70 +199,23 @@ margin_right = 326.0
|
|||
margin_bottom = 22.0
|
||||
text = "Smear options:"
|
||||
|
||||
[node name="Tolerance" type="HBoxContainer" parent="VBoxContainer/SmearOptions"]
|
||||
[node name="ToleranceSlider" parent="VBoxContainer/SmearOptions" instance=ExtResource( 3 )]
|
||||
margin_top = 26.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 50.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/SmearOptions/Tolerance"]
|
||||
margin_top = 5.0
|
||||
margin_right = 66.0
|
||||
margin_bottom = 19.0
|
||||
text = "Tolerance:"
|
||||
|
||||
[node name="ToleranceHSlider" type="HSlider" parent="VBoxContainer/SmearOptions/Tolerance"]
|
||||
margin_left = 70.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
max_value = 255.0
|
||||
value = 100.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
prefix = "Tolerance:"
|
||||
|
||||
[node name="ToleranceSpinBox" type="SpinBox" parent="VBoxContainer/SmearOptions/Tolerance"]
|
||||
margin_left = 252.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
max_value = 255.0
|
||||
value = 100.0
|
||||
|
||||
[node name="AngleOptions" type="HBoxContainer" parent="VBoxContainer/SmearOptions"]
|
||||
[node name="InitialAngleSlider" parent="VBoxContainer/SmearOptions" instance=ExtResource( 3 )]
|
||||
margin_top = 54.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 78.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/SmearOptions/AngleOptions"]
|
||||
margin_top = 5.0
|
||||
margin_right = 79.0
|
||||
margin_bottom = 19.0
|
||||
text = "Initial angle:"
|
||||
|
||||
[node name="InitialAngleHSlider" type="HSlider" parent="VBoxContainer/SmearOptions/AngleOptions"]
|
||||
margin_left = 83.0
|
||||
margin_right = 248.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
max_value = 359.0
|
||||
value = 359.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="InitialAngleSpinBox" type="SpinBox" parent="VBoxContainer/SmearOptions/AngleOptions"]
|
||||
margin_left = 252.0
|
||||
margin_right = 326.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
max_value = 359.0
|
||||
value = 359.0
|
||||
prefix = "Initial angle:"
|
||||
suffix = "°"
|
||||
snap_step = 45.0
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer"]
|
||||
margin_top = 374.0
|
||||
|
@ -323,17 +228,19 @@ margin_right = 326.0
|
|||
margin_bottom = 406.0
|
||||
|
||||
[node name="SelectionCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"]
|
||||
margin_right = 160.0
|
||||
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 = 164.0
|
||||
margin_right = 278.0
|
||||
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
|
||||
|
@ -343,20 +250,17 @@ selected = 0
|
|||
[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/WaitSettings/WaitTime" to="." method="_on_WaitTime_value_changed"]
|
||||
[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/TitleButtons/XPivot" to="." method="_on_Pivot_value_changed" binds= [ true ]]
|
||||
[connection signal="value_changed" from="VBoxContainer/TitleButtons/YPivot" to="." method="_on_Pivot_value_changed" binds= [ false ]]
|
||||
[connection signal="pressed" from="VBoxContainer/TitleButtons/Centre" to="." method="_on_Centre_pressed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleHSlider" to="." method="_on_AngleHSlider_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/AngleOptions/AngleSpinBox" to="." method="_on_AngleSpinBox_value_changed"]
|
||||
[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="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 ]]
|
||||
[connection signal="pressed" from="VBoxContainer/QuickRotations/Deduct45" to="." method="_on_quick_change_angle_pressed" binds= [ -45 ]]
|
||||
[connection signal="pressed" from="VBoxContainer/QuickRotations/Zero" to="." method="_on_quick_change_angle_pressed" binds= [ 0 ]]
|
||||
[connection signal="pressed" from="VBoxContainer/QuickRotations/Add45" to="." method="_on_quick_change_angle_pressed" binds= [ 45 ]]
|
||||
[connection signal="pressed" from="VBoxContainer/QuickRotations/Add90" to="." method="_on_quick_change_angle_pressed" binds= [ 90 ]]
|
||||
[connection signal="value_changed" from="VBoxContainer/SmearOptions/Tolerance/ToleranceHSlider" to="." method="_on_ToleranceHSlider_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/SmearOptions/Tolerance/ToleranceSpinBox" to="." method="_on_ToleranceSpinBox_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/SmearOptions/AngleOptions/InitialAngleHSlider" to="." method="_on_InitialAngleHSlider_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/SmearOptions/AngleOptions/InitialAngleSpinBox" to="." method="_on_InitialAngleSpinBox_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/SmearOptions/ToleranceSlider" to="." method="_on_ToleranceSlider_value_changed"]
|
||||
[connection signal="value_changed" from="VBoxContainer/SmearOptions/InitialAngleSlider" to="." method="_on_InitialAngleSlider_value_changed"]
|
||||
[connection signal="timeout" from="WaitApply" to="." method="_on_WaitApply_timeout"]
|
||||
|
|
Loading…
Reference in a new issue