2020-05-19 00:51:16 +00:00
|
|
|
extends VBoxContainer
|
|
|
|
|
|
|
|
|
2020-05-31 21:44:53 +00:00
|
|
|
var previous_colors := [Color.black, Color.white]
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorSwitch_pressed() -> void:
|
2020-05-31 15:40:47 +00:00
|
|
|
var temp : Color = Global.color_pickers[0].color
|
2020-05-31 15:03:44 +00:00
|
|
|
Global.color_pickers[0].color = Global.color_pickers[1].color
|
|
|
|
Global.color_pickers[1].color = temp
|
2020-05-31 15:40:47 +00:00
|
|
|
Global.update_custom_brush(0)
|
|
|
|
Global.update_custom_brush(1)
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton_color_changed(color : Color, right : bool):
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
2020-05-19 00:51:16 +00:00
|
|
|
# If the color changed while it's on full transparency, make it opaque (GH issue #54)
|
2020-05-31 21:44:53 +00:00
|
|
|
if color.a == 0:
|
|
|
|
if previous_colors[mouse_button].r != color.r or previous_colors[mouse_button].g != color.g or previous_colors[mouse_button].b != color.b:
|
|
|
|
Global.color_pickers[mouse_button].color.a = 1
|
|
|
|
Global.update_custom_brush(mouse_button)
|
|
|
|
previous_colors[mouse_button] = color
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
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-31 15:40:47 +00:00
|
|
|
Global.update_custom_brush(0)
|
|
|
|
Global.update_custom_brush(1)
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_FitToFrameButton_pressed() -> void:
|
2020-06-04 20:20:20 +00:00
|
|
|
Global.camera.fit_to_frame(Global.current_project.size)
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_100ZoomButton_pressed() -> void:
|
|
|
|
Global.camera.zoom = Vector2.ONE
|
2020-06-04 20:20:20 +00:00
|
|
|
Global.camera.offset = Global.current_project.size / 2
|
2020-05-19 00:51:16 +00:00
|
|
|
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:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.brushes_popup.popup(Rect2(Global.brush_type_buttons[mouse_button].rect_global_position, Vector2(226, 72)))
|
|
|
|
Global.brush_type_window_position = mouse_button
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_BrushSizeEdit_value_changed(value : float, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
2020-05-19 00:51:16 +00:00
|
|
|
var new_size = int(value)
|
2020-05-31 21:44:53 +00:00
|
|
|
Global.brush_size_edits[mouse_button].value = value
|
|
|
|
Global.brush_size_sliders[mouse_button].value = value
|
|
|
|
Global.brush_sizes[mouse_button] = new_size
|
|
|
|
Global.update_custom_brush(mouse_button)
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_PixelPerfectMode_toggled(button_pressed : bool, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.pixel_perfect[mouse_button] = button_pressed
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_InterpolateFactor_value_changed(value : float, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.interpolate_spinboxes[mouse_button].value = value
|
|
|
|
Global.interpolate_sliders[mouse_button].value = value
|
|
|
|
Global.update_custom_brush(mouse_button)
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_FillAreaOptions_item_selected(ID : int, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.fill_areas[mouse_button] = ID
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_FillWithOptions_item_selected(ID : int, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.fill_with[mouse_button] = ID
|
|
|
|
if ID == 1:
|
|
|
|
Global.fill_pattern_containers[mouse_button].visible = true
|
2020-05-19 00:51:16 +00:00
|
|
|
else:
|
2020-05-31 21:44:53 +00:00
|
|
|
Global.fill_pattern_containers[mouse_button].visible = false
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_PatternTypeButton_pressed(right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.pattern_window_position = mouse_button
|
|
|
|
Global.patterns_popup.popup(Rect2(Global.brush_type_buttons[mouse_button].rect_global_position, Vector2(226, 72)))
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_PatternOffsetX_value_changed(value : float, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.fill_pattern_offsets[mouse_button].x = value
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_PatternOffsetY_value_changed(value : float, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.fill_pattern_offsets[mouse_button].y = value
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_LightenDarken_item_selected(ID : int, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.ld_modes[mouse_button] = ID
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_LDAmount_value_changed(value : float, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.ld_amounts[mouse_button] = value / 100
|
|
|
|
Global.ld_amount_sliders[mouse_button].value = value
|
|
|
|
Global.ld_amount_spinboxes[mouse_button].value = value
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ForColorOptions_item_selected(ID : int, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.color_picker_for[mouse_button] = ID
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ZoomModeOptions_item_selected(ID : int, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.zoom_modes[mouse_button] = ID
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_HorizontalMirroring_toggled(button_pressed : bool, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.horizontal_mirror[mouse_button] = button_pressed
|
2020-05-19 00:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_VerticalMirroring_toggled(button_pressed : bool, right : bool) -> void:
|
2020-05-31 21:44:53 +00:00
|
|
|
var mouse_button := int(right)
|
|
|
|
Global.vertical_mirror[mouse_button] = button_pressed
|