mirror of
https://github.com/Relintai/props.git
synced 2025-02-04 16:05:54 +01:00
Make sure the dependencies are actually optional.
This commit is contained in:
parent
e1f43af571
commit
152be1328b
6
SCsub
6
SCsub
@ -7,6 +7,12 @@ module_env = env.Clone()
|
|||||||
if os.path.isdir('../mesh_data_resource'):
|
if os.path.isdir('../mesh_data_resource'):
|
||||||
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
|
||||||
|
|
||||||
|
if os.path.isdir('../texture_packer'):
|
||||||
|
module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT'])
|
||||||
|
|
||||||
|
if os.path.isdir('../voxelman'):
|
||||||
|
module_env.Append(CPPDEFINES=['VOXELMAN_PRESENT'])
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
|
|
||||||
"register_types.cpp",
|
"register_types.cpp",
|
||||||
|
@ -22,6 +22,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "ground_clutter.h"
|
#include "ground_clutter.h"
|
||||||
|
|
||||||
|
#ifdef VOXELMAN_PRESENT
|
||||||
#include "../../voxelman/world/voxel_chunk.h"
|
#include "../../voxelman/world/voxel_chunk.h"
|
||||||
|
|
||||||
bool GroundClutter::should_spawn(Ref<VoxelChunk> chunk, int x, int y, int z) {
|
bool GroundClutter::should_spawn(Ref<VoxelChunk> chunk, int x, int y, int z) {
|
||||||
@ -35,11 +36,14 @@ void GroundClutter::add_meshes_to(Ref<VoxelMesher> mesher, Ref<VoxelChunk> chunk
|
|||||||
if (has_method("_add_meshes_to"))
|
if (has_method("_add_meshes_to"))
|
||||||
call("_add_meshes_to", mesher, chunk, x, y, z);
|
call("_add_meshes_to", mesher, chunk, x, y, z);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TEXTURE_PACKER_PRESENT
|
||||||
void GroundClutter::add_textures_to(Ref<TexturePacker> packer) {
|
void GroundClutter::add_textures_to(Ref<TexturePacker> packer) {
|
||||||
if (has_method("_add_textures_to"))
|
if (has_method("_add_textures_to"))
|
||||||
call("_add_textures_to", packer);
|
call("_add_textures_to", packer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
GroundClutter::GroundClutter() {
|
GroundClutter::GroundClutter() {
|
||||||
}
|
}
|
||||||
@ -48,11 +52,18 @@ GroundClutter::~GroundClutter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GroundClutter::_bind_methods() {
|
void GroundClutter::_bind_methods() {
|
||||||
|
|
||||||
|
#ifdef TEXTURE_PACKER_PRESENT
|
||||||
|
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);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VOXELMAN_PRESENT
|
||||||
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "should"), "_should_spawn", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "y"), PropertyInfo(Variant::INT, "z")));
|
BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::BOOL, "should"), "_should_spawn", PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "y"), PropertyInfo(Variant::INT, "z")));
|
||||||
BIND_VMETHOD(MethodInfo("_add_meshes_to", PropertyInfo(Variant::OBJECT, "mesher", PROPERTY_HINT_RESOURCE_TYPE, "VoxelMesher"), PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "y"), PropertyInfo(Variant::INT, "z")));
|
BIND_VMETHOD(MethodInfo("_add_meshes_to", PropertyInfo(Variant::OBJECT, "mesher", PROPERTY_HINT_RESOURCE_TYPE, "VoxelMesher"), PropertyInfo(Variant::OBJECT, "chunk", PROPERTY_HINT_RESOURCE_TYPE, "VoxelChunk"), PropertyInfo(Variant::INT, "x"), PropertyInfo(Variant::INT, "y"), PropertyInfo(Variant::INT, "z")));
|
||||||
BIND_VMETHOD(MethodInfo("_add_textures_to", PropertyInfo(Variant::OBJECT, "packer", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker")));
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("should_spawn", "chunk", "x", "y", "z"), &GroundClutter::should_spawn);
|
ClassDB::bind_method(D_METHOD("should_spawn", "chunk", "x", "y", "z"), &GroundClutter::should_spawn);
|
||||||
ClassDB::bind_method(D_METHOD("add_meshes_to", "mesher", "chunk", "x", "y", "z"), &GroundClutter::add_meshes_to);
|
ClassDB::bind_method(D_METHOD("add_meshes_to", "mesher", "chunk", "x", "y", "z"), &GroundClutter::add_meshes_to);
|
||||||
ClassDB::bind_method(D_METHOD("add_textures_to", "packer"), &GroundClutter::add_textures_to);
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,13 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "core/resource.h"
|
#include "core/resource.h"
|
||||||
|
|
||||||
|
#ifdef TEXTURE_PACKER_PRESENT
|
||||||
#include "../../texture_packer/texture_packer.h"
|
#include "../../texture_packer/texture_packer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VOXELMAN_PRESENT
|
||||||
#include "../../voxelman/meshers/voxel_mesher.h"
|
#include "../../voxelman/meshers/voxel_mesher.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class VoxelChunk;
|
class VoxelChunk;
|
||||||
class VoxelMesher;
|
class VoxelMesher;
|
||||||
@ -35,10 +40,15 @@ class GroundClutter : public Resource {
|
|||||||
GDCLASS(GroundClutter, Resource);
|
GDCLASS(GroundClutter, Resource);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#ifdef VOXELMAN_PRESENT
|
||||||
bool should_spawn(Ref<VoxelChunk> chunk, int x, int y, int z);
|
bool should_spawn(Ref<VoxelChunk> chunk, int x, int y, int z);
|
||||||
|
|
||||||
void add_meshes_to(Ref<VoxelMesher> mesher, Ref<VoxelChunk> chunk, int x, int y, int z);
|
void add_meshes_to(Ref<VoxelMesher> mesher, Ref<VoxelChunk> chunk, int x, int y, int z);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TEXTURE_PACKER_PRESENT
|
||||||
void add_textures_to(Ref<TexturePacker> packer);
|
void add_textures_to(Ref<TexturePacker> packer);
|
||||||
|
#endif
|
||||||
|
|
||||||
GroundClutter();
|
GroundClutter();
|
||||||
~GroundClutter();
|
~GroundClutter();
|
||||||
|
Loading…
Reference in New Issue
Block a user