1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Fix minor bugs and cleanup

This commit is contained in:
luiq54 2020-04-15 15:19:29 +05:30
parent cb051239dc
commit 8fdeb63778
6 changed files with 33 additions and 28 deletions

File diff suppressed because one or more lines are too long

View file

@ -3,7 +3,6 @@
[ext_resource path="res://Scripts/Dialogs/HSVDialog.gd" type="Script" id=1]
[node name="HSVDialog" type="WindowDialog"]
visible = true
margin_left = 1.0
margin_top = -1.0
margin_right = 464.0
@ -85,6 +84,7 @@ custom_constants/separation = 7
[node name="Hue" type="HSlider" parent="MarginContainer/VBoxContainer/HBoxContainer/Sliders"]
margin_right = 276.0
margin_bottom = 16.0
mouse_default_cursor_shape = 2
min_value = -180.0
max_value = 180.0
@ -92,15 +92,15 @@ max_value = 180.0
margin_top = 23.0
margin_right = 276.0
margin_bottom = 39.0
mouse_default_cursor_shape = 2
min_value = -100.0
max_value = 100.0
[node name="Value" type="HSlider" parent="MarginContainer/VBoxContainer/HBoxContainer/Sliders"]
margin_top = 46.0
margin_right = 276.0
margin_bottom = 62.0
mouse_default_cursor_shape = 2
min_value = -100.0
max_value = 100.0
[node name="TextBoxes" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"]
margin_left = 378.0
@ -113,6 +113,7 @@ custom_constants/separation = 6
[node name="Hue" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer/TextBoxes"]
margin_right = 74.0
margin_bottom = 24.0
mouse_default_cursor_shape = 1
min_value = -180.0
max_value = 180.0
@ -120,15 +121,15 @@ max_value = 180.0
margin_top = 30.0
margin_right = 74.0
margin_bottom = 54.0
mouse_default_cursor_shape = 1
min_value = -100.0
max_value = 100.0
[node name="Value" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer/TextBoxes"]
margin_top = 60.0
margin_right = 74.0
margin_bottom = 84.0
mouse_default_cursor_shape = 1
min_value = -100.0
max_value = 100.0
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 289.0
@ -142,6 +143,7 @@ __meta__ = {
[node name="Apply" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
margin_right = 218.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
text = "Apply"
@ -149,6 +151,7 @@ text = "Apply"
margin_left = 234.0
margin_right = 453.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
text = "Cancel"
[connection signal="about_to_show" from="." to="." method="_on_HSVDialog_about_to_show"]

View file

@ -1011,7 +1011,7 @@ func blend_rect(bg : Image, brush : Image, src_rect : Rect2, dst : Vector2) -> v
bg.set_pixel(dst_x, dst_y, out_color)
brush.unlock()
func adjust_hsv(img: Image, id, delta)->void:
func adjust_hsv(img: Image, id : int, delta : float)->void:
var selection_only:bool = !Global.selected_pixels.empty()
var layer:Image = img
layer.lock()
@ -1055,6 +1055,7 @@ func adjust_hsv(img: Image, id, delta)->void:
elif delta < 0:
sat = range_lerp(delta,-100,0,0,c.s)
c.s = sat
layer.set_pixel(i,j,c)
elif(!selection_only):
var c: Color = layer.get_pixel(i,j)
var sat = c.s
@ -1063,7 +1064,6 @@ func adjust_hsv(img: Image, id, delta)->void:
elif delta < 0:
sat = range_lerp(delta,-100,0,0,c.s)
c.s = sat
print(sat)
layer.set_pixel(i,j,c)
#value
@ -1078,7 +1078,7 @@ func adjust_hsv(img: Image, id, delta)->void:
elif delta < 0:
val = range_lerp(delta,-100,0,0,c.v)
c.s = val
c.v = val
layer.set_pixel(i,j,c)
elif(!selection_only):
var c: Color = layer.get_pixel(i,j)

View file

@ -39,7 +39,7 @@ func _on_Apply_pressed():
reset()
visible = false
func reset():
func reset() -> void:
disconnect_signals()
hue_slider.value = 0
sat_slider.value = 0
@ -49,7 +49,7 @@ func reset():
val_spinbox.value = 0
reconnect_signals()
func update_preview():
func update_preview() -> void:
preview_image.copy_from(current_layer)
Global.canvas.adjust_hsv(preview_image,0,hue_slider.value)
Global.canvas.adjust_hsv(preview_image,1,sat_slider.value)
@ -57,7 +57,7 @@ func update_preview():
preview_texture.create_from_image(preview_image, 0)
preview.texture = preview_texture
func disconnect_signals():
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")
@ -65,7 +65,7 @@ func disconnect_signals():
sat_spinbox.disconnect("value_changed",self,"_on_Saturation_value_changed")
val_spinbox.disconnect("value_changed",self,"_on_Value_value_changed")
func reconnect_signals():
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")

View file

@ -71,7 +71,7 @@ func _ready() -> void:
"Invert colors" : 0,
"Desaturation" : 0,
"Outline" : 0,
"Adjust Hue/Sat/Val":0
"Adjust Hue/Saturation/Value":0
}
var help_menu_items := {
"View Splash Screen" : 0,

View file

@ -320,6 +320,9 @@ msgstr ""
msgid "Outline"
msgstr ""
msgid "Adjust Hue/Saturation/Value"
msgstr ""
msgid "Diagonal"
msgstr ""