mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 06:54:43 -04:00
Changes to the tool options UI
New option for the color picker tool (closes #115 - also includes new translatable strings), VSplitContainer for the tools and their options and a ScrollContainer for the tool options.
This commit is contained in:
parent
60422c0133
commit
5cce9d3180
15 changed files with 514 additions and 311 deletions
|
@ -107,6 +107,7 @@ func _input(event : InputEvent) -> void:
|
|||
# For the LightenDarken tool
|
||||
var ld := 0
|
||||
var ld_amount := 0.1
|
||||
var color_picker_for := 0
|
||||
|
||||
west_limit = location.x
|
||||
east_limit = location.x + size.x
|
||||
|
@ -125,6 +126,7 @@ func _input(event : InputEvent) -> void:
|
|||
fill_area = Global.left_fill_area
|
||||
ld = Global.left_ld
|
||||
ld_amount = Global.left_ld_amount
|
||||
color_picker_for = Global.left_color_picker_for
|
||||
elif Input.is_mouse_button_pressed(BUTTON_RIGHT):
|
||||
current_mouse_button = "right_mouse"
|
||||
current_action = Global.current_right_tool
|
||||
|
@ -132,6 +134,7 @@ func _input(event : InputEvent) -> void:
|
|||
fill_area = Global.right_fill_area
|
||||
ld = Global.right_ld
|
||||
ld_amount = Global.right_ld_amount
|
||||
color_picker_for = Global.right_color_picker_for
|
||||
|
||||
if Global.current_frame == frame:
|
||||
if mouse_in_canvas && Global.has_focus:
|
||||
|
@ -251,10 +254,10 @@ func _input(event : InputEvent) -> void:
|
|||
"ColorPicker":
|
||||
if can_handle && Global.current_frame == frame:
|
||||
var pixel_color : Color = layers[current_layer_index][0].get_pixelv(mouse_pos)
|
||||
if current_mouse_button == "left_mouse":
|
||||
if color_picker_for == 0: # Pick for the left color
|
||||
Global.left_color_picker.color = pixel_color
|
||||
Global.update_left_custom_brush()
|
||||
elif current_mouse_button == "right_mouse":
|
||||
elif color_picker_for == 1: # Pick for the left color
|
||||
Global.right_color_picker.color = pixel_color
|
||||
Global.update_right_custom_brush()
|
||||
|
||||
|
|
|
@ -57,6 +57,12 @@ var left_ld_amount := 0.1
|
|||
# warning-ignore:unused_class_variable
|
||||
var right_ld_amount := 0.1
|
||||
|
||||
# 0 for the left, 1 for the right
|
||||
# warning-ignore:unused_class_variable
|
||||
var left_color_picker_for := 0
|
||||
# warning-ignore:unused_class_variable
|
||||
var right_color_picker_for := 1
|
||||
|
||||
# warning-ignore:unused_class_variable
|
||||
var left_horizontal_mirror := false
|
||||
# warning-ignore:unused_class_variable
|
||||
|
@ -185,6 +191,9 @@ var right_ld_container : Container
|
|||
var right_ld_amount_slider : HSlider
|
||||
var right_ld_amount_spinbox : SpinBox
|
||||
|
||||
var left_colorpicker_container : Container
|
||||
var right_colorpicker_container : Container
|
||||
|
||||
var left_mirror_container : Container
|
||||
var right_mirror_container : Container
|
||||
|
||||
|
@ -297,6 +306,9 @@ func _ready() -> void:
|
|||
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_colorpicker_container = find_node_by_name(left_tool_options_container, "LeftColorPickerOptions")
|
||||
right_colorpicker_container = find_node_by_name(right_tool_options_container, "RightColorPickerOptions")
|
||||
|
||||
left_mirror_container = find_node_by_name(left_tool_options_container, "LeftMirroring")
|
||||
right_mirror_container = find_node_by_name(right_tool_options_container, "RightMirroring")
|
||||
|
||||
|
|
|
@ -572,6 +572,8 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
|
|||
Global.left_brush_size_container.visible = true
|
||||
Global.left_ld_container.visible = true
|
||||
Global.left_mirror_container.visible = true
|
||||
elif current_action == "ColorPicker":
|
||||
Global.left_colorpicker_container.visible = true
|
||||
|
||||
elif (mouse_press && Input.is_action_just_released("right_mouse")) || (!mouse_press && !key_for_left):
|
||||
Global.current_right_tool = current_action
|
||||
|
@ -597,6 +599,8 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
|
|||
Global.right_brush_size_container.visible = true
|
||||
Global.right_ld_container.visible = true
|
||||
Global.right_mirror_container.visible = true
|
||||
elif current_action == "ColorPicker":
|
||||
Global.right_colorpicker_container.visible = true
|
||||
|
||||
for t in tools:
|
||||
var tool_name : String = t[0].name
|
||||
|
@ -925,6 +929,12 @@ func _on_RightLDAmountSpinbox_value_changed(value : float) -> void:
|
|||
Global.right_ld_amount_slider.value = value
|
||||
Global.right_ld_amount_spinbox.value = value
|
||||
|
||||
func _on_LeftForColorOptions_item_selected(ID : int) -> void:
|
||||
Global.left_color_picker_for = ID
|
||||
|
||||
func _on_RightForColorOptions_item_selected(ID : int) -> void:
|
||||
Global.right_color_picker_for = ID
|
||||
|
||||
func _on_LeftHorizontalMirroring_toggled(button_pressed) -> void:
|
||||
Global.left_horizontal_mirror = button_pressed
|
||||
func _on_LeftVerticalMirroring_toggled(button_pressed) -> void:
|
||||
|
@ -947,3 +957,4 @@ func _on_QuitDialog_confirmed() -> void:
|
|||
modulate = Color(0.5, 0.5, 0.5)
|
||||
|
||||
get_tree().quit()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue