From 7e6671456b17c6a2cc37b382ec9fb43a8dc3fc97 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 2 Oct 2024 16:24:32 +0200 Subject: [PATCH] [godot] Remove debug defines --- .../spine_godot/SpineAtlasResource.cpp | 21 +++++++++++-------- spine-godot/spine_godot/SpineEditorPlugin.cpp | 1 - 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/spine-godot/spine_godot/SpineAtlasResource.cpp b/spine-godot/spine_godot/SpineAtlasResource.cpp index ac258fe52..1531a8978 100644 --- a/spine-godot/spine_godot/SpineAtlasResource.cpp +++ b/spine-godot/spine_godot/SpineAtlasResource.cpp @@ -35,7 +35,6 @@ #include "scene/resources/texture.h" #include -#define TOOLS_ENABLED #ifdef TOOLS_ENABLED #include "editor/editor_file_system.h" #endif @@ -105,13 +104,8 @@ public: } #endif - void load(spine::AtlasPage &page, const spine::String &path) override { - Error error = OK; - String fixed_path = String(path.buffer()); - bool is_resource = fix_path(fixed_path); - - -#ifdef VERSION_MAJOR > 4 + void import_image_resource(const String &path) { +#ifdef VERSION_MAJOR> 4 #ifdef TOOLS_ENABLED // Required when importing into editor by e.g. drag & drop. The .png files // of the atlas might not have been imported yet. @@ -119,10 +113,18 @@ public: if (is_importing) { HashMap custom_options; Dictionary generator_parameters; - EditorFileSystem::get_singleton()->reimport_append(fixed_path, custom_options, "", generator_parameters); + EditorFileSystem::get_singleton()->reimport_append(path, custom_options, "", generator_parameters); } #endif #endif + } + + void load(spine::AtlasPage &page, const spine::String &path) override { + Error error = OK; + String fixed_path = String(path.buffer()); + bool is_resource = fix_path(fixed_path); + + import_image_resource(fixed_path); #if VERSION_MAJOR > 3 Ref texture = get_texture_from_image(fixed_path, is_resource); @@ -145,6 +147,7 @@ public: String new_path = vformat("%s/%s_%s", fixed_path.get_base_dir(), normal_map_prefix, fixed_path.get_file()); if (ResourceLoader::exists(new_path)) { + import_image_resource(new_path); Ref normal_map = get_texture_from_image(new_path, is_resource); normal_maps->append(normal_map); renderer_object->normal_map = normal_map; diff --git a/spine-godot/spine_godot/SpineEditorPlugin.cpp b/spine-godot/spine_godot/SpineEditorPlugin.cpp index b2d8b060a..446709e66 100644 --- a/spine-godot/spine_godot/SpineEditorPlugin.cpp +++ b/spine-godot/spine_godot/SpineEditorPlugin.cpp @@ -26,7 +26,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE * SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#define TOOLS_ENABLED #define VERSION_MAJOR 4 #ifdef TOOLS_ENABLED