Also replaced the old PROPS_PRESENT defines with the module system's generated defines.

This commit is contained in:
Relintai 2022-10-05 11:16:32 +02:00
parent a0472fb6eb
commit ea2a36c4ea
42 changed files with 218 additions and 127 deletions

View File

@ -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",

View File

@ -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> &texture) {
return Rect2(0, 0, 1, 1);
}
#if PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void ESSMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
if (!prop.is_valid()) {
return;
@ -203,7 +203,7 @@ void ESSMaterialCache::prop_add_textures(const Ref<PropData> &prop) {
if (!twd.is_valid())
continue;
twd->setup_cache(Ref<ESSMaterialCache>(this));
twd->setup_ess_cache(Ref<ESSMaterialCache>(this));
continue;
}
@ -242,16 +242,16 @@ void ESSMaterialCache::prop_remove_textures(const Ref<PropData> &prop) {
if (!twd.is_valid())
continue;
for (int j = 0; j < twd->get_texture_count(); ++j) {
const Ref<Texture> &tex = twd->get_texture(j);
for (int j = 0; j < twd->get_tile_count(); ++j) {
const Ref<Texture> &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<Texture> &tex = twd->get_flavour_texture(j);
for (int j = 0; j < twd->get_flavour_tile_count(); ++j) {
const Ref<Texture> &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

View File

@ -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<AtlasTexture> texture_get_atlas_tex(const Ref<Texture> &texture);
virtual Rect2 texture_get_uv_rect(const Ref<Texture> &texture);
#if PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void prop_add_textures(const Ref<PropData> &prop);
void prop_remove_textures(const Ref<PropData> &prop);
#endif

View File

@ -22,7 +22,9 @@ SOFTWARE.
#include "prop_data_entity.h"
#if PROPS_PRESENT
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_PROPS_ENABLED
Ref<EntityData> PropDataEntity::get_entity_data() const {
return _entity_data;

View File

@ -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"

View File

@ -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<PropDataEntity>();
#endif

View File

@ -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'])

View File

@ -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"

View File

@ -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"

View File

@ -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<MeshDataInstance>();
ClassDB::register_class<MeshDataInstance2D>();
#if PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
ClassDB::register_class<PropDataMeshData>();
Ref<PropDataMeshData> processor = Ref<PropDataMeshData>(memnew(PropDataMeshData));
PropUtils::add_processor(processor);

View File

@ -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) \

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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<PropMaterialCache> cache) {
}
}
#ifdef MODULE_ENTITY_SPELL_SYSTEM_ENABLED
void TiledWallData::setup_ess_cache(Ref<ESSMaterialCache> cache) {
//Note: the caller should lock and unlock the cache!
call("_setup_ess_cache", cache);
}
void TiledWallData::_setup_ess_cache(Ref<ESSMaterialCache> cache) {
if (cache->material_get_num() == 0) {
for (int i = 0; i < _materials.size(); ++i) {
const Ref<Material> &m = _materials[i];
if (m.is_valid()) {
Ref<Material> nm = m->duplicate();
cache->material_add(nm);
}
}
}
for (int i = 0; i < _tiles.size(); ++i) {
const Ref<Texture> &t = _tiles[i].texture;
if (t.is_valid()) {
cache->texture_add(t);
}
}
for (int i = 0; i < _flavour_tiles.size(); ++i) {
const Ref<Texture> &t = _flavour_tiles[i].texture;
if (t.is_valid()) {
cache->texture_add(t);
}
}
}
#endif
void TiledWallData::copy_from(const Ref<TiledWallData> &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);

View File

@ -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);
@ -154,6 +157,11 @@ public:
void setup_cache(Ref<PropMaterialCache> cache);
void _setup_cache(Ref<PropMaterialCache> cache);
#ifdef MODULE_ENTITY_SPELL_SYSTEM_ENABLED
void setup_ess_cache(Ref<ESSMaterialCache> cache);
void _setup_ess_cache(Ref<ESSMaterialCache> cache);
#endif
void copy_from(const Ref<TiledWallData> &tiled_wall_data);
//Ref<Shape> get_collider_shape();

View File

@ -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

View File

@ -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'])

View File

@ -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<PropData> TerrainLibrary::prop_get(const int id) {
return Ref<PropData>();
}
@ -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);

View File

@ -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<PropData> prop_get(const int id);
virtual void prop_add(Ref<PropData> value);
virtual bool prop_has(const Ref<PropData> &value) const;

View File

@ -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<Variant> &surfaces) {
}
}
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> TerrainLibraryMerger::get_prop(const int index) {
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
@ -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<PropData> 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");

View File

@ -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<Variant> get_terra_surfaces();
void set_terra_surfaces(const Vector<Variant> &surfaces);
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> get_prop(const int index);
void add_prop(Ref<PropData> value);
bool has_prop(const Ref<PropData> &value) const;
@ -90,14 +92,14 @@ public:
~TerrainLibraryMerger();
protected:
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
bool process_prop_textures(Ref<PropData> prop);
#endif
static void _bind_methods();
Vector<Ref<TerrainSurfaceMerger>> _terra_surfaces;
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Vector<Ref<PropData>> _props;
#endif

View File

@ -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<TerrainChunk> chu
Vector<uint64_t> props;
/*
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
for (int i = 0; i < chunk->prop_get_count(); ++i) {
Ref<PropData> prop = chunk->prop_get(i);
@ -497,7 +499,7 @@ void TerrainLibraryMergerPCM::_prop_material_cache_get_key(Ref<TerrainChunk> chu
}
/*
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
for (int i = 0; i < chunk->prop_get_count(); ++i) {
Ref<PropData> prop = chunk->prop_get(i);
@ -686,7 +688,7 @@ void TerrainLibraryMergerPCM::set_terra_surfaces(const Vector<Variant> &surfaces
}
}
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> TerrainLibraryMergerPCM::get_prop(const int index) {
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
@ -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<PropData> 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");

View File

@ -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<Variant> get_terra_surfaces();
void set_terra_surfaces(const Vector<Variant> &surfaces);
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> get_prop(const int index);
void add_prop(Ref<PropData> value);
bool has_prop(const Ref<PropData> &value) const;
@ -109,7 +111,7 @@ public:
~TerrainLibraryMergerPCM();
protected:
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
bool process_prop_textures(Ref<PropData> prop);
#endif
@ -120,7 +122,7 @@ protected:
Map<int, Ref<TerrainMaterialCachePCM>> _prop_material_cache;
Vector<Ref<TerrainSurfaceMerger>> _terra_surfaces;
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Vector<Ref<PropData>> _props;
#endif

View File

@ -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<Texture> &t
return Rect2(0, 0, 1, 1);
}
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void TerrainMaterialCache::prop_add_textures(const Ref<PropData> &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

View File

@ -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<AtlasTexture> additional_texture_get_atlas_tex(const Ref<Texture> &texture);
virtual Rect2 additional_texture_get_uv_rect(const Ref<Texture> &texture);
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void prop_add_textures(const Ref<PropData> &prop);
void prop_remove_textures(const Ref<PropData> &prop);
#endif

View File

@ -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<PropData> &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);

View File

@ -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<TerrainLight> light);
void clear_baked_lights();
#if PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void prop_add(const Transform &tarnsform, const Ref<PropData> &prop);
Ref<PropData> 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<PropData> prop;
@ -383,7 +385,7 @@ protected:
Vector<Ref<TerrainStructure>> _voxel_structures;
#if PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Vector<PropDataStore> _props;
#endif

View File

@ -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<PropData> &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

View File

@ -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<PropData> &prop, const bool apply_voxel_scale = true);
#endif

View File

@ -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<PropData> VoxelLibrary::prop_get(const int id) {
return Ref<PropData>();
}
@ -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);

View File

@ -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<PropData> prop_get(const int id);
virtual void prop_add(Ref<PropData> value);
virtual bool prop_has(const Ref<PropData> &value) const;

View File

@ -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<Variant> &surfaces) {
}
}
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> VoxelLibraryMerger::get_prop(const int index) {
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
@ -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<PropData> 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");

View File

@ -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<Variant> get_voxel_surfaces();
void set_voxel_surfaces(const Vector<Variant> &surfaces);
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> get_prop(const int index);
void add_prop(Ref<PropData> value);
bool has_prop(const Ref<PropData> &value) const;
@ -90,14 +96,14 @@ public:
~VoxelLibraryMerger();
protected:
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
bool process_prop_textures(Ref<PropData> prop);
#endif
static void _bind_methods();
Vector<Ref<VoxelSurfaceMerger>> _voxel_surfaces;
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Vector<Ref<PropData>> _props;
#endif

View File

@ -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<VoxelChunk> chunk)
Vector<uint64_t> props;
/*
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
for (int i = 0; i < chunk->prop_get_count(); ++i) {
Ref<PropData> prop = chunk->prop_get(i);
@ -317,7 +319,7 @@ void VoxelLibraryMergerPCM::_prop_material_cache_get_key(Ref<VoxelChunk> chunk)
}
/*
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
for (int i = 0; i < chunk->prop_get_count(); ++i) {
Ref<PropData> prop = chunk->prop_get(i);
@ -494,7 +496,7 @@ void VoxelLibraryMergerPCM::set_voxel_surfaces(const Vector<Variant> &surfaces)
}
}
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> VoxelLibraryMergerPCM::get_prop(const int index) {
ERR_FAIL_INDEX_V(index, _props.size(), Ref<PropData>());
@ -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<PropData> 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");

View File

@ -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<Variant> get_voxel_surfaces();
void set_voxel_surfaces(const Vector<Variant> &surfaces);
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Ref<PropData> get_prop(const int index);
void add_prop(Ref<PropData> value);
bool has_prop(const Ref<PropData> &value) const;
@ -107,7 +109,7 @@ public:
~VoxelLibraryMergerPCM();
protected:
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
bool process_prop_textures(Ref<PropData> prop);
#endif
@ -117,7 +119,7 @@ protected:
Map<int, Ref<VoxelMaterialCachePCM>> _prop_material_cache;
Vector<Ref<VoxelSurfaceMerger>> _voxel_surfaces;
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Vector<Ref<PropData>> _props;
#endif

View File

@ -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<Texture> &tex
return Rect2(0, 0, 1, 1);
}
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void VoxelMaterialCache::prop_add_textures(const Ref<PropData> &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

View File

@ -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<AtlasTexture> additional_texture_get_atlas_tex(const Ref<Texture> &texture);
virtual Rect2 additional_texture_get_uv_rect(const Ref<Texture> &texture);
#ifdef PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void prop_add_textures(const Ref<PropData> &prop);
void prop_remove_textures(const Ref<PropData> &prop);
#endif

View File

@ -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<PropData> &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);

View File

@ -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<VoxelLight> light);
void clear_baked_lights();
#if PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
void prop_add(const Transform &tarnsform, const Ref<PropData> &prop);
Ref<PropData> 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<PropData> prop;
@ -391,7 +393,7 @@ protected:
Vector<Ref<VoxelStructure>> _voxel_structures;
#if PROPS_PRESENT
#ifdef MODULE_PROPS_ENABLED
Vector<PropDataStore> _props;
#endif

View File

@ -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<PropData> &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

View File

@ -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<PropData> &prop, const bool apply_voxel_scael = true);
#endif