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

Use enums instead of strings for tools

This could be a slight increase in performance
This commit is contained in:
OverloadedOrama 2020-05-31 16:04:33 +03:00
parent bda9e6267d
commit 5b7d161ecf
6 changed files with 71 additions and 72 deletions

View file

@ -14,7 +14,7 @@ var mouse_press_pixels := [] # Cleared after mouse release
var mouse_press_pressure_values := [] # Cleared after mouse release
func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_button : String, pen_pressure : float, current_action := "None") -> void:
func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_button : String, pen_pressure : float, current_action := -1) -> void:
if Global.can_draw && Global.has_focus:
var west_limit = Global.canvas.west_limit
var east_limit = Global.canvas.east_limit
@ -33,9 +33,9 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
var ld := 0
var ld_amount := 0.1
if Global.pressure_sensitivity_mode == Global.Pressure_Sensitivity.ALPHA:
if current_action == "Pencil":
if current_action == Global.Tools.PENCIL:
color.a *= pen_pressure
elif current_action == "Eraser": # This is not working
elif current_action == Global.Tools.ERASER: # This is not working
color.a *= (1.0 - pen_pressure)
if current_mouse_button == "left_mouse":
brush_size = Global.left_brush_size
@ -86,7 +86,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
var end_pos_x
var end_pos_y
if brush_type == Global.Brush_Types.PIXEL || current_action == "LightenDarken":
if brush_type == Global.Brush_Types.PIXEL || current_action == Global.Tools.LIGHTENDARKEN:
var drawer = pixel_perfect_drawer if pixel_perfect else simple_drawer
var drawer_v_mirror = pixel_perfect_drawer_v_mirror if pixel_perfect else simple_drawer
var drawer_h_mirror = pixel_perfect_drawer_h_mirror if pixel_perfect else simple_drawer
@ -103,12 +103,12 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
# Don't draw the same pixel over and over and don't re-lighten/darken it
var current_pixel_color : Color = sprite.get_pixel(cur_pos_x, cur_pos_y)
var _c := color
if current_action == "Pencil" && color.a < 1:
if current_action == Global.Tools.PENCIL && color.a < 1:
_c = DrawingAlgos.blend_colors(color, current_pixel_color)
var saved_pixel_index = DrawingAlgos.mouse_press_pixels.find(pos_floored)
if current_pixel_color != _c && (saved_pixel_index == -1 || pen_pressure > DrawingAlgos.mouse_press_pressure_values[saved_pixel_index]):
if current_action == "LightenDarken":
if current_action == Global.Tools.LIGHTENDARKEN:
_c = current_pixel_color
if _c.a > 0:
if ld == 0: # Lighten
@ -129,7 +129,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
if horizontal_mirror:
current_pixel_color = sprite.get_pixel(mirror_x, cur_pos_y)
if current_pixel_color != _c: # don't draw the same pixel over and over
if current_action == "LightenDarken":
if current_action == Global.Tools.LIGHTENDARKEN:
if ld == 0: # Lighten
_c = current_pixel_color.lightened(ld_amount)
else:
@ -142,7 +142,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
if vertical_mirror:
current_pixel_color = sprite.get_pixel(cur_pos_x, mirror_y)
if current_pixel_color != _c: # don't draw the same pixel over and over
if current_action == "LightenDarken":
if current_action == Global.Tools.LIGHTENDARKEN:
if ld == 0: # Lighten
_c = current_pixel_color.lightened(ld_amount)
else:
@ -154,7 +154,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
if horizontal_mirror && vertical_mirror:
current_pixel_color = sprite.get_pixel(mirror_x, mirror_y)
if current_pixel_color != _c: # don't draw the same pixel over and over
if current_action == "LightenDarken":
if current_action == Global.Tools.LIGHTENDARKEN:
if ld == 0: # Lighten
_c = current_pixel_color.lightened(ld_amount)
else:
@ -255,7 +255,7 @@ func draw_brush(sprite : Image, pos : Vector2, color : Color, current_mouse_butt
# Bresenham's Algorithm
# Thanks to https://godotengine.org/qa/35276/tile-based-line-drawing-algorithm-efficiency
func fill_gaps(sprite : Image, end_pos : Vector2, start_pos : Vector2, color : Color, current_mouse_button : String, pen_pressure : float, current_action := "None") -> void:
func fill_gaps(sprite : Image, end_pos : Vector2, start_pos : Vector2, color : Color, current_mouse_button : String, pen_pressure : float, current_action := -1) -> void:
var previous_mouse_pos_floored = start_pos.floor()
var mouse_pos_floored = end_pos.floor()
var dx := int(abs(mouse_pos_floored.x - previous_mouse_pos_floored.x))
@ -509,7 +509,6 @@ func scale3X(sprite : Image, tol : float = 50) -> Image:
func rotxel(sprite : Image, angle : float) -> void:
# If angle is simple, then nn rotation is the best
if angle == 0 || angle == PI/2 || angle == PI || angle == 2*PI:

View file

@ -3,24 +3,19 @@ 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}
var root_directory := "."
var window_title := "" setget title_changed # Why doesn't Godot have get_window_title()?
var config_cache := ConfigFile.new()
var XDGDataPaths = preload("res://src/XDGDataPaths.gd")
var directory_module : Reference
enum Direction {UP, DOWN, LEFT, RIGHT}
enum Tools {PENCIL, ERASER, BUCKET, LIGHTENDARKEN, RECTSELECT, COLORPICKER, ZOOM}
# Stuff for arrowkey-based canvas movements nyaa ^.^
const low_speed_move_rate := 150.0
const medium_speed_move_rate := 750.0
const high_speed_move_rate := 3750.0
enum Direction {
UP = 0,
DOWN = 1,
LEFT = 2,
RIGHT = 3
}
var root_directory := "."
var window_title := "" setget title_changed # Why doesn't Godot have get_window_title()?
var config_cache := ConfigFile.new()
var XDGDataPaths = preload("res://src/XDGDataPaths.gd")
var directory_module : Reference
# Indices are as in the Direction enum
# This is the total time the key for
@ -69,8 +64,8 @@ var checker_color_1 := Color(0.47, 0.47, 0.47, 1)
var checker_color_2 := Color(0.34, 0.35, 0.34, 1)
# Tools & options
var current_left_tool := "Pencil"
var current_right_tool := "Eraser"
var current_left_tool : int = Tools.PENCIL
var current_right_tool :int = Tools.ERASER
var show_left_tool_icon := true
var show_right_tool_icon := true
var left_square_indicator_visible := true

View file

@ -13,7 +13,7 @@ var previous_mouse_pos := Vector2.ZERO
var previous_mouse_pos_for_lines := Vector2.ZERO
var can_undo := true
var cursor_inside_canvas := false
var previous_action := "None"
var previous_action := -1
var west_limit := location.x
var east_limit := location.x + size.x
var north_limit := location.y
@ -171,37 +171,37 @@ 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 == "LightenDarken":
if Global.current_left_tool == "Pencil" || Global.current_left_tool == "Eraser" || Global.current_left_tool == "LightenDarken":
if Global.current_left_brush_type == 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:
if Global.current_left_tool == "Pencil" || Global.current_left_tool == "Eraser":
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:
draw_rect(Rect2(rect, Vector2.ONE), Color.blue, false)
draw_set_transform(position, rotation, scale)
else:
if Global.current_left_tool == "Pencil" || Global.current_left_tool == "Eraser":
if Global.current_left_tool == Global.Tools.PENCIL || Global.current_left_tool == Global.Tools.ERASER:
var custom_brush_size = Global.custom_left_brush_image.get_size() - Vector2.ONE
var dst := rectangle_center(mouse_pos, custom_brush_size)
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 == "LightenDarken":
if Global.current_right_tool == "Pencil" || Global.current_right_tool == "Eraser" || Global.current_right_tool == "LightenDarken":
if Global.current_right_brush_type == 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:
if Global.current_right_tool == "Pencil" || Global.current_right_tool == "Eraser":
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:
draw_rect(Rect2(rect, Vector2.ONE), Color.red, false)
draw_set_transform(position, rotation, scale)
else:
if Global.current_right_tool == "Pencil" || Global.current_right_tool == "Eraser":
if Global.current_right_tool == Global.Tools.PENCIL || Global.current_right_tool == Global.Tools.ERASER:
var custom_brush_size = Global.custom_right_brush_image.get_size() - Vector2.ONE
var dst := rectangle_center(mouse_pos, custom_brush_size)
draw_texture(Global.custom_right_brush_texture, dst)
@ -252,7 +252,7 @@ func _input(event : InputEvent) -> void:
var mouse_pos_floored := mouse_pos.floor()
var mouse_pos_ceiled := mouse_pos.ceil()
var current_mouse_button := "None"
var current_action := "None"
var current_action := -1
var current_color : Color
var fill_area := 0 # For the bucket tool
# For the LightenDarken tool
@ -318,22 +318,22 @@ func _input(event : InputEvent) -> void:
if mouse_pressed:
if can_handle || is_making_line:
if current_action != "None" && current_action != "ColorPicker" && current_action != "Zoom":
if current_action == "RectSelect":
if current_action != -1 && current_action != Global.Tools.COLORPICKER && current_action != Global.Tools.ZOOM:
if current_action == Global.Tools.RECTSELECT:
handle_undo("Rectangle Select")
else:
handle_undo("Draw")
elif (Input.is_action_just_released("left_mouse") && !Input.is_action_pressed("right_mouse")) || (Input.is_action_just_released("right_mouse") && !Input.is_action_pressed("left_mouse")):
if can_handle || Global.undos == Global.undo_redo.get_version():
if previous_action != "None" && previous_action != "RectSelect" && current_action != "ColorPicker" && current_action != "Zoom":
if previous_action != -1 && previous_action != Global.Tools.RECTSELECT && current_action != Global.Tools.COLORPICKER && current_action != Global.Tools.ZOOM:
handle_redo("Draw")
match current_action: # Handle current tool
"Pencil":
Global.Tools.PENCIL:
pencil_and_eraser(sprite, mouse_pos, current_color, current_mouse_button, current_action)
"Eraser":
Global.Tools.ERASER:
pencil_and_eraser(sprite, mouse_pos, Color(0, 0, 0, 0), current_mouse_button, current_action)
"Bucket":
Global.Tools.BUCKET:
if can_handle:
var fill_with := 0
var pattern_image : Image
@ -399,7 +399,7 @@ func _input(event : InputEvent) -> void:
else:
sprite.set_pixel(xx, yy, current_color)
sprite_changed_this_frame = true
"LightenDarken":
Global.Tools.LIGHTENDARKEN:
if can_handle:
var pixel_color : Color = sprite.get_pixelv(mouse_pos)
var color_changed : Color
@ -408,7 +408,7 @@ func _input(event : InputEvent) -> void:
else: # Darken
color_changed = pixel_color.darkened(ld_amount)
pencil_and_eraser(sprite, mouse_pos, color_changed, current_mouse_button, current_action)
"RectSelect":
Global.Tools.RECTSELECT:
# Check SelectionRectangle.gd for more code on Rectangle Selection
if Global.can_draw && Global.has_focus:
# If we're creating a new selection
@ -432,7 +432,7 @@ func _input(event : InputEvent) -> void:
Global.selection_rectangle.polygon[1] = Vector2(end_pos.x, start_pos.y)
Global.selection_rectangle.polygon[2] = end_pos
Global.selection_rectangle.polygon[3] = Vector2(start_pos.x, end_pos.y)
"ColorPicker":
Global.Tools.COLORPICKER:
if can_handle:
var image_data := Image.new()
image_data.copy_from(sprite)
@ -444,7 +444,7 @@ func _input(event : InputEvent) -> void:
elif color_picker_for == 1: # Pick for the left color
Global.right_color_picker.color = pixel_color
Global.update_right_custom_brush()
"Zoom":
Global.Tools.ZOOM:
if can_handle:
if zoom_mode == 0:
Global.camera.zoom_camera(-1)
@ -580,7 +580,7 @@ func update_texture(layer_index : int) -> void:
frame_texture_rect.texture = layers[layer_index][1]
func pencil_and_eraser(sprite : Image, mouse_pos : Vector2, color : Color, current_mouse_button : String, current_action := "None") -> void:
func pencil_and_eraser(sprite : Image, mouse_pos : Vector2, color : Color, current_mouse_button : String, current_action := -1) -> void:
if made_line:
return
if is_making_line:

View file

@ -34,10 +34,10 @@ func _process(_delta : float) -> void:
else:
visible = true
if Global.can_draw and Global.has_focus and point_in_rectangle(mouse_pos, polygon[0], polygon[2]) and Global.selected_pixels.size() > 0 and (Global.current_left_tool == "RectSelect" or Global.current_right_tool == "RectSelect"):
if Global.can_draw and Global.has_focus and point_in_rectangle(mouse_pos, polygon[0], polygon[2]) and Global.selected_pixels.size() > 0 and (Global.current_left_tool == Global.Tools.RECTSELECT or Global.current_right_tool == Global.Tools.RECTSELECT):
get_parent().get_parent().mouse_default_cursor_shape = Input.CURSOR_MOVE
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if (Global.current_left_tool == "RectSelect" && Input.is_action_just_pressed("left_mouse")) || (Global.current_right_tool == "RectSelect" && Input.is_action_just_pressed("right_mouse")):
if (Global.current_left_tool == Global.Tools.RECTSELECT && Input.is_action_just_pressed("left_mouse")) || (Global.current_right_tool == Global.Tools.RECTSELECT && Input.is_action_just_pressed("right_mouse")):
# Begin dragging
is_dragging = true
if Input.is_key_pressed(KEY_SHIFT):
@ -72,7 +72,7 @@ func _process(_delta : float) -> void:
get_parent().get_parent().mouse_default_cursor_shape = Input.CURSOR_ARROW
if is_dragging:
if (Global.current_left_tool == "RectSelect" && Input.is_action_pressed("left_mouse")) || (Global.current_right_tool == "RectSelect" && Input.is_action_pressed("right_mouse")):
if (Global.current_left_tool == Global.Tools.RECTSELECT && Input.is_action_pressed("left_mouse")) || (Global.current_right_tool == Global.Tools.RECTSELECT && Input.is_action_pressed("right_mouse")):
# Drag
start_pos.x = orig_x + mouse_pos_floored.x
end_pos.x = diff_x + mouse_pos_floored.x
@ -84,7 +84,7 @@ func _process(_delta : float) -> void:
polygon[2] = end_pos
polygon[3] = Vector2(start_pos.x, end_pos.y)
if (Global.current_left_tool == "RectSelect" && Input.is_action_just_released("left_mouse")) || (Global.current_right_tool == "RectSelect" && Input.is_action_just_released("right_mouse")):
if (Global.current_left_tool == Global.Tools.RECTSELECT && Input.is_action_just_released("left_mouse")) || (Global.current_right_tool == Global.Tools.RECTSELECT && Input.is_action_just_released("right_mouse")):
# Release Drag
is_dragging = false
if move_pixels:

View file

@ -17,7 +17,7 @@ func _on_BrushButton_pressed() -> void:
Global.current_left_brush_type = brush_type
Global.custom_left_brush_index = custom_brush_index
if custom_brush_index > -1: # Custom brush
if Global.current_left_tool == "Pencil":
if Global.current_left_tool == Global.Tools.PENCIL:
Global.left_color_interpolation_container.visible = true
# if hint_tooltip == "":
# Global.left_brush_type_label.text = tr("Custom brush")
@ -40,7 +40,7 @@ func _on_BrushButton_pressed() -> void:
Global.current_right_brush_type = brush_type
Global.custom_right_brush_index = custom_brush_index
if custom_brush_index > -1:
if Global.current_right_tool == "Pencil":
if Global.current_right_tool == Global.Tools.PENCIL:
Global.right_color_interpolation_container.visible = true
# if hint_tooltip == "":
# Global.right_brush_type_label.text = tr("Custom brush")

View file

@ -33,8 +33,12 @@ func _input(event : InputEvent) -> void:
func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_left := true) -> void:
var current_action := tool_pressed.name
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()
if (mouse_press and Input.is_action_just_released("left_mouse")) or (!mouse_press and key_for_left):
Global.current_left_tool = current_action
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()):
@ -43,34 +47,35 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
Global.left_tool_options_container.get_node("EmptySpacer").visible = true
# Tool options visible depending on the selected tool
if current_action == "Pencil":
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_action == "Eraser":
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_action == "Bucket":
elif current_tool == Global.Tools.BUCKET:
Global.left_fill_area_container.visible = true
Global.left_mirror_container.visible = true
elif current_action == "LightenDarken":
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_action == "ColorPicker":
elif current_tool == Global.Tools.COLORPICKER:
Global.left_colorpicker_container.visible = true
elif current_action == "Zoom":
elif current_tool == Global.Tools.ZOOM:
Global.left_zoom_container.visible = true
elif (mouse_press and Input.is_action_just_released("right_mouse")) or (!mouse_press and !key_for_left):
Global.current_right_tool = current_action
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
@ -78,44 +83,44 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
Global.right_tool_options_container.get_node("EmptySpacer").visible = true
# Tool options visible depending on the selected tool
if current_action == "Pencil":
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
elif current_action == "Eraser":
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
elif current_action == "Bucket":
elif current_tool == Global.Tools.BUCKET:
Global.right_fill_area_container.visible = true
Global.right_mirror_container.visible = true
elif current_action == "LightenDarken":
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
elif current_action == "ColorPicker":
elif current_tool == Global.Tools.COLORPICKER:
Global.right_colorpicker_container.visible = true
elif current_action == "Zoom":
elif current_tool == Global.Tools.ZOOM:
Global.right_zoom_container.visible = true
for t in tools:
var tool_name : String = t[0].name
var tool_name : String = t[0].name.to_lower()
var texture_button : TextureRect = t[0].get_child(0)
if tool_name == Global.current_left_tool and tool_name == Global.current_right_tool:
if tool_name == left_tool_name and tool_name == right_tool_name:
Global.change_button_texturerect(texture_button, "%s_l_r.png" % tool_name.to_lower())
elif tool_name == Global.current_left_tool:
elif tool_name == left_tool_name:
Global.change_button_texturerect(texture_button, "%s_l.png" % tool_name.to_lower())
elif tool_name == Global.current_right_tool:
elif tool_name == right_tool_name:
Global.change_button_texturerect(texture_button, "%s_r.png" % tool_name.to_lower())
else:
Global.change_button_texturerect(texture_button, "%s.png" % tool_name.to_lower())
Global.left_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_left_tool.to_lower()), 0)
Global.right_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_right_tool.to_lower()), 0)
Global.left_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % left_tool_name), 0)
Global.right_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % right_tool_name), 0)