Skip to content

Commit

Permalink
[godot] Remove debug defines
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Oct 2, 2024
1 parent 15ecabc commit 7e66714
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
21 changes: 12 additions & 9 deletions spine-godot/spine_godot/SpineAtlasResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "scene/resources/texture.h"
#include <spine/TextureLoader.h>

#define TOOLS_ENABLED
#ifdef TOOLS_ENABLED
#include "editor/editor_file_system.h"
#endif
Expand Down Expand Up @@ -105,24 +104,27 @@ class GodotSpineTextureLoader : public spine::TextureLoader {
}
#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.
// See https://github.com/EsotericSoftware/spine-runtimes/issues/2385
if (is_importing) {
HashMap<StringName, Variant> 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<Texture2D> texture = get_texture_from_image(fixed_path, is_resource);
Expand All @@ -145,6 +147,7 @@ class GodotSpineTextureLoader : public spine::TextureLoader {

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<Texture> normal_map = get_texture_from_image(new_path, is_resource);
normal_maps->append(normal_map);
renderer_object->normal_map = normal_map;
Expand Down
1 change: 0 additions & 1 deletion spine-godot/spine_godot/SpineEditorPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e66714

Please sign in to comment.