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

Added sliders next to spinboxes for the brush color from & LightenDarken amount

This commit is contained in:
OverloadedOrama 2019-12-25 21:42:01 +02:00
parent d4b42534bb
commit 4a2c0eb291
3 changed files with 90 additions and 26 deletions

View file

@ -258,6 +258,7 @@ size_flags_vertical = 3
custom_constants/separation = 0
[node name="ToolPanel" type="Panel" parent="MenuAndUI/UI"]
editor/display_folded = true
margin_right = 224.0
margin_bottom = 620.0
rect_min_size = Vector2( 224, 0 )
@ -398,6 +399,7 @@ button_mask = 3
texture_normal = ExtResource( 9 )
[node name="ColorAndToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools"]
editor/display_folded = true
margin_top = 159.0
margin_right = 208.0
margin_bottom = 612.0
@ -529,6 +531,7 @@ margin_bottom = 23.0
text = "Brush: Pixel"
[node name="LeftBrushSize" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions"]
editor/display_folded = true
margin_top = 75.0
margin_right = 208.0
margin_bottom = 92.0
@ -573,8 +576,16 @@ margin_bottom = 16.0
hint_tooltip = "COLORFROM_HT"
text = "Brush color from"
[node name="LeftInterpolateFactor" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftColorInterpolation"]
[node name="LeftInterpolateSlider" type="HSlider" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftColorInterpolation"]
margin_left = 94.0
margin_right = 149.0
margin_bottom = 17.0
size_flags_horizontal = 3
size_flags_vertical = 1
value = 100.0
[node name="LeftInterpolateFactor" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftColorInterpolation"]
margin_left = 153.0
margin_right = 208.0
margin_bottom = 17.0
hint_tooltip = "COLORFROM_HT"
@ -626,9 +637,18 @@ margin_right = 47.0
margin_bottom = 16.0
text = "Amount:"
[node name="LeftLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount"]
[node name="LeftLDAmountSlider" type="HSlider" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount"]
margin_left = 51.0
margin_right = 115.0
margin_right = 150.0
margin_bottom = 17.0
hint_tooltip = "LDAMOUNT_HT"
size_flags_horizontal = 3
size_flags_vertical = 1
value = 10.0
[node name="LeftLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount"]
margin_left = 154.0
margin_right = 208.0
margin_bottom = 17.0
hint_tooltip = "LDAMOUNT_HT"
value = 10.0
@ -718,6 +738,7 @@ margin_bottom = 23.0
text = "Brush: Pixel"
[node name="RightBrushSize" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions"]
editor/display_folded = true
margin_top = 75.0
margin_right = 208.0
margin_bottom = 92.0
@ -762,8 +783,18 @@ margin_bottom = 16.0
hint_tooltip = "COLORFROM_HT"
text = "Brush color from"
[node name="RightInterpolateFactor" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightColorInterpolation"]
[node name="RightInterpolateSlider" type="HSlider" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightColorInterpolation"]
margin_left = 94.0
margin_right = 149.0
margin_bottom = 17.0
hint_tooltip = "COLORFROM_HT"
size_flags_horizontal = 3
size_flags_vertical = 1
value = 100.0
ticks_on_borders = true
[node name="RightInterpolateFactor" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightColorInterpolation"]
margin_left = 153.0
margin_right = 208.0
margin_bottom = 17.0
hint_tooltip = "COLORFROM_HT"
@ -815,9 +846,18 @@ margin_right = 47.0
margin_bottom = 16.0
text = "Amount:"
[node name="RightLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightLDOptions/RightLDAmount"]
[node name="RightLDAmountSlider" type="HSlider" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightLDOptions/RightLDAmount"]
margin_left = 51.0
margin_right = 115.0
margin_right = 150.0
margin_bottom = 17.0
hint_tooltip = "LDAMOUNT_HT"
size_flags_horizontal = 3
size_flags_vertical = 1
value = 10.0
[node name="RightLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightLDOptions/RightLDAmount"]
margin_left = 154.0
margin_right = 208.0
margin_bottom = 17.0
hint_tooltip = "LDAMOUNT_HT"
value = 10.0
@ -1912,9 +1952,11 @@ visible = false
[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushType/LeftBrushTypeButton" to="." method="_on_LeftBrushTypeButton_pressed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize/LeftBrushSizeSlider" to="." method="_on_LeftBrushSizeEdit_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize/LeftBrushSizeEdit" to="." method="_on_LeftBrushSizeEdit_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftColorInterpolation/LeftInterpolateSlider" to="." method="_on_LeftInterpolateFactor_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftColorInterpolation/LeftInterpolateFactor" to="." method="_on_LeftInterpolateFactor_value_changed"]
[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftFillArea/LeftFillAreaOptions" to="." method="_on_LeftFillAreaOptions_item_selected"]
[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftLDOptions/LeftLightenDarken" to="." method="_on_LeftLightenDarken_item_selected"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount/LeftLDAmountSlider" to="." method="_on_LeftLDAmountSpinbox_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount/LeftLDAmountSpinbox" to="." method="_on_LeftLDAmountSpinbox_value_changed"]
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftMirroring/LeftMirrorButtons/LeftHorizontalMirroring" to="." method="_on_LeftHorizontalMirroring_toggled"]
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftMirroring/LeftMirrorButtons/LeftVerticalMirroring" to="." method="_on_LeftVerticalMirroring_toggled"]
@ -1922,9 +1964,11 @@ visible = false
[connection signal="pressed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushType/RightBrushTypeButton" to="." method="_on_RightBrushTypeButton_pressed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushSize/RightBrushSizeSlider" to="." method="_on_RightBrushSizeEdit_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightBrushSize/RightBrushSizeEdit" to="." method="_on_RightBrushSizeEdit_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightColorInterpolation/RightInterpolateSlider" to="." method="_on_RightInterpolateFactor_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightColorInterpolation/RightInterpolateFactor" to="." method="_on_RightInterpolateFactor_value_changed"]
[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightFillArea/RightFillAreaOptions" to="." method="_on_RightFillAreaOptions_item_selected"]
[connection signal="item_selected" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightLDOptions/RightLightenDarken" to="." method="_on_RightLightenDarken_item_selected"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightLDOptions/RightLDAmount/RightLDAmountSlider" to="." method="_on_RightLDAmountSpinbox_value_changed"]
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightLDOptions/RightLDAmount/RightLDAmountSpinbox" to="." method="_on_RightLDAmountSpinbox_value_changed"]
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightMirroring/RightMirrorButtons/RightHorizontalMirroring" to="." method="_on_RightHorizontalMirroring_toggled"]
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightMirroring/RightMirrorButtons/RightVerticalMirroring" to="." method="_on_RightVerticalMirroring_toggled"]

View file

@ -6,7 +6,7 @@ var loaded_locales : Array
var undo_redo : UndoRedo
var undos := 0 #The number of times we added undo properties
#Canvas related stuff
# Canvas related stuff
var current_frame := 0 setget frame_changed
# warning-ignore:unused_class_variable
var can_draw := false
@ -30,7 +30,7 @@ var grid_height := 1
# warning-ignore:unused_class_variable
var grid_color := Color.black
#Tools & options
# Tools & options
# warning-ignore:unused_class_variable
var current_left_tool := "Pencil"
# warning-ignore:unused_class_variable
@ -45,7 +45,7 @@ var left_fill_area := 0
# warning-ignore:unused_class_variable
var right_fill_area := 0
#0 for lighten, 1 for darken
# 0 for lighten, 1 for darken
# warning-ignore:unused_class_variable
var left_ld := 0
# warning-ignore:unused_class_variable
@ -64,7 +64,7 @@ var right_horizontal_mirror := false
# warning-ignore:unused_class_variable
var right_vertical_mirror := false
#View menu options
# View menu options
# warning-ignore:unused_class_variable
var tile_mode := false
# warning-ignore:unused_class_variable
@ -74,7 +74,7 @@ var show_rulers := true
# warning-ignore:unused_class_variable
var show_guides := true
#Onion skinning options
# Onion skinning options
# warning-ignore:unused_class_variable
var onion_skinning_past_rate := 0
# warning-ignore:unused_class_variable
@ -82,7 +82,7 @@ var onion_skinning_future_rate := 0
# warning-ignore:unused_class_variable
var onion_skinning_blue_red := false
#Brushes
# Brushes
enum BRUSH_TYPES {PIXEL, CIRCLE, FILE, CUSTOM}
# warning-ignore:unused_class_variable
var left_brush_size := 1
@ -113,11 +113,11 @@ var custom_left_brush_texture := ImageTexture.new()
# warning-ignore:unused_class_variable
var custom_right_brush_texture := ImageTexture.new()
#Palettes
# Palettes
# warning-ignore:unused_class_variable
var palettes := {}
#Nodes
# Nodes
var control : Node
var top_menu_container : Panel
var left_cursor : Sprite
@ -168,14 +168,20 @@ var right_brush_size_slider : HSlider
var left_color_interpolation_container : Container
var right_color_interpolation_container : Container
var left_interpolate_slider : SpinBox
var right_interpolate_slider : SpinBox
var left_interpolate_spinbox : SpinBox
var left_interpolate_slider : HSlider
var right_interpolate_spinbox : SpinBox
var right_interpolate_slider : HSlider
var left_fill_area_container : Container
var right_fill_area_container : Container
var left_ld_container : Container
var left_ld_amount_slider : HSlider
var left_ld_amount_spinbox : SpinBox
var right_ld_container : Container
var right_ld_amount_slider : HSlider
var right_ld_amount_spinbox : SpinBox
var left_mirror_container : Container
var right_mirror_container : Container
@ -273,14 +279,20 @@ func _ready() -> void:
left_color_interpolation_container = find_node_by_name(left_tool_options_container, "LeftColorInterpolation")
right_color_interpolation_container = find_node_by_name(right_tool_options_container, "RightColorInterpolation")
left_interpolate_slider = find_node_by_name(left_color_interpolation_container, "LeftInterpolateFactor")
right_interpolate_slider = find_node_by_name(right_color_interpolation_container, "RightInterpolateFactor")
left_interpolate_spinbox = find_node_by_name(left_color_interpolation_container, "LeftInterpolateFactor")
left_interpolate_slider = find_node_by_name(left_color_interpolation_container, "LeftInterpolateSlider")
right_interpolate_spinbox = find_node_by_name(right_color_interpolation_container, "RightInterpolateFactor")
right_interpolate_slider = find_node_by_name(right_color_interpolation_container, "RightInterpolateSlider")
left_fill_area_container = find_node_by_name(left_tool_options_container, "LeftFillArea")
right_fill_area_container = find_node_by_name(right_tool_options_container, "RightFillArea")
left_ld_container = find_node_by_name(left_tool_options_container, "LeftLDOptions")
left_ld_amount_slider = find_node_by_name(left_ld_container, "LeftLDAmountSlider")
left_ld_amount_spinbox = find_node_by_name(left_ld_container, "LeftLDAmountSpinbox")
right_ld_container = find_node_by_name(right_tool_options_container, "RightLDOptions")
right_ld_amount_slider = find_node_by_name(right_ld_container, "RightLDAmountSlider")
right_ld_amount_spinbox = find_node_by_name(right_ld_container, "RightLDAmountSpinbox")
left_mirror_container = find_node_by_name(left_tool_options_container, "LeftMirroring")
right_mirror_container = find_node_by_name(right_tool_options_container, "RightMirroring")
@ -490,7 +502,7 @@ func update_left_custom_brush() -> void:
custom_brush.copy_from(custom_brushes[custom_left_brush_index])
var custom_brush_size = custom_brush.get_size()
custom_brush.resize(custom_brush_size.x * left_brush_size, custom_brush_size.y * left_brush_size, Image.INTERPOLATE_NEAREST)
custom_left_brush_image = blend_image_with_color(custom_brush, left_color_picker.color, left_interpolate_slider.value / 100)
custom_left_brush_image = blend_image_with_color(custom_brush, left_color_picker.color, left_interpolate_spinbox.value / 100)
custom_left_brush_texture.create_from_image(custom_left_brush_image, 0)
left_brush_type_button.get_child(0).texture = custom_left_brush_texture
@ -512,7 +524,7 @@ func update_right_custom_brush() -> void:
custom_brush.copy_from(custom_brushes[custom_right_brush_index])
var custom_brush_size = custom_brush.get_size()
custom_brush.resize(custom_brush_size.x * right_brush_size, custom_brush_size.y * right_brush_size, Image.INTERPOLATE_NEAREST)
custom_right_brush_image = blend_image_with_color(custom_brush, right_color_picker.color, right_interpolate_slider.value / 100)
custom_right_brush_image = blend_image_with_color(custom_brush, right_color_picker.color, right_interpolate_spinbox.value / 100)
custom_right_brush_texture.create_from_image(custom_right_brush_image, 0)
right_brush_type_button.get_child(0).texture = custom_right_brush_texture

View file

@ -798,16 +798,16 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
if (mouse_press && Input.is_action_just_released("left_mouse")) || (!mouse_press && key_for_left):
Global.current_left_tool = current_action
#Start from 2, so the label and the cursor checkbox won't get invisible
# Start from 2, so the label and the cursor checkbox won't get invisible
for i in range(2, Global.left_tool_options_container.get_child_count()):
Global.left_tool_options_container.get_child(i).visible = false
#Tool options visible depending on the selected tool
# Tool options visible depending on the selected tool
if current_action == "Pencil":
Global.left_brush_type_container.visible = true
Global.left_brush_size_container.visible = true
Global.left_mirror_container.visible = true
if Global.current_left_brush_type != Global.BRUSH_TYPES.PIXEL:
if Global.current_left_brush_type == Global.BRUSH_TYPES.FILE || Global.current_left_brush_type == Global.BRUSH_TYPES.CUSTOM:
Global.left_color_interpolation_container.visible = true
elif current_action == "Eraser":
Global.left_brush_type_container.visible = true
@ -823,16 +823,16 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
elif (mouse_press && Input.is_action_just_released("right_mouse")) || (!mouse_press && !key_for_left):
Global.current_right_tool = current_action
#Start from 2, so the label and the cursor checkbox won't get invisible
# Start from 2, so the label and the cursor checkbox won't get invisible
for i in range(2, Global.right_tool_options_container.get_child_count()):
Global.right_tool_options_container.get_child(i).visible = false
#Tool options visible depending on the selected tool
# Tool options visible depending on the selected tool
if current_action == "Pencil":
Global.right_brush_type_container.visible = true
Global.right_brush_size_container.visible = true
Global.right_mirror_container.visible = true
if Global.current_right_brush_type != Global.BRUSH_TYPES.PIXEL:
if Global.current_right_brush_type == Global.BRUSH_TYPES.FILE || Global.current_right_brush_type == Global.BRUSH_TYPES.CUSTOM:
Global.right_color_interpolation_container.visible = true
elif current_action == "Eraser":
Global.right_brush_type_container.visible = true
@ -1137,10 +1137,14 @@ func _on_RightColorPickerButton_color_changed(color : Color) -> void:
# warning-ignore:unused_argument
func _on_LeftInterpolateFactor_value_changed(value : float) -> void:
Global.left_interpolate_spinbox.value = value
Global.left_interpolate_slider.value = value
update_left_custom_brush()
# warning-ignore:unused_argument
func _on_RightInterpolateFactor_value_changed(value : float) -> void:
Global.right_interpolate_spinbox.value = value
Global.right_interpolate_slider.value = value
update_right_custom_brush()
func update_left_custom_brush() -> void:
@ -1158,11 +1162,15 @@ func _on_LeftLightenDarken_item_selected(ID : int) -> void:
Global.left_ld = ID
func _on_LeftLDAmountSpinbox_value_changed(value : float) -> void:
Global.left_ld_amount = value / 100
Global.left_ld_amount_slider.value = value
Global.left_ld_amount_spinbox.value = value
func _on_RightLightenDarken_item_selected(ID : int) -> void:
Global.right_ld = ID
func _on_RightLDAmountSpinbox_value_changed(value : float) -> void:
Global.right_ld_amount = value / 100
Global.right_ld_amount_slider.value = value
Global.right_ld_amount_spinbox.value = value
func _on_LeftHorizontalMirroring_toggled(button_pressed) -> void:
Global.left_horizontal_mirror = button_pressed