mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Changed Global node variables to arrays for left/right
Instead of having 2 variables for left & right nodes, use an array instead. This will help with better looking code, automation and less repetitive code, as seen in ToolButtons.gd. Move related refactoring will follow.
This commit is contained in:
parent
37a8ad2447
commit
c538140de2
|
@ -39,7 +39,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
|
|||
color.a *= (1.0 - pen_pressure)
|
||||
if current_mouse_button == "left_mouse":
|
||||
brush_size = Global.left_brush_size
|
||||
brush_type = Global.current_left_brush_type
|
||||
brush_type = Global.current_brush_type[0]
|
||||
brush_index = Global.custom_left_brush_index
|
||||
if brush_type != Global.Brush_Types.RANDOM_FILE:
|
||||
custom_brush_image = Global.custom_left_brush_image
|
||||
|
@ -50,7 +50,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
|
|||
custom_brush_image.copy_from(brush_button.random_brushes[random_index])
|
||||
var custom_brush_size = custom_brush_image.get_size()
|
||||
custom_brush_image.resize(custom_brush_size.x * brush_size, custom_brush_size.y * brush_size, Image.INTERPOLATE_NEAREST)
|
||||
custom_brush_image = Global.blend_image_with_color(custom_brush_image, color, Global.left_interpolate_spinbox.value / 100)
|
||||
custom_brush_image = Global.blend_image_with_color(custom_brush_image, color, Global.interpolate_spinboxes[0].value / 100)
|
||||
custom_brush_image.lock()
|
||||
|
||||
horizontal_mirror = Global.left_horizontal_mirror
|
||||
|
@ -61,7 +61,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
|
|||
|
||||
elif current_mouse_button == "right_mouse":
|
||||
brush_size = Global.right_brush_size
|
||||
brush_type = Global.current_right_brush_type
|
||||
brush_type = Global.current_brush_type[1]
|
||||
brush_index = Global.custom_right_brush_index
|
||||
if brush_type != Global.Brush_Types.RANDOM_FILE:
|
||||
custom_brush_image = Global.custom_right_brush_image
|
||||
|
@ -72,7 +72,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
|
|||
custom_brush_image.copy_from(brush_button.random_brushes[random_index])
|
||||
var custom_brush_size = custom_brush_image.get_size()
|
||||
custom_brush_image.resize(custom_brush_size.x * brush_size, custom_brush_size.y * brush_size, Image.INTERPOLATE_NEAREST)
|
||||
custom_brush_image = Global.blend_image_with_color(custom_brush_image, color, Global.right_interpolate_spinbox.value / 100)
|
||||
custom_brush_image = Global.blend_image_with_color(custom_brush_image, color, Global.interpolate_spinboxes[1].value / 100)
|
||||
custom_brush_image.lock()
|
||||
|
||||
horizontal_mirror = Global.right_horizontal_mirror
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
extends Node
|
||||
|
||||
|
||||
enum Grid_Types {CARTESIAN, ISOMETRIC, ALL}
|
||||
enum Pressure_Sensitivity {NONE, ALPHA, SIZE, ALPHA_AND_SIZE}
|
||||
enum Brush_Types {PIXEL, CIRCLE, FILLED_CIRCLE, FILE, RANDOM_FILE, CUSTOM}
|
||||
enum Direction {UP, DOWN, LEFT, RIGHT}
|
||||
enum Mouse_Button {LEFT, RIGHT}
|
||||
enum Tools {PENCIL, ERASER, BUCKET, LIGHTENDARKEN, RECTSELECT, COLORPICKER, ZOOM}
|
||||
|
||||
# Stuff for arrowkey-based canvas movements nyaa ^.^
|
||||
|
@ -87,9 +89,8 @@ var right_ld := 0
|
|||
var left_ld_amount := 0.1
|
||||
var right_ld_amount := 0.1
|
||||
|
||||
# 0 for the left, 1 for the right
|
||||
var left_color_picker_for := 0
|
||||
var right_color_picker_for := 1
|
||||
var left_color_picker_for : int = Mouse_Button.LEFT
|
||||
var right_color_picker_for : int = Mouse_Button.RIGHT
|
||||
|
||||
# 0 for zoom in, 1 for zoom out
|
||||
var left_zoom_mode := 0
|
||||
|
@ -119,8 +120,7 @@ var onion_skinning_blue_red := false
|
|||
# Brushes
|
||||
var left_brush_size := 1
|
||||
var right_brush_size := 1
|
||||
var current_left_brush_type = Brush_Types.PIXEL
|
||||
var current_right_brush_type = Brush_Types.PIXEL
|
||||
var current_brush_type := []
|
||||
|
||||
var brush_type_window_position := "left"
|
||||
var left_circle_points := []
|
||||
|
@ -173,58 +173,40 @@ var import_sprites_dialog : FileDialog
|
|||
var export_dialog : AcceptDialog
|
||||
var preferences_dialog : AcceptDialog
|
||||
|
||||
var left_color_picker : ColorPickerButton
|
||||
var right_color_picker : ColorPickerButton
|
||||
var color_pickers := []
|
||||
|
||||
var color_switch_button : BaseButton
|
||||
|
||||
var left_tool_options_container : Container
|
||||
var right_tool_options_container : Container
|
||||
var tool_options_containers := []
|
||||
|
||||
var left_brush_type_container : Container
|
||||
var right_brush_type_container : Container
|
||||
var left_brush_type_button : BaseButton
|
||||
var right_brush_type_button : BaseButton
|
||||
var brush_type_containers := []
|
||||
var brush_type_buttons := []
|
||||
var brushes_popup : Popup
|
||||
var file_brush_container : GridContainer
|
||||
var project_brush_container : GridContainer
|
||||
var patterns_popup : Popup
|
||||
|
||||
var left_brush_size_edit : SpinBox
|
||||
var left_brush_size_slider : HSlider
|
||||
var right_brush_size_edit : SpinBox
|
||||
var right_brush_size_slider : HSlider
|
||||
var brush_size_edits := []
|
||||
var brush_size_sliders := []
|
||||
|
||||
var left_pixel_perfect_container : VBoxContainer
|
||||
var right_pixel_perfect_container : VBoxContainer
|
||||
var pixel_perfect_containers := []
|
||||
|
||||
var left_color_interpolation_container : Container
|
||||
var right_color_interpolation_container : Container
|
||||
var left_interpolate_spinbox : SpinBox
|
||||
var left_interpolate_slider : HSlider
|
||||
var right_interpolate_spinbox : SpinBox
|
||||
var right_interpolate_slider : HSlider
|
||||
var color_interpolation_containers := []
|
||||
var interpolate_spinboxes := []
|
||||
var interpolate_sliders := []
|
||||
|
||||
var left_fill_area_container : Container
|
||||
var left_fill_pattern_container : Container
|
||||
var right_fill_area_container : Container
|
||||
var right_fill_pattern_container : Container
|
||||
var fill_area_containers := []
|
||||
var fill_pattern_containers := []
|
||||
|
||||
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 ld_containers := []
|
||||
var ld_amount_sliders := []
|
||||
var ld_amount_spinboxes := []
|
||||
|
||||
var left_colorpicker_container : Container
|
||||
var right_colorpicker_container : Container
|
||||
var colorpicker_containers := []
|
||||
|
||||
var left_zoom_container : Container
|
||||
var right_zoom_container : Container
|
||||
var zoom_containers := []
|
||||
|
||||
var left_mirror_container : Container
|
||||
var right_mirror_container : Container
|
||||
var mirror_containers := []
|
||||
|
||||
var animation_timeline : Panel
|
||||
|
||||
|
@ -276,6 +258,8 @@ func _ready() -> void:
|
|||
|
||||
undo_redo = UndoRedo.new()
|
||||
image_clipboard = Image.new()
|
||||
current_brush_type.append(Brush_Types.PIXEL)
|
||||
current_brush_type.append(Brush_Types.PIXEL)
|
||||
|
||||
var root = get_tree().get_root()
|
||||
control = find_node_by_name(root, "Control")
|
||||
|
@ -311,57 +295,57 @@ func _ready() -> void:
|
|||
export_dialog = find_node_by_name(root, "ExportDialog")
|
||||
preferences_dialog = find_node_by_name(root, "PreferencesDialog")
|
||||
|
||||
left_tool_options_container = find_node_by_name(root, "LeftToolOptions")
|
||||
right_tool_options_container = find_node_by_name(root, "RightToolOptions")
|
||||
tool_options_containers.append(find_node_by_name(root, "LeftToolOptions"))
|
||||
tool_options_containers.append(find_node_by_name(root, "RightToolOptions"))
|
||||
|
||||
left_color_picker = find_node_by_name(root, "LeftColorPickerButton")
|
||||
right_color_picker = find_node_by_name(root, "RightColorPickerButton")
|
||||
color_pickers.append(find_node_by_name(root, "LeftColorPickerButton"))
|
||||
color_pickers.append(find_node_by_name(root, "RightColorPickerButton"))
|
||||
color_switch_button = find_node_by_name(root, "ColorSwitch")
|
||||
|
||||
left_brush_type_container = find_node_by_name(left_tool_options_container, "LeftBrushType")
|
||||
right_brush_type_container = find_node_by_name(right_tool_options_container, "RightBrushType")
|
||||
left_brush_type_button = find_node_by_name(left_brush_type_container, "LeftBrushTypeButton")
|
||||
right_brush_type_button = find_node_by_name(right_brush_type_container, "RightBrushTypeButton")
|
||||
brush_type_containers.append(find_node_by_name(tool_options_containers[0], "LeftBrushType"))
|
||||
brush_type_containers.append(find_node_by_name(tool_options_containers[1], "RightBrushType"))
|
||||
brush_type_buttons.append(find_node_by_name(brush_type_containers[0], "LeftBrushTypeButton"))
|
||||
brush_type_buttons.append(find_node_by_name(brush_type_containers[1], "RightBrushTypeButton"))
|
||||
brushes_popup = find_node_by_name(root, "BrushesPopup")
|
||||
file_brush_container = find_node_by_name(brushes_popup, "FileBrushContainer")
|
||||
project_brush_container = find_node_by_name(brushes_popup, "ProjectBrushContainer")
|
||||
patterns_popup = find_node_by_name(root, "PatternsPopup")
|
||||
|
||||
left_brush_size_edit = find_node_by_name(root, "LeftBrushSizeEdit")
|
||||
left_brush_size_slider = find_node_by_name(root, "LeftBrushSizeSlider")
|
||||
right_brush_size_edit = find_node_by_name(root, "RightBrushSizeEdit")
|
||||
right_brush_size_slider = find_node_by_name(root, "RightBrushSizeSlider")
|
||||
brush_size_edits.append(find_node_by_name(root, "LeftBrushSizeEdit"))
|
||||
brush_size_sliders.append(find_node_by_name(root, "LeftBrushSizeSlider"))
|
||||
brush_size_edits.append(find_node_by_name(root, "RightBrushSizeEdit"))
|
||||
brush_size_sliders.append(find_node_by_name(root, "RightBrushSizeSlider"))
|
||||
|
||||
left_pixel_perfect_container = find_node_by_name(root, "LeftBrushPixelPerfectMode")
|
||||
right_pixel_perfect_container = find_node_by_name(root, "RightBrushPixelPerfectMode")
|
||||
pixel_perfect_containers.append(find_node_by_name(root, "LeftBrushPixelPerfectMode"))
|
||||
pixel_perfect_containers.append(find_node_by_name(root, "RightBrushPixelPerfectMode"))
|
||||
|
||||
left_color_interpolation_container = find_node_by_name(root, "LeftColorInterpolation")
|
||||
right_color_interpolation_container = find_node_by_name(root, "RightColorInterpolation")
|
||||
left_interpolate_spinbox = find_node_by_name(root, "LeftInterpolateFactor")
|
||||
left_interpolate_slider = find_node_by_name(root, "LeftInterpolateSlider")
|
||||
right_interpolate_spinbox = find_node_by_name(root, "RightInterpolateFactor")
|
||||
right_interpolate_slider = find_node_by_name(root, "RightInterpolateSlider")
|
||||
color_interpolation_containers.append(find_node_by_name(root, "LeftColorInterpolation"))
|
||||
color_interpolation_containers.append(find_node_by_name(root, "RightColorInterpolation"))
|
||||
interpolate_spinboxes.append(find_node_by_name(root, "LeftInterpolateFactor"))
|
||||
interpolate_sliders.append(find_node_by_name(root, "LeftInterpolateSlider"))
|
||||
interpolate_spinboxes.append(find_node_by_name(root, "RightInterpolateFactor"))
|
||||
interpolate_sliders.append(find_node_by_name(root, "RightInterpolateSlider"))
|
||||
|
||||
left_fill_area_container = find_node_by_name(root, "LeftFillArea")
|
||||
left_fill_pattern_container = find_node_by_name(root, "LeftFillPattern")
|
||||
right_fill_area_container = find_node_by_name(root, "RightFillArea")
|
||||
right_fill_pattern_container = find_node_by_name(root, "RightFillPattern")
|
||||
fill_area_containers.append(find_node_by_name(root, "LeftFillArea"))
|
||||
fill_pattern_containers.append(find_node_by_name(root, "LeftFillPattern"))
|
||||
fill_area_containers.append(find_node_by_name(root, "RightFillArea"))
|
||||
fill_pattern_containers.append(find_node_by_name(root, "RightFillPattern"))
|
||||
|
||||
left_ld_container = find_node_by_name(root, "LeftLDOptions")
|
||||
left_ld_amount_slider = find_node_by_name(root, "LeftLDAmountSlider")
|
||||
left_ld_amount_spinbox = find_node_by_name(root, "LeftLDAmountSpinbox")
|
||||
right_ld_container = find_node_by_name(root, "RightLDOptions")
|
||||
right_ld_amount_slider = find_node_by_name(root, "RightLDAmountSlider")
|
||||
right_ld_amount_spinbox = find_node_by_name(root, "RightLDAmountSpinbox")
|
||||
ld_containers.append(find_node_by_name(root, "LeftLDOptions"))
|
||||
ld_amount_sliders.append(find_node_by_name(root, "LeftLDAmountSlider"))
|
||||
ld_amount_spinboxes.append(find_node_by_name(root, "LeftLDAmountSpinbox"))
|
||||
ld_containers.append(find_node_by_name(root, "RightLDOptions"))
|
||||
ld_amount_sliders.append(find_node_by_name(root, "RightLDAmountSlider"))
|
||||
ld_amount_spinboxes.append(find_node_by_name(root, "RightLDAmountSpinbox"))
|
||||
|
||||
left_colorpicker_container = find_node_by_name(root, "LeftColorPickerOptions")
|
||||
right_colorpicker_container = find_node_by_name(root, "RightColorPickerOptions")
|
||||
colorpicker_containers.append(find_node_by_name(root, "LeftColorPickerOptions"))
|
||||
colorpicker_containers.append(find_node_by_name(root, "RightColorPickerOptions"))
|
||||
|
||||
left_zoom_container = find_node_by_name(root, "LeftZoomOptions")
|
||||
right_zoom_container = find_node_by_name(root, "RightZoomOptions")
|
||||
zoom_containers.append(find_node_by_name(root, "LeftZoomOptions"))
|
||||
zoom_containers.append(find_node_by_name(root, "RightZoomOptions"))
|
||||
|
||||
left_mirror_container = find_node_by_name(root, "LeftMirrorButtons")
|
||||
right_mirror_container = find_node_by_name(root, "RightMirrorButtons")
|
||||
mirror_containers.append(find_node_by_name(root, "LeftMirrorButtons"))
|
||||
mirror_containers.append(find_node_by_name(root, "RightMirrorButtons"))
|
||||
|
||||
animation_timeline = find_node_by_name(root, "AnimationTimeline")
|
||||
|
||||
|
@ -859,8 +843,8 @@ func create_brush_button(brush_img : Image, brush_type := Brush_Types.CUSTOM, hi
|
|||
|
||||
|
||||
func remove_brush_buttons() -> void:
|
||||
current_left_brush_type = Brush_Types.PIXEL
|
||||
current_right_brush_type = Brush_Types.PIXEL
|
||||
current_brush_type[0] = Brush_Types.PIXEL
|
||||
current_brush_type[1] = Brush_Types.PIXEL
|
||||
for child in project_brush_container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
|
@ -882,55 +866,55 @@ func redo_custom_brush(_brush_button : BaseButton = null) -> void:
|
|||
|
||||
|
||||
func update_left_custom_brush() -> void:
|
||||
if current_left_brush_type == Brush_Types.PIXEL:
|
||||
if current_brush_type[0] == Brush_Types.PIXEL:
|
||||
var pixel := Image.new()
|
||||
pixel = preload("res://assets/graphics/pixel_image.png")
|
||||
left_brush_type_button.get_child(0).texture.create_from_image(pixel, 0)
|
||||
elif current_left_brush_type == Brush_Types.CIRCLE:
|
||||
brush_type_buttons[0].get_child(0).texture.create_from_image(pixel, 0)
|
||||
elif current_brush_type[0] == Brush_Types.CIRCLE:
|
||||
var pixel := Image.new()
|
||||
pixel = preload("res://assets/graphics/circle_9x9.png")
|
||||
left_brush_type_button.get_child(0).texture.create_from_image(pixel, 0)
|
||||
brush_type_buttons[0].get_child(0).texture.create_from_image(pixel, 0)
|
||||
left_circle_points = plot_circle(left_brush_size)
|
||||
elif current_left_brush_type == Brush_Types.FILLED_CIRCLE:
|
||||
elif current_brush_type[0] == Brush_Types.FILLED_CIRCLE:
|
||||
var pixel := Image.new()
|
||||
pixel = preload("res://assets/graphics/circle_filled_9x9.png")
|
||||
left_brush_type_button.get_child(0).texture.create_from_image(pixel, 0)
|
||||
brush_type_buttons[0].get_child(0).texture.create_from_image(pixel, 0)
|
||||
left_circle_points = plot_circle(left_brush_size)
|
||||
else:
|
||||
var custom_brush := Image.new()
|
||||
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_spinbox.value / 100)
|
||||
custom_left_brush_image = blend_image_with_color(custom_brush, color_pickers[0].color, interpolate_spinboxes[0].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
|
||||
brush_type_buttons[0].get_child(0).texture = custom_left_brush_texture
|
||||
|
||||
|
||||
func update_right_custom_brush() -> void:
|
||||
if current_right_brush_type == Brush_Types.PIXEL:
|
||||
if current_brush_type[1] == Brush_Types.PIXEL:
|
||||
var pixel := Image.new()
|
||||
pixel = preload("res://assets/graphics/pixel_image.png")
|
||||
right_brush_type_button.get_child(0).texture.create_from_image(pixel, 0)
|
||||
elif current_right_brush_type == Brush_Types.CIRCLE:
|
||||
brush_type_buttons[1].get_child(0).texture.create_from_image(pixel, 0)
|
||||
elif current_brush_type[1] == Brush_Types.CIRCLE:
|
||||
var pixel := Image.new()
|
||||
pixel = preload("res://assets/graphics/circle_9x9.png")
|
||||
right_brush_type_button.get_child(0).texture.create_from_image(pixel, 0)
|
||||
brush_type_buttons[1].get_child(0).texture.create_from_image(pixel, 0)
|
||||
right_circle_points = plot_circle(right_brush_size)
|
||||
elif current_right_brush_type == Brush_Types.FILLED_CIRCLE:
|
||||
elif current_brush_type[1] == Brush_Types.FILLED_CIRCLE:
|
||||
var pixel := Image.new()
|
||||
pixel = preload("res://assets/graphics/circle_filled_9x9.png")
|
||||
right_brush_type_button.get_child(0).texture.create_from_image(pixel, 0)
|
||||
brush_type_buttons[1].get_child(0).texture.create_from_image(pixel, 0)
|
||||
right_circle_points = plot_circle(right_brush_size)
|
||||
else:
|
||||
var custom_brush := Image.new()
|
||||
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_spinbox.value / 100)
|
||||
custom_right_brush_image = blend_image_with_color(custom_brush, color_pickers[1].color, interpolate_spinboxes[1].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
|
||||
brush_type_buttons[1].get_child(0).texture = custom_right_brush_texture
|
||||
|
||||
|
||||
func blend_image_with_color(image : Image, color : Color, interpolate_factor : float) -> Image:
|
||||
|
|
|
@ -252,16 +252,16 @@ func import_patterns(priority_ordered_search_path: Array) -> void:
|
|||
Global.pattern_left_image = Global.patterns[0]
|
||||
var pattern_left_tex := ImageTexture.new()
|
||||
pattern_left_tex.create_from_image(Global.pattern_left_image, 0)
|
||||
Global.left_fill_pattern_container.get_child(0).get_child(0).texture = pattern_left_tex
|
||||
Global.left_fill_pattern_container.get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.left_fill_pattern_container.get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
Global.fill_pattern_containers[0].get_child(0).get_child(0).texture = pattern_left_tex
|
||||
Global.fill_pattern_containers[0].get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.fill_pattern_containers[0].get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
|
||||
Global.pattern_right_image = Global.patterns[0]
|
||||
var pattern_right_tex := ImageTexture.new()
|
||||
pattern_right_tex.create_from_image(Global.pattern_right_image, 0)
|
||||
Global.right_fill_pattern_container.get_child(0).get_child(0).texture = pattern_right_tex
|
||||
Global.right_fill_pattern_container.get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.right_fill_pattern_container.get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
Global.fill_pattern_containers[1].get_child(0).get_child(0).texture = pattern_right_tex
|
||||
Global.fill_pattern_containers[1].get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.fill_pattern_containers[1].get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
|
||||
|
||||
func import_gpl(path : String) -> Palette:
|
||||
|
|
|
@ -128,19 +128,19 @@ func open_pxo_file(path : String, untitled_backup : bool = false) -> void:
|
|||
Global.current_frame = frame - 1
|
||||
Global.layers = Global.layers # Just to call Global.layers_changed
|
||||
# Load tool options
|
||||
Global.left_color_picker.color = file.get_var()
|
||||
Global.right_color_picker.color = file.get_var()
|
||||
Global.color_pickers[0].color = file.get_var()
|
||||
Global.color_pickers[1].color = file.get_var()
|
||||
Global.left_brush_size = file.get_8()
|
||||
Global.left_brush_size_edit.value = Global.left_brush_size
|
||||
Global.brush_size_edits[0].value = Global.left_brush_size
|
||||
Global.right_brush_size = file.get_8()
|
||||
Global.right_brush_size_edit.value = Global.right_brush_size
|
||||
Global.brush_size_edits[1].value = Global.right_brush_size
|
||||
if file_major_version == 0 and file_minor_version < 7:
|
||||
var left_palette = file.get_var()
|
||||
var right_palette = file.get_var()
|
||||
for color in left_palette:
|
||||
Global.left_color_picker.get_picker().add_preset(color)
|
||||
Global.color_pickers[0].get_picker().add_preset(color)
|
||||
for color in right_palette:
|
||||
Global.right_color_picker.get_picker().add_preset(color)
|
||||
Global.color_pickers[1].get_picker().add_preset(color)
|
||||
|
||||
# Load custom brushes
|
||||
Global.custom_brushes.resize(Global.brushes_from_files)
|
||||
|
@ -224,8 +224,8 @@ func save_pxo_file(path : String, autosave : bool) -> void:
|
|||
file.store_line("END_FRAMES")
|
||||
|
||||
# Save tool options
|
||||
var left_color : Color = Global.left_color_picker.color
|
||||
var right_color : Color = Global.right_color_picker.color
|
||||
var left_color : Color = Global.color_pickers[0].color
|
||||
var right_color : Color = Global.color_pickers[1].color
|
||||
var left_brush_size : int = Global.left_brush_size
|
||||
var right_brush_size : int = Global.right_brush_size
|
||||
file.store_var(left_color)
|
||||
|
|
|
@ -171,12 +171,12 @@ func _draw() -> void:
|
|||
var mouse_pos := current_pixel
|
||||
mouse_pos = mouse_pos.floor()
|
||||
if Global.left_square_indicator_visible && Global.can_draw:
|
||||
if Global.current_left_brush_type == Global.Brush_Types.PIXEL || Global.current_left_tool == Global.Tools.LIGHTENDARKEN:
|
||||
if Global.current_brush_type[0] == Global.Brush_Types.PIXEL || Global.current_left_tool == Global.Tools.LIGHTENDARKEN:
|
||||
if Global.current_left_tool == Global.Tools.PENCIL || Global.current_left_tool == Global.Tools.ERASER || Global.current_left_tool == Global.Tools.LIGHTENDARKEN:
|
||||
var start_pos_x = mouse_pos.x - (Global.left_brush_size >> 1)
|
||||
var start_pos_y = mouse_pos.y - (Global.left_brush_size >> 1)
|
||||
draw_rect(Rect2(start_pos_x, start_pos_y, Global.left_brush_size, Global.left_brush_size), Color.blue, false)
|
||||
elif Global.current_left_brush_type == Global.Brush_Types.CIRCLE || Global.current_left_brush_type == Global.Brush_Types.FILLED_CIRCLE:
|
||||
elif Global.current_brush_type[0] == Global.Brush_Types.CIRCLE || Global.current_brush_type[0] == Global.Brush_Types.FILLED_CIRCLE:
|
||||
if Global.current_left_tool == Global.Tools.PENCIL || Global.current_left_tool == Global.Tools.ERASER:
|
||||
draw_set_transform(mouse_pos, rotation, scale)
|
||||
for rect in Global.left_circle_points:
|
||||
|
@ -189,12 +189,12 @@ func _draw() -> void:
|
|||
draw_texture(Global.custom_left_brush_texture, dst)
|
||||
|
||||
if Global.right_square_indicator_visible && Global.can_draw:
|
||||
if Global.current_right_brush_type == Global.Brush_Types.PIXEL || Global.current_right_tool == Global.Tools.LIGHTENDARKEN:
|
||||
if Global.current_brush_type[1] == Global.Brush_Types.PIXEL || Global.current_right_tool == Global.Tools.LIGHTENDARKEN:
|
||||
if Global.current_right_tool == Global.Tools.PENCIL || Global.current_right_tool == Global.Tools.ERASER || Global.current_right_tool == Global.Tools.LIGHTENDARKEN:
|
||||
var start_pos_x = mouse_pos.x - (Global.right_brush_size >> 1)
|
||||
var start_pos_y = mouse_pos.y - (Global.right_brush_size >> 1)
|
||||
draw_rect(Rect2(start_pos_x, start_pos_y, Global.right_brush_size, Global.right_brush_size), Color.red, false)
|
||||
elif Global.current_right_brush_type == Global.Brush_Types.CIRCLE || Global.current_right_brush_type == Global.Brush_Types.FILLED_CIRCLE:
|
||||
elif Global.current_brush_type[1] == Global.Brush_Types.CIRCLE || Global.current_brush_type[1] == Global.Brush_Types.FILLED_CIRCLE:
|
||||
if Global.current_right_tool == Global.Tools.PENCIL || Global.current_right_tool == Global.Tools.ERASER:
|
||||
draw_set_transform(mouse_pos, rotation, scale)
|
||||
for rect in Global.right_circle_points:
|
||||
|
@ -274,7 +274,7 @@ func _input(event : InputEvent) -> void:
|
|||
if Input.is_mouse_button_pressed(BUTTON_LEFT):
|
||||
current_mouse_button = "left_mouse"
|
||||
current_action = Global.current_left_tool
|
||||
current_color = Global.left_color_picker.color
|
||||
current_color = Global.color_pickers[0].color
|
||||
fill_area = Global.left_fill_area
|
||||
ld = Global.left_ld
|
||||
ld_amount = Global.left_ld_amount
|
||||
|
@ -284,7 +284,7 @@ func _input(event : InputEvent) -> void:
|
|||
elif Input.is_mouse_button_pressed(BUTTON_RIGHT):
|
||||
current_mouse_button = "right_mouse"
|
||||
current_action = Global.current_right_tool
|
||||
current_color = Global.right_color_picker.color
|
||||
current_color = Global.color_pickers[1].color
|
||||
fill_area = Global.right_fill_area
|
||||
ld = Global.right_ld
|
||||
ld_amount = Global.right_ld_amount
|
||||
|
@ -440,10 +440,10 @@ func _input(event : InputEvent) -> void:
|
|||
image_data.lock()
|
||||
var pixel_color : Color = image_data.get_pixelv(mouse_pos)
|
||||
if color_picker_for == 0: # Pick for the left color
|
||||
Global.left_color_picker.color = pixel_color
|
||||
Global.color_pickers[0].color = pixel_color
|
||||
Global.update_left_custom_brush()
|
||||
elif color_picker_for == 1: # Pick for the left color
|
||||
Global.right_color_picker.color = pixel_color
|
||||
Global.color_pickers[1].color = pixel_color
|
||||
Global.update_right_custom_brush()
|
||||
Global.Tools.ZOOM:
|
||||
if can_handle:
|
||||
|
|
|
@ -28,8 +28,8 @@ func _ready() -> void:
|
|||
Import.import_brushes(Global.directory_module.get_brushes_search_path_in_order())
|
||||
Import.import_patterns(Global.directory_module.get_patterns_search_path_in_order())
|
||||
|
||||
Global.left_color_picker.get_picker().presets_visible = false
|
||||
Global.right_color_picker.get_picker().presets_visible = false
|
||||
Global.color_pickers[0].get_picker().presets_visible = false
|
||||
Global.color_pickers[1].get_picker().presets_visible = false
|
||||
|
||||
$QuitAndSaveDialog.add_button("Save & Exit", false, "Save")
|
||||
$QuitAndSaveDialog.get_ok().text = "Exit without saving"
|
||||
|
|
|
@ -27,8 +27,8 @@ func open(palette : String) -> void:
|
|||
self.popup_centered()
|
||||
Global.dialog_open(true)
|
||||
|
||||
left_color_button.modulate = Global.left_color_picker.color
|
||||
right_color_button.modulate = Global.right_color_picker.color
|
||||
left_color_button.modulate = Global.color_pickers[0].color
|
||||
right_color_button.modulate = Global.color_pickers[1].color
|
||||
|
||||
|
||||
func _display_palette() -> void:
|
||||
|
@ -177,12 +177,12 @@ func _refresh_hint_tooltip(_index : int) -> void:
|
|||
|
||||
|
||||
func _on_LeftColor_pressed() -> void:
|
||||
color_picker.color = Global.left_color_picker.color
|
||||
color_picker.color = Global.color_pickers[0].color
|
||||
_on_EditPaletteColorPicker_color_changed(color_picker.color)
|
||||
|
||||
|
||||
func _on_RightColor_pressed() -> void:
|
||||
color_picker.color = Global.right_color_picker.color
|
||||
color_picker.color = Global.color_pickers[1].color
|
||||
_on_EditPaletteColorPicker_color_changed(color_picker.color)
|
||||
|
||||
|
||||
|
|
|
@ -165,10 +165,10 @@ func on_color_select(index : int) -> void:
|
|||
var color : Color = Global.palettes[current_palette].get_color(index)
|
||||
|
||||
if Input.is_action_just_pressed("left_mouse"):
|
||||
Global.left_color_picker.color = color
|
||||
Global.color_pickers[0].color = color
|
||||
Global.update_left_custom_brush()
|
||||
elif Input.is_action_just_pressed("right_mouse"):
|
||||
Global.right_color_picker.color = color
|
||||
Global.color_pickers[1].color = color
|
||||
Global.update_right_custom_brush()
|
||||
|
||||
|
||||
|
|
|
@ -14,46 +14,46 @@ func _on_BrushButton_pressed() -> void:
|
|||
|
||||
# Change left brush
|
||||
if Global.brush_type_window_position == "left":
|
||||
Global.current_left_brush_type = brush_type
|
||||
Global.current_brush_type[0] = brush_type
|
||||
Global.custom_left_brush_index = custom_brush_index
|
||||
if custom_brush_index > -1: # Custom brush
|
||||
if Global.current_left_tool == Global.Tools.PENCIL:
|
||||
Global.left_color_interpolation_container.visible = true
|
||||
Global.color_interpolation_containers[0].visible = true
|
||||
# if hint_tooltip == "":
|
||||
# Global.left_brush_type_label.text = tr("Custom brush")
|
||||
# else:
|
||||
# Global.left_brush_type_label.text = tr("Brush:") + " %s" % hint_tooltip
|
||||
elif custom_brush_index == -3: # Pixel brush
|
||||
Global.left_color_interpolation_container.visible = false
|
||||
Global.color_interpolation_containers[0].visible = false
|
||||
# Global.left_brush_type_label.text = tr("Brush: Pixel")
|
||||
elif custom_brush_index == -2: # Circle brush
|
||||
Global.left_color_interpolation_container.visible = false
|
||||
Global.color_interpolation_containers[0].visible = false
|
||||
# Global.left_brush_type_label.text = tr("Brush: Circle")
|
||||
elif custom_brush_index == -1: # Filled Circle brush
|
||||
Global.left_color_interpolation_container.visible = false
|
||||
Global.color_interpolation_containers[0].visible = false
|
||||
# Global.left_brush_type_label.text = tr("Brush: Filled Circle")
|
||||
|
||||
Global.update_left_custom_brush()
|
||||
Global.brushes_popup.hide()
|
||||
|
||||
else: # Change right brush
|
||||
Global.current_right_brush_type = brush_type
|
||||
Global.current_brush_type[1] = brush_type
|
||||
Global.custom_right_brush_index = custom_brush_index
|
||||
if custom_brush_index > -1:
|
||||
if Global.current_right_tool == Global.Tools.PENCIL:
|
||||
Global.right_color_interpolation_container.visible = true
|
||||
Global.color_interpolation_containers[1].visible = true
|
||||
# if hint_tooltip == "":
|
||||
# Global.right_brush_type_label.text = tr("Custom brush")
|
||||
# else:
|
||||
# Global.right_brush_type_label.text = tr("Brush:") + " %s" % hint_tooltip
|
||||
elif custom_brush_index == -3: # Pixel brush
|
||||
Global.right_color_interpolation_container.visible = false
|
||||
Global.color_interpolation_containers[1].visible = false
|
||||
# Global.right_brush_type_label.text = tr("Brush: Pixel")
|
||||
elif custom_brush_index == -2: # Circle brush
|
||||
Global.right_color_interpolation_container.visible = false
|
||||
Global.color_interpolation_containers[1].visible = false
|
||||
# Global.right_brush_type_label.text = tr("Brush: Circle")
|
||||
elif custom_brush_index == -1: # Filled Circle brush
|
||||
Global.right_color_interpolation_container.visible = false
|
||||
Global.color_interpolation_containers[1].visible = false
|
||||
# Global.right_brush_type_label.text = tr("Brush: Filled Circle")
|
||||
|
||||
Global.update_right_custom_brush()
|
||||
|
@ -64,12 +64,12 @@ func _on_DeleteButton_pressed() -> void:
|
|||
if brush_type == Global.Brush_Types.CUSTOM:
|
||||
if Global.custom_left_brush_index == custom_brush_index:
|
||||
Global.custom_left_brush_index = -3
|
||||
Global.current_left_brush_type = Global.Brush_Types.PIXEL
|
||||
Global.current_brush_type[0] = Global.Brush_Types.PIXEL
|
||||
# Global.left_brush_type_label.text = "Brush: Pixel"
|
||||
Global.update_left_custom_brush()
|
||||
if Global.custom_right_brush_index == custom_brush_index:
|
||||
Global.custom_right_brush_index = -3
|
||||
Global.current_right_brush_type = Global.Brush_Types.PIXEL
|
||||
Global.current_brush_type[1] = Global.Brush_Types.PIXEL
|
||||
# Global.right_brush_type_label.text = "Brush: Pixel"
|
||||
Global.update_right_custom_brush()
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ var previous_right_color := Color.white
|
|||
|
||||
|
||||
func _on_ColorSwitch_pressed() -> void:
|
||||
var temp: Color = Global.left_color_picker.color
|
||||
Global.left_color_picker.color = Global.right_color_picker.color
|
||||
Global.right_color_picker.color = temp
|
||||
var temp: Color = Global.color_pickers[0].color
|
||||
Global.color_pickers[0].color = Global.color_pickers[1].color
|
||||
Global.color_pickers[1].color = temp
|
||||
Global.update_left_custom_brush()
|
||||
Global.update_right_custom_brush()
|
||||
|
||||
|
@ -18,13 +18,13 @@ func _on_ColorPickerButton_color_changed(color : Color, right : bool):
|
|||
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:
|
||||
Global.right_color_picker.color.a = 1
|
||||
Global.color_pickers[1].color.a = 1
|
||||
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:
|
||||
Global.left_color_picker.color.a = 1
|
||||
Global.color_pickers[0].color.a = 1
|
||||
Global.update_left_custom_brush()
|
||||
previous_left_color = color
|
||||
|
||||
|
@ -38,8 +38,8 @@ func _on_ColorPickerButton_popup_closed() -> void:
|
|||
|
||||
|
||||
func _on_ColorDefaults_pressed() -> void:
|
||||
Global.left_color_picker.color = Color.black
|
||||
Global.right_color_picker.color = Color.white
|
||||
Global.color_pickers[0].color = Color.black
|
||||
Global.color_pickers[1].color = Color.white
|
||||
Global.update_left_custom_brush()
|
||||
Global.update_right_custom_brush()
|
||||
|
||||
|
@ -58,23 +58,23 @@ func _on_100ZoomButton_pressed() -> void:
|
|||
|
||||
func _on_BrushTypeButton_pressed(right : bool) -> void:
|
||||
if right:
|
||||
Global.brushes_popup.popup(Rect2(Global.right_brush_type_button.rect_global_position, Vector2(226, 72)))
|
||||
Global.brushes_popup.popup(Rect2(Global.brush_type_buttons[1].rect_global_position, Vector2(226, 72)))
|
||||
Global.brush_type_window_position = "right"
|
||||
else:
|
||||
Global.brushes_popup.popup(Rect2(Global.left_brush_type_button.rect_global_position, Vector2(226, 72)))
|
||||
Global.brushes_popup.popup(Rect2(Global.brush_type_buttons[0].rect_global_position, Vector2(226, 72)))
|
||||
Global.brush_type_window_position = "left"
|
||||
|
||||
|
||||
func _on_BrushSizeEdit_value_changed(value : float, right : bool) -> void:
|
||||
var new_size = int(value)
|
||||
if right:
|
||||
Global.right_brush_size_edit.value = value
|
||||
Global.right_brush_size_slider.value = value
|
||||
Global.brush_size_edits[1].value = value
|
||||
Global.brush_size_sliders[1].value = value
|
||||
Global.right_brush_size = new_size
|
||||
Global.update_right_custom_brush()
|
||||
else:
|
||||
Global.left_brush_size_edit.value = value
|
||||
Global.left_brush_size_slider.value = value
|
||||
Global.brush_size_edits[0].value = value
|
||||
Global.brush_size_sliders[0].value = value
|
||||
Global.left_brush_size = new_size
|
||||
Global.update_left_custom_brush()
|
||||
|
||||
|
@ -88,12 +88,12 @@ func _on_PixelPerfectMode_toggled(button_pressed : bool, right : bool) -> void:
|
|||
|
||||
func _on_InterpolateFactor_value_changed(value : float, right : bool) -> void:
|
||||
if right:
|
||||
Global.right_interpolate_spinbox.value = value
|
||||
Global.right_interpolate_slider.value = value
|
||||
Global.interpolate_spinboxes[1].value = value
|
||||
Global.interpolate_sliders[1].value = value
|
||||
Global.update_right_custom_brush()
|
||||
else:
|
||||
Global.left_interpolate_spinbox.value = value
|
||||
Global.left_interpolate_slider.value = value
|
||||
Global.interpolate_spinboxes[0].value = value
|
||||
Global.interpolate_sliders[0].value = value
|
||||
Global.update_left_custom_brush()
|
||||
|
||||
|
||||
|
@ -108,24 +108,24 @@ func _on_FillWithOptions_item_selected(ID : int, right : bool) -> void:
|
|||
if right:
|
||||
Global.right_fill_with = ID
|
||||
if ID == 1:
|
||||
Global.right_fill_pattern_container.visible = true
|
||||
Global.fill_pattern_containers[1].visible = true
|
||||
else:
|
||||
Global.right_fill_pattern_container.visible = false
|
||||
Global.fill_pattern_containers[1].visible = false
|
||||
else:
|
||||
Global.left_fill_with = ID
|
||||
if ID == 1:
|
||||
Global.left_fill_pattern_container.visible = true
|
||||
Global.fill_pattern_containers[0].visible = true
|
||||
else:
|
||||
Global.left_fill_pattern_container.visible = false
|
||||
Global.fill_pattern_containers[0].visible = false
|
||||
|
||||
|
||||
func _on_PatternTypeButton_pressed(right : bool) -> void:
|
||||
if right:
|
||||
Global.pattern_window_position = "right"
|
||||
Global.patterns_popup.popup(Rect2(Global.right_brush_type_button.rect_global_position, Vector2(226, 72)))
|
||||
Global.patterns_popup.popup(Rect2(Global.brush_type_buttons[1].rect_global_position, Vector2(226, 72)))
|
||||
else:
|
||||
Global.pattern_window_position = "left"
|
||||
Global.patterns_popup.popup(Rect2(Global.left_brush_type_button.rect_global_position, Vector2(226, 72)))
|
||||
Global.patterns_popup.popup(Rect2(Global.brush_type_buttons[0].rect_global_position, Vector2(226, 72)))
|
||||
|
||||
|
||||
func _on_PatternOffsetX_value_changed(value : float, right : bool) -> void:
|
||||
|
@ -152,12 +152,12 @@ func _on_LightenDarken_item_selected(ID : int, right : bool) -> void:
|
|||
func _on_LDAmount_value_changed(value : float, right : bool) -> void:
|
||||
if right:
|
||||
Global.right_ld_amount = value / 100
|
||||
Global.right_ld_amount_slider.value = value
|
||||
Global.right_ld_amount_spinbox.value = value
|
||||
Global.ld_amount_sliders[1].value = value
|
||||
Global.ld_amount_spinboxes[1].value = value
|
||||
else:
|
||||
Global.left_ld_amount = value / 100
|
||||
Global.left_ld_amount_slider.value = value
|
||||
Global.left_ld_amount_spinbox.value = value
|
||||
Global.ld_amount_sliders[0].value = value
|
||||
Global.ld_amount_spinboxes[0].value = value
|
||||
|
||||
|
||||
func _on_ForColorOptions_item_selected(ID : int, right : bool) -> void:
|
||||
|
|
|
@ -16,14 +16,14 @@ func _ready() -> void:
|
|||
func _on_PatternButton_pressed() -> void:
|
||||
if Global.pattern_window_position == "left":
|
||||
Global.pattern_left_image = image
|
||||
Global.left_fill_pattern_container.get_child(0).get_child(0).texture = texture
|
||||
Global.left_fill_pattern_container.get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.left_fill_pattern_container.get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
Global.fill_pattern_containers[0].get_child(0).get_child(0).texture = texture
|
||||
Global.fill_pattern_containers[0].get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.fill_pattern_containers[0].get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
|
||||
elif Global.pattern_window_position == "right":
|
||||
Global.pattern_right_image = image
|
||||
Global.right_fill_pattern_container.get_child(0).get_child(0).texture = texture
|
||||
Global.right_fill_pattern_container.get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.right_fill_pattern_container.get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
Global.fill_pattern_containers[1].get_child(0).get_child(0).texture = texture
|
||||
Global.fill_pattern_containers[1].get_child(2).get_child(1).max_value = image_size.x - 1
|
||||
Global.fill_pattern_containers[1].get_child(3).get_child(1).max_value = image_size.y - 1
|
||||
|
||||
Global.patterns_popup.hide()
|
||||
|
|
|
@ -36,78 +36,51 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
|
|||
var current_tool : int = Global.Tools.keys().find(current_action.to_upper())
|
||||
var left_tool_name := str(Global.Tools.keys()[Global.current_left_tool]).to_lower()
|
||||
var right_tool_name := str(Global.Tools.keys()[Global.current_right_tool]).to_lower()
|
||||
var current_mouse_button := -1
|
||||
|
||||
if (mouse_press and Input.is_action_just_released("left_mouse")) or (!mouse_press and key_for_left):
|
||||
Global.current_left_tool = current_tool
|
||||
left_tool_name = current_action.to_lower()
|
||||
|
||||
# Start from 1, so the label won't get invisible
|
||||
for i in range(1, Global.left_tool_options_container.get_child_count()):
|
||||
Global.left_tool_options_container.get_child(i).visible = false
|
||||
|
||||
Global.left_tool_options_container.get_node("EmptySpacer").visible = true
|
||||
|
||||
# Tool options visible depending on the selected tool
|
||||
if current_tool == Global.Tools.PENCIL:
|
||||
Global.left_brush_type_container.visible = true
|
||||
Global.left_brush_size_slider.visible = true
|
||||
Global.left_pixel_perfect_container.visible = true
|
||||
Global.left_mirror_container.visible = true
|
||||
if Global.current_left_brush_type == Global.Brush_Types.FILE or Global.current_left_brush_type == Global.Brush_Types.CUSTOM or Global.current_left_brush_type == Global.Brush_Types.RANDOM_FILE:
|
||||
Global.left_color_interpolation_container.visible = true
|
||||
elif current_tool == Global.Tools.ERASER:
|
||||
Global.left_brush_type_container.visible = true
|
||||
Global.left_brush_size_slider.visible = true
|
||||
Global.left_pixel_perfect_container.visible = true
|
||||
Global.left_mirror_container.visible = true
|
||||
elif current_tool == Global.Tools.BUCKET:
|
||||
Global.left_fill_area_container.visible = true
|
||||
Global.left_mirror_container.visible = true
|
||||
elif current_tool == Global.Tools.LIGHTENDARKEN:
|
||||
Global.left_brush_type_container.visible = true
|
||||
Global.left_brush_size_slider.visible = true
|
||||
Global.left_pixel_perfect_container.visible = true
|
||||
Global.left_ld_container.visible = true
|
||||
Global.left_mirror_container.visible = true
|
||||
elif current_tool == Global.Tools.COLORPICKER:
|
||||
Global.left_colorpicker_container.visible = true
|
||||
elif current_tool == Global.Tools.ZOOM:
|
||||
Global.left_zoom_container.visible = true
|
||||
current_mouse_button = Global.Mouse_Button.LEFT
|
||||
|
||||
elif (mouse_press and Input.is_action_just_released("right_mouse")) or (!mouse_press and !key_for_left):
|
||||
Global.current_right_tool = current_tool
|
||||
right_tool_name = current_action.to_lower()
|
||||
# Start from 1, so the label won't get invisible
|
||||
for i in range(1, Global.right_tool_options_container.get_child_count()):
|
||||
Global.right_tool_options_container.get_child(i).visible = false
|
||||
current_mouse_button = Global.Mouse_Button.RIGHT
|
||||
|
||||
Global.right_tool_options_container.get_node("EmptySpacer").visible = true
|
||||
if current_mouse_button != -1:
|
||||
# Start from 1, so the label won't get invisible
|
||||
for i in range(1, Global.tool_options_containers[current_mouse_button].get_child_count()):
|
||||
Global.tool_options_containers[current_mouse_button].get_child(i).visible = false
|
||||
|
||||
Global.tool_options_containers[current_mouse_button].get_node("EmptySpacer").visible = true
|
||||
|
||||
# Tool options visible depending on the selected tool
|
||||
if current_tool == Global.Tools.PENCIL:
|
||||
Global.right_brush_type_container.visible = true
|
||||
Global.right_brush_size_slider.visible = true
|
||||
Global.right_pixel_perfect_container.visible = true
|
||||
Global.right_mirror_container.visible = true
|
||||
if Global.current_right_brush_type == Global.Brush_Types.FILE or Global.current_right_brush_type == Global.Brush_Types.CUSTOM or Global.current_right_brush_type == Global.Brush_Types.RANDOM_FILE:
|
||||
Global.right_color_interpolation_container.visible = true
|
||||
Global.brush_type_containers[current_mouse_button].visible = true
|
||||
Global.brush_size_sliders[current_mouse_button].visible = true
|
||||
Global.pixel_perfect_containers[current_mouse_button].visible = true
|
||||
Global.mirror_containers[current_mouse_button].visible = true
|
||||
if Global.current_brush_type[current_mouse_button] == Global.Brush_Types.FILE or Global.current_brush_type[current_mouse_button] == Global.Brush_Types.CUSTOM or Global.current_brush_type[current_mouse_button] == Global.Brush_Types.RANDOM_FILE:
|
||||
Global.color_interpolation_containers[current_mouse_button].visible = true
|
||||
elif current_tool == Global.Tools.ERASER:
|
||||
Global.right_brush_type_container.visible = true
|
||||
Global.right_brush_size_slider.visible = true
|
||||
Global.right_pixel_perfect_container.visible = true
|
||||
Global.right_mirror_container.visible = true
|
||||
Global.brush_type_containers[current_mouse_button].visible = true
|
||||
Global.brush_size_sliders[current_mouse_button].visible = true
|
||||
Global.pixel_perfect_containers[current_mouse_button].visible = true
|
||||
Global.mirror_containers[current_mouse_button].visible = true
|
||||
elif current_tool == Global.Tools.BUCKET:
|
||||
Global.right_fill_area_container.visible = true
|
||||
Global.right_mirror_container.visible = true
|
||||
Global.fill_area_containers[current_mouse_button].visible = true
|
||||
Global.mirror_containers[current_mouse_button].visible = true
|
||||
elif current_tool == Global.Tools.LIGHTENDARKEN:
|
||||
Global.right_brush_type_container.visible = true
|
||||
Global.right_brush_size_slider.visible = true
|
||||
Global.right_pixel_perfect_container.visible = true
|
||||
Global.right_ld_container.visible = true
|
||||
Global.right_mirror_container.visible = true
|
||||
Global.brush_type_containers[current_mouse_button].visible = true
|
||||
Global.brush_size_sliders[current_mouse_button].visible = true
|
||||
Global.pixel_perfect_containers[current_mouse_button].visible = true
|
||||
Global.ld_containers[current_mouse_button].visible = true
|
||||
Global.mirror_containers[current_mouse_button].visible = true
|
||||
elif current_tool == Global.Tools.COLORPICKER:
|
||||
Global.right_colorpicker_container.visible = true
|
||||
Global.colorpicker_containers[current_mouse_button].visible = true
|
||||
elif current_tool == Global.Tools.ZOOM:
|
||||
Global.right_zoom_container.visible = true
|
||||
Global.zoom_containers[current_mouse_button].visible = true
|
||||
|
||||
for t in tools:
|
||||
var tool_name : String = t[0].name.to_lower()
|
||||
|
|
Loading…
Reference in a new issue