diff --git a/modules/entity_spell_system/SCsub b/modules/entity_spell_system/SCsub index d144bcce3..94974ecad 100644 --- a/modules/entity_spell_system/SCsub +++ b/modules/entity_spell_system/SCsub @@ -7,9 +7,6 @@ module_env = env.Clone() if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) -if os.path.isdir('../props'): - module_env.Append(CPPDEFINES=['PROPS_PRESENT']) - sources = [ "register_types.cpp", diff --git a/modules/entity_spell_system/material_cache/ess_material_cache.cpp b/modules/entity_spell_system/material_cache/ess_material_cache.cpp index d42bb00dd..95fbd83ea 100644 --- a/modules/entity_spell_system/material_cache/ess_material_cache.cpp +++ b/modules/entity_spell_system/material_cache/ess_material_cache.cpp @@ -22,16 +22,16 @@ SOFTWARE. #include "ess_material_cache.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_prop.h" #include "../../props/props/prop_data_tiled_wall.h" #include "../../props/tiled_wall/tiled_wall_data.h" #if MESH_DATA_RESOURCE_PRESENT -#define PROPS_PRESENT 1 #include "../../mesh_data_resource/props/prop_data_mesh_data.h" -#undef PROPS_PRESENT #endif #endif @@ -173,7 +173,7 @@ Rect2 ESSMaterialCache::texture_get_uv_rect(const Ref &texture) { return Rect2(0, 0, 1, 1); } -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void ESSMaterialCache::prop_add_textures(const Ref &prop) { if (!prop.is_valid()) { return; @@ -203,7 +203,7 @@ void ESSMaterialCache::prop_add_textures(const Ref &prop) { if (!twd.is_valid()) continue; - twd->setup_cache(Ref(this)); + twd->setup_ess_cache(Ref(this)); continue; } @@ -242,16 +242,16 @@ void ESSMaterialCache::prop_remove_textures(const Ref &prop) { if (!twd.is_valid()) continue; - for (int j = 0; j < twd->get_texture_count(); ++j) { - const Ref &tex = twd->get_texture(j); + for (int j = 0; j < twd->get_tile_count(); ++j) { + const Ref &tex = twd->get_tile_texture(j); if (tex.is_valid()) { texture_remove(tex); } } - for (int j = 0; j < twd->get_flavour_texture_count(); ++j) { - const Ref &tex = twd->get_flavour_texture(j); + for (int j = 0; j < twd->get_flavour_tile_count(); ++j) { + const Ref &tex = twd->get_flavour_tile_texture(j); if (tex.is_valid()) { texture_remove(tex); @@ -349,7 +349,7 @@ void ESSMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("texture_get_atlas_tex", "index"), &ESSMaterialCache::texture_get_atlas_tex); ClassDB::bind_method(D_METHOD("texture_get_uv_rect", "texture"), &ESSMaterialCache::texture_get_uv_rect); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_add_textures", "prop"), &ESSMaterialCache::prop_add_textures); ClassDB::bind_method(D_METHOD("prop_remove_textures", "prop"), &ESSMaterialCache::prop_remove_textures); #endif diff --git a/modules/entity_spell_system/material_cache/ess_material_cache.h b/modules/entity_spell_system/material_cache/ess_material_cache.h index ac9f5f727..534875d9f 100644 --- a/modules/entity_spell_system/material_cache/ess_material_cache.h +++ b/modules/entity_spell_system/material_cache/ess_material_cache.h @@ -30,6 +30,8 @@ SOFTWARE. #include "core/os/mutex.h" #include "scene/resources/material.h" +#include "modules/modules_enabled.gen.h" + class PropData; class ESSMaterialCache : public Resource { @@ -69,7 +71,7 @@ public: virtual Ref texture_get_atlas_tex(const Ref &texture); virtual Rect2 texture_get_uv_rect(const Ref &texture); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void prop_add_textures(const Ref &prop); void prop_remove_textures(const Ref &prop); #endif diff --git a/modules/entity_spell_system/props/prop_data_entity.cpp b/modules/entity_spell_system/props/prop_data_entity.cpp index dc3ef8c8a..2f8059dbc 100644 --- a/modules/entity_spell_system/props/prop_data_entity.cpp +++ b/modules/entity_spell_system/props/prop_data_entity.cpp @@ -22,7 +22,9 @@ SOFTWARE. #include "prop_data_entity.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED Ref PropDataEntity::get_entity_data() const { return _entity_data; diff --git a/modules/entity_spell_system/props/prop_data_entity.h b/modules/entity_spell_system/props/prop_data_entity.h index 6bd7a5013..02a7003ec 100644 --- a/modules/entity_spell_system/props/prop_data_entity.h +++ b/modules/entity_spell_system/props/prop_data_entity.h @@ -22,7 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data_entry.h" diff --git a/modules/entity_spell_system/register_types.cpp b/modules/entity_spell_system/register_types.cpp index 5e2607a43..b4590a402 100644 --- a/modules/entity_spell_system/register_types.cpp +++ b/modules/entity_spell_system/register_types.cpp @@ -138,7 +138,7 @@ SOFTWARE. #include "material_cache/ess_material_cache_pcm.h" #endif -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED #include "props/prop_data_entity.h" #endif @@ -146,7 +146,7 @@ static ESS *entity_data_manager = NULL; static ProfileManager *profile_manager = NULL; void register_entity_spell_system_types() { -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::register_class(); #endif diff --git a/modules/mesh_data_resource/SCsub b/modules/mesh_data_resource/SCsub index 6761b536a..5de29810d 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_props_enabled"]: - module_env.Append(CPPDEFINES=['PROPS_PRESENT']) - if env["module_props_2d_enabled"]: module_env.Append(CPPDEFINES=['PROPS_2D_PRESENT']) 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 05936307d..002bdcb57 100644 --- a/modules/mesh_data_resource/props/prop_data_mesh_data.cpp +++ b/modules/mesh_data_resource/props/prop_data_mesh_data.cpp @@ -24,7 +24,7 @@ SOFTWARE. #include "modules/modules_enabled.gen.h" -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED #include "../nodes/mesh_data_instance.h" #include "scene/resources/material.h" 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 267c90936..29340d2e8 100644 --- a/modules/mesh_data_resource/props/prop_data_mesh_data.h +++ b/modules/mesh_data_resource/props/prop_data_mesh_data.h @@ -24,7 +24,7 @@ SOFTWARE. #include "modules/modules_enabled.gen.h" -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data_entry.h" #include "core/math/vector3.h" diff --git a/modules/mesh_data_resource/register_types.cpp b/modules/mesh_data_resource/register_types.cpp index cbc4a6224..2c9ac0dc0 100644 --- a/modules/mesh_data_resource/register_types.cpp +++ b/modules/mesh_data_resource/register_types.cpp @@ -39,7 +39,7 @@ SOFTWARE. #include "./editor/mdi_ed_plugin.h" #endif -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED #include "../props/singleton/prop_utils.h" #include "props/prop_data_mesh_data.h" #endif @@ -56,7 +56,7 @@ void register_mesh_data_resource_types() { ClassDB::register_class(); ClassDB::register_class(); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::register_class(); Ref processor = Ref(memnew(PropDataMeshData)); PropUtils::add_processor(processor); diff --git a/modules/props/material_cache/prop_material_cache.cpp b/modules/props/material_cache/prop_material_cache.cpp index 1c98ba3a4..1ccd2c7bd 100644 --- a/modules/props/material_cache/prop_material_cache.cpp +++ b/modules/props/material_cache/prop_material_cache.cpp @@ -29,9 +29,7 @@ SOFTWARE. #include "../tiled_wall/tiled_wall_data.h" #if MESH_DATA_RESOURCE_PRESENT -#define PROPS_PRESENT 1 #include "../../mesh_data_resource/props/prop_data_mesh_data.h" -#undef PROPS_PRESENT #endif #define VARIANT_ARRAY_GET(arr) \ diff --git a/modules/props/prop_instance.cpp b/modules/props/prop_instance.cpp index cb4812f80..a4692ecc8 100644 --- a/modules/props/prop_instance.cpp +++ b/modules/props/prop_instance.cpp @@ -5,9 +5,6 @@ #include "scene/3d/light.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. -#define PROPS_PRESENT 1 #include "../mesh_data_resource/props/prop_data_mesh_data.h" #endif diff --git a/modules/props/prop_instance_merger.cpp b/modules/props/prop_instance_merger.cpp index 4980a61fb..60cd4694c 100644 --- a/modules/props/prop_instance_merger.cpp +++ b/modules/props/prop_instance_merger.cpp @@ -23,9 +23,6 @@ #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. -#define PROPS_PRESENT 1 #include "../mesh_data_resource/props/prop_data_mesh_data.h" #endif diff --git a/modules/props/prop_instance_prop_job.cpp b/modules/props/prop_instance_prop_job.cpp index c7a0de8e6..98f69b3cb 100644 --- a/modules/props/prop_instance_prop_job.cpp +++ b/modules/props/prop_instance_prop_job.cpp @@ -48,11 +48,7 @@ SOFTWARE. #endif #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. -#define PROPS_PRESENT 1 #include "../mesh_data_resource/props/prop_data_mesh_data.h" -#undef PROPS_PRESENT #endif #include "props/prop_data_tiled_wall.h" diff --git a/modules/props/tiled_wall/tiled_wall_data.cpp b/modules/props/tiled_wall/tiled_wall_data.cpp index 0f98127a0..b2f5c0982 100644 --- a/modules/props/tiled_wall/tiled_wall_data.cpp +++ b/modules/props/tiled_wall/tiled_wall_data.cpp @@ -42,6 +42,10 @@ SOFTWARE. #include "modules/modules_enabled.gen.h" +#ifdef MODULE_ENTITY_SPELL_SYSTEM_ENABLED +#include "modules/entity_spell_system/material_cache/ess_material_cache.h" +#endif + 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"; @@ -333,6 +337,43 @@ void TiledWallData::_setup_cache(Ref cache) { } } +#ifdef MODULE_ENTITY_SPELL_SYSTEM_ENABLED +void TiledWallData::setup_ess_cache(Ref cache) { + //Note: the caller should lock and unlock the cache! + + call("_setup_ess_cache", cache); +} +void TiledWallData::_setup_ess_cache(Ref cache) { + if (cache->material_get_num() == 0) { + for (int i = 0; i < _materials.size(); ++i) { + const Ref &m = _materials[i]; + + if (m.is_valid()) { + Ref nm = m->duplicate(); + + cache->material_add(nm); + } + } + } + + for (int i = 0; i < _tiles.size(); ++i) { + const Ref &t = _tiles[i].texture; + + if (t.is_valid()) { + cache->texture_add(t); + } + } + + for (int i = 0; i < _flavour_tiles.size(); ++i) { + const Ref &t = _flavour_tiles[i].texture; + + if (t.is_valid()) { + cache->texture_add(t); + } + } +} +#endif + void TiledWallData::copy_from(const Ref &tiled_wall_data) { ERR_FAIL_COND(!tiled_wall_data.is_valid()); @@ -578,6 +619,13 @@ void TiledWallData::_bind_methods() { ClassDB::bind_method(D_METHOD("setup_cache", "cache"), &TiledWallData::setup_cache); ClassDB::bind_method(D_METHOD("_setup_cache", "cache"), &TiledWallData::_setup_cache); +#ifdef MODULE_ENTITY_SPELL_SYSTEM_ENABLED + BIND_VMETHOD(MethodInfo("_setup_ess_cache", PropertyInfo(Variant::OBJECT, "cache", PROPERTY_HINT_RESOURCE_TYPE, "ESSMaterialCache"))); + + ClassDB::bind_method(D_METHOD("setup_ess_cache", "cache"), &TiledWallData::setup_ess_cache); + ClassDB::bind_method(D_METHOD("_setup_ess_cache", "cache"), &TiledWallData::_setup_ess_cache); +#endif + ClassDB::bind_method(D_METHOD("copy_from", "prop_data"), &TiledWallData::copy_from); BIND_ENUM_CONSTANT(TILED_WALL_TILING_TYPE_NONE); diff --git a/modules/props/tiled_wall/tiled_wall_data.h b/modules/props/tiled_wall/tiled_wall_data.h index 02ac9e6b1..30bc7962b 100644 --- a/modules/props/tiled_wall/tiled_wall_data.h +++ b/modules/props/tiled_wall/tiled_wall_data.h @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "core/object/reference.h" #include "core/containers/vector.h" +#include "core/object/reference.h" #include "core/math/rect2.h" #include "core/math/transform.h" @@ -41,6 +41,9 @@ SOFTWARE. class PropMaterialCache; class PropMesher; +#ifdef MODULE_ENTITY_SPELL_SYSTEM_ENABLED +class ESSMaterialCache; +#endif class TiledWallData : public Resource { GDCLASS(TiledWallData, Resource); @@ -97,7 +100,7 @@ public: //textures void add_tile(const Ref &texture, const float y_size = 1, const float z_offset = 0, const int texture_scale = 1); void remove_tile(const int index); - TextureEntry get_tile(const int index) const; + TextureEntry get_tile(const int index) const; Ref get_tile_texture(const int index) const; void set_tile_texture(const int index, const Ref &texture); @@ -117,7 +120,7 @@ public: //flavour_textures void add_flavour_tile(const Ref &texture, const float y_size = 1, const float z_offset = 0, const int texture_scale = 1); void remove_flavour_tile(const int index); - TextureEntry get_flavour_tile(const int index) const; + TextureEntry get_flavour_tile(const int index) const; Ref get_flavour_tile_texture(const int index) const; void set_flavour_tile_texture(const int index, const Ref &texture); @@ -154,6 +157,11 @@ public: void setup_cache(Ref cache); void _setup_cache(Ref cache); +#ifdef MODULE_ENTITY_SPELL_SYSTEM_ENABLED + void setup_ess_cache(Ref cache); + void _setup_ess_cache(Ref cache); +#endif + void copy_from(const Ref &tiled_wall_data); //Ref get_collider_shape(); diff --git a/modules/props_2d/prop_2d_instance_prop_job.cpp b/modules/props_2d/prop_2d_instance_prop_job.cpp index 192c0665d..e1a069828 100644 --- a/modules/props_2d/prop_2d_instance_prop_job.cpp +++ b/modules/props_2d/prop_2d_instance_prop_job.cpp @@ -30,8 +30,6 @@ 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 diff --git a/modules/terraman/SCsub b/modules/terraman/SCsub index 518318b04..0f4317b1b 100644 --- a/modules/terraman/SCsub +++ b/modules/terraman/SCsub @@ -7,9 +7,6 @@ module_env = env.Clone() if os.path.isdir('../mesh_data_resource'): module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) -if os.path.isdir('../props'): - module_env.Append(CPPDEFINES=['PROPS_PRESENT']) - if os.path.isdir('../mesh_utils'): module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) diff --git a/modules/terraman/library/terrain_library.cpp b/modules/terraman/library/terrain_library.cpp index 291a2661f..ef5ad1532 100644 --- a/modules/terraman/library/terrain_library.cpp +++ b/modules/terraman/library/terrain_library.cpp @@ -26,7 +26,9 @@ SOFTWARE. #include "terrain_material_cache.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #endif @@ -311,7 +313,7 @@ int TerrainLibrary::scene_get_num() const { void TerrainLibrary::scenes_clear() { } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref TerrainLibrary::prop_get(const int id) { return Ref(); } @@ -454,7 +456,7 @@ void TerrainLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("scene_get_num"), &TerrainLibrary::scene_get_num); ClassDB::bind_method(D_METHOD("scenes_clear"), &TerrainLibrary::scenes_clear); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_get", "id"), &TerrainLibrary::prop_get); ClassDB::bind_method(D_METHOD("prop_add", "value"), &TerrainLibrary::prop_add); ClassDB::bind_method(D_METHOD("prop_has", "prop"), &TerrainLibrary::prop_has); diff --git a/modules/terraman/library/terrain_library.h b/modules/terraman/library/terrain_library.h index 1fbfd5751..f61a62c19 100644 --- a/modules/terraman/library/terrain_library.h +++ b/modules/terraman/library/terrain_library.h @@ -30,12 +30,14 @@ SOFTWARE. #include "../data/terrain_light.h" #include "terrain_surface.h" +#include "modules/modules_enabled.gen.h" + class TerrainMaterialCache; class TerrainSurface; class TerrainMesher; class PackedScene; class TerrainChunk; -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED class PropData; #endif @@ -127,7 +129,7 @@ public: virtual int scene_get_num() const; virtual void scenes_clear(); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED virtual Ref prop_get(const int id); virtual void prop_add(Ref value); virtual bool prop_has(const Ref &value) const; diff --git a/modules/terraman/library/terrain_library_merger.cpp b/modules/terraman/library/terrain_library_merger.cpp index 20e08348a..33b0b0c53 100644 --- a/modules/terraman/library/terrain_library_merger.cpp +++ b/modules/terraman/library/terrain_library_merger.cpp @@ -25,7 +25,9 @@ SOFTWARE. #include "scene/resources/packed_scene.h" #include "scene/resources/texture.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_prop.h" @@ -151,7 +153,7 @@ void TerrainLibraryMerger::set_terra_surfaces(const Vector &surfaces) { } } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref TerrainLibraryMerger::get_prop(const int index) { ERR_FAIL_INDEX_V(index, _props.size(), Ref()); @@ -260,7 +262,7 @@ void TerrainLibraryMerger::refresh_rects() { setup_material_albedo(MATERIAL_INDEX_LIQUID, tex); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED //todo add this back //texture_added = false; for (int i = 0; i < _props.size(); i++) { @@ -400,7 +402,7 @@ TerrainLibraryMerger::~TerrainLibraryMerger() { _prop_packer.unref(); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool TerrainLibraryMerger::process_prop_textures(Ref prop) { if (!prop.is_valid()) { return false; @@ -462,7 +464,7 @@ void TerrainLibraryMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &TerrainLibraryMerger::set_terra_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:TerrainSurfaceMerger", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("get_props"), &TerrainLibraryMerger::get_props); ClassDB::bind_method(D_METHOD("set_props"), &TerrainLibraryMerger::set_props); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); diff --git a/modules/terraman/library/terrain_library_merger.h b/modules/terraman/library/terrain_library_merger.h index 41c28e5b1..3d305be1f 100644 --- a/modules/terraman/library/terrain_library_merger.h +++ b/modules/terraman/library/terrain_library_merger.h @@ -32,6 +32,8 @@ SOFTWARE. #include "../data/terrain_light.h" #include "terrain_surface_merger.h" +#include "modules/modules_enabled.gen.h" + class TerrainSurfaceSimple; class TerrainMesher; class PackedScene; @@ -65,7 +67,7 @@ public: Vector get_terra_surfaces(); void set_terra_surfaces(const Vector &surfaces); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref get_prop(const int index); void add_prop(Ref value); bool has_prop(const Ref &value) const; @@ -90,14 +92,14 @@ public: ~TerrainLibraryMerger(); protected: -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool process_prop_textures(Ref prop); #endif static void _bind_methods(); Vector> _terra_surfaces; -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Vector> _props; #endif diff --git a/modules/terraman/library/terrain_library_merger_pcm.cpp b/modules/terraman/library/terrain_library_merger_pcm.cpp index 90a1bbd40..caa68178a 100644 --- a/modules/terraman/library/terrain_library_merger_pcm.cpp +++ b/modules/terraman/library/terrain_library_merger_pcm.cpp @@ -26,7 +26,9 @@ SOFTWARE. #include "scene/resources/packed_scene.h" #include "scene/resources/texture.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_prop.h" @@ -388,7 +390,7 @@ void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref chu Vector props; /* - #ifdef PROPS_PRESENT + #ifdef MODULE_PROPS_ENABLED for (int i = 0; i < chunk->prop_get_count(); ++i) { Ref prop = chunk->prop_get(i); @@ -497,7 +499,7 @@ void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref chu } /* - #ifdef PROPS_PRESENT + #ifdef MODULE_PROPS_ENABLED for (int i = 0; i < chunk->prop_get_count(); ++i) { Ref prop = chunk->prop_get(i); @@ -686,7 +688,7 @@ void TerrainLibraryMergerPCM::set_terra_surfaces(const Vector &surfaces } } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref TerrainLibraryMergerPCM::get_prop(const int index) { ERR_FAIL_INDEX_V(index, _props.size(), Ref()); @@ -796,7 +798,7 @@ void TerrainLibraryMergerPCM::refresh_rects() { setup_material_albedo(MATERIAL_INDEX_LIQUID, tex); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED //todo add this back //texture_added = false; for (int i = 0; i < _props.size(); i++) { @@ -938,7 +940,7 @@ TerrainLibraryMergerPCM::~TerrainLibraryMergerPCM() { _prop_packer.unref(); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool TerrainLibraryMergerPCM::process_prop_textures(Ref prop) { /* if (!prop.is_valid()) { @@ -1002,7 +1004,7 @@ void TerrainLibraryMergerPCM::_bind_methods() { ClassDB::bind_method(D_METHOD("set_terra_surfaces"), &TerrainLibraryMergerPCM::set_terra_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "terra_surfaces", PROPERTY_HINT_NONE, "23/19:TerrainSurfaceMerger", PROPERTY_USAGE_DEFAULT, "TerrainSurfaceMerger"), "set_terra_surfaces", "get_terra_surfaces"); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("get_props"), &TerrainLibraryMergerPCM::get_props); ClassDB::bind_method(D_METHOD("set_props"), &TerrainLibraryMergerPCM::set_props); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); diff --git a/modules/terraman/library/terrain_library_merger_pcm.h b/modules/terraman/library/terrain_library_merger_pcm.h index 3d8b1daf7..f6d510a95 100644 --- a/modules/terraman/library/terrain_library_merger_pcm.h +++ b/modules/terraman/library/terrain_library_merger_pcm.h @@ -34,6 +34,8 @@ SOFTWARE. #include "core/os/mutex.h" +#include "modules/modules_enabled.gen.h" + class TerrainSurfaceSimple; class TerrainMesher; class PackedScene; @@ -84,7 +86,7 @@ public: Vector get_terra_surfaces(); void set_terra_surfaces(const Vector &surfaces); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref get_prop(const int index); void add_prop(Ref value); bool has_prop(const Ref &value) const; @@ -109,7 +111,7 @@ public: ~TerrainLibraryMergerPCM(); protected: -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool process_prop_textures(Ref prop); #endif @@ -120,7 +122,7 @@ protected: Map> _prop_material_cache; Vector> _terra_surfaces; -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Vector> _props; #endif diff --git a/modules/terraman/library/terrain_material_cache.cpp b/modules/terraman/library/terrain_material_cache.cpp index b0ba796e2..c2ed8d3b9 100644 --- a/modules/terraman/library/terrain_material_cache.cpp +++ b/modules/terraman/library/terrain_material_cache.cpp @@ -24,7 +24,9 @@ SOFTWARE. #include "../defines.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_prop.h" @@ -196,7 +198,7 @@ Rect2 TerrainMaterialCache::additional_texture_get_uv_rect(const Ref &t return Rect2(0, 0, 1, 1); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void TerrainMaterialCache::prop_add_textures(const Ref &prop) { if (!prop.is_valid()) { return; @@ -315,7 +317,7 @@ void TerrainMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("additional_texture_get_atlas_tex", "index"), &TerrainMaterialCache::additional_texture_get_atlas_tex); ClassDB::bind_method(D_METHOD("additional_texture_get_uv_rect", "texture"), &TerrainMaterialCache::additional_texture_get_uv_rect); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_add_textures", "prop"), &TerrainMaterialCache::prop_add_textures); ClassDB::bind_method(D_METHOD("prop_remove_textures", "prop"), &TerrainMaterialCache::prop_remove_textures); #endif diff --git a/modules/terraman/library/terrain_material_cache.h b/modules/terraman/library/terrain_material_cache.h index 19df2a82a..a2f1f7c33 100644 --- a/modules/terraman/library/terrain_material_cache.h +++ b/modules/terraman/library/terrain_material_cache.h @@ -33,6 +33,8 @@ SOFTWARE. #include "../defines.h" +#include "modules/modules_enabled.gen.h" + class TerrainLibrary; class TerrainMaterialCache : public Resource { @@ -76,7 +78,7 @@ public: virtual Ref additional_texture_get_atlas_tex(const Ref &texture); virtual Rect2 additional_texture_get_uv_rect(const Ref &texture); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void prop_add_textures(const Ref &prop); void prop_remove_textures(const Ref &prop); #endif diff --git a/modules/terraman/world/terrain_chunk.cpp b/modules/terraman/world/terrain_chunk.cpp index 825649f8f..ac9c3185f 100644 --- a/modules/terraman/world/terrain_chunk.cpp +++ b/modules/terraman/world/terrain_chunk.cpp @@ -35,6 +35,8 @@ SOFTWARE. #include "core/os/thread_pool.h" +#include "modules/modules_enabled.gen.h" + _FORCE_INLINE_ bool TerrainChunk::get_process() const { return _is_processing; } @@ -701,7 +703,7 @@ void TerrainChunk::clear_baked_lights() { call("_clear_baked_lights"); } -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void TerrainChunk::prop_add(const Transform &tarnsform, const Ref &prop) { ERR_FAIL_COND(!prop.is_valid()); @@ -757,7 +759,7 @@ int TerrainChunk::mesh_data_resource_addv(const Vector3 &local_data_pos, const R AABB mesh_aabb = e.transform.xform(mesh->get_aabb()); e.is_inside = aabb.encloses(mesh_aabb); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED if (get_library().is_valid() && texture.is_valid()) { e.uv_rect = get_library()->get_prop_uv_rect(texture); } else { @@ -797,7 +799,7 @@ int TerrainChunk::mesh_data_resource_add(const Transform &local_transform, const AABB mesh_aabb = e.transform.xform(mesh->get_aabb()); e.is_inside = aabb.encloses(mesh_aabb); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED if (get_library().is_valid() && texture.is_valid()) e.uv_rect = get_library()->get_prop_uv_rect(texture); else @@ -1091,7 +1093,7 @@ TerrainChunk::~TerrainChunk() { _library.unref(); } -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED props_clear(); #endif @@ -1460,7 +1462,7 @@ void TerrainChunk::_bind_methods() { //Meshes -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_add", "prop"), &TerrainChunk::prop_add); ClassDB::bind_method(D_METHOD("prop_get", "index"), &TerrainChunk::prop_get); ClassDB::bind_method(D_METHOD("prop_get_count"), &TerrainChunk::prop_get_count); diff --git a/modules/terraman/world/terrain_chunk.h b/modules/terraman/world/terrain_chunk.h index 140225fc2..730d5e2fc 100644 --- a/modules/terraman/world/terrain_chunk.h +++ b/modules/terraman/world/terrain_chunk.h @@ -43,7 +43,9 @@ SOFTWARE. #include "../meshers/terrain_mesher.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #endif @@ -215,7 +217,7 @@ public: void bake_light(Ref light); void clear_baked_lights(); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void prop_add(const Transform &tarnsform, const Ref &prop); Ref prop_get(const int index); Transform prop_get_tarnsform(const int index); @@ -301,7 +303,7 @@ protected: virtual void _generation_physics_process(const float delta); protected: -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED struct PropDataStore { Transform transform; Ref prop; @@ -383,7 +385,7 @@ protected: Vector> _voxel_structures; -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Vector _props; #endif diff --git a/modules/terraman/world/terrain_world.cpp b/modules/terraman/world/terrain_world.cpp index 3eaf2ff11..12446b1ee 100644 --- a/modules/terraman/world/terrain_world.cpp +++ b/modules/terraman/world/terrain_world.cpp @@ -28,7 +28,9 @@ SOFTWARE. #include "../defines.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_entry.h" #include "../../props/props/prop_data_light.h" @@ -579,7 +581,7 @@ int TerrainWorld::generation_get_size() const { return _generating.size(); } -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void TerrainWorld::prop_add(Transform transform, const Ref &prop, const bool apply_voxel_scale) { ERR_FAIL_COND(!prop.is_valid()); @@ -1197,7 +1199,7 @@ void TerrainWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("is_position_walkable", "position"), &TerrainWorld::is_position_walkable); ClassDB::bind_method(D_METHOD("on_chunk_mesh_generation_finished", "chunk"), &TerrainWorld::on_chunk_mesh_generation_finished); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_add", "transform", "prop", "apply_voxel_scale"), &TerrainWorld::prop_add, DEFVAL(true)); #endif diff --git a/modules/terraman/world/terrain_world.h b/modules/terraman/world/terrain_world.h index e190e2c39..8ef2ff3f0 100644 --- a/modules/terraman/world/terrain_world.h +++ b/modules/terraman/world/terrain_world.h @@ -35,7 +35,9 @@ SOFTWARE. #include "core/os/os.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #endif @@ -161,7 +163,7 @@ public: void generation_remove_index(const int index); int generation_get_size() const; -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void prop_add(Transform transform, const Ref &prop, const bool apply_voxel_scale = true); #endif diff --git a/modules/voxelman/library/voxel_library.cpp b/modules/voxelman/library/voxel_library.cpp index 9b85c068f..e1ed0d594 100644 --- a/modules/voxelman/library/voxel_library.cpp +++ b/modules/voxelman/library/voxel_library.cpp @@ -25,7 +25,9 @@ SOFTWARE. #include "../world/voxel_chunk.h" #include "voxel_material_cache.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #endif @@ -312,7 +314,7 @@ int VoxelLibrary::scene_get_num() const { void VoxelLibrary::scenes_clear() { } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref VoxelLibrary::prop_get(const int id) { return Ref(); } @@ -455,7 +457,7 @@ void VoxelLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("scene_get_num"), &VoxelLibrary::scene_get_num); ClassDB::bind_method(D_METHOD("scenes_clear"), &VoxelLibrary::scenes_clear); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_get", "id"), &VoxelLibrary::prop_get); ClassDB::bind_method(D_METHOD("prop_add", "value"), &VoxelLibrary::prop_add); ClassDB::bind_method(D_METHOD("prop_has", "prop"), &VoxelLibrary::prop_has); diff --git a/modules/voxelman/library/voxel_library.h b/modules/voxelman/library/voxel_library.h index 7a759770e..6d6943464 100644 --- a/modules/voxelman/library/voxel_library.h +++ b/modules/voxelman/library/voxel_library.h @@ -32,12 +32,14 @@ SOFTWARE. #include "../defines.h" +#include "modules/modules_enabled.gen.h" + class VoxelMaterialCache; class VoxelChunk; class VoxelSurface; class VoxelMesher; class PackedScene; -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED class PropData; #endif @@ -129,7 +131,7 @@ public: virtual int scene_get_num() const; virtual void scenes_clear(); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED virtual Ref prop_get(const int id); virtual void prop_add(Ref value); virtual bool prop_has(const Ref &value) const; diff --git a/modules/voxelman/library/voxel_library_merger.cpp b/modules/voxelman/library/voxel_library_merger.cpp index 8269db488..7b3cd902c 100644 --- a/modules/voxelman/library/voxel_library_merger.cpp +++ b/modules/voxelman/library/voxel_library_merger.cpp @@ -25,7 +25,9 @@ SOFTWARE. #include "scene/resources/packed_scene.h" #include "scene/resources/texture.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_prop.h" @@ -151,7 +153,7 @@ void VoxelLibraryMerger::set_voxel_surfaces(const Vector &surfaces) { } } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref VoxelLibraryMerger::get_prop(const int index) { ERR_FAIL_INDEX_V(index, _props.size(), Ref()); @@ -260,7 +262,7 @@ void VoxelLibraryMerger::refresh_rects() { setup_material_albedo(MATERIAL_INDEX_LIQUID, tex); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED //todo add this back //texture_added = false; for (int i = 0; i < _props.size(); i++) { @@ -400,7 +402,7 @@ VoxelLibraryMerger::~VoxelLibraryMerger() { _prop_packer.unref(); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool VoxelLibraryMerger::process_prop_textures(Ref prop) { if (!prop.is_valid()) { return false; @@ -460,7 +462,7 @@ void VoxelLibraryMerger::_bind_methods() { ClassDB::bind_method(D_METHOD("set_voxel_surfaces"), &VoxelLibraryMerger::set_voxel_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "23/19:VoxelSurfaceMerger", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceMerger"), "set_voxel_surfaces", "get_voxel_surfaces"); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("get_props"), &VoxelLibraryMerger::get_props); ClassDB::bind_method(D_METHOD("set_props"), &VoxelLibraryMerger::set_props); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); diff --git a/modules/voxelman/library/voxel_library_merger.h b/modules/voxelman/library/voxel_library_merger.h index 6249764a5..0ec972e71 100644 --- a/modules/voxelman/library/voxel_library_merger.h +++ b/modules/voxelman/library/voxel_library_merger.h @@ -32,6 +32,12 @@ SOFTWARE. #include "../data/voxel_light.h" #include "voxel_surface_merger.h" +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED +class PropData; +#endif + class VoxelSurfaceSimple; class VoxelMesher; class PackedScene; @@ -65,7 +71,7 @@ public: Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &surfaces); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref get_prop(const int index); void add_prop(Ref value); bool has_prop(const Ref &value) const; @@ -90,14 +96,14 @@ public: ~VoxelLibraryMerger(); protected: -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool process_prop_textures(Ref prop); #endif static void _bind_methods(); Vector> _voxel_surfaces; -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Vector> _props; #endif diff --git a/modules/voxelman/library/voxel_library_merger_pcm.cpp b/modules/voxelman/library/voxel_library_merger_pcm.cpp index 6d50b49d1..a04fa1129 100644 --- a/modules/voxelman/library/voxel_library_merger_pcm.cpp +++ b/modules/voxelman/library/voxel_library_merger_pcm.cpp @@ -26,7 +26,9 @@ SOFTWARE. #include "scene/resources/packed_scene.h" #include "scene/resources/texture.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_prop.h" @@ -208,7 +210,7 @@ void VoxelLibraryMergerPCM::_prop_material_cache_get_key(Ref chunk) Vector props; /* - #ifdef PROPS_PRESENT + #ifdef MODULE_PROPS_ENABLED for (int i = 0; i < chunk->prop_get_count(); ++i) { Ref prop = chunk->prop_get(i); @@ -317,7 +319,7 @@ void VoxelLibraryMergerPCM::_prop_material_cache_get_key(Ref chunk) } /* - #ifdef PROPS_PRESENT + #ifdef MODULE_PROPS_ENABLED for (int i = 0; i < chunk->prop_get_count(); ++i) { Ref prop = chunk->prop_get(i); @@ -494,7 +496,7 @@ void VoxelLibraryMergerPCM::set_voxel_surfaces(const Vector &surfaces) } } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref VoxelLibraryMergerPCM::get_prop(const int index) { ERR_FAIL_INDEX_V(index, _props.size(), Ref()); @@ -603,7 +605,7 @@ void VoxelLibraryMergerPCM::refresh_rects() { setup_material_albedo(MATERIAL_INDEX_LIQUID, tex); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED //todo add this back //texture_added = false; for (int i = 0; i < _props.size(); i++) { @@ -743,7 +745,7 @@ VoxelLibraryMergerPCM::~VoxelLibraryMergerPCM() { _prop_packer.unref(); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool VoxelLibraryMergerPCM::process_prop_textures(Ref prop) { if (!prop.is_valid()) { return false; @@ -803,7 +805,7 @@ void VoxelLibraryMergerPCM::_bind_methods() { ClassDB::bind_method(D_METHOD("set_voxel_surfaces"), &VoxelLibraryMergerPCM::set_voxel_surfaces); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "voxel_surfaces", PROPERTY_HINT_NONE, "23/19:VoxelSurfaceMerger", PROPERTY_USAGE_DEFAULT, "VoxelSurfaceMerger"), "set_voxel_surfaces", "get_voxel_surfaces"); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("get_props"), &VoxelLibraryMergerPCM::get_props); ClassDB::bind_method(D_METHOD("set_props"), &VoxelLibraryMergerPCM::set_props); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "props", PROPERTY_HINT_NONE, "23/19:PropData", PROPERTY_USAGE_DEFAULT, "PropData"), "set_props", "get_props"); diff --git a/modules/voxelman/library/voxel_library_merger_pcm.h b/modules/voxelman/library/voxel_library_merger_pcm.h index e7c2f3ed3..811527e18 100644 --- a/modules/voxelman/library/voxel_library_merger_pcm.h +++ b/modules/voxelman/library/voxel_library_merger_pcm.h @@ -34,6 +34,8 @@ SOFTWARE. #include "core/os/mutex.h" +#include "modules/modules_enabled.gen.h" + class VoxelSurfaceSimple; class VoxelMesher; class PackedScene; @@ -82,7 +84,7 @@ public: Vector get_voxel_surfaces(); void set_voxel_surfaces(const Vector &surfaces); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Ref get_prop(const int index); void add_prop(Ref value); bool has_prop(const Ref &value) const; @@ -107,7 +109,7 @@ public: ~VoxelLibraryMergerPCM(); protected: -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED bool process_prop_textures(Ref prop); #endif @@ -117,7 +119,7 @@ protected: Map> _prop_material_cache; Vector> _voxel_surfaces; -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Vector> _props; #endif diff --git a/modules/voxelman/library/voxel_material_cache.cpp b/modules/voxelman/library/voxel_material_cache.cpp index 547d9d277..1c67ef518 100644 --- a/modules/voxelman/library/voxel_material_cache.cpp +++ b/modules/voxelman/library/voxel_material_cache.cpp @@ -24,7 +24,9 @@ SOFTWARE. #include "../defines.h" -#ifdef PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_prop.h" @@ -196,7 +198,7 @@ Rect2 VoxelMaterialCache::additional_texture_get_uv_rect(const Ref &tex return Rect2(0, 0, 1, 1); } -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void VoxelMaterialCache::prop_add_textures(const Ref &prop) { if (!prop.is_valid()) { return; @@ -315,7 +317,7 @@ void VoxelMaterialCache::_bind_methods() { ClassDB::bind_method(D_METHOD("additional_texture_get_atlas_tex", "index"), &VoxelMaterialCache::additional_texture_get_atlas_tex); ClassDB::bind_method(D_METHOD("additional_texture_get_uv_rect", "texture"), &VoxelMaterialCache::additional_texture_get_uv_rect); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_add_textures", "prop"), &VoxelMaterialCache::prop_add_textures); ClassDB::bind_method(D_METHOD("prop_remove_textures", "prop"), &VoxelMaterialCache::prop_remove_textures); #endif diff --git a/modules/voxelman/library/voxel_material_cache.h b/modules/voxelman/library/voxel_material_cache.h index cea69423d..186cf9dba 100644 --- a/modules/voxelman/library/voxel_material_cache.h +++ b/modules/voxelman/library/voxel_material_cache.h @@ -33,6 +33,8 @@ SOFTWARE. #include "../defines.h" +#include "modules/modules_enabled.gen.h" + class VoxelLibrary; class VoxelMaterialCache : public Resource { @@ -76,7 +78,7 @@ public: virtual Ref additional_texture_get_atlas_tex(const Ref &texture); virtual Rect2 additional_texture_get_uv_rect(const Ref &texture); -#ifdef PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void prop_add_textures(const Ref &prop); void prop_remove_textures(const Ref &prop); #endif diff --git a/modules/voxelman/world/voxel_chunk.cpp b/modules/voxelman/world/voxel_chunk.cpp index 05cc1059c..e21a90dc7 100644 --- a/modules/voxelman/world/voxel_chunk.cpp +++ b/modules/voxelman/world/voxel_chunk.cpp @@ -34,6 +34,8 @@ SOFTWARE. #include "core/os/thread_pool.h" +#include "modules/modules_enabled.gen.h" + _FORCE_INLINE_ bool VoxelChunk::get_is_build_threaded() const { return _is_build_threaded; } @@ -698,7 +700,7 @@ void VoxelChunk::clear_baked_lights() { } } -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void VoxelChunk::prop_add(const Transform &tarnsform, const Ref &prop) { ERR_FAIL_COND(!prop.is_valid()); @@ -754,7 +756,7 @@ int VoxelChunk::mesh_data_resource_addv(const Vector3 &local_data_pos, const Ref AABB mesh_aabb = e.transform.xform(mesh->get_aabb()); e.is_inside = aabb.encloses(mesh_aabb); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED if (get_library().is_valid() && texture.is_valid()) { e.uv_rect = get_library()->get_prop_uv_rect(texture); } else { @@ -795,7 +797,7 @@ int VoxelChunk::mesh_data_resource_add(const Transform &local_transform, const R AABB mesh_aabb = e.transform.xform(mesh->get_aabb()); e.is_inside = aabb.encloses(mesh_aabb); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED if (get_library().is_valid() && texture.is_valid()) e.uv_rect = get_library()->get_prop_uv_rect(texture); else @@ -1087,7 +1089,7 @@ VoxelChunk::~VoxelChunk() { _library.unref(); } -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED props_clear(); #endif @@ -1448,7 +1450,7 @@ void VoxelChunk::_bind_methods() { //Meshes -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_add", "prop"), &VoxelChunk::prop_add); ClassDB::bind_method(D_METHOD("prop_get", "index"), &VoxelChunk::prop_get); ClassDB::bind_method(D_METHOD("prop_get_count"), &VoxelChunk::prop_get_count); diff --git a/modules/voxelman/world/voxel_chunk.h b/modules/voxelman/world/voxel_chunk.h index 0b3d9daee..2f580595c 100644 --- a/modules/voxelman/world/voxel_chunk.h +++ b/modules/voxelman/world/voxel_chunk.h @@ -43,7 +43,9 @@ SOFTWARE. #include "../meshers/voxel_mesher.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #endif @@ -222,7 +224,7 @@ public: void bake_light(Ref light); void clear_baked_lights(); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void prop_add(const Transform &tarnsform, const Ref &prop); Ref prop_get(const int index); Transform prop_get_tarnsform(const int index); @@ -306,7 +308,7 @@ protected: virtual void _generation_physics_process(const float delta); protected: -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED struct PropDataStore { Transform transform; Ref prop; @@ -391,7 +393,7 @@ protected: Vector> _voxel_structures; -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED Vector _props; #endif diff --git a/modules/voxelman/world/voxel_world.cpp b/modules/voxelman/world/voxel_world.cpp index d63e3f5d4..bdae20a39 100644 --- a/modules/voxelman/world/voxel_world.cpp +++ b/modules/voxelman/world/voxel_world.cpp @@ -27,7 +27,9 @@ SOFTWARE. #include "../defines.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #include "../../props/props/prop_data_entry.h" #include "../../props/props/prop_data_light.h" @@ -543,7 +545,7 @@ int VoxelWorld::generation_get_size() const { return _generating.size(); } -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void VoxelWorld::prop_add(Transform tarnsform, const Ref &prop, const bool apply_voxel_scael) { ERR_FAIL_COND(!prop.is_valid()); @@ -1157,7 +1159,7 @@ void VoxelWorld::_bind_methods() { ClassDB::bind_method(D_METHOD("is_position_walkable", "position"), &VoxelWorld::is_position_walkable); ClassDB::bind_method(D_METHOD("on_chunk_mesh_generation_finished", "chunk"), &VoxelWorld::on_chunk_mesh_generation_finished); -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED ClassDB::bind_method(D_METHOD("prop_add", "transform", "prop", "apply_voxel_scael"), &VoxelWorld::prop_add, DEFVAL(true)); #endif diff --git a/modules/voxelman/world/voxel_world.h b/modules/voxelman/world/voxel_world.h index 7b605659a..fc79ccb6c 100644 --- a/modules/voxelman/world/voxel_world.h +++ b/modules/voxelman/world/voxel_world.h @@ -35,7 +35,9 @@ SOFTWARE. #include "core/os/os.h" -#if PROPS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_PROPS_ENABLED #include "../../props/props/prop_data.h" #endif @@ -160,7 +162,7 @@ public: void generation_remove_index(const int index); int generation_get_size() const; -#if PROPS_PRESENT +#ifdef MODULE_PROPS_ENABLED void prop_add(Transform tarnsform, const Ref &prop, const bool apply_voxel_scael = true); #endif