diff --git a/spine-godot/spine_godot/SpineCommon.h b/spine-godot/spine_godot/SpineCommon.h index c9cdda5d5..1cacf556b 100644 --- a/spine-godot/spine_godot/SpineCommon.h +++ b/spine-godot/spine_godot/SpineCommon.h @@ -30,8 +30,18 @@ #ifndef SPINE_COMMON_H #define SPINE_COMMON_H +#include "core/version_generated.gen.h" #ifdef SPINE_GODOT_EXTENSION #include + +// When running scons with deprecated=no, these are not defined in version.h in Godot 4.5.1 +// but our code for older versions of Godot relies on them. +#ifndef VERSION_MAJOR +#define VERSION_MAJOR GODOT_VERSION_MAJOR +#define VERSION_MINOR GODOT_VERSION_MINOR +#define VERSION_PATCH GODOT_VERSION_PATCH +#endif + #include #include using namespace godot; @@ -46,17 +56,20 @@ using namespace godot; #define RES Ref #define REF Ref #define GEOMETRY2D Geometry2D -#ifndef VERSION_MAJOR -#define VERSION_MAJOR GODOT_VERSION_MAJOR -#endif -#ifndef VERSION_MINOR -#define VERSION_MINOR GODOT_VERSION_MINOR -#endif // FIXME this doesn't do the same as the engine SNAME in terms of caching #define SNAME(name) StringName(name) #define RS RenderingServer #else #include "core/version.h" + +// When running scons with deprecated=no, these are not defined in version.h in Godot 4.5.1 +// but our code for older versions of Godot relies on them. +#ifndef VERSION_MAJOR +#define VERSION_MAJOR GODOT_VERSION_MAJOR +#define VERSION_MINOR GODOT_VERSION_MINOR +#define VERSION_PATCH GODOT_VERSION_PATCH +#endif + #if VERSION_MAJOR > 3 #include "core/core_bind.h" #include "core/error/error_macros.h" diff --git a/spine-godot/spine_godot/SpineSkeletonDataResource.cpp b/spine-godot/spine_godot/SpineSkeletonDataResource.cpp index 83ef759f3..050bd2563 100644 --- a/spine-godot/spine_godot/SpineSkeletonDataResource.cpp +++ b/spine-godot/spine_godot/SpineSkeletonDataResource.cpp @@ -33,11 +33,15 @@ #ifdef SPINE_GODOT_EXTENSION #include #include +#ifdef TOOLS_ENABLED #include +#endif #else #if VERSION_MAJOR > 3 #include "core/config/engine.h" +#ifdef TOOLS_ENABLED #include "editor/editor_interface.h" +#endif #else #include "core/engine.h" #endif diff --git a/spine-godot/spine_godot/SpineSprite.cpp b/spine-godot/spine_godot/SpineSprite.cpp index c29e250bf..ce479e291 100644 --- a/spine-godot/spine_godot/SpineSprite.cpp +++ b/spine-godot/spine_godot/SpineSprite.cpp @@ -41,7 +41,9 @@ #include #include #include +#ifdef TOOLS_ENABLED #include +#endif #include #include #include @@ -60,7 +62,7 @@ #include "scene/resources/mesh.h" #include "servers/rendering_server.h" #include "scene/resources/canvas_item_material.h" -#if VERSION_MINOR > 0 +#if VERSION_MINOR > 0 && defined(TOOLS_ENABLED) #include "editor/editor_interface.h" #endif #else