This commit is contained in:
Lilith Schier 2026-05-01 19:50:57 +02:00
commit f389e4e807
186 changed files with 10853 additions and 0 deletions

View file

@ -0,0 +1,225 @@
@tool
extends RefCounted
# GLOBAL SETTINGS
const _CONFIG_SECTION_KEY = 'aseprite'
const _COMMAND_KEY = 'aseprite/general/command_path'
# PROJECT SETTINGS
# animation import defaults
const _DEFAULT_EXCLUSION_PATTERN_KEY = 'aseprite/animation/layers/exclusion_pattern'
const _DEFAULT_ONLY_VISIBLE_LAYERS = 'aseprite/animation/layers/only_include_visible_layers_by_default'
const _DEFAULT_LOOP_EX_PREFIX = '_'
const _LOOP_ENABLED = 'aseprite/animation/loop/enabled'
const _LOOP_EXCEPTION_PREFIX = 'aseprite/animation/loop/exception_prefix'
# cleanup
const _REMOVE_SOURCE_FILES_KEY = 'aseprite/import/cleanup/remove_json_file'
const _SET_VISIBLE_TRACK_AUTOMATICALLY = 'aseprite/import/cleanup/automatically_hide_sprites_not_in_animation'
# automatic importer
const _IMPORTER_ENABLE_KEY = 'aseprite/import/import_plugin/enable_automatic_importer'
const _DEFAULT_IMPORTER_KEY = 'aseprite/import/import_plugin/default_automatic_importer'
const IMPORTER_SPRITEFRAMES_NAME = "SpriteFrames"
const IMPORTER_SPRITEFRAMES_SPLIT_NAME = "SpriteFrames (Split By Layer)"
const IMPORTER_NOOP_NAME = "No Import"
const IMPORTER_TILESET_TEXTURE_NAME = "Tileset Texture"
const IMPORTER_STATIC_TEXTURE_NAME = "Static Texture"
const IMPORTER_STATIC_TEXTURE_SPLIT_NAME = "Static Texture (Split By Layer)"
const _IMPORTER_GENERATE_BAKE_FILE_KEY = 'aseprite/import/import_plugin/generate_bake_files'
# wizard history
const _WIZARD_HISTORY = "wizard_history"
const _HISTORY_MAX_ENTRIES = 'aseprite/wizard/history/max_history_entries'
const _HISTORY_DEFAULT_MAX_ENTRIES = 100
# SpriteFrames import last config
const _STANDALONE_SPRITEFRAMES_LAST_IMPORT_CFG = "standalone_sf_last_import_cfg"
var _editor_settings: EditorSettings = EditorInterface.get_editor_settings()
#######################################################
# GLOBAL CONFIGS
######################################################
func default_command() -> String:
match OS.get_name():
"Windows":
return "C:\\\\Steam\\steamapps\\common\\Aseprite\\aseprite.exe"
"macOS":
return "/Applications/Aseprite.app/Contents/MacOS/aseprite"
_:
return 'aseprite'
func get_command() -> String:
var command = _editor_settings.get(_COMMAND_KEY) if _editor_settings.has_setting(_COMMAND_KEY) else ""
return command if command != "" else default_command()
func set_command(command: String) -> void:
_editor_settings.set_setting(_COMMAND_KEY, command)
#######################################################
# PROJECT SETTINGS
######################################################
# remove this config in the next major version
func is_importer_enabled() -> bool:
return _get_project_setting(_IMPORTER_ENABLE_KEY, false)
func get_default_importer() -> String:
return _get_project_setting(_DEFAULT_IMPORTER_KEY, IMPORTER_SPRITEFRAMES_NAME if is_importer_enabled() else IMPORTER_NOOP_NAME)
func should_generate_bake_files() -> bool:
return _get_project_setting(_IMPORTER_GENERATE_BAKE_FILE_KEY, false)
func should_remove_source_files() -> bool:
return _get_project_setting(_REMOVE_SOURCE_FILES_KEY, true)
func is_default_animation_loop_enabled() -> bool:
return _get_project_setting(_LOOP_ENABLED, true)
func get_animation_loop_exception_prefix() -> String:
return _get_project_setting(_LOOP_EXCEPTION_PREFIX, _DEFAULT_LOOP_EX_PREFIX)
func get_default_exclusion_pattern() -> String:
return _get_project_setting(_DEFAULT_EXCLUSION_PATTERN_KEY, "")
func should_include_only_visible_layers_by_default() -> bool:
return _get_project_setting(_DEFAULT_ONLY_VISIBLE_LAYERS, false)
func get_history_max_entries() -> int:
return _get_project_setting(_HISTORY_MAX_ENTRIES, _HISTORY_DEFAULT_MAX_ENTRIES)
func get_import_history() -> Array:
return get_plugin_metadata(_WIZARD_HISTORY, [])
func is_set_visible_track_automatically_enabled() -> bool:
return _get_project_setting(_SET_VISIBLE_TRACK_AUTOMATICALLY, false)
func save_import_history(history: Array):
set_plugin_metadata(_WIZARD_HISTORY, history)
#=========================================================
# IMPORT CONFIGS
#=========================================================
## Return config for last import done via standalone SpriteFrames import dock
func get_standalone_spriteframes_last_import_config() -> Dictionary:
return get_plugin_metadata(_STANDALONE_SPRITEFRAMES_LAST_IMPORT_CFG, {})
## Set config for last import done via standalone SpriteFrames import dock
func set_standalone_spriteframes_last_import_config(data: Dictionary) -> void:
set_plugin_metadata(_STANDALONE_SPRITEFRAMES_LAST_IMPORT_CFG, data)
func clear_standalone_spriteframes_last_import_config() -> void:
set_plugin_metadata(_STANDALONE_SPRITEFRAMES_LAST_IMPORT_CFG, {})
func get_plugin_metadata(key: String, default: Variant = null) -> Variant:
return _editor_settings.get_project_metadata(_CONFIG_SECTION_KEY, key, default)
func set_plugin_metadata(key: String, data: Variant):
_editor_settings.set_project_metadata(_CONFIG_SECTION_KEY, key, data)
#######################################################
# INITIALIZATION
######################################################
func initialize_project_settings():
_initialize_project_cfg(_DEFAULT_EXCLUSION_PATTERN_KEY, "", TYPE_STRING)
_initialize_project_cfg(_DEFAULT_ONLY_VISIBLE_LAYERS, false, TYPE_BOOL)
_initialize_project_cfg(_LOOP_ENABLED, true, TYPE_BOOL)
_initialize_project_cfg(_LOOP_EXCEPTION_PREFIX, _DEFAULT_LOOP_EX_PREFIX, TYPE_STRING)
_initialize_project_cfg(_REMOVE_SOURCE_FILES_KEY, true, TYPE_BOOL)
_initialize_project_cfg(
_DEFAULT_IMPORTER_KEY,
IMPORTER_SPRITEFRAMES_NAME if is_importer_enabled() else IMPORTER_NOOP_NAME,
TYPE_STRING,
PROPERTY_HINT_ENUM,
",".join([
IMPORTER_NOOP_NAME,
IMPORTER_SPRITEFRAMES_NAME,
IMPORTER_SPRITEFRAMES_SPLIT_NAME,
IMPORTER_TILESET_TEXTURE_NAME,
IMPORTER_STATIC_TEXTURE_NAME,
IMPORTER_STATIC_TEXTURE_SPLIT_NAME
])
)
_initialize_project_cfg(_IMPORTER_GENERATE_BAKE_FILE_KEY, false, TYPE_BOOL)
_initialize_project_cfg(_HISTORY_MAX_ENTRIES, _HISTORY_DEFAULT_MAX_ENTRIES, TYPE_INT)
_initialize_project_cfg(_SET_VISIBLE_TRACK_AUTOMATICALLY, false, TYPE_BOOL)
ProjectSettings.save()
_initialize_editor_cfg(_COMMAND_KEY, default_command(), TYPE_STRING)
func clear_project_settings():
var _all_settings = [
_DEFAULT_EXCLUSION_PATTERN_KEY,
_LOOP_ENABLED,
_LOOP_EXCEPTION_PREFIX,
_REMOVE_SOURCE_FILES_KEY,
_DEFAULT_IMPORTER_KEY,
_HISTORY_MAX_ENTRIES,
_SET_VISIBLE_TRACK_AUTOMATICALLY,
_DEFAULT_ONLY_VISIBLE_LAYERS,
_IMPORTER_GENERATE_BAKE_FILE_KEY,
]
for key in _all_settings:
ProjectSettings.clear(key)
ProjectSettings.save()
func _initialize_project_cfg(key: String, default_value, type: int, hint: int = PROPERTY_HINT_NONE, hint_string = null):
if not ProjectSettings.has_setting(key):
ProjectSettings.set(key, default_value)
ProjectSettings.set_initial_value(key, default_value)
ProjectSettings.add_property_info({
"name": key,
"type": type,
"hint": hint,
"hint_string": hint_string,
})
func _get_project_setting(key: String, default_value):
if not ProjectSettings.has_setting(key):
return default_value
var p = ProjectSettings.get(key)
return p if p != null else default_value
func _initialize_editor_cfg(key: String, default_value, type: int, hint: int = PROPERTY_HINT_NONE):
if not _editor_settings.has_setting(key):
_editor_settings.set(key, default_value)
_editor_settings.set_initial_value(key, default_value, false)
_editor_settings.add_property_info({
"name": key,
"type": type,
"hint": hint,
})

View file

@ -0,0 +1 @@
uid://ck82ws61uw8au

View file

@ -0,0 +1,87 @@
@tool
extends Window
#var _file_dialog: EditorFileDialog
# change this to be a window instead of popup
var _config = preload("./config.gd").new()
@onready var _aseprite_command_field = $PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/aseprite_command
@onready var _version_label = $PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/version_found
@onready var _warnings_block = $PanelContainer/MarginContainer/VBoxContainer/warnings
@onready var _warnings_icon = $PanelContainer/MarginContainer/VBoxContainer/warnings/MarginContainer/VBoxContainer/HBoxContainer/Icon
@onready
var _command_path := _config.get_command()
func _ready():
_aseprite_command_field.text = _command_path
_version_label.modulate.a = 0
var sb = _warnings_block.get_theme_stylebox("panel")
var color = EditorInterface.get_editor_settings().get_setting("interface/theme/accent_color")
color.a = 0.2
sb.bg_color = color
_warnings_icon.texture = get_theme_icon("NodeInfo", "EditorIcons")
var p = $PanelContainer.get_theme_stylebox("panel")
var p_color = EditorInterface.get_editor_settings().get_setting("interface/theme/base_color")
p.bg_color = p_color
func _on_close_button_up():
self.hide()
func _on_test_pressed():
var output = []
if _test_command(output):
_version_label.text = "%s found." % "\n".join(PackedStringArray(output)).strip_edges()
else:
_version_label.text = "Command not found."
_version_label.modulate.a = 1
func _test_command(output):
var exit_code = OS.execute(_aseprite_command_field.text, ['--version'], output, true, true)
return exit_code == 0
func _on_aseprite_command_text_changed(new_text: String) -> void:
_command_path = new_text
func _on_save_button_up() -> void:
_config.set_command(_command_path)
self.hide()
func _on_select_pressed() -> void:
_create_file_selection()
func _create_file_selection():
var file_dialog = EditorFileDialog.new()
file_dialog.file_mode = EditorFileDialog.FILE_MODE_OPEN_FILE
file_dialog.access = EditorFileDialog.ACCESS_FILESYSTEM
file_dialog.file_selected.connect(_on_file_selected.bind(file_dialog))
file_dialog.close_requested.connect(file_dialog.queue_free)
get_parent().add_child(file_dialog)
file_dialog.popup_centered_ratio()
func _on_file_selected(path: String, file_dialog):
if OS.get_name() == "macOS" and path.ends_with(".app"):
path += "/Contents/MacOS/aseprite"
_command_path = path
_aseprite_command_field.text = _command_path
_aseprite_command_field.grab_focus()
file_dialog.queue_free()
func _on_close_requested() -> void:
_on_close_button_up()

View file

@ -0,0 +1 @@
uid://66ct0chhwb4h

View file

@ -0,0 +1,154 @@
[gd_scene load_steps=6 format=3 uid="uid://d0whlywijwa6s"]
[ext_resource type="Script" uid="uid://66ct0chhwb4h" path="res://addons/AsepriteWizard/config/config_dialog.gd" id="1"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_01nxe"]
bg_color = Color(0.21, 0.24, 0.29, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_brc5y"]
content_margin_left = 5.0
content_margin_top = 5.0
content_margin_right = 10.0
content_margin_bottom = 5.0
bg_color = Color(0.44, 0.73, 0.98, 0.2)
border_width_left = 10
border_color = Color(0.8, 0.8, 0.8, 0)
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="Image" id="Image_brc5y"]
data = {
"data": PackedByteArray(255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 231, 255, 90, 90, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 90, 90, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 42, 255, 90, 90, 0, 255, 94, 94, 0, 255, 91, 91, 42, 255, 93, 93, 233, 255, 92, 92, 232, 255, 93, 93, 41, 255, 90, 90, 0, 255, 94, 94, 0, 255, 91, 91, 42, 255, 93, 93, 233, 255, 92, 92, 232, 255, 92, 92, 0, 255, 92, 92, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 93, 93, 44, 255, 91, 91, 0, 255, 91, 91, 42, 255, 91, 91, 42, 255, 93, 93, 0, 255, 91, 91, 45, 255, 93, 93, 44, 255, 91, 91, 0, 255, 91, 91, 42, 255, 91, 91, 42, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 92, 92, 235, 255, 92, 92, 234, 255, 89, 89, 43, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 92, 92, 235, 255, 92, 92, 234, 255, 89, 89, 43, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 91, 91, 59, 255, 92, 92, 61, 255, 92, 92, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 91, 91, 59, 255, 92, 92, 61, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_01nxe"]
image = SubResource("Image_brc5y")
[node name="config_dialog" type="Window"]
title = "Aseprite Wizard Config"
initial_position = 1
size = Vector2i(850, 236)
wrap_controls = true
transient = true
min_size = Vector2i(800, 0)
script = ExtResource("1")
[node name="PanelContainer" type="PanelContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_01nxe")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 10
[node name="warnings" type="PanelContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_brc5y")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/warnings"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_right = 10
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/warnings/MarginContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/warnings/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Icon" type="TextureRect" parent="PanelContainer/MarginContainer/VBoxContainer/warnings/MarginContainer/VBoxContainer/HBoxContainer"]
modulate = Color(1, 1, 1, 0.486275)
custom_minimum_size = Vector2(16, 0)
layout_mode = 2
texture = SubResource("ImageTexture_01nxe")
stretch_mode = 5
[node name="v" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/warnings/MarginContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="project_text" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/warnings/MarginContainer/VBoxContainer/HBoxContainer/v"]
custom_minimum_size = Vector2(10, 0)
layout_mode = 2
size_flags_horizontal = 3
text = "- Project specific settings are located at \"Project > Project Settings > Aseprite\""
autowrap_mode = 2
[node name="HSeparator" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Aseprite Command" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
tooltip_text = "Define the path for Aseprite command"
mouse_filter = 1
text = "Aseprite Command Path"
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="aseprite_command" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "/Applications/Aseprite.app/Contents/MacOS/aseprite"
caret_blink = true
[node name="select" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Find"
[node name="test" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Test"
[node name="version_found" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer"]
modulate = Color(1, 1, 1, 0)
layout_mode = 2
size_flags_horizontal = 3
text = "Aseprite version found"
[node name="HSeparator2" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="VBoxContainer2" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
alignment = 2
[node name="close" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Close"
[node name="save" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Save"
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
[connection signal="text_changed" from="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/aseprite_command" to="." method="_on_aseprite_command_text_changed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/select" to="." method="_on_select_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer/HBoxContainer/test" to="." method="_on_test_pressed"]
[connection signal="button_up" from="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer2/close" to="." method="_on_close_button_up"]
[connection signal="button_up" from="PanelContainer/MarginContainer/VBoxContainer/VBoxContainer2/save" to="." method="_on_save_button_up"]

View file

@ -0,0 +1,21 @@
@tool
extends RefCounted
const LOG_PREFIX = "[Aseprite Wizard] "
static func info(message: String, file_name: String = "") -> void:
print(_build_log_line(message, file_name))
static func error(message: String, file_name: String = "") -> void:
printerr(_build_log_line(message, file_name))
static func warn(message: String, file_name: String = "") -> void:
print(_build_log_line("WARN: "+ message, file_name))
static func _build_log_line(message: String, file_name: String) -> String:
if file_name == "":
return LOG_PREFIX + message
return "%s%s (%s)" % [LOG_PREFIX, message, file_name]

View file

@ -0,0 +1 @@
uid://bsaui5vs757mr

View file

@ -0,0 +1,39 @@
@tool
extends RefCounted
const SUCCESS = 0
const ERR_ASEPRITE_CMD_NOT_FOUND = 991
const ERR_SOURCE_FILE_NOT_FOUND = 992
const ERR_OUTPUT_FOLDER_NOT_FOUND = 993
const ERR_ASEPRITE_EXPORT_FAILED = 994
const ERR_UNKNOWN_EXPORT_MODE = 995
const ERR_NO_VALID_LAYERS_FOUND = 996
const ERR_INVALID_ASEPRITE_SPRITESHEET = 997
static func get_error_message(code: int):
match code:
ERR_ASEPRITE_CMD_NOT_FOUND:
return "Aseprite command failed. Please, check if the right command is in your PATH or configured through \"Editor > Editor Settings > Aseprite > General > Command Path\"."
ERR_SOURCE_FILE_NOT_FOUND:
return "source file does not exist"
ERR_OUTPUT_FOLDER_NOT_FOUND:
return "output location does not exist"
ERR_ASEPRITE_EXPORT_FAILED:
return "unable to import file"
ERR_INVALID_ASEPRITE_SPRITESHEET:
return "aseprite generated bad data file"
ERR_UNKNOWN_EXPORT_MODE:
return "wrong export mode"
ERR_NO_VALID_LAYERS_FOUND:
return "no valid layers found"
_:
return "import failed: %d" % error_string(code)
static func error(error_code: int):
return { "code": error_code, "content": null, "is_ok": false }
static func result(result):
return { "code": SUCCESS, "content": result, "is_ok": true }

View file

@ -0,0 +1 @@
uid://by7cb27r13oyv

View file

@ -0,0 +1,41 @@
@tool
extends RefCounted
const WIZARD_CONFIG_META_NAME = "_aseprite_wizard_config_"
const WIZARD_INTERFACE_CONFIG_META_NAME = "_aseprite_wizard_interface_config_"
const SOURCE_FILE_HASH_META_NAME = "_aseprite_wizard_source_file_hash_"
static func load_config(node: Object):
if node.has_meta(WIZARD_CONFIG_META_NAME):
return node.get_meta(WIZARD_CONFIG_META_NAME)
return {}
static func save_config(node: Object, cfg: Dictionary):
node.set_meta(WIZARD_CONFIG_META_NAME, cfg)
static func has_config(node: Object) -> bool:
return node.has_meta(WIZARD_CONFIG_META_NAME)
static func load_interface_config(node: Node, default: Dictionary = {}) -> Dictionary:
if node.has_meta(WIZARD_INTERFACE_CONFIG_META_NAME):
return node.get_meta(WIZARD_INTERFACE_CONFIG_META_NAME)
return default
static func save_interface_config(node: Node, cfg:Dictionary) -> void:
node.set_meta(WIZARD_INTERFACE_CONFIG_META_NAME, cfg)
static func set_source_hash(node: Object, hash: String) -> void:
node.set_meta(SOURCE_FILE_HASH_META_NAME, hash)
static func get_source_hash(node: Object) -> String:
if node.has_meta(SOURCE_FILE_HASH_META_NAME):
return node.get_meta(SOURCE_FILE_HASH_META_NAME)
return ""

View file

@ -0,0 +1 @@
uid://dhp6gmqfu1yrm