2020-05-19 00:51:16 +00:00
|
|
|
extends VBoxContainer
|
|
|
|
|
|
|
|
|
|
|
|
var previous_left_color := Color.black
|
|
|
|
var previous_right_color := Color.white
|
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorSwitch_pressed() -> void:
|
2020-05-31 15:03:44 +00:00
|
|
|
var temp: Color = Global.color_pickers[0].color
|
|
|
|
Global.color_pickers[0].color = Global.color_pickers[1].color
|
|
|
|
Global.color_pickers[1].color = temp
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.update_left_custom_brush()
|
|
|
|
Global.update_right_custom_brush()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton_color_changed(color : Color, right : bool):
|
|
|
|
# If the color changed while it's on full transparency, make it opaque (GH issue #54)
|
|
|
|
if right:
|
|
|
|
if color.a == 0:
|
|
|
|
if previous_right_color.r != color.r or previous_right_color.g != color.g or previous_right_color.b != color.b:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.color_pickers[1].color.a = 1
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.update_right_custom_brush()
|
|
|
|
previous_right_color = color
|
|
|
|
else:
|
|
|
|
if color.a == 0:
|
|
|
|
if previous_left_color.r != color.r or previous_left_color.g != color.g or previous_left_color.b != color.b:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.color_pickers[0].color.a = 1
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.update_left_custom_brush()
|
|
|
|
previous_left_color = color
|
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton_pressed() -> void:
|
|
|
|
Global.can_draw = false
|
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton_popup_closed() -> void:
|
|
|
|
Global.can_draw = true
|
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorDefaults_pressed() -> void:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.color_pickers[0].color = Color.black
|
|
|
|
Global.color_pickers[1].color = Color.white
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.update_left_custom_brush()
|
|
|
|
Global.update_right_custom_brush()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_FitToFrameButton_pressed() -> void:
|
|
|
|
Global.camera.fit_to_frame(Global.canvas.size)
|
|
|
|
|
|
|
|
|
|
|
|
func _on_100ZoomButton_pressed() -> void:
|
|
|
|
Global.camera.zoom = Vector2.ONE
|
|
|
|
Global.camera.offset = Global.canvas.size / 2
|
|
|
|
Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %"
|
|
|
|
Global.horizontal_ruler.update()
|
|
|
|
Global.vertical_ruler.update()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BrushTypeButton_pressed(right : bool) -> void:
|
|
|
|
if right:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.brushes_popup.popup(Rect2(Global.brush_type_buttons[1].rect_global_position, Vector2(226, 72)))
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.brush_type_window_position = "right"
|
|
|
|
else:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.brushes_popup.popup(Rect2(Global.brush_type_buttons[0].rect_global_position, Vector2(226, 72)))
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.brush_type_window_position = "left"
|
|
|
|
|
|
|
|
|
|
|
|
func _on_BrushSizeEdit_value_changed(value : float, right : bool) -> void:
|
|
|
|
var new_size = int(value)
|
|
|
|
if right:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.brush_size_edits[1].value = value
|
|
|
|
Global.brush_size_sliders[1].value = value
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.right_brush_size = new_size
|
|
|
|
Global.update_right_custom_brush()
|
|
|
|
else:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.brush_size_edits[0].value = value
|
|
|
|
Global.brush_size_sliders[0].value = value
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.left_brush_size = new_size
|
|
|
|
Global.update_left_custom_brush()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_PixelPerfectMode_toggled(button_pressed : bool, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_pixel_perfect = button_pressed
|
|
|
|
else:
|
|
|
|
Global.left_pixel_perfect = button_pressed
|
|
|
|
|
|
|
|
|
|
|
|
func _on_InterpolateFactor_value_changed(value : float, right : bool) -> void:
|
|
|
|
if right:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.interpolate_spinboxes[1].value = value
|
|
|
|
Global.interpolate_sliders[1].value = value
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.update_right_custom_brush()
|
|
|
|
else:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.interpolate_spinboxes[0].value = value
|
|
|
|
Global.interpolate_sliders[0].value = value
|
2020-05-19 00:51:16 +00:00
|
|
|
Global.update_left_custom_brush()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_FillAreaOptions_item_selected(ID : int, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_fill_area = ID
|
|
|
|
else:
|
|
|
|
Global.left_fill_area = ID
|
|
|
|
|
|
|
|
|
|
|
|
func _on_FillWithOptions_item_selected(ID : int, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_fill_with = ID
|
|
|
|
if ID == 1:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.fill_pattern_containers[1].visible = true
|
2020-05-19 00:51:16 +00:00
|
|
|
else:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.fill_pattern_containers[1].visible = false
|
2020-05-19 00:51:16 +00:00
|
|
|
else:
|
|
|
|
Global.left_fill_with = ID
|
|
|
|
if ID == 1:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.fill_pattern_containers[0].visible = true
|
2020-05-19 00:51:16 +00:00
|
|
|
else:
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.fill_pattern_containers[0].visible = false
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_PatternTypeButton_pressed(right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.pattern_window_position = "right"
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.patterns_popup.popup(Rect2(Global.brush_type_buttons[1].rect_global_position, Vector2(226, 72)))
|
2020-05-19 00:51:16 +00:00
|
|
|
else:
|
|
|
|
Global.pattern_window_position = "left"
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.patterns_popup.popup(Rect2(Global.brush_type_buttons[0].rect_global_position, Vector2(226, 72)))
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_PatternOffsetX_value_changed(value : float, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_fill_pattern_offset.x = value
|
|
|
|
else:
|
|
|
|
Global.left_fill_pattern_offset.x = value
|
|
|
|
|
|
|
|
|
|
|
|
func _on_PatternOffsetY_value_changed(value : float, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_fill_pattern_offset.y = value
|
|
|
|
else:
|
|
|
|
Global.left_fill_pattern_offset.y = value
|
|
|
|
|
|
|
|
|
|
|
|
func _on_LightenDarken_item_selected(ID : int, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_ld = ID
|
|
|
|
else:
|
|
|
|
Global.left_ld = ID
|
|
|
|
|
|
|
|
|
|
|
|
func _on_LDAmount_value_changed(value : float, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_ld_amount = value / 100
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.ld_amount_sliders[1].value = value
|
|
|
|
Global.ld_amount_spinboxes[1].value = value
|
2020-05-19 00:51:16 +00:00
|
|
|
else:
|
|
|
|
Global.left_ld_amount = value / 100
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.ld_amount_sliders[0].value = value
|
|
|
|
Global.ld_amount_spinboxes[0].value = value
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ForColorOptions_item_selected(ID : int, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_color_picker_for = ID
|
|
|
|
else:
|
|
|
|
Global.left_color_picker_for = ID
|
|
|
|
|
|
|
|
|
|
|
|
func _on_ZoomModeOptions_item_selected(ID : int, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_zoom_mode = ID
|
|
|
|
else:
|
|
|
|
Global.left_zoom_mode = ID
|
|
|
|
|
|
|
|
|
|
|
|
func _on_HorizontalMirroring_toggled(button_pressed : bool, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_horizontal_mirror = button_pressed
|
|
|
|
else:
|
|
|
|
Global.left_horizontal_mirror = button_pressed
|
|
|
|
|
|
|
|
|
|
|
|
func _on_VerticalMirroring_toggled(button_pressed : bool, right : bool) -> void:
|
|
|
|
if right:
|
|
|
|
Global.right_vertical_mirror = button_pressed
|
|
|
|
else:
|
|
|
|
Global.left_vertical_mirror = button_pressed
|