diff --git a/modules/mesh_data_resource/SCsub b/modules/mesh_data_resource/SCsub index 5d9115a6d..17e1e930f 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_mesh_utils_enabled"]: - module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) - module_env.add_source_files(env.modules_sources,"register_types.cpp") module_env.add_source_files(env.modules_sources,"mesh_data_resource.cpp") @@ -19,20 +16,21 @@ if 'TOOLS_ENABLED' in env["CPPDEFINES"]: module_env.add_source_files(env.modules_sources,"plugin_gltf/editor_import_gltf_mdr.cpp") module_env.add_source_files(env.modules_sources,"plugin_gltf/editor_plugin_gltf_mdr.cpp") - module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_decompose.cpp") - module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_outline.cpp") - module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_utils.cpp") + if env["module_mesh_utils_enabled"]: + module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_decompose.cpp") + module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_outline.cpp") + module_env.add_source_files(env.modules_sources,"editor/utilities/mdr_ed_mesh_utils.cpp") - module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_ed_uv_previewer.cpp") - module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor.cpp") - module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view_node.cpp") - module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor_popup.cpp") - module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view.cpp") + module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_ed_uv_previewer.cpp") + module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor.cpp") + module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view_node.cpp") + module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_editor_popup.cpp") + module_env.add_source_files(env.modules_sources,"editor/uv_editor/mdr_uv_rect_view.cpp") - module_env.add_source_files(env.modules_sources,"editor/mdi_ed_plugin.cpp") - module_env.add_source_files(env.modules_sources,"editor/mdi_ed.cpp") - module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo_plugin.cpp") - module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo.cpp") + module_env.add_source_files(env.modules_sources,"editor/mdi_ed_plugin.cpp") + module_env.add_source_files(env.modules_sources,"editor/mdi_ed.cpp") + module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo_plugin.cpp") + module_env.add_source_files(env.modules_sources,"editor/mdi_gizmo.cpp") module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance.cpp") module_env.add_source_files(env.modules_sources,"nodes/mesh_data_instance_2d.cpp") diff --git a/modules/mesh_data_resource/editor/utilities/mdr_ed_mesh_utils.cpp b/modules/mesh_data_resource/editor/utilities/mdr_ed_mesh_utils.cpp index 1ad124d4c..6af42fa1f 100644 --- a/modules/mesh_data_resource/editor/utilities/mdr_ed_mesh_utils.cpp +++ b/modules/mesh_data_resource/editor/utilities/mdr_ed_mesh_utils.cpp @@ -27,6 +27,8 @@ SOFTWARE. #include "scene/resources/mesh.h" #include "scene/resources/surface_tool.h" +#include "modules/modules_enabled.gen.h" + int MDREDMeshUtils::SeamTriangleHelper::get_other_side_index(int index) const { if (side_index_1 == index) { return side_index_2; diff --git a/modules/mesh_data_resource/plugin/mdr_import_plugin_base.cpp b/modules/mesh_data_resource/plugin/mdr_import_plugin_base.cpp index 37617315f..3029eca99 100644 --- a/modules/mesh_data_resource/plugin/mdr_import_plugin_base.cpp +++ b/modules/mesh_data_resource/plugin/mdr_import_plugin_base.cpp @@ -30,7 +30,9 @@ SOFTWARE. #include "scene/resources/shape.h" #include "scene/resources/sphere_shape.h" -#if MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../mesh_utils/mesh_utils.h" #endif @@ -41,7 +43,7 @@ SOFTWARE. const String MDRImportPluginBase::BINDING_MDR_IMPORT_TYPE = "Single,Multiple"; const String MDRImportPluginBase::BINDING_MDR_SURFACE_HANDLING_TYPE = "Only Use First,Create Separate MDRs,Merge"; const String MDRImportPluginBase::BINDING_MDR_OPTIMIZATION_TYPE = "Off" -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED ",Remove Doubles,Remove Doubles Interpolate Normals" #endif ; @@ -50,7 +52,7 @@ void MDRImportPluginBase::get_import_options(List *r_options, int r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_type", PROPERTY_HINT_ENUM, BINDING_MDR_IMPORT_TYPE), MDRImportPluginBase::MDR_IMPORT_TIME_SINGLE)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "surface_handling", PROPERTY_HINT_ENUM, BINDING_MDR_SURFACE_HANDLING_TYPE), MDRImportPluginBase::MDR_SURFACE_HANDLING_TYPE_ONLY_USE_FIRST)); -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED //Normal remove doubles should be the default if mesh utils present as it shouldn't visibly change the mesh r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "optimization_type", PROPERTY_HINT_ENUM, BINDING_MDR_OPTIMIZATION_TYPE), MDRImportPluginBase::MDR_OPTIMIZATION_REMOVE_DOUBLES)); #else @@ -128,7 +130,7 @@ int MDRImportPluginBase::get_mesh_count(Node *n) { } Error MDRImportPluginBase::process_node_single(Node *n, const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED MDRImportPluginBase::MDROptimizationType optimization_type = static_cast(static_cast(p_options["optimization_type"])); #endif @@ -154,7 +156,7 @@ Error MDRImportPluginBase::process_node_single(Node *n, const String &p_source_f continue; } -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED switch (optimization_type) { case MDR_OPTIMIZATION_OFF: break; @@ -188,7 +190,7 @@ Error MDRImportPluginBase::process_node_single(Node *n, const String &p_source_f } Error MDRImportPluginBase::process_node_single_separated_bones(Node *n, const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED MDRImportPluginBase::MDROptimizationType optimization_type = static_cast(static_cast(p_options["optimization_type"])); #endif @@ -223,7 +225,7 @@ Error MDRImportPluginBase::process_node_single_separated_bones(Node *n, const St if (!mdr.is_valid()) continue; -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED switch (optimization_type) { case MDR_OPTIMIZATION_OFF: break; @@ -273,7 +275,7 @@ Error MDRImportPluginBase::process_node_single_separated_bones(Node *n, const St } Error MDRImportPluginBase::process_node_multi(Node *n, const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata, Ref coll, Ref copy_coll, int node_count) { -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED MDRImportPluginBase::MDROptimizationType optimization_type = static_cast(static_cast(p_options["optimization_type"])); #endif @@ -298,7 +300,7 @@ Error MDRImportPluginBase::process_node_multi(Node *n, const String &p_source_fi continue; } -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED switch (optimization_type) { case MDR_OPTIMIZATION_OFF: break; diff --git a/modules/mesh_data_resource/plugin/mdr_import_plugin_base.h b/modules/mesh_data_resource/plugin/mdr_import_plugin_base.h index 06cf207b9..adda6689f 100644 --- a/modules/mesh_data_resource/plugin/mdr_import_plugin_base.h +++ b/modules/mesh_data_resource/plugin/mdr_import_plugin_base.h @@ -39,6 +39,8 @@ SOFTWARE. #include "scene/3d/mesh_instance.h" +#include "modules/modules_enabled.gen.h" + class MDRImportPluginBase : public EditorImportPlugin { GDCLASS(MDRImportPluginBase, EditorImportPlugin); @@ -62,7 +64,7 @@ public: enum MDROptimizationType { MDR_OPTIMIZATION_OFF = 0, -#if MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED MDR_OPTIMIZATION_REMOVE_DOUBLES, MDR_OPTIMIZATION_REMOVE_DOUBLES_INTERPOLATE_NORMALS, #endif diff --git a/modules/mesh_data_resource/register_types.cpp b/modules/mesh_data_resource/register_types.cpp index 56e6e6d09..b6ba86f5b 100644 --- a/modules/mesh_data_resource/register_types.cpp +++ b/modules/mesh_data_resource/register_types.cpp @@ -36,9 +36,12 @@ SOFTWARE. #include "plugin_gltf/editor_plugin_gltf_mdr.h" #endif +#ifdef MODULE_MESH_UTILS_ENABLED #include "./editor/mdi_ed_plugin.h" #endif +#endif + #ifdef MODULE_PROPS_ENABLED #include "../props/singleton/prop_utils.h" #include "props/prop_data_mesh_data.h" @@ -69,11 +72,16 @@ void register_mesh_data_resource_types() { #endif #ifdef TOOLS_ENABLED + #ifdef MODULE_GLTF_ENABLED EditorPlugins::add_by_type(); #endif + +#ifdef MODULE_MESH_UTILS_ENABLED EditorPlugins::add_by_type(); #endif + +#endif } void unregister_mesh_data_resource_types() { diff --git a/modules/props/SCsub b/modules/props/SCsub index 6051a5293..55f169d8d 100644 --- a/modules/props/SCsub +++ b/modules/props/SCsub @@ -6,9 +6,6 @@ module_env = env.Clone() import version -if os.path.isdir('../mesh_utils'): - module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) - sources = [ "register_types.cpp", diff --git a/modules/props/jobs/prop_mesher_job_step.cpp b/modules/props/jobs/prop_mesher_job_step.cpp index 20d69fd2d..14205860e 100644 --- a/modules/props/jobs/prop_mesher_job_step.cpp +++ b/modules/props/jobs/prop_mesher_job_step.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "prop_mesher_job_step.h" +#include "modules/modules_enabled.gen.h" + const String PropMesherJobStep::BINDING_STRING_PROP_MESHER_JOB_STEP_TYPE = "Normal,Normal LOD,Drop UV2,Merge Verts,Bake Texture,Simplify Mesh"; PropMesherJobStep::PropMesherJobStepType PropMesherJobStep::get_job_type() const { @@ -38,7 +40,7 @@ void PropMesherJobStep::set_lod_index(const int value) { _lod_index = value; } -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref PropMesherJobStep::get_fqms() { return _fqms; } @@ -73,7 +75,7 @@ PropMesherJobStep::PropMesherJobStep() { _job_type = TYPE_NORMAL; _lod_index = 0; -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED _simplification_step_ratio = 0.8; _simplification_steps = 2; _simplification_agressiveness = 7; @@ -81,7 +83,7 @@ PropMesherJobStep::PropMesherJobStep() { } PropMesherJobStep::~PropMesherJobStep() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED _fqms.unref(); #endif } @@ -95,7 +97,7 @@ void PropMesherJobStep::_bind_methods() { ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &PropMesherJobStep::set_lod_index); ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index"); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED ClassDB::bind_method(D_METHOD("get_fqms"), &PropMesherJobStep::get_fqms); ClassDB::bind_method(D_METHOD("set_fqms", "value"), &PropMesherJobStep::set_fqms); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fqms", PROPERTY_HINT_RESOURCE_TYPE, "FastQuadraticMeshSimplifier"), "set_fqms", "get_fqms"); diff --git a/modules/props/jobs/prop_mesher_job_step.h b/modules/props/jobs/prop_mesher_job_step.h index 5642a194a..e39375901 100644 --- a/modules/props/jobs/prop_mesher_job_step.h +++ b/modules/props/jobs/prop_mesher_job_step.h @@ -24,7 +24,9 @@ SOFTWARE. #include "core/object/reference.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -54,7 +56,7 @@ public: int get_lod_index() const; void set_lod_index(const int value); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref get_fqms(); void set_fqms(const Ref &val); @@ -77,7 +79,7 @@ protected: PropMesherJobStepType _job_type; int _lod_index; -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref _fqms; float _simplification_step_ratio; int _simplification_steps; diff --git a/modules/props/prop_instance_prop_job.cpp b/modules/props/prop_instance_prop_job.cpp index 1d91382f6..b0c8d4f04 100644 --- a/modules/props/prop_instance_prop_job.cpp +++ b/modules/props/prop_instance_prop_job.cpp @@ -39,7 +39,7 @@ SOFTWARE. #include "../mesh_data_resource/mesh_data_resource.h" #endif -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED #include "../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -402,7 +402,7 @@ void PropInstancePropJob::phase_steps() { ++count; break; case PropMesherJobStep::TYPE_SIMPLIFY_MESH: -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED count += step->get_simplification_steps(); #endif break; @@ -559,7 +559,7 @@ void PropInstancePropJob::step_type_bake_texture() { } void PropInstancePropJob::step_type_simplify_mesh() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref step = _job_steps[_current_job_step]; ERR_FAIL_COND(!step.is_valid()); diff --git a/modules/props_2d/SCsub b/modules/props_2d/SCsub index ebcf18c44..ac53dfbf9 100644 --- a/modules/props_2d/SCsub +++ b/modules/props_2d/SCsub @@ -9,9 +9,6 @@ import version if os.path.isdir('../terraman_2d'): module_env.Append(CPPDEFINES=['TERRAMAN_2D_PRESENT']) -if os.path.isdir('../mesh_utils'): - module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) - sources = [ "register_types.cpp", diff --git a/modules/props_2d/prop_2d_instance_prop_job.cpp b/modules/props_2d/prop_2d_instance_prop_job.cpp index 83dfa2f21..0f7e87f3e 100644 --- a/modules/props_2d/prop_2d_instance_prop_job.cpp +++ b/modules/props_2d/prop_2d_instance_prop_job.cpp @@ -36,7 +36,7 @@ SOFTWARE. #include "../mesh_data_resource/mesh_data_resource.h" #endif -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED #include "../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif diff --git a/modules/terraman/SCsub b/modules/terraman/SCsub index ff2770a76..e5c0249dc 100644 --- a/modules/terraman/SCsub +++ b/modules/terraman/SCsub @@ -4,9 +4,6 @@ Import('env') module_env = env.Clone() -if os.path.isdir('../mesh_utils'): - module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) - sources = [ "register_types.cpp", diff --git a/modules/terraman/world/blocky/terrain_world_blocky.cpp b/modules/terraman/world/blocky/terrain_world_blocky.cpp index 4a931d4e7..7329a7849 100644 --- a/modules/terraman/world/blocky/terrain_world_blocky.cpp +++ b/modules/terraman/world/blocky/terrain_world_blocky.cpp @@ -29,6 +29,8 @@ SOFTWARE. #include "../jobs/terrain_prop_job.h" #include "../jobs/terrain_terrain_job.h" +#include "modules/modules_enabled.gen.h" + Ref TerrainWorldBlocky::_create_chunk(int x, int z, Ref chunk) { if (!chunk.is_valid()) { chunk = Ref(memnew(TerrainChunkBlocky)); @@ -90,7 +92,7 @@ Ref TerrainWorldBlocky::_create_chunk(int x, int z, Refset_job_type(TerrainMesherJobStep::TYPE_SIMPLIFY_MESH); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref fqms; fqms.instance(); s->set_fqms(fqms); diff --git a/modules/terraman/world/jobs/terrain_mesher_job_step.cpp b/modules/terraman/world/jobs/terrain_mesher_job_step.cpp index aeb43deef..c19cfe6a3 100644 --- a/modules/terraman/world/jobs/terrain_mesher_job_step.cpp +++ b/modules/terraman/world/jobs/terrain_mesher_job_step.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "terrain_mesher_job_step.h" +#include "modules/modules_enabled.gen.h" + const String TerrainMesherJobStep::BINDING_STRING_TERRAIN_TERRAIN_JOB_STEP_TYPE = "Normal,Normal LOD,Drop UV2,Merge Verts,Bake Texture,Simplify Mesh"; TerrainMesherJobStep::TerrainMesherJobStepType TerrainMesherJobStep::get_job_type() const { @@ -38,7 +40,7 @@ void TerrainMesherJobStep::set_lod_index(const int value) { _lod_index = value; } -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref TerrainMesherJobStep::get_fqms() { return _fqms; } @@ -73,7 +75,7 @@ TerrainMesherJobStep::TerrainMesherJobStep() { _job_type = TYPE_NORMAL; _lod_index = 0; -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED _simplification_step_ratio = 0.8; _simplification_steps = 2; _simplification_agressiveness = 7; @@ -81,7 +83,7 @@ TerrainMesherJobStep::TerrainMesherJobStep() { } TerrainMesherJobStep::~TerrainMesherJobStep() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED _fqms.unref(); #endif } @@ -95,7 +97,7 @@ void TerrainMesherJobStep::_bind_methods() { ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &TerrainMesherJobStep::set_lod_index); ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index"); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED ClassDB::bind_method(D_METHOD("get_fqms"), &TerrainMesherJobStep::get_fqms); ClassDB::bind_method(D_METHOD("set_fqms", "value"), &TerrainMesherJobStep::set_fqms); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fqms", PROPERTY_HINT_RESOURCE_TYPE, "FastQuadraticMeshSimplifier"), "set_fqms", "get_fqms"); diff --git a/modules/terraman/world/jobs/terrain_mesher_job_step.h b/modules/terraman/world/jobs/terrain_mesher_job_step.h index 45152b708..9a666e1d6 100644 --- a/modules/terraman/world/jobs/terrain_mesher_job_step.h +++ b/modules/terraman/world/jobs/terrain_mesher_job_step.h @@ -24,7 +24,9 @@ SOFTWARE. #include "core/object/reference.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -54,7 +56,7 @@ public: int get_lod_index() const; void set_lod_index(const int value); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref get_fqms(); void set_fqms(const Ref &val); @@ -77,7 +79,7 @@ protected: TerrainMesherJobStepType _job_type; int _lod_index; -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref _fqms; float _simplification_step_ratio; int _simplification_steps; diff --git a/modules/terraman/world/jobs/terrain_prop_job.cpp b/modules/terraman/world/jobs/terrain_prop_job.cpp index 7d2815d3c..cb01de5fe 100644 --- a/modules/terraman/world/jobs/terrain_prop_job.cpp +++ b/modules/terraman/world/jobs/terrain_prop_job.cpp @@ -42,7 +42,7 @@ SOFTWARE. #include "../../world/default/terrain_world_default.h" -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -374,7 +374,7 @@ void TerrainPropJob::phase_steps() { ++count; break; case TerrainMesherJobStep::TYPE_SIMPLIFY_MESH: -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED count += step->get_simplification_steps(); #endif break; @@ -561,7 +561,7 @@ void TerrainPropJob::step_type_bake_texture() { } void TerrainPropJob::step_type_simplify_mesh() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref chunk = _chunk; Ref step = _job_steps[_current_job_step]; diff --git a/modules/terraman/world/jobs/terrain_terrain_job.cpp b/modules/terraman/world/jobs/terrain_terrain_job.cpp index 293f3dcbf..9951119e8 100644 --- a/modules/terraman/world/jobs/terrain_terrain_job.cpp +++ b/modules/terraman/world/jobs/terrain_terrain_job.cpp @@ -32,7 +32,9 @@ SOFTWARE. #include "../default/terrain_chunk_default.h" #include "servers/physics_server.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -306,7 +308,7 @@ void TerrainTerrainJob::phase_terrain_mesh() { ++count; break; case TerrainMesherJobStep::TYPE_SIMPLIFY_MESH: -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED count += step->get_simplification_steps(); #endif break; @@ -633,7 +635,7 @@ void TerrainTerrainJob::step_type_bake_texture() { } void TerrainTerrainJob::step_type_simplify_mesh() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref chunk = _chunk; Ref step = _job_steps[_current_job_step]; diff --git a/modules/terraman_2d/SCsub b/modules/terraman_2d/SCsub index 05c3a19d6..22a148940 100644 --- a/modules/terraman_2d/SCsub +++ b/modules/terraman_2d/SCsub @@ -4,9 +4,6 @@ Import('env') module_env = env.Clone() -if os.path.isdir('../mesh_utils'): - module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) - sources = [ "register_types.cpp", diff --git a/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp b/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp index 793864b3f..ad51e34e7 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp +++ b/modules/terraman_2d/world/jobs/terrain_2d_prop_job.cpp @@ -40,7 +40,7 @@ SOFTWARE. #include "../../world/default/terrain_2d_world_default.h" -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif diff --git a/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.cpp b/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.cpp index 949f42368..71518260c 100644 --- a/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.cpp +++ b/modules/terraman_2d/world/jobs/terrain_2d_terrain_job.cpp @@ -32,7 +32,9 @@ SOFTWARE. #include "../default/terrain_2d_chunk_default.h" #include "servers/physics_2d_server.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif diff --git a/modules/voxelman/SCsub b/modules/voxelman/SCsub index 69367bf07..04413c40e 100644 --- a/modules/voxelman/SCsub +++ b/modules/voxelman/SCsub @@ -7,9 +7,6 @@ module_env = env.Clone() if os.path.isdir('../props'): module_env.Append(CPPDEFINES=['PROPS_PRESENT']) -if os.path.isdir('../mesh_utils'): - module_env.Append(CPPDEFINES=['MESH_UTILS_PRESENT']) - sources = [ "register_types.cpp", diff --git a/modules/voxelman/world/blocky/voxel_world_blocky.cpp b/modules/voxelman/world/blocky/voxel_world_blocky.cpp index 04b0844bb..fce04312c 100644 --- a/modules/voxelman/world/blocky/voxel_world_blocky.cpp +++ b/modules/voxelman/world/blocky/voxel_world_blocky.cpp @@ -31,7 +31,7 @@ SOFTWARE. #include "../jobs/voxel_prop_job.h" #include "../jobs/voxel_terrain_job.h" -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -64,7 +64,7 @@ Ref VoxelWorldBlocky::_create_chunk(int x, int y, int z, Refset_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE); tj->add_jobs_step(s); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED s.instance(); Ref fqms; fqms.instance(); @@ -97,7 +97,7 @@ Ref VoxelWorldBlocky::_create_chunk(int x, int y, int z, Refset_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED fqms.instance(); s->set_fqms(fqms); s->set_simplification_steps(2); diff --git a/modules/voxelman/world/cubic/voxel_world_cubic.cpp b/modules/voxelman/world/cubic/voxel_world_cubic.cpp index 978aaf91b..516884c7d 100644 --- a/modules/voxelman/world/cubic/voxel_world_cubic.cpp +++ b/modules/voxelman/world/cubic/voxel_world_cubic.cpp @@ -29,7 +29,9 @@ SOFTWARE. #include "../jobs/voxel_prop_job.h" #include "../jobs/voxel_terrain_job.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -62,7 +64,7 @@ Ref VoxelWorldCubic::_create_chunk(int x, int y, int z, Refset_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE); tj->add_jobs_step(s); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED s.instance(); Ref fqms; fqms.instance(); @@ -98,7 +100,7 @@ Ref VoxelWorldCubic::_create_chunk(int x, int y, int z, Refset_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED fqms.instance(); s->set_fqms(fqms); s->set_simplification_steps(2); diff --git a/modules/voxelman/world/default/voxel_world_default.cpp b/modules/voxelman/world/default/voxel_world_default.cpp index 580cce598..be8d8af8d 100644 --- a/modules/voxelman/world/default/voxel_world_default.cpp +++ b/modules/voxelman/world/default/voxel_world_default.cpp @@ -31,7 +31,9 @@ SOFTWARE. #include "../jobs/voxel_prop_job.h" #include "../jobs/voxel_terrain_job.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -212,7 +214,7 @@ Ref VoxelWorldDefault::_create_chunk(int x, int y, int z, Refset_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE); tj->add_jobs_step(s); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED s.instance(); Ref fqms; fqms.instance(); @@ -245,7 +247,7 @@ Ref VoxelWorldDefault::_create_chunk(int x, int y, int z, Refset_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED fqms.instance(); s->set_fqms(fqms); s->set_simplification_steps(2); diff --git a/modules/voxelman/world/jobs/voxel_mesher_job_step.cpp b/modules/voxelman/world/jobs/voxel_mesher_job_step.cpp index cc4afd3f2..e0f096d2b 100644 --- a/modules/voxelman/world/jobs/voxel_mesher_job_step.cpp +++ b/modules/voxelman/world/jobs/voxel_mesher_job_step.cpp @@ -22,6 +22,8 @@ SOFTWARE. #include "voxel_mesher_job_step.h" +#include "modules/modules_enabled.gen.h" + const String VoxelMesherJobStep::BINDING_STRING_TERRAIN_TERRAIN_JOB_STEP_TYPE = "Normal,Normal LOD,Drop UV2,Merge Verts,Bake Texture,Simplify Mesh"; VoxelMesherJobStep::VoxelMesherJobStepType VoxelMesherJobStep::get_job_type() const { @@ -38,7 +40,7 @@ void VoxelMesherJobStep::set_lod_index(const int value) { _lod_index = value; } -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref VoxelMesherJobStep::get_fqms() { return _fqms; } @@ -73,7 +75,7 @@ VoxelMesherJobStep::VoxelMesherJobStep() { _job_type = TYPE_NORMAL; _lod_index = 0; -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED _simplification_step_ratio = 0.8; _simplification_steps = 2; _simplification_agressiveness = 7; @@ -81,7 +83,7 @@ VoxelMesherJobStep::VoxelMesherJobStep() { } VoxelMesherJobStep::~VoxelMesherJobStep() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED _fqms.unref(); #endif } @@ -95,7 +97,7 @@ void VoxelMesherJobStep::_bind_methods() { ClassDB::bind_method(D_METHOD("set_lod_index", "value"), &VoxelMesherJobStep::set_lod_index); ADD_PROPERTY(PropertyInfo(Variant::INT, "lod_index"), "set_lod_index", "get_lod_index"); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED ClassDB::bind_method(D_METHOD("get_fqms"), &VoxelMesherJobStep::get_fqms); ClassDB::bind_method(D_METHOD("set_fqms", "value"), &VoxelMesherJobStep::set_fqms); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fqms", PROPERTY_HINT_RESOURCE_TYPE, "FastQuadraticMeshSimplifier"), "set_fqms", "get_fqms"); diff --git a/modules/voxelman/world/jobs/voxel_mesher_job_step.h b/modules/voxelman/world/jobs/voxel_mesher_job_step.h index a6e8ab9c5..4965ac203 100644 --- a/modules/voxelman/world/jobs/voxel_mesher_job_step.h +++ b/modules/voxelman/world/jobs/voxel_mesher_job_step.h @@ -24,7 +24,9 @@ SOFTWARE. #include "core/object/reference.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -54,7 +56,7 @@ public: int get_lod_index() const; void set_lod_index(const int value); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref get_fqms(); void set_fqms(const Ref &val); @@ -77,7 +79,7 @@ protected: VoxelMesherJobStepType _job_type; int _lod_index; -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref _fqms; float _simplification_step_ratio; int _simplification_steps; diff --git a/modules/voxelman/world/jobs/voxel_prop_job.cpp b/modules/voxelman/world/jobs/voxel_prop_job.cpp index 6d3ab4554..8476ce511 100644 --- a/modules/voxelman/world/jobs/voxel_prop_job.cpp +++ b/modules/voxelman/world/jobs/voxel_prop_job.cpp @@ -43,7 +43,7 @@ SOFTWARE. #include "../../world/default/voxel_world_default.h" -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -375,7 +375,7 @@ void VoxelPropJob::phase_steps() { ++count; break; case VoxelMesherJobStep::TYPE_SIMPLIFY_MESH: -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED count += step->get_simplification_steps(); #endif break; @@ -562,7 +562,7 @@ void VoxelPropJob::step_type_bake_texture() { } void VoxelPropJob::step_type_simplify_mesh() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref chunk = _chunk; Ref step = _job_steps[_current_job_step]; diff --git a/modules/voxelman/world/jobs/voxel_terrain_job.cpp b/modules/voxelman/world/jobs/voxel_terrain_job.cpp index a48070bb2..5f10b2dae 100644 --- a/modules/voxelman/world/jobs/voxel_terrain_job.cpp +++ b/modules/voxelman/world/jobs/voxel_terrain_job.cpp @@ -32,7 +32,9 @@ SOFTWARE. #include "../default/voxel_chunk_default.h" #include "servers/physics_server.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -474,7 +476,7 @@ void VoxelTerrainJob::phase_terrain_mesh() { ++count; break; case VoxelMesherJobStep::TYPE_SIMPLIFY_MESH: -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED count += step->get_simplification_steps(); #endif break; @@ -841,7 +843,7 @@ void VoxelTerrainJob::step_type_bake_texture() { } void VoxelTerrainJob::step_type_simplify_mesh() { -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED Ref chunk = _chunk; Ref step = _job_steps[_current_job_step]; diff --git a/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp b/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp index a0b056885..db3338289 100644 --- a/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp +++ b/modules/voxelman/world/marching_cubes/voxel_world_marching_cubes.cpp @@ -29,7 +29,9 @@ SOFTWARE. #include "../jobs/voxel_prop_job.h" #include "../jobs/voxel_terrain_job.h" -#ifdef MESH_UTILS_PRESENT +#include "modules/modules_enabled.gen.h" + +#ifdef MODULE_MESH_UTILS_ENABLED #include "../../../mesh_utils/fast_quadratic_mesh_simplifier.h" #endif @@ -62,7 +64,7 @@ Ref VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref< s->set_job_type(VoxelMesherJobStep::TYPE_BAKE_TEXTURE); tj->add_jobs_step(s); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED s.instance(); Ref fqms; fqms.instance(); @@ -99,7 +101,7 @@ Ref VoxelWorldMarchingCubes::_create_chunk(int x, int y, int z, Ref< s.instance(); s->set_job_type(VoxelMesherJobStep::TYPE_SIMPLIFY_MESH); -#ifdef MESH_UTILS_PRESENT +#ifdef MODULE_MESH_UTILS_ENABLED fqms.instance(); s->set_fqms(fqms); s->set_simplification_steps(2);