diff --git a/modules/entity_spell_system/SCsub b/modules/entity_spell_system/SCsub index b80b85553..d144bcce3 100644 --- a/modules/entity_spell_system/SCsub +++ b/modules/entity_spell_system/SCsub @@ -10,12 +10,6 @@ if os.path.isdir('../mesh_data_resource'): if os.path.isdir('../props'): module_env.Append(CPPDEFINES=['PROPS_PRESENT']) -has_texture_packer = False - -if os.path.isdir('../texture_packer'): - has_texture_packer = True - module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT']) - sources = [ "register_types.cpp", @@ -131,7 +125,7 @@ sources = [ "material_cache/ess_material_cache.cpp" ] -if has_texture_packer: +if env["module_texture_packer_enabled"]: sources.append("material_cache/ess_material_cache_pcm.cpp") if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': diff --git a/modules/entity_spell_system/register_types.cpp b/modules/entity_spell_system/register_types.cpp index b8cc5b949..5e2607a43 100644 --- a/modules/entity_spell_system/register_types.cpp +++ b/modules/entity_spell_system/register_types.cpp @@ -131,7 +131,12 @@ SOFTWARE. #include "database/ess_resource_db_static.h" #include "material_cache/ess_material_cache.h" + +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "material_cache/ess_material_cache_pcm.h" +#endif #if PROPS_PRESENT #include "props/prop_data_entity.h" @@ -265,7 +270,10 @@ void register_entity_spell_system_types() { ClassDB::register_class(); ClassDB::register_class(); + +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::register_class(); +#endif entity_data_manager = memnew(ESS); ClassDB::register_class(); diff --git a/modules/entity_spell_system/singletons/ess.cpp b/modules/entity_spell_system/singletons/ess.cpp index 5d3a4012d..d3bca0e3b 100644 --- a/modules/entity_spell_system/singletons/ess.cpp +++ b/modules/entity_spell_system/singletons/ess.cpp @@ -28,6 +28,8 @@ SOFTWARE. #include "../utility/entity_create_info.h" #include "core/config/project_settings.h" +#include "modules/modules_enabled.gen.h" + ESS *ESS::instance; ESS *ESS::get_singleton() { @@ -495,7 +497,7 @@ void ESS::set_class_xp_data(const PoolIntArray &data) { _class_xps = data; } -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int ESS::get_texture_flags() const { return _texture_flags; } @@ -814,7 +816,7 @@ void ESS::_bind_methods() { ClassDB::bind_method(D_METHOD("set_class_xp_data", "data"), &ESS::set_character_xp_data); ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "class_xp_data"), "set_class_xp_data", "get_class_xp_data"); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("get_texture_flags"), &ESS::get_texture_flags); ClassDB::bind_method(D_METHOD("set_texture_flags", "flags"), &ESS::set_texture_flags); ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_texture_flags", "get_texture_flags"); @@ -899,13 +901,13 @@ ESS::ESS() { _class_xps = GLOBAL_DEF("ess/xp/class_xps", PoolIntArray()); _character_xps = GLOBAL_DEF("ess/xp/character_xps", PoolIntArray()); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED _default_ess_material_cache_class = GLOBAL_DEF("ess/material_cache/default_ess_material_cache_class", "ESSMaterialCachePCM"); #else _default_ess_material_cache_class = GLOBAL_DEF("ess/material_cache/default_ess_material_cache_class", "ESSMaterialCache"); #endif -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED _texture_flags = GLOBAL_DEF("ess/material_cache/texture_flags", Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _max_atlas_size = GLOBAL_DEF("ess/material_cache/max_atlas_size", 1024); diff --git a/modules/entity_spell_system/singletons/ess.h b/modules/entity_spell_system/singletons/ess.h index 795de4ad9..dd85db171 100644 --- a/modules/entity_spell_system/singletons/ess.h +++ b/modules/entity_spell_system/singletons/ess.h @@ -31,6 +31,7 @@ SOFTWARE. #include "scene/main/node.h" #include "../defines.h" +#include "modules/modules_enabled.gen.h" class ESSResourceDB; class ESSEntitySpawner; @@ -171,7 +172,7 @@ public: PoolIntArray get_class_xp_data(); void set_class_xp_data(const PoolIntArray &data); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int get_texture_flags() const; void set_texture_flags(const int flags); @@ -277,7 +278,7 @@ private: Map> _material_cache; -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int _texture_flags; int _max_atlas_size; bool _keep_original_atlases; diff --git a/modules/mesh_data_resource/SCsub b/modules/mesh_data_resource/SCsub index ed3afe79a..6761b536a 100644 --- a/modules/mesh_data_resource/SCsub +++ b/modules/mesh_data_resource/SCsub @@ -4,9 +4,6 @@ Import('env') module_env = env.Clone() -if env["module_texture_packer_enabled"]: - module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT']) - if env["module_props_enabled"]: module_env.Append(CPPDEFINES=['PROPS_PRESENT']) diff --git a/modules/mesh_data_resource/nodes/mesh_data_instance.cpp b/modules/mesh_data_resource/nodes/mesh_data_instance.cpp index f02f3d520..4083dc1d1 100644 --- a/modules/mesh_data_resource/nodes/mesh_data_instance.cpp +++ b/modules/mesh_data_resource/nodes/mesh_data_instance.cpp @@ -4,7 +4,9 @@ #include "core/io/image.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_resource/packer_image_resource.h" #endif @@ -165,7 +167,7 @@ void MeshDataInstance::setup_material_texture() { return; } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED Ref r = _texture; if (r.is_valid()) { diff --git a/modules/mesh_data_resource/nodes/mesh_data_instance_2d.cpp b/modules/mesh_data_resource/nodes/mesh_data_instance_2d.cpp index d0b16a508..3c7402ac6 100644 --- a/modules/mesh_data_resource/nodes/mesh_data_instance_2d.cpp +++ b/modules/mesh_data_resource/nodes/mesh_data_instance_2d.cpp @@ -4,7 +4,9 @@ #include "core/io/image.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_resource/packer_image_resource.h" #endif diff --git a/modules/mesh_data_resource/props/prop_data_mesh_data.cpp b/modules/mesh_data_resource/props/prop_data_mesh_data.cpp index 1e904ff03..05936307d 100644 --- a/modules/mesh_data_resource/props/prop_data_mesh_data.cpp +++ b/modules/mesh_data_resource/props/prop_data_mesh_data.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_data_mesh_data.h" +#include "modules/modules_enabled.gen.h" + #if PROPS_PRESENT #include "../nodes/mesh_data_instance.h" @@ -55,7 +57,7 @@ void PropDataMeshData::set_snap_axis(Vector3 value) { _snap_axis = value; } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void PropDataMeshData::_add_textures_into(Ref texture_packer) { if (get_texture().is_valid()) { texture_packer->add_texture(get_texture()); @@ -122,7 +124,7 @@ void PropDataMeshData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &PropDataMeshData::set_snap_axis); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("_add_textures_into", "texture_packer"), &PropDataMeshData::_add_textures_into); #endif } diff --git a/modules/mesh_data_resource/props/prop_data_mesh_data.h b/modules/mesh_data_resource/props/prop_data_mesh_data.h index f4236b82d..267c90936 100644 --- a/modules/mesh_data_resource/props/prop_data_mesh_data.h +++ b/modules/mesh_data_resource/props/prop_data_mesh_data.h @@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "modules/modules_enabled.gen.h" + #if PROPS_PRESENT #include "../../props/props/prop_data_entry.h" @@ -31,7 +33,7 @@ SOFTWARE. #include "../mesh_data_resource.h" -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -53,7 +55,7 @@ public: Vector3 get_snap_axis(); void set_snap_axis(Vector3 value); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void _add_textures_into(Ref texture_packer); #endif diff --git a/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.cpp b/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.cpp index d7b9bf76a..9b6a8c06a 100644 --- a/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.cpp +++ b/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_2d_data_mesh_data.h" +#include "modules/modules_enabled.gen.h" + #if PROPS_2D_PRESENT #include "../nodes/mesh_data_instance.h" @@ -55,7 +57,7 @@ void Prop2DDataMeshData::set_snap_axis(Vector3 value) { _snap_axis = value; } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void Prop2DDataMeshData::_add_textures_into(Ref texture_packer) { if (get_texture().is_valid()) { texture_packer->add_texture(get_texture()); @@ -129,7 +131,7 @@ void Prop2DDataMeshData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &Prop2DDataMeshData::set_snap_axis); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("_add_textures_into", "texture_packer"), &Prop2DDataMeshData::_add_textures_into); #endif } diff --git a/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.h b/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.h index 34be16560..81b7a781d 100644 --- a/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.h +++ b/modules/mesh_data_resource/props_2d/prop_2d_data_mesh_data.h @@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "modules/modules_enabled.gen.h" + #if PROPS_2D_PRESENT #include "../../props_2d/props/prop_2d_data_entry.h" @@ -31,7 +33,7 @@ SOFTWARE. #include "../mesh_data_resource.h" -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -53,7 +55,7 @@ public: Vector3 get_snap_axis(); void set_snap_axis(Vector3 value); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void _add_textures_into(Ref texture_packer); #endif diff --git a/modules/props/SCsub b/modules/props/SCsub index ab7e60dd9..795b9cca5 100644 --- a/modules/props/SCsub +++ b/modules/props/SCsub @@ -9,12 +9,6 @@ import version if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) -has_texture_packer = False - -if os.path.isdir('../texture_packer'): - has_texture_packer = True - module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT']) - if os.path.isdir('../terraman'): module_env.Append(CPPDEFINES=['TERRAMAN_PRESENT']) @@ -65,7 +59,7 @@ sources = [ if version.minor >= 4: sources.append("props/prop_data_portal.cpp") -if has_texture_packer: +if env["module_texture_packer_enabled"]: sources.append("material_cache/prop_material_cache_pcm.cpp") if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': diff --git a/modules/props/clutter/ground_clutter.cpp b/modules/props/clutter/ground_clutter.cpp index ed3551e47..b7309f041 100644 --- a/modules/props/clutter/ground_clutter.cpp +++ b/modules/props/clutter/ground_clutter.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "ground_clutter.h" +#include "modules/modules_enabled.gen.h" + #ifdef VOXELMAN_PRESENT #include "../../voxelman/world/voxel_chunk.h" @@ -38,7 +40,7 @@ void GroundClutter::add_meshes_to(Ref mesher, Ref chunk } #endif -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void GroundClutter::add_textures_to(Ref packer) { if (has_method("_add_textures_to")) call("_add_textures_to", packer); @@ -52,7 +54,7 @@ GroundClutter::~GroundClutter() { } void GroundClutter::_bind_methods() { -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED BIND_VMETHOD(MethodInfo("_add_textures_to", PropertyInfo(Variant::OBJECT, "packer", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker"))); ClassDB::bind_method(D_METHOD("add_textures_to", "packer"), &GroundClutter::add_textures_to); diff --git a/modules/props/clutter/ground_clutter.h b/modules/props/clutter/ground_clutter.h index 8a77c6479..2b5ffdbe3 100644 --- a/modules/props/clutter/ground_clutter.h +++ b/modules/props/clutter/ground_clutter.h @@ -24,7 +24,9 @@ SOFTWARE. #include "core/object/resource.h" -#ifdef TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -45,7 +47,7 @@ public: void add_meshes_to(Ref mesher, Ref chunk, int x, int y, int z); #endif -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_to(Ref packer); #endif diff --git a/modules/props/jobs/prop_texture_job.cpp b/modules/props/jobs/prop_texture_job.cpp index 3fb3fb447..2acca1157 100644 --- a/modules/props/jobs/prop_texture_job.cpp +++ b/modules/props/jobs/prop_texture_job.cpp @@ -22,11 +22,13 @@ SOFTWARE. #include "prop_texture_job.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED Ref PropTextureJob::get_merger() { return _merger; } @@ -37,7 +39,7 @@ void PropTextureJob::set_merger(const Ref &merger) { #endif void PropTextureJob::_execute() { -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED if (!_merger.is_valid()) { set_complete(true); return; @@ -56,7 +58,7 @@ PropTextureJob::~PropTextureJob() { } void PropTextureJob::_bind_methods() { -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("get_merger"), &PropTextureJob::get_merger); ClassDB::bind_method(D_METHOD("set_merger", "value"), &PropTextureJob::set_merger); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "merger", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker"), "set_merger", "get_merger"); diff --git a/modules/props/jobs/prop_texture_job.h b/modules/props/jobs/prop_texture_job.h index 2d66dd09a..8b9cae785 100644 --- a/modules/props/jobs/prop_texture_job.h +++ b/modules/props/jobs/prop_texture_job.h @@ -28,7 +28,9 @@ SOFTWARE. #include "core/object/reference.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED class TexturePacker; #endif @@ -36,7 +38,7 @@ class PropTextureJob : public ThreadPoolJob { GDCLASS(PropTextureJob, ThreadPoolJob); public: -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED Ref get_merger(); void set_merger(const Ref &merger); #endif @@ -49,7 +51,7 @@ public: protected: static void _bind_methods(); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED Ref _merger; #endif }; diff --git a/modules/props/prop_instance_merger.cpp b/modules/props/prop_instance_merger.cpp index eba05144c..4980a61fb 100644 --- a/modules/props/prop_instance_merger.cpp +++ b/modules/props/prop_instance_merger.cpp @@ -18,6 +18,10 @@ #include "servers/rendering_server.h" +#include "modules/modules_enabled.gen.h" + +#include "./singleton/prop_cache.h" + #if MESH_DATA_RESOURCE_PRESENT //define PROPS_PRESENT, so things compile. That module's scsub will define this too while compiling, //but not when included from here. @@ -35,7 +39,7 @@ #include "scene/3d/camera.h" #include "scene/main/viewport.h" -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "./singleton/prop_cache.h" #endif diff --git a/modules/props/prop_instance_prop_job.cpp b/modules/props/prop_instance_prop_job.cpp index f5f842fc8..c7a0de8e6 100644 --- a/modules/props/prop_instance_prop_job.cpp +++ b/modules/props/prop_instance_prop_job.cpp @@ -33,6 +33,8 @@ SOFTWARE. #include "servers/physics_server.h" #include "singleton/prop_cache.h" +#include "modules/modules_enabled.gen.h" + #ifdef MESH_DATA_RESOURCE_PRESENT #include "../mesh_data_resource/mesh_data_resource.h" #endif @@ -41,7 +43,7 @@ SOFTWARE. #include "../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../texture_packer/texture_packer.h" #endif diff --git a/modules/props/props/prop_data.cpp b/modules/props/props/prop_data.cpp index 9cad0bf52..003b63371 100644 --- a/modules/props/props/prop_data.cpp +++ b/modules/props/props/prop_data.cpp @@ -28,6 +28,8 @@ SOFTWARE. #include "servers/physics_server.h" +#include "modules/modules_enabled.gen.h" + int PropData::get_id() const { return _id; } @@ -88,7 +90,7 @@ void PropData::set_props(const Vector &props) { } } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void PropData::add_textures_into(Ref texture_packer) { ERR_FAIL_COND(!texture_packer.is_valid()); @@ -163,7 +165,7 @@ void PropData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_props", "props"), &PropData::set_props); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropDataEntry", PROPERTY_USAGE_DEFAULT, "PropDataEntry"), "set_props", "get_props"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &PropData::add_textures_into); #endif diff --git a/modules/props/props/prop_data.h b/modules/props/props/prop_data.h index a199d6c2f..72f2173bf 100644 --- a/modules/props/props/prop_data.h +++ b/modules/props/props/prop_data.h @@ -32,7 +32,9 @@ SOFTWARE. #include "prop_data_entry.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -59,7 +61,7 @@ public: Vector get_props(); void set_props(const Vector &props); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_into(Ref texture_packer); #endif diff --git a/modules/props/props/prop_data_entry.cpp b/modules/props/props/prop_data_entry.cpp index e27a09fb0..f90501e36 100644 --- a/modules/props/props/prop_data_entry.cpp +++ b/modules/props/props/prop_data_entry.cpp @@ -26,7 +26,9 @@ SOFTWARE. #include "scene/3d/spatial.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -39,7 +41,7 @@ void PropDataEntry::set_transform(const Transform &value) { _transform = value; } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void PropDataEntry::add_textures_into(Ref texture_packer) { if (has_method("_add_textures_into")) call("_add_textures_into", texture_packer); @@ -81,7 +83,7 @@ void PropDataEntry::_bind_methods() { ClassDB::bind_method(D_METHOD("set_transform", "value"), &PropDataEntry::set_transform); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED BIND_VMETHOD(MethodInfo("_add_textures_into", PropertyInfo(Variant::OBJECT, "texture_packer", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker"))); ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &PropDataEntry::add_textures_into); diff --git a/modules/props/props/prop_data_entry.h b/modules/props/props/prop_data_entry.h index 1e347e89b..1be8a727e 100644 --- a/modules/props/props/prop_data_entry.h +++ b/modules/props/props/prop_data_entry.h @@ -25,6 +25,8 @@ SOFTWARE. #include "core/math/transform.h" #include "core/object/resource.h" +#include "modules/modules_enabled.gen.h" + class PropData; class PropMesher; class TexturePacker; @@ -36,7 +38,7 @@ public: Transform get_transform() const; void set_transform(const Transform &value); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_into(Ref texture_packer); #endif diff --git a/modules/props/props/prop_data_prop.cpp b/modules/props/props/prop_data_prop.cpp index 10317b8b4..17694c330 100644 --- a/modules/props/props/prop_data_prop.cpp +++ b/modules/props/props/prop_data_prop.cpp @@ -25,6 +25,8 @@ SOFTWARE. #include "../prop_instance.h" #include "prop_data.h" +#include "modules/modules_enabled.gen.h" + Ref PropDataProp::get_prop() const { return _prop; } @@ -46,7 +48,7 @@ void PropDataProp::set_snap_axis(Vector3 value) { _snap_axis = value; } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void PropDataProp::_add_textures_into(Ref texture_packer) { if (get_prop().is_valid()) { get_prop()->add_textures_into(texture_packer); @@ -103,7 +105,7 @@ void PropDataProp::_bind_methods() { ClassDB::bind_method(D_METHOD("set_snap_axis", "value"), &PropDataProp::set_snap_axis); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap_axis"), "set_snap_axis", "get_snap_axis"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("_add_textures_into", "texture_packer"), &PropDataProp::_add_textures_into); #endif } diff --git a/modules/props/props/prop_data_prop.h b/modules/props/props/prop_data_prop.h index e4c016ebb..8b56e1f2c 100644 --- a/modules/props/props/prop_data_prop.h +++ b/modules/props/props/prop_data_prop.h @@ -27,7 +27,9 @@ SOFTWARE. #include "prop_data.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -44,7 +46,7 @@ public: Vector3 get_snap_axis(); void set_snap_axis(Vector3 value); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void _add_textures_into(Ref texture_packer); #endif diff --git a/modules/props/register_types.cpp b/modules/props/register_types.cpp index bb9e34b88..a04bfc29a 100644 --- a/modules/props/register_types.cpp +++ b/modules/props/register_types.cpp @@ -62,7 +62,9 @@ SOFTWARE. #include "material_cache/prop_material_cache.h" -#ifdef TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "material_cache/prop_material_cache_pcm.h" #endif @@ -104,7 +106,7 @@ void register_props_types() { ClassDB::register_class(); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::register_class(); #endif diff --git a/modules/props/singleton/prop_cache.cpp b/modules/props/singleton/prop_cache.cpp index 603530ba9..30b2d72a3 100644 --- a/modules/props/singleton/prop_cache.cpp +++ b/modules/props/singleton/prop_cache.cpp @@ -37,6 +37,8 @@ SOFTWARE. #include "core/containers/hashfuncs.h" +#include "modules/modules_enabled.gen.h" + #define VARIANT_ARRAY_GET(arr) \ Vector r; \ for (int i = 0; i < arr.size(); i++) { \ @@ -57,7 +59,7 @@ void PropCache::set_default_prop_material_cache_class(const StringName &cls_name _default_prop_material_cache_class = cls_name; } -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int PropCache::get_texture_flags() const { return _texture_flags; } @@ -342,13 +344,13 @@ Ref PropCache::load_resource(const String &path, const String &type_hi PropCache::PropCache() { _instance = this; -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED _default_prop_material_cache_class = GLOBAL_DEF("props/default_prop_material_cache_class", "PropMaterialCachePCM"); #else _default_prop_material_cache_class = GLOBAL_DEF("props/default_prop_material_cache_class", "PropMaterialCache"); #endif -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED _texture_flags = GLOBAL_DEF("props/texture_flags", Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _max_atlas_size = GLOBAL_DEF("props/max_atlas_size", 1024); @@ -369,7 +371,7 @@ void PropCache::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_prop_material_cache_class", "cls_name"), &PropCache::set_default_prop_material_cache_class); ADD_PROPERTY(PropertyInfo(Variant::STRING, "default_prop_material_cache_class"), "set_default_prop_material_cache_class", "get_default_prop_material_cache_class"); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("get_texture_flags"), &PropCache::get_texture_flags); ClassDB::bind_method(D_METHOD("set_texture_flags", "flags"), &PropCache::set_texture_flags); ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_texture_flags", "get_texture_flags"); diff --git a/modules/props/singleton/prop_cache.h b/modules/props/singleton/prop_cache.h index 34c42e7f5..218ebba63 100644 --- a/modules/props/singleton/prop_cache.h +++ b/modules/props/singleton/prop_cache.h @@ -35,6 +35,8 @@ SOFTWARE. #include "../props/prop_data.h" +#include "modules/modules_enabled.gen.h" + class PropMaterialCache; class TiledWallData; @@ -47,7 +49,7 @@ public: StringName get_default_prop_material_cache_class(); void set_default_prop_material_cache_class(const StringName &cls_name); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int get_texture_flags() const; void set_texture_flags(const int flags); @@ -110,7 +112,7 @@ protected: Mutex _tiled_wall_material_cache_mutex; Mutex _custom_keyed_material_cache_mutex; -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int _texture_flags; int _max_atlas_size; bool _keep_original_atlases; diff --git a/modules/props/tiled_wall/tiled_wall.cpp b/modules/props/tiled_wall/tiled_wall.cpp index e04505c93..b01bc2a92 100644 --- a/modules/props/tiled_wall/tiled_wall.cpp +++ b/modules/props/tiled_wall/tiled_wall.cpp @@ -4,7 +4,9 @@ #include "core/io/image.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_resource/packer_image_resource.h" #endif diff --git a/modules/props/tiled_wall/tiled_wall_data.cpp b/modules/props/tiled_wall/tiled_wall_data.cpp index e69cb0b1b..0f98127a0 100644 --- a/modules/props/tiled_wall/tiled_wall_data.cpp +++ b/modules/props/tiled_wall/tiled_wall_data.cpp @@ -40,6 +40,8 @@ SOFTWARE. #include "../material_cache/prop_material_cache.h" +#include "modules/modules_enabled.gen.h" + const String TiledWallData::BINDING_STRING_TILED_WALL_TILING_TYPE = "None,Horizontal,Vertical,Both"; const String TiledWallData::BINDING_STRING_TILED_WALL_COLLIDER_TYPE = "None,Plane,Box,Convex Mesh,Concave Mesh"; @@ -274,7 +276,7 @@ void TiledWallData::materials_set(const Vector &materials) { emit_changed(); } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void TiledWallData::add_textures_into(Ref texture_packer) { ERR_FAIL_COND(!texture_packer.is_valid()); @@ -567,7 +569,7 @@ void TiledWallData::_bind_methods() { ClassDB::bind_method(D_METHOD("materials_set"), &TiledWallData::materials_set); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/19:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &TiledWallData::add_textures_into); #endif diff --git a/modules/props/tiled_wall/tiled_wall_data.h b/modules/props/tiled_wall/tiled_wall_data.h index 1562b57f3..02ac9e6b1 100644 --- a/modules/props/tiled_wall/tiled_wall_data.h +++ b/modules/props/tiled_wall/tiled_wall_data.h @@ -33,7 +33,9 @@ SOFTWARE. #include "scene/resources/material.h" #include "scene/resources/texture.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -145,7 +147,7 @@ public: Vector materials_get(); void materials_set(const Vector &materials); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_into(Ref texture_packer); #endif diff --git a/modules/props_2d/SCsub b/modules/props_2d/SCsub index 5b30ea53e..6a0e8ee12 100644 --- a/modules/props_2d/SCsub +++ b/modules/props_2d/SCsub @@ -9,12 +9,6 @@ import version if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) -has_texture_packer = False - -if os.path.isdir('../texture_packer'): - has_texture_packer = True - module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT']) - if os.path.isdir('../terraman_2d'): module_env.Append(CPPDEFINES=['TERRAMAN_2D_PRESENT']) @@ -64,7 +58,7 @@ sources = [ if version.minor >= 4: sources.append("props/prop_2d_data_portal.cpp") -if has_texture_packer: +if env["module_texture_packer_enabled"]: sources.append("material_cache/prop_2d_material_cache_pcm.cpp") if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': diff --git a/modules/props_2d/clutter/ground_clutter_2d.cpp b/modules/props_2d/clutter/ground_clutter_2d.cpp index c9fb81a50..d71291869 100644 --- a/modules/props_2d/clutter/ground_clutter_2d.cpp +++ b/modules/props_2d/clutter/ground_clutter_2d.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "ground_clutter_2d.h" +#include "modules/modules_enabled.gen.h" + #ifdef VOXELMAN_PRESENT #include "../../voxelman/world/voxel_chunk.h" @@ -38,7 +40,7 @@ void GroundClutter2D::add_meshes_to(Ref mesher, Ref chu } #endif -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void GroundClutter2D::add_textures_to(Ref packer) { if (has_method("_add_textures_to")) call("_add_textures_to", packer); @@ -52,7 +54,7 @@ GroundClutter2D::~GroundClutter2D() { } void GroundClutter2D::_bind_methods() { -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED BIND_VMETHOD(MethodInfo("_add_textures_to", PropertyInfo(Variant::OBJECT, "packer", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker"))); ClassDB::bind_method(D_METHOD("add_textures_to", "packer"), &GroundClutter2D::add_textures_to); diff --git a/modules/props_2d/clutter/ground_clutter_2d.h b/modules/props_2d/clutter/ground_clutter_2d.h index 1523db71b..895652e48 100644 --- a/modules/props_2d/clutter/ground_clutter_2d.h +++ b/modules/props_2d/clutter/ground_clutter_2d.h @@ -24,7 +24,9 @@ SOFTWARE. #include "core/object/resource.h" -#ifdef TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -45,7 +47,7 @@ public: void add_meshes_to(Ref mesher, Ref chunk, int x, int y, int z); #endif -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_to(Ref packer); #endif diff --git a/modules/props_2d/jobs/prop_2d_texture_job.cpp b/modules/props_2d/jobs/prop_2d_texture_job.cpp index 8985e9e1f..0b95c9039 100644 --- a/modules/props_2d/jobs/prop_2d_texture_job.cpp +++ b/modules/props_2d/jobs/prop_2d_texture_job.cpp @@ -22,11 +22,13 @@ SOFTWARE. #include "prop_2d_texture_job.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED Ref Prop2DTextureJob::get_merger() { return _merger; } @@ -37,7 +39,7 @@ void Prop2DTextureJob::set_merger(const Ref &merger) { #endif void Prop2DTextureJob::_execute() { -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED if (!_merger.is_valid()) { set_complete(true); return; @@ -56,7 +58,7 @@ Prop2DTextureJob::~Prop2DTextureJob() { } void Prop2DTextureJob::_bind_methods() { -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("get_merger"), &Prop2DTextureJob::get_merger); ClassDB::bind_method(D_METHOD("set_merger", "value"), &Prop2DTextureJob::set_merger); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "merger", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker"), "set_merger", "get_merger"); diff --git a/modules/props_2d/jobs/prop_2d_texture_job.h b/modules/props_2d/jobs/prop_2d_texture_job.h index a65bda982..6731a5c17 100644 --- a/modules/props_2d/jobs/prop_2d_texture_job.h +++ b/modules/props_2d/jobs/prop_2d_texture_job.h @@ -28,7 +28,9 @@ SOFTWARE. #include "core/object/reference.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED class TexturePacker; #endif @@ -36,7 +38,7 @@ class Prop2DTextureJob : public ThreadPoolJob { GDCLASS(Prop2DTextureJob, ThreadPoolJob); public: -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED Ref get_merger(); void set_merger(const Ref &merger); #endif @@ -49,7 +51,7 @@ public: protected: static void _bind_methods(); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED Ref _merger; #endif }; diff --git a/modules/props_2d/prop_2d_instance_merger.cpp b/modules/props_2d/prop_2d_instance_merger.cpp index a751c6746..7da1e1671 100644 --- a/modules/props_2d/prop_2d_instance_merger.cpp +++ b/modules/props_2d/prop_2d_instance_merger.cpp @@ -8,6 +8,10 @@ #include "core/config/engine.h" +#include "modules/modules_enabled.gen.h" + +#include "./singleton/prop_2d_cache.h" + #define VARIANT_ARRAY_GET(arr) \ Vector r; \ for (int i = 0; i < arr.size(); i++) { \ @@ -32,7 +36,7 @@ #include "material_cache/prop_2d_material_cache.h" #include "scene/3d/camera.h" -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "./singleton/prop_2d_cache.h" #endif diff --git a/modules/props_2d/prop_2d_instance_prop_job.cpp b/modules/props_2d/prop_2d_instance_prop_job.cpp index 051a9e9b3..192c0665d 100644 --- a/modules/props_2d/prop_2d_instance_prop_job.cpp +++ b/modules/props_2d/prop_2d_instance_prop_job.cpp @@ -30,6 +30,8 @@ SOFTWARE. #include "scene/resources/shape.h" #include "singleton/prop_2d_cache.h" +#include "modules/modules_enabled.gen.h" + #ifdef MESH_DATA_RESOURCE_PRESENT #include "../mesh_data_resource/mesh_data_resource.h" #endif @@ -38,7 +40,7 @@ SOFTWARE. #include "../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../texture_packer/texture_packer.h" #endif diff --git a/modules/props_2d/props/prop_2d_data.cpp b/modules/props_2d/props/prop_2d_data.cpp index d9a5090fe..b8d9f5636 100644 --- a/modules/props_2d/props/prop_2d_data.cpp +++ b/modules/props_2d/props/prop_2d_data.cpp @@ -28,6 +28,8 @@ SOFTWARE. #include "servers/physics_server.h" +#include "modules/modules_enabled.gen.h" + int Prop2DData::get_id() const { return _id; } @@ -74,7 +76,7 @@ void Prop2DData::set_props(const Vector &props) { } } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void Prop2DData::add_textures_into(Ref texture_packer) { ERR_FAIL_COND(!texture_packer.is_valid()); @@ -141,7 +143,7 @@ void Prop2DData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_props", "props"), &Prop2DData::set_props); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:Prop2DDataEntry", PROPERTY_USAGE_DEFAULT, "Prop2DDataEntry"), "set_props", "get_props"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &Prop2DData::add_textures_into); #endif diff --git a/modules/props_2d/props/prop_2d_data.h b/modules/props_2d/props/prop_2d_data.h index bacb2ac00..33e4aee22 100644 --- a/modules/props_2d/props/prop_2d_data.h +++ b/modules/props_2d/props/prop_2d_data.h @@ -32,7 +32,9 @@ SOFTWARE. #include "prop_2d_data_entry.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -53,7 +55,7 @@ public: Vector get_props(); void set_props(const Vector &props); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_into(Ref texture_packer); #endif diff --git a/modules/props_2d/props/prop_2d_data_entry.cpp b/modules/props_2d/props/prop_2d_data_entry.cpp index 811f5161b..ed06192da 100644 --- a/modules/props_2d/props/prop_2d_data_entry.cpp +++ b/modules/props_2d/props/prop_2d_data_entry.cpp @@ -26,7 +26,9 @@ SOFTWARE. #include "scene/2d/node_2d.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -108,7 +110,7 @@ void Prop2DDataEntry::set_use_parent_material(const bool value) { _use_parent_material = value; } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void Prop2DDataEntry::add_textures_into(Ref texture_packer) { if (has_method("_add_textures_into")) call("_add_textures_into", texture_packer); @@ -248,7 +250,7 @@ void Prop2DDataEntry::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_parent_material", "value"), &Prop2DDataEntry::set_use_parent_material); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_parent_material"), "set_use_parent_material", "get_use_parent_material"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED BIND_VMETHOD(MethodInfo("_add_textures_into", PropertyInfo(Variant::OBJECT, "texture_packer", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker"))); ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &Prop2DDataEntry::add_textures_into); diff --git a/modules/props_2d/props/prop_2d_data_entry.h b/modules/props_2d/props/prop_2d_data_entry.h index ba23ca4f5..1b840c26c 100644 --- a/modules/props_2d/props/prop_2d_data_entry.h +++ b/modules/props_2d/props/prop_2d_data_entry.h @@ -28,6 +28,8 @@ SOFTWARE. #include "scene/resources/material.h" +#include "modules/modules_enabled.gen.h" + class Prop2DData; class Prop2DMesher; class TexturePacker; @@ -69,7 +71,7 @@ public: bool get_use_parent_material() const; void set_use_parent_material(const bool value); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_into(Ref texture_packer); #endif diff --git a/modules/props_2d/props/prop_2d_data_prop.cpp b/modules/props_2d/props/prop_2d_data_prop.cpp index 8108e9520..a8c0e617a 100644 --- a/modules/props_2d/props/prop_2d_data_prop.cpp +++ b/modules/props_2d/props/prop_2d_data_prop.cpp @@ -25,6 +25,8 @@ SOFTWARE. #include "../prop_2d_instance.h" #include "prop_2d_data.h" +#include "modules/modules_enabled.gen.h" + Ref Prop2DDataProp2D::get_prop() const { return _prop; } @@ -32,7 +34,7 @@ void Prop2DDataProp2D::set_prop(const Ref value) { _prop = value; } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void Prop2DDataProp2D::_add_textures_into(Ref texture_packer) { if (get_prop().is_valid()) { get_prop()->add_textures_into(texture_packer); @@ -92,7 +94,7 @@ void Prop2DDataProp2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_prop", "value"), &Prop2DDataProp2D::set_prop); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop", PROPERTY_HINT_RESOURCE_TYPE, "Prop2DData"), "set_prop", "get_prop"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("_add_textures_into", "texture_packer"), &Prop2DDataProp2D::_add_textures_into); #endif } diff --git a/modules/props_2d/props/prop_2d_data_prop.h b/modules/props_2d/props/prop_2d_data_prop.h index ba154808a..6fd9ebe5d 100644 --- a/modules/props_2d/props/prop_2d_data_prop.h +++ b/modules/props_2d/props/prop_2d_data_prop.h @@ -28,7 +28,9 @@ SOFTWARE. #include "prop_2d_data.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -39,7 +41,7 @@ public: Ref get_prop() const; void set_prop(const Ref value); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void _add_textures_into(Ref texture_packer); #endif diff --git a/modules/props_2d/register_types.cpp b/modules/props_2d/register_types.cpp index d789855f3..3a6dd8df2 100644 --- a/modules/props_2d/register_types.cpp +++ b/modules/props_2d/register_types.cpp @@ -62,7 +62,9 @@ SOFTWARE. #include "material_cache/prop_2d_material_cache.h" -#ifdef TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "material_cache/prop_2d_material_cache_pcm.h" #endif @@ -104,7 +106,7 @@ void register_props_2d_types() { ClassDB::register_class(); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::register_class(); #endif diff --git a/modules/props_2d/singleton/prop_2d_cache.cpp b/modules/props_2d/singleton/prop_2d_cache.cpp index 4775bceef..81d4c4f9f 100644 --- a/modules/props_2d/singleton/prop_2d_cache.cpp +++ b/modules/props_2d/singleton/prop_2d_cache.cpp @@ -37,6 +37,8 @@ SOFTWARE. #include "core/containers/hashfuncs.h" +#include "modules/modules_enabled.gen.h" + #define VARIANT_ARRAY_GET(arr) \ Vector r; \ for (int i = 0; i < arr.size(); i++) { \ @@ -64,7 +66,7 @@ void Prop2DCache::set_default_prop_material_cache_class(const StringName &cls_na _default_prop_material_cache_class = cls_name; } -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int Prop2DCache::get_texture_flags() const { return _texture_flags; } @@ -315,13 +317,13 @@ Prop2DCache::Prop2DCache() { _default_pixels_per_unit = GLOBAL_DEF("props_2d/default_pixels_per_unit", 64); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED _default_prop_material_cache_class = GLOBAL_DEF("props_2d/default_prop_material_cache_class", "Prop2DMaterialCachePCM"); #else _default_prop_material_cache_class = GLOBAL_DEF("props_2d/default_prop_material_cache_class", "Prop2DMaterialCache"); #endif -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED _texture_flags = GLOBAL_DEF("props_2d/texture_flags", Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER); _max_atlas_size = GLOBAL_DEF("props_2d/max_atlas_size", 1024); @@ -346,7 +348,7 @@ void Prop2DCache::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_prop_material_cache_class", "cls_name"), &Prop2DCache::set_default_prop_material_cache_class); ADD_PROPERTY(PropertyInfo(Variant::STRING, "default_prop_material_cache_class"), "set_default_prop_material_cache_class", "get_default_prop_material_cache_class"); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("get_texture_flags"), &Prop2DCache::get_texture_flags); ClassDB::bind_method(D_METHOD("set_texture_flags", "flags"), &Prop2DCache::set_texture_flags); ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Linear,Convert to Linear,Mirrored Repeat,Video Surface"), "set_texture_flags", "get_texture_flags"); diff --git a/modules/props_2d/singleton/prop_2d_cache.h b/modules/props_2d/singleton/prop_2d_cache.h index c86b76c5b..917c14c47 100644 --- a/modules/props_2d/singleton/prop_2d_cache.h +++ b/modules/props_2d/singleton/prop_2d_cache.h @@ -35,6 +35,8 @@ SOFTWARE. #include "../props/prop_2d_data.h" +#include "modules/modules_enabled.gen.h" + class Prop2DMaterialCache; class TiledWall2DData; @@ -50,7 +52,7 @@ public: StringName get_default_prop_material_cache_class(); void set_default_prop_material_cache_class(const StringName &cls_name); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int get_texture_flags() const; void set_texture_flags(const int flags); @@ -108,7 +110,7 @@ protected: Mutex _tiled_wall_material_cache_mutex; Mutex _custom_keyed_material_cache_mutex; -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED int _texture_flags; int _max_atlas_size; bool _keep_original_atlases; diff --git a/modules/props_2d/tiled_wall/tiled_wall_2d.cpp b/modules/props_2d/tiled_wall/tiled_wall_2d.cpp index e481f0882..2ee1f6628 100644 --- a/modules/props_2d/tiled_wall/tiled_wall_2d.cpp +++ b/modules/props_2d/tiled_wall/tiled_wall_2d.cpp @@ -4,7 +4,9 @@ #include "core/io/image.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_resource/packer_image_resource.h" #endif diff --git a/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp b/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp index ef4490282..804102e85 100644 --- a/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp +++ b/modules/props_2d/tiled_wall/tiled_wall_2d_data.cpp @@ -40,6 +40,8 @@ SOFTWARE. #include "../material_cache/prop_2d_material_cache.h" +#include "modules/modules_enabled.gen.h" + const String TiledWall2DData::BINDING_STRING_TILED_WALL_TILING_TYPE = "None,Horizontal,Vertical,Both"; TiledWall2DData::TiledWall2DTilingType TiledWall2DData::get_tiling_type() const { @@ -159,7 +161,7 @@ void TiledWall2DData::material_set(const Ref &value) { emit_changed(); } -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void TiledWall2DData::add_textures_into(Ref texture_packer) { ERR_FAIL_COND(!texture_packer.is_valid()); @@ -278,7 +280,7 @@ void TiledWall2DData::_bind_methods() { ClassDB::bind_method(D_METHOD("material_set", "value"), &TiledWall2DData::material_set); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "Material"), "material_set", "material_get"); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::bind_method(D_METHOD("add_textures_into", "texture_packer"), &TiledWall2DData::add_textures_into); #endif diff --git a/modules/props_2d/tiled_wall/tiled_wall_2d_data.h b/modules/props_2d/tiled_wall/tiled_wall_2d_data.h index 2bea63b2f..7ece488a1 100644 --- a/modules/props_2d/tiled_wall/tiled_wall_2d_data.h +++ b/modules/props_2d/tiled_wall/tiled_wall_2d_data.h @@ -33,7 +33,9 @@ SOFTWARE. #include "scene/resources/material.h" #include "scene/resources/texture.h" -#if TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "../../texture_packer/texture_packer.h" #endif @@ -86,7 +88,7 @@ public: Ref material_get(); void material_set(const Ref &value); -#if TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED void add_textures_into(Ref texture_packer); #endif diff --git a/modules/terraman/SCsub b/modules/terraman/SCsub index 5c26650ac..518318b04 100644 --- a/modules/terraman/SCsub +++ b/modules/terraman/SCsub @@ -4,11 +4,6 @@ Import('env') module_env = env.Clone() -has_texture_packer = False -if os.path.isdir('../texture_packer'): - module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT']) - has_texture_packer = True - if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) @@ -66,7 +61,7 @@ sources = [ "world/jobs/terrain_prop_job.cpp", ] -if has_texture_packer: +if env["module_texture_packer_enabled"]: sources.append("library/terrain_library_merger.cpp") sources.append("library/terrain_library_merger_pcm.cpp") sources.append("library/terrain_surface_merger.cpp") diff --git a/modules/terraman/register_types.cpp b/modules/terraman/register_types.cpp index 12b4e11b4..e2fe07a31 100644 --- a/modules/terraman/register_types.cpp +++ b/modules/terraman/register_types.cpp @@ -29,7 +29,9 @@ SOFTWARE. #include "library/terrain_library_simple.h" #include "library/terrain_material_cache.h" -#ifdef TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "library/terrain_library_merger.h" #include "library/terrain_library_merger_pcm.h" #include "library/terrain_material_cache_pcm.h" @@ -80,7 +82,7 @@ void register_terraman_types() { ClassDB::register_class(); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); diff --git a/modules/terraman_2d/SCsub b/modules/terraman_2d/SCsub index b4b3f7987..406568f40 100644 --- a/modules/terraman_2d/SCsub +++ b/modules/terraman_2d/SCsub @@ -4,11 +4,6 @@ Import('env') module_env = env.Clone() -has_texture_packer = False -if os.path.isdir('../texture_packer'): - module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT']) - has_texture_packer = True - if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) @@ -69,7 +64,7 @@ sources = [ "world/jobs/terrain_2d_prop_job.cpp", ] -if has_texture_packer: +if env["module_texture_packer_enabled"]: sources.append("library/terrain_2d_library_merger.cpp") sources.append("library/terrain_2d_library_merger_pcm.cpp") sources.append("library/terrain_2d_surface_merger.cpp") diff --git a/modules/terraman_2d/register_types.cpp b/modules/terraman_2d/register_types.cpp index c5e85ce79..c1d45c9c1 100644 --- a/modules/terraman_2d/register_types.cpp +++ b/modules/terraman_2d/register_types.cpp @@ -29,7 +29,9 @@ SOFTWARE. #include "library/terrain_2d_library_simple.h" #include "library/terrain_2d_material_cache.h" -#ifdef TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "library/terrain_2d_library_merger.h" #include "library/terrain_2d_library_merger_pcm.h" #include "library/terrain_2d_material_cache_pcm.h" @@ -82,7 +84,7 @@ void register_terraman_2d_types() { ClassDB::register_class(); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); diff --git a/modules/voxelman/SCsub b/modules/voxelman/SCsub index 959b42764..de90dd280 100644 --- a/modules/voxelman/SCsub +++ b/modules/voxelman/SCsub @@ -4,11 +4,6 @@ Import('env') module_env = env.Clone() -has_texture_packer = False -if os.path.isdir('../texture_packer'): - module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT']) - has_texture_packer = True - if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) @@ -80,7 +75,7 @@ sources = [ "world/jobs/voxel_prop_job.cpp", ] -if has_texture_packer: +if env["module_texture_packer_enabled"]: sources.append("library/voxel_library_merger.cpp") sources.append("library/voxel_surface_merger.cpp") sources.append("library/voxel_library_merger_pcm.cpp") diff --git a/modules/voxelman/register_types.cpp b/modules/voxelman/register_types.cpp index 96c3feb5e..0d9464697 100644 --- a/modules/voxelman/register_types.cpp +++ b/modules/voxelman/register_types.cpp @@ -29,7 +29,9 @@ SOFTWARE. #include "library/voxel_library_simple.h" #include "library/voxel_material_cache.h" -#ifdef TEXTURE_PACKER_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_TEXTURE_PACKER_ENABLED #include "library/voxel_library_merger.h" #include "library/voxel_library_merger_pcm.h" #include "library/voxel_material_cache_pcm.h" @@ -96,7 +98,7 @@ void register_voxelman_types() { ClassDB::register_class(); -#ifdef TEXTURE_PACKER_PRESENT +#ifdef MODULE_TEXTURE_PACKER_ENABLED ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class();