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

Allow Internal extensions (#963)

* Moved tools to Extension

* removed accidental change

* code re-arrangement

* some improvements

* Restored tools and some improvements

* typo

* re-arranged tools

* formatting
This commit is contained in:
Variable 2023-12-20 19:23:20 +05:00 committed by GitHub
parent 3d46d7390c
commit 54604fa0af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 181 additions and 119 deletions

View file

@ -404,9 +404,11 @@ class ToolAPI:
## display name [param display_name], tool scene [param scene], layers that the tool works ## display name [param display_name], tool scene [param scene], layers that the tool works
## on [param layer_types] defined by [constant LayerTypes], ## on [param layer_types] defined by [constant LayerTypes],
## [param extra_hint] (text that appears when mouse havers tool icon), primary shortcut ## [param extra_hint] (text that appears when mouse havers tool icon), primary shortcut
## name [param shortcut] and any extra shortcuts [param extra_shortucts]. ## name [param shortcut] and any extra shortcuts [param extra_shortcuts].
## [br][br]At the moment extensions can't make their own shortcuts so you can ignore ## [br][br]At the moment extensions can't make their own shortcuts so you can ignore
## [param shortcut] and [param extra_shortucts]. ## [param shortcut] and [param extra_shortcuts].
## [br] to determine the position of tool in tool list, use [param insert_point]
## (if you leave it empty then the added tool will be placed at bottom)
func add_tool( func add_tool(
tool_name: String, tool_name: String,
display_name: String, display_name: String,
@ -414,13 +416,14 @@ class ToolAPI:
layer_types: PackedInt32Array = [], layer_types: PackedInt32Array = [],
extra_hint := "", extra_hint := "",
shortcut: String = "", shortcut: String = "",
extra_shortucts: PackedStringArray = [] extra_shortcuts: PackedStringArray = [],
insert_point := -1
) -> void: ) -> void:
var tool_class := Tools.Tool.new( var tool_class := Tools.Tool.new(
tool_name, display_name, shortcut, scene, layer_types, extra_hint, extra_shortucts tool_name, display_name, shortcut, scene, layer_types, extra_hint, extra_shortcuts
) )
Tools.tools[tool_name] = tool_class Tools.tools[tool_name] = tool_class
Tools.add_tool_button(tool_class) Tools.add_tool_button(tool_class, insert_point)
ExtensionsApi.add_action("ToolAPI", "add_tool") ExtensionsApi.add_action("ToolAPI", "add_tool")
## Removes a tool with name [param tool_name] ## Removes a tool with name [param tool_name]
@ -723,8 +726,8 @@ class SignalsAPI:
func _on_texture_changed(): func _on_texture_changed():
texture_changed.emit() texture_changed.emit()
func _connect_disconnect(signal_class: Signal, callable: Callable, disconnect := false): func _connect_disconnect(signal_class: Signal, callable: Callable, is_disconnecting := false):
if !disconnect: if !is_disconnecting:
signal_class.connect(callable) signal_class.connect(callable)
ExtensionsApi.add_action("SignalsAPI", signal_class.get_name()) ExtensionsApi.add_action("SignalsAPI", signal_class.get_name())
else: else:
@ -734,67 +737,69 @@ class SignalsAPI:
# APP RELATED SIGNALS # APP RELATED SIGNALS
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## when pixelorama is just opened. ## when pixelorama is just opened.
func signal_pixelorama_opened(callable: Callable, disconnect := false): func signal_pixelorama_opened(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.pixelorama_opened, callable, disconnect) _connect_disconnect(Global.pixelorama_opened, callable, is_disconnecting)
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## when pixelorama is about to close. ## when pixelorama is about to close.
func signal_pixelorama_about_to_close(callable: Callable, disconnect := false): func signal_pixelorama_about_to_close(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.pixelorama_about_to_close, callable, disconnect) _connect_disconnect(Global.pixelorama_about_to_close, callable, is_disconnecting)
# PROJECT RELATED SIGNALS # PROJECT RELATED SIGNALS
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever a new project is created.[br] ## whenever a new project is created.[br]
## [b]Binds: [/b]It has one bind of type [code]Project[/code] which is the newly created project ## [b]Binds: [/b]It has one bind of type [code]Project[/code] which is the newly created project
func signal_project_created(callable: Callable, disconnect := false): func signal_project_created(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.project_created, callable, disconnect) _connect_disconnect(Global.project_created, callable, is_disconnecting)
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## after a project is saved. ## after a project is saved.
func signal_project_saved(callable: Callable, disconnect := false): func signal_project_saved(callable: Callable, is_disconnecting := false):
_connect_disconnect(OpenSave.project_saved, callable, disconnect) _connect_disconnect(OpenSave.project_saved, callable, is_disconnecting)
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever you switch to some other project. ## whenever you switch to some other project.
func signal_project_changed(callable: Callable, disconnect := false): func signal_project_changed(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.project_changed, callable, disconnect) _connect_disconnect(Global.project_changed, callable, is_disconnecting)
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever you select a different cel. ## whenever you select a different cel.
func signal_cel_changed(callable: Callable, disconnect := false): func signal_cel_changed(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.cel_changed, callable, disconnect) _connect_disconnect(Global.cel_changed, callable, is_disconnecting)
# TOOL RELATED SIGNALS # TOOL RELATED SIGNALS
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever a tool changes color.[br] ## whenever a tool changes color.[br]
## [b]Binds: [/b] It has two bind of type [Color] (indicating new color) ## [b]Binds: [/b] It has two bind of type [Color] (indicating new color)
## and [int] (Indicating button that tool is assigned to, see [enum @GlobalScope.MouseButton]) ## and [int] (Indicating button that tool is assigned to, see [enum @GlobalScope.MouseButton])
func signal_tool_color_changed(callable: Callable, disconnect := false): func signal_tool_color_changed(callable: Callable, is_disconnecting := false):
_connect_disconnect(Tools.color_changed, callable, disconnect) _connect_disconnect(Tools.color_changed, callable, is_disconnecting)
# TIMELINE RELATED SIGNALS # TIMELINE RELATED SIGNALS
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever timeline animation starts.[br] ## whenever timeline animation starts.[br]
## [b]Binds: [/b] It has one bind of type [bool] which indicated if animation is in ## [b]Binds: [/b] It has one bind of type [bool] which indicated if animation is in
## forward direction ([code]true[/code]) or backward direction ([code]false[/code]) ## forward direction ([code]true[/code]) or backward direction ([code]false[/code])
func signal_timeline_animation_started(callable: Callable, disconnect := false): func signal_timeline_animation_started(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.animation_timeline.animation_started, callable, disconnect) _connect_disconnect(Global.animation_timeline.animation_started, callable, is_disconnecting)
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever timeline animation stops. ## whenever timeline animation stops.
func signal_timeline_animation_finished(callable: Callable, disconnect := false): func signal_timeline_animation_finished(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.animation_timeline.animation_finished, callable, disconnect) _connect_disconnect(
Global.animation_timeline.animation_finished, callable, is_disconnecting
)
# UPDATER SIGNALS # UPDATER SIGNALS
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever texture of the currently focused cel changes. ## whenever texture of the currently focused cel changes.
func signal_current_cel_texture_changed(callable: Callable, disconnect := false): func signal_current_cel_texture_changed(callable: Callable, is_disconnecting := false):
_connect_disconnect(texture_changed, callable, disconnect) _connect_disconnect(texture_changed, callable, is_disconnecting)
## connects/disconnects a signal to [param callable], that emits ## connects/disconnects a signal to [param callable], that emits
## whenever preview is about to be drawn.[br] ## whenever preview is about to be drawn.[br]
## [b]Binds: [/b]It has one bind of type [Dictionary] with keys: [code]exporter_id[/code], ## [b]Binds: [/b]It has one bind of type [Dictionary] with keys: [code]exporter_id[/code],
## [code]export_tab[/code], [code]preview_images[/code], [code]durations[/code] ## [code]export_tab[/code], [code]preview_images[/code], [code]durations[/code]
## [br] Use this if you plan on changing preview of export ## [br] Use this if you plan on changing preview of export
func signal_export_about_to_preview(callable: Callable, disconnect := false): func signal_export_about_to_preview(callable: Callable, is_disconnecting := false):
_connect_disconnect(Global.export_dialog.about_to_preview, callable, disconnect) _connect_disconnect(Global.export_dialog.about_to_preview, callable, is_disconnecting)

View file

@ -74,26 +74,35 @@ var tools := {
"res://src/Tools/SelectionTools/PaintSelect.tscn" "res://src/Tools/SelectionTools/PaintSelect.tscn"
), ),
"Move": "Move":
Tool.new("Move", "Move", "move", "res://src/Tools/Move.tscn", [Global.LayerTypes.PIXEL]), Tool.new(
"Zoom": Tool.new("Zoom", "Zoom", "zoom", "res://src/Tools/Zoom.tscn"), "Move", "Move", "move", "res://src/Tools/UtilityTools/Move.tscn", [Global.LayerTypes.PIXEL]
"Pan": Tool.new("Pan", "Pan", "pan", "res://src/Tools/Pan.tscn"), ),
"Zoom": Tool.new("Zoom", "Zoom", "zoom", "res://src/Tools/UtilityTools/Zoom.tscn"),
"Pan": Tool.new("Pan", "Pan", "pan", "res://src/Tools/UtilityTools/Pan.tscn"),
"ColorPicker": "ColorPicker":
Tool.new( Tool.new(
"ColorPicker", "ColorPicker",
"Color Picker", "Color Picker",
"colorpicker", "colorpicker",
"res://src/Tools/ColorPicker.tscn", "res://src/Tools/UtilityTools/ColorPicker.tscn",
[], [],
"Select a color from a pixel of the sprite" "Select a color from a pixel of the sprite"
), ),
"Crop": "Crop":
Tool.new("Crop", "Crop", "crop", "res://src/Tools/CropTool.tscn", [], "Resize the canvas"), Tool.new(
"Crop",
"Crop",
"crop",
"res://src/Tools/UtilityTools/CropTool.tscn",
[],
"Resize the canvas"
),
"Pencil": "Pencil":
Tool.new( Tool.new(
"Pencil", "Pencil",
"Pencil", "Pencil",
"pencil", "pencil",
"res://src/Tools/Pencil.tscn", "res://src/Tools/DesignTools/Pencil.tscn",
[Global.LayerTypes.PIXEL], [Global.LayerTypes.PIXEL],
"Hold %s to make a line", "Hold %s to make a line",
["draw_create_line"] ["draw_create_line"]
@ -103,19 +112,25 @@ var tools := {
"Eraser", "Eraser",
"Eraser", "Eraser",
"eraser", "eraser",
"res://src/Tools/Eraser.tscn", "res://src/Tools/DesignTools/Eraser.tscn",
[Global.LayerTypes.PIXEL], [Global.LayerTypes.PIXEL],
"Hold %s to make a line", "Hold %s to make a line",
["draw_create_line"] ["draw_create_line"]
), ),
"Bucket": "Bucket":
Tool.new("Bucket", "Bucket", "fill", "res://src/Tools/Bucket.tscn", [Global.LayerTypes.PIXEL]), Tool.new(
"Bucket",
"Bucket",
"fill",
"res://src/Tools/DesignTools/Bucket.tscn",
[Global.LayerTypes.PIXEL]
),
"Shading": "Shading":
Tool.new( Tool.new(
"Shading", "Shading",
"Shading Tool", "Shading Tool",
"shading", "shading",
"res://src/Tools/Shading.tscn", "res://src/Tools/DesignTools/Shading.tscn",
[Global.LayerTypes.PIXEL] [Global.LayerTypes.PIXEL]
), ),
"LineTool": "LineTool":
@ -125,7 +140,7 @@ var tools := {
"LineTool", "LineTool",
"Line Tool", "Line Tool",
"linetool", "linetool",
"res://src/Tools/LineTool.tscn", "res://src/Tools/DesignTools/LineTool.tscn",
[Global.LayerTypes.PIXEL], [Global.LayerTypes.PIXEL],
"""Hold %s to snap the angle of the line """Hold %s to snap the angle of the line
Hold %s to center the shape on the click origin Hold %s to center the shape on the click origin
@ -140,7 +155,7 @@ Hold %s to displace the shape's origin""",
"RectangleTool", "RectangleTool",
"Rectangle Tool", "Rectangle Tool",
"rectangletool", "rectangletool",
"res://src/Tools/RectangleTool.tscn", "res://src/Tools/DesignTools/RectangleTool.tscn",
[Global.LayerTypes.PIXEL], [Global.LayerTypes.PIXEL],
"""Hold %s to create a 1:1 shape """Hold %s to create a 1:1 shape
Hold %s to center the shape on the click origin Hold %s to center the shape on the click origin
@ -155,7 +170,7 @@ Hold %s to displace the shape's origin""",
"EllipseTool", "EllipseTool",
"Ellipse Tool", "Ellipse Tool",
"ellipsetool", "ellipsetool",
"res://src/Tools/EllipseTool.tscn", "res://src/Tools/DesignTools/EllipseTool.tscn",
[Global.LayerTypes.PIXEL], [Global.LayerTypes.PIXEL],
"""Hold %s to create a 1:1 shape """Hold %s to create a 1:1 shape
Hold %s to center the shape on the click origin Hold %s to center the shape on the click origin
@ -168,12 +183,12 @@ Hold %s to displace the shape's origin""",
"3DShapeEdit", "3DShapeEdit",
"3D Shape Edit", "3D Shape Edit",
"3dshapeedit", "3dshapeedit",
"res://src/Tools/3DShapeEdit.tscn", "res://src/Tools/3DTools/3DShapeEdit.tscn",
[Global.LayerTypes.THREE_D] [Global.LayerTypes.THREE_D]
), ),
} }
var _tool_button_scene := preload("res://src/Tools/ToolButton.tscn") var _tool_button_scene := preload("res://src/UI/ToolsPanel/ToolButton.tscn")
var _slots := {} var _slots := {}
var _panels := {} var _panels := {}
var _curr_layer_type := Global.LayerTypes.PIXEL var _curr_layer_type := Global.LayerTypes.PIXEL
@ -210,7 +225,7 @@ class Tool:
_scene_path: String, _scene_path: String,
_layer_types: PackedInt32Array = [], _layer_types: PackedInt32Array = [],
_extra_hint := "", _extra_hint := "",
_extra_shortucts: PackedStringArray = [] _extra_shortcuts: PackedStringArray = []
) -> void: ) -> void:
name = _name name = _name
display_name = _display_name display_name = _display_name
@ -218,7 +233,7 @@ class Tool:
scene_path = _scene_path scene_path = _scene_path
layer_types = _layer_types layer_types = _layer_types
extra_hint = _extra_hint extra_hint = _extra_hint
extra_shortcuts = _extra_shortucts extra_shortcuts = _extra_shortcuts
icon = load("res://assets/graphics/tools/%s.png" % name.to_lower()) icon = load("res://assets/graphics/tools/%s.png" % name.to_lower())
cursor_icon = load("res://assets/graphics/tools/cursors/%s.png" % name.to_lower()) cursor_icon = load("res://assets/graphics/tools/cursors/%s.png" % name.to_lower())
@ -329,10 +344,13 @@ func _ready() -> void:
update_tool_cursors() update_tool_cursors()
var layer: BaseLayer = Global.current_project.layers[Global.current_project.current_layer] var layer: BaseLayer = Global.current_project.layers[Global.current_project.current_layer]
var layer_type := layer.get_layer_type() var layer_type := layer.get_layer_type()
# Yield is necessary to hide irrelevant tools added by extensions
await get_tree().process_frame
_show_relevant_tools(layer_type) _show_relevant_tools(layer_type)
func add_tool_button(t: Tool) -> void: func add_tool_button(t: Tool, insert_pos := -1) -> void:
var tool_button: BaseButton = _tool_button_scene.instantiate() var tool_button: BaseButton = _tool_button_scene.instantiate()
tool_button.name = t.name tool_button.name = t.name
tool_button.get_node("BackgroundLeft").modulate = Global.left_tool_color tool_button.get_node("BackgroundLeft").modulate = Global.left_tool_color
@ -341,6 +359,9 @@ func add_tool_button(t: Tool) -> void:
tool_button.tooltip_text = t.generate_hint_tooltip() tool_button.tooltip_text = t.generate_hint_tooltip()
t.button_node = tool_button t.button_node = tool_button
_tool_buttons.add_child(tool_button) _tool_buttons.add_child(tool_button)
if insert_pos > -1:
insert_pos = min(insert_pos, _tool_buttons.get_child_count() - 1)
_tool_buttons.move_child(tool_button, insert_pos)
tool_button.pressed.connect(_tool_buttons._on_Tool_pressed.bind(tool_button)) tool_button.pressed.connect(_tool_buttons._on_Tool_pressed.bind(tool_button))
@ -432,7 +453,6 @@ func update_tool_buttons() -> void:
func update_hint_tooltips() -> void: func update_hint_tooltips() -> void:
await get_tree().process_frame
for tool_name in tools: for tool_name in tools:
var t: Tool = tools[tool_name] var t: Tool = tools[tool_name]
t.button_node.tooltip_text = t.generate_hint_tooltip() t.button_node.tooltip_text = t.generate_hint_tooltip()

View file

@ -25,7 +25,12 @@ class Extension:
var version := "" var version := ""
var license := "" var license := ""
var nodes := [] var nodes := []
var enabled := false var enabled: bool:
set(value):
enabled = value
enabled_once = true
var internal := false
var enabled_once := false
func serialize(dict: Dictionary) -> void: func serialize(dict: Dictionary) -> void:
if dict.has("name"): if dict.has("name"):
@ -50,6 +55,8 @@ func _ready() -> void:
$HBoxContainer/AddExtensionButton.disabled = true $HBoxContainer/AddExtensionButton.disabled = true
$HBoxContainer/OpenFolderButton.visible = false $HBoxContainer/OpenFolderButton.visible = false
_add_internal_extensions()
var file_names: PackedStringArray = [] var file_names: PackedStringArray = []
var dir := DirAccess.open("user://") var dir := DirAccess.open("user://")
dir.make_dir(EXTENSIONS_PATH) dir.make_dir(EXTENSIONS_PATH)
@ -71,6 +78,13 @@ func _ready() -> void:
_add_extension(file_name) _add_extension(file_name)
func _add_internal_extensions() -> void:
## at the moment this is an empty function but you should add all internal extensions here
# for example:
#read_extension("ExtensionName", true)
pass
func install_extension(path: String) -> void: func install_extension(path: String) -> void:
var file_name := path.get_file() var file_name := path.get_file()
var err := DirAccess.copy_absolute(path, EXTENSIONS_PATH.path_join(file_name)) var err := DirAccess.copy_absolute(path, EXTENSIONS_PATH.path_join(file_name))
@ -150,7 +164,6 @@ func _add_extension(file_name: String) -> void:
await get_tree().process_frame await get_tree().process_frame
await get_tree().process_frame await get_tree().process_frame
var file_name_no_ext := file_name.get_basename()
var file_path := EXTENSIONS_PATH.path_join(file_name) var file_path := EXTENSIONS_PATH.path_join(file_name)
var success := ProjectSettings.load_resource_pack(file_path) var success := ProjectSettings.load_resource_pack(file_path)
if !success: if !success:
@ -162,6 +175,11 @@ func _add_extension(file_name: String) -> void:
# Delete the faulty.txt, (it's fate has already been decided) # Delete the faulty.txt, (it's fate has already been decided)
DirAccess.remove_absolute(EXTENSIONS_PATH.path_join("Faulty.txt")) DirAccess.remove_absolute(EXTENSIONS_PATH.path_join("Faulty.txt"))
return return
read_extension(file_name)
func read_extension(extension_file_or_folder_name: StringName, internal := false):
var file_name_no_ext := extension_file_or_folder_name.get_basename()
var extension_path := "res://src/Extensions/%s/" % file_name_no_ext var extension_path := "res://src/Extensions/%s/" % file_name_no_ext
var extension_config_file_path := extension_path.path_join("extension.json") var extension_config_file_path := extension_path.path_join("extension.json")
var extension_config_file := FileAccess.open(extension_config_file_path, FileAccess.READ) var extension_config_file := FileAccess.open(extension_config_file_path, FileAccess.READ)
@ -198,24 +216,30 @@ func _add_extension(file_name: String) -> void:
Global.error_dialog.popup_centered() Global.error_dialog.popup_centered()
Global.dialog_open(true) Global.dialog_open(true)
print("Incompatible API") print("Incompatible API")
# Don't put it in faulty, (it's merely incompatible) if !internal: # the file isn't created for internal extensions, no need for removal
DirAccess.remove_absolute(EXTENSIONS_PATH.path_join("Faulty.txt")) # Don't put it in faulty, (it's merely incompatible)
DirAccess.remove_absolute(EXTENSIONS_PATH.path_join("Faulty.txt"))
return return
var extension := Extension.new() var extension := Extension.new()
extension.serialize(extension_json) extension.serialize(extension_json)
extensions[file_name] = extension extension.internal = internal
extensions[extension_file_or_folder_name] = extension
extension_list.add_item(extension.display_name) extension_list.add_item(extension.display_name)
var item_count := extension_list.get_item_count() - 1 var item_count := extension_list.get_item_count() - 1
extension_list.set_item_tooltip(item_count, extension.description) extension_list.set_item_tooltip(item_count, extension.description)
extension_list.set_item_metadata(item_count, file_name) extension_list.set_item_metadata(item_count, extension_file_or_folder_name)
extension.enabled = Global.config_cache.get_value("extensions", extension.file_name, false) if internal: # enable internal extensions if it is for the first time
extension.enabled = Global.config_cache.get_value("extensions", extension.file_name, true)
else:
extension.enabled = Global.config_cache.get_value("extensions", extension.file_name, false)
if extension.enabled: if extension.enabled:
_enable_extension(extension) _enable_extension(extension)
# If an extension doesn't crash pixelorama then it is proven innocent # If an extension doesn't crash pixelorama then it is proven innocent
# And we should now delete its "Faulty.txt" file # And we should now delete its "Faulty.txt" file
DirAccess.remove_absolute(EXTENSIONS_PATH.path_join("Faulty.txt")) if !internal: # the file isn't created for internal extensions, so no need to remove it
DirAccess.remove_absolute(EXTENSIONS_PATH.path_join("Faulty.txt"))
func _enable_extension(extension: Extension, save_to_config := true) -> void: func _enable_extension(extension: Extension, save_to_config := true) -> void:
@ -258,7 +282,10 @@ func _on_InstalledExtensions_item_selected(index: int) -> void:
else: else:
enable_button.text = "Enable" enable_button.text = "Enable"
enable_button.disabled = false enable_button.disabled = false
uninstall_button.disabled = false if !extension.internal:
uninstall_button.disabled = false
else:
uninstall_button.disabled = true
func _on_InstalledExtensions_empty_clicked(_position: Vector2, _button_index: int) -> void: func _on_InstalledExtensions_empty_clicked(_position: Vector2, _button_index: int) -> void:
@ -274,7 +301,12 @@ func _on_EnableButton_pressed() -> void:
var file_name: String = extension_list.get_item_metadata(extension_selected) var file_name: String = extension_list.get_item_metadata(extension_selected)
var extension: Extension = extensions[file_name] var extension: Extension = extensions[file_name]
extension.enabled = !extension.enabled extension.enabled = !extension.enabled
_enable_extension(extension) # Don't allow disabling internal extensions through this button.
if extension.internal and extension.enabled_once:
Global.preferences_dialog.preference_update(true)
else:
_enable_extension(extension)
if extension.enabled: if extension.enabled:
enable_button.text = "Disable" enable_button.text = "Disable"
else: else:

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=10 format=3 uid="uid://cg7d36746on67"] [gd_scene load_steps=10 format=3 uid="uid://cg7d36746on67"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/3DShapeEdit.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/3DTools/3DShapeEdit.gd" id="2"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="3"] [ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="3"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="4"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="4"]
[ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="5"] [ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="5"]

View file

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="2"]
[ext_resource type="Script" path="res://src/Tools/Draw.gd" id="3"] [ext_resource type="Script" path="res://src/Tools/BaseDraw.gd" id="3"]
[sub_resource type="StyleBoxFlat" id="1"] [sub_resource type="StyleBoxFlat" id="1"]
bg_color = Color(1, 1, 1, 1) bg_color = Color(1, 1, 1, 1)

View file

@ -1,4 +1,4 @@
class_name SelectionTool class_name BaseSelectionTool
extends BaseTool extends BaseTool
enum Mode { DEFAULT, ADD, SUBTRACT, INTERSECT } enum Mode { DEFAULT, ADD, SUBTRACT, INTERSECT }

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://bd62qfjn380wf"] [gd_scene load_steps=4 format=3 uid="uid://bd62qfjn380wf"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/SelectionTool.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/BaseSelectionTool.gd" id="2"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="4"] [ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="4"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Draw.gd" extends "res://src/Tools/BaseDraw.gd"
var _start := Vector2i.ZERO var _start := Vector2i.ZERO
var _offset := Vector2i.ZERO var _offset := Vector2i.ZERO

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://n40lhf8hm7o1"] [gd_scene load_steps=4 format=3 uid="uid://n40lhf8hm7o1"]
[ext_resource type="Script" path="res://src/Tools/ShapeDrawer.gd" id="1"] [ext_resource type="Script" path="res://src/Tools/BaseShapeDrawer.gd" id="1"]
[ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/Draw.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="2"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[node name="ToolOptions" instance=ExtResource("2")] [node name="ToolOptions" instance=ExtResource("2")]

View file

@ -18,3 +18,4 @@ layout_mode = 2
layout_mode = 2 layout_mode = 2
theme_type_variation = &"HeaderSmall" theme_type_variation = &"HeaderSmall"
text = "Tool Name" text = "Tool Name"
horizontal_alignment = 1

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://bbvvkrrjyxugo"] [gd_scene load_steps=6 format=3 uid="uid://bbvvkrrjyxugo"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSlider.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="2"]
[ext_resource type="Script" path="res://src/Tools/Bucket.gd" id="3"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Bucket.gd" id="3"]
[sub_resource type="StyleBoxFlat" id="1"] [sub_resource type="StyleBoxFlat" id="1"]
bg_color = Color(1, 1, 1, 1) bg_color = Color(1, 1, 1, 1)

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/ShapeDrawer.gd" extends "res://src/Tools/BaseShapeDrawer.gd"
func _get_shape_points_filled(shape_size: Vector2i) -> Array[Vector2i]: func _get_shape_points_filled(shape_size: Vector2i) -> Array[Vector2i]:

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://4hp76lf38bc7"] [gd_scene load_steps=3 format=3 uid="uid://4hp76lf38bc7"]
[ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/ShapeDrawer.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/EllipseTool.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/EllipseTool.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Draw.gd" extends "res://src/Tools/BaseDraw.gd"
var _last_position := Vector2.INF var _last_position := Vector2.INF
var _clear_image: Image var _clear_image: Image

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://btmbrqqig7wys"] [gd_scene load_steps=4 format=3 uid="uid://btmbrqqig7wys"]
[ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/Draw.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/Eraser.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Eraser.gd" id="2"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Draw.gd" extends "res://src/Tools/BaseDraw.gd"
var _original_pos := Vector2i.ZERO var _original_pos := Vector2i.ZERO
var _start := Vector2i.ZERO var _start := Vector2i.ZERO

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://ceahf2toaq47l"] [gd_scene load_steps=4 format=3 uid="uid://ceahf2toaq47l"]
[ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/Draw.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/LineTool.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/LineTool.gd" id="2"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Draw.gd" extends "res://src/Tools/BaseDraw.gd"
var _prev_mode := false var _prev_mode := false
var _last_position := Vector2i(Vector2.INF) var _last_position := Vector2i(Vector2.INF)

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://cul5mpy17ebfl"] [gd_scene load_steps=4 format=3 uid="uid://cul5mpy17ebfl"]
[ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/Draw.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="1"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="2"] [ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="2"]
[ext_resource type="Script" path="res://src/Tools/Pencil.gd" id="3"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Pencil.gd" id="3"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("3") script = ExtResource("3")

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/ShapeDrawer.gd" extends "res://src/Tools/BaseShapeDrawer.gd"
func _get_shape_points_filled(shape_size: Vector2i) -> Array[Vector2i]: func _get_shape_points_filled(shape_size: Vector2i) -> Array[Vector2i]:

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://dhlab4q2dwu0a"] [gd_scene load_steps=3 format=3 uid="uid://dhlab4q2dwu0a"]
[ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/ShapeDrawer.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/RectangleTool.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/RectangleTool.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Draw.gd" extends "res://src/Tools/BaseDraw.gd"
enum ShadingMode { SIMPLE, HUE_SHIFTING } enum ShadingMode { SIMPLE, HUE_SHIFTING }
enum LightenDarken { LIGHTEN, DARKEN } enum LightenDarken { LIGHTEN, DARKEN }

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://rbyd7i6snxjc"] [gd_scene load_steps=4 format=3 uid="uid://rbyd7i6snxjc"]
[ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/Draw.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/Shading.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Shading.gd" id="2"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,4 +1,4 @@
extends SelectionTool extends BaseSelectionTool
var shader := preload("res://src/Shaders/ColorSelect.gdshader") var shader := preload("res://src/Shaders/ColorSelect.gdshader")
var _similarity := 100 var _similarity := 100

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://bqr6hr0p3ew6a"] [gd_scene load_steps=4 format=3 uid="uid://bqr6hr0p3ew6a"]
[ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/SelectionTools/SelectionTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/BaseSelectionTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/ColorSelect.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/SelectionTools/ColorSelect.gd" id="2"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,4 +1,4 @@
extends SelectionTool extends BaseSelectionTool
var _rect := Rect2i(0, 0, 0, 0) var _rect := Rect2i(0, 0, 0, 0)

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://cf2gm1oypbm6m"] [gd_scene load_steps=3 format=3 uid="uid://cf2gm1oypbm6m"]
[ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/SelectionTools/SelectionTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/BaseSelectionTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/EllipseSelect.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/SelectionTools/EllipseSelect.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]

View file

@ -1,4 +1,4 @@
extends SelectionTool extends BaseSelectionTool
var _last_position := Vector2.INF var _last_position := Vector2.INF
var _draw_points: Array[Vector2i] = [] var _draw_points: Array[Vector2i] = []

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://cu37uo35mcfom"] [gd_scene load_steps=3 format=3 uid="uid://cu37uo35mcfom"]
[ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/SelectionTools/SelectionTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/BaseSelectionTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/Lasso.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/SelectionTools/Lasso.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]

View file

@ -1,4 +1,4 @@
extends SelectionTool extends BaseSelectionTool
## Working array used as buffer for segments while flooding ## Working array used as buffer for segments while flooding
var _allegro_flood_segments: Array[Segment] var _allegro_flood_segments: Array[Segment]

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://blt8u6nvg1k3g"] [gd_scene load_steps=3 format=3 uid="uid://blt8u6nvg1k3g"]
[ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/SelectionTools/SelectionTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/BaseSelectionTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/MagicWand.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/SelectionTools/MagicWand.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]

View file

@ -1,4 +1,4 @@
extends SelectionTool extends BaseSelectionTool
var _brush_size := 2 var _brush_size := 2
var _brush := Brushes.get_default_brush() var _brush := Brushes.get_default_brush()

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=3 uid="uid://bry4ltxur56u7"] [gd_scene load_steps=6 format=3 uid="uid://bry4ltxur56u7"]
[ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/SelectionTools/SelectionTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/BaseSelectionTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/PaintSelect.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/SelectionTools/PaintSelect.gd" id="2"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]

View file

@ -1,4 +1,4 @@
extends SelectionTool extends BaseSelectionTool
var _last_position := Vector2i(Vector2.INF) var _last_position := Vector2i(Vector2.INF)
var _draw_points: Array[Vector2i] = [] var _draw_points: Array[Vector2i] = []

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://dv8bn8gys3tax"] [gd_scene load_steps=3 format=3 uid="uid://dv8bn8gys3tax"]
[ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/SelectionTools/SelectionTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/BaseSelectionTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/PolygonSelect.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/SelectionTools/PolygonSelect.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]

View file

@ -1,4 +1,4 @@
extends SelectionTool extends BaseSelectionTool
var _rect := Rect2i() var _rect := Rect2i()

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://iph72k1ii717"] [gd_scene load_steps=3 format=3 uid="uid://iph72k1ii717"]
[ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/SelectionTools/SelectionTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://bd62qfjn380wf" path="res://src/Tools/BaseSelectionTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/SelectionTools/RectSelect.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/SelectionTools/RectSelect.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://2onobu8eymt8"] [gd_scene load_steps=3 format=3 uid="uid://2onobu8eymt8"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/ColorPicker.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/UtilityTools/ColorPicker.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=6 format=3 uid="uid://c35n21ii7onhe"] [gd_scene load_steps=6 format=3 uid="uid://c35n21ii7onhe"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSlider.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="2"]
[ext_resource type="Script" path="res://src/Tools/CropTool.gd" id="3"] [ext_resource type="Script" path="res://src/Tools/UtilityTools/CropTool.gd" id="3"]
[ext_resource type="Texture2D" uid="uid://bgrq56ndc4ydj" path="res://assets/graphics/misc/unlocked_size.png" id="4"] [ext_resource type="Texture2D" uid="uid://bgrq56ndc4ydj" path="res://assets/graphics/misc/unlocked_size.png" id="4"]
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="5"] [ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="5"]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://64l4dmyfeev7"] [gd_scene load_steps=3 format=3 uid="uid://64l4dmyfeev7"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/Move.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/UtilityTools/Move.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://pvno2bc0jepk"] [gd_scene load_steps=3 format=3 uid="uid://pvno2bc0jepk"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/Pan.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/UtilityTools/Pan.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://qyxbkvju2fbb"] [gd_scene load_steps=3 format=3 uid="uid://qyxbkvju2fbb"]
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/Zoom.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/UtilityTools/Zoom.gd" id="2"]
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")

View file

@ -105,7 +105,7 @@ func _input(event: InputEvent) -> void:
func _has_selection_tool() -> bool: func _has_selection_tool() -> bool:
for slot in Tools._slots.values(): for slot in Tools._slots.values():
if slot.tool_node is SelectionTool: if slot.tool_node is BaseSelectionTool:
return true return true
return false return false

View file

@ -14,7 +14,7 @@ var big_bounding_rectangle := Rect2i():
set(value): set(value):
big_bounding_rectangle = value big_bounding_rectangle = value
for slot in Tools._slots.values(): for slot in Tools._slots.values():
if slot.tool_node is SelectionTool: if slot.tool_node is BaseSelectionTool:
slot.tool_node.set_spinbox_values() slot.tool_node.set_spinbox_values()
_update_gizmos() _update_gizmos()
var image_current_pixel := Vector2.ZERO ## The ACTUAL pixel coordinate of image var image_current_pixel := Vector2.ZERO ## The ACTUAL pixel coordinate of image
@ -182,7 +182,7 @@ func _input(event: InputEvent) -> void:
func _move_with_arrow_keys(event: InputEvent) -> void: func _move_with_arrow_keys(event: InputEvent) -> void:
var selection_tool_selected := false var selection_tool_selected := false
for slot in Tools._slots.values(): for slot in Tools._slots.values():
if slot.tool_node is SelectionTool: if slot.tool_node is BaseSelectionTool:
selection_tool_selected = true selection_tool_selected = true
break break
if !selection_tool_selected: if !selection_tool_selected:

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://ddrry0n03t66c"] [gd_scene load_steps=4 format=3 uid="uid://ddrry0n03t66c"]
[ext_resource type="Texture2D" uid="uid://cnomk15kl7go0" path="res://assets/graphics/tools/tool_background.png" id="1"] [ext_resource type="Texture2D" uid="uid://cnomk15kl7go0" path="res://assets/graphics/tools/tool_background.png" id="1_voklp"]
[ext_resource type="Texture2D" uid="uid://chg3ejelsgcwm" path="res://assets/graphics/tools/rectselect.png" id="2"] [ext_resource type="Texture2D" uid="uid://4h6t2v7tf6r2" path="res://assets/graphics/tools/tool_background_right.png" id="2_v8t3o"]
[ext_resource type="Texture2D" uid="uid://4h6t2v7tf6r2" path="res://assets/graphics/tools/tool_background_right.png" id="2_sxm2f"] [ext_resource type="Texture2D" uid="uid://chg3ejelsgcwm" path="res://assets/graphics/tools/rectselect.png" id="3_hl32r"]
[node name="Tool" type="Button" groups=["UIButtons"]] [node name="Tool" type="Button" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24) custom_minimum_size = Vector2(24, 24)
@ -16,12 +16,13 @@ mouse_default_cursor_shape = 2
button_mask = 3 button_mask = 3
[node name="BackgroundLeft" type="NinePatchRect" parent="."] [node name="BackgroundLeft" type="NinePatchRect" parent="."]
visible = false
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_vertical = 2 grow_vertical = 2
texture = ExtResource("1") texture = ExtResource("1_voklp")
region_rect = Rect2(0, 0, 11, 24) region_rect = Rect2(0, 0, 11, 24)
patch_margin_left = 2 patch_margin_left = 2
patch_margin_top = 1 patch_margin_top = 1
@ -29,12 +30,13 @@ patch_margin_right = 10
patch_margin_bottom = 1 patch_margin_bottom = 1
[node name="BackgroundRight" type="NinePatchRect" parent="."] [node name="BackgroundRight" type="NinePatchRect" parent="."]
visible = false
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
texture = ExtResource("2_sxm2f") texture = ExtResource("2_v8t3o")
patch_margin_left = 11 patch_margin_left = 11
patch_margin_top = 1 patch_margin_top = 1
patch_margin_right = 1 patch_margin_right = 1
@ -51,4 +53,6 @@ offset_left = -11.0
offset_top = -11.0 offset_top = -11.0
offset_right = 11.0 offset_right = 11.0
offset_bottom = 11.0 offset_bottom = 11.0
texture = ExtResource("2") grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_hl32r")

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://byu3rtoipuvoc"] [gd_scene load_steps=2 format=3 uid="uid://byu3rtoipuvoc"]
[ext_resource type="Script" path="res://src/UI/Tools/ToolButtons.gd" id="1"] [ext_resource type="Script" path="res://src/UI/ToolsPanel/ToolButtons.gd" id="1"]
[node name="Tools" type="ScrollContainer"] [node name="Tools" type="ScrollContainer"]
custom_minimum_size = Vector2(36, 36) custom_minimum_size = Vector2(36, 36)

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=54 format=3 uid="uid://c8dsi6ggkqa7a"] [gd_scene load_steps=54 format=3 uid="uid://c8dsi6ggkqa7a"]
[ext_resource type="PackedScene" uid="uid://byu3rtoipuvoc" path="res://src/UI/Tools/Tools.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://byu3rtoipuvoc" path="res://src/UI/ToolsPanel/Tools.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://c546tskdu53j1" path="res://src/UI/Canvas/CanvasPreview.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://c546tskdu53j1" path="res://src/UI/Canvas/CanvasPreview.tscn" id="2"]
[ext_resource type="Script" path="res://src/UI/Tabs.gd" id="3"] [ext_resource type="Script" path="res://src/UI/Tabs.gd" id="3"]
[ext_resource type="Script" path="res://src/UI/Canvas/Rulers/VerticalRuler.gd" id="4"] [ext_resource type="Script" path="res://src/UI/Canvas/Rulers/VerticalRuler.gd" id="4"]