|
62 | 62 | #include "editor/editor_file_system.h" |
63 | 63 | #endif |
64 | 64 |
|
| 65 | +#include "modules/modules_enabled.gen.h" // For csg, gridmap. |
| 66 | + |
| 67 | +#ifdef MODULE_CSG_ENABLED |
| 68 | +#include "modules/csg/csg_shape.h" |
| 69 | +#endif |
| 70 | +#ifdef MODULE_GRIDMAP_ENABLED |
| 71 | +#include "modules/gridmap/grid_map.h" |
| 72 | +#endif |
| 73 | + |
65 | 74 | // FIXME: Hardcoded to avoid editor dependency. |
66 | 75 | #define GLTF_IMPORT_GENERATE_TANGENT_ARRAYS 8 |
67 | 76 | #define GLTF_IMPORT_USE_NAMED_SKIN_BINDS 16 |
@@ -5912,8 +5921,10 @@ void GLTFDocument::_convert_scene_node(Ref<GLTFState> p_state, Node *p_current, |
5912 | 5921 | } |
5913 | 5922 | } |
5914 | 5923 |
|
5915 | | -#ifdef MODULE_CSG_ENABLED |
5916 | 5924 | void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeIndex p_gltf_parent, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state) { |
| 5925 | +#ifndef MODULE_CSG_ENABLED |
| 5926 | + ERR_FAIL_MSG("csg module is disabled."); |
| 5927 | +#else |
5917 | 5928 | CSGShape3D *csg = p_current; |
5918 | 5929 | csg->call("_update_shape"); |
5919 | 5930 | Array meshes = csg->get_meshes(); |
@@ -5964,8 +5975,8 @@ void GLTFDocument::_convert_csg_shape_to_gltf(CSGShape3D *p_current, GLTFNodeInd |
5964 | 5975 | p_gltf_node->transform = csg->get_transform(); |
5965 | 5976 | p_gltf_node->set_original_name(csg->get_name()); |
5966 | 5977 | p_gltf_node->set_name(_gen_unique_name(p_state, csg->get_name())); |
5967 | | -} |
5968 | 5978 | #endif // MODULE_CSG_ENABLED |
| 5979 | +} |
5969 | 5980 |
|
5970 | 5981 | void GLTFDocument::_check_visibility(Node *p_node, bool &r_retflag) { |
5971 | 5982 | r_retflag = true; |
@@ -5996,8 +6007,10 @@ void GLTFDocument::_convert_light_to_gltf(Light3D *light, Ref<GLTFState> p_state |
5996 | 6007 | } |
5997 | 6008 | } |
5998 | 6009 |
|
5999 | | -#ifdef MODULE_GRIDMAP_ENABLED |
6000 | 6010 | void GLTFDocument::_convert_grid_map_to_gltf(GridMap *p_grid_map, GLTFNodeIndex p_parent_node_index, GLTFNodeIndex p_root_node_index, Ref<GLTFNode> p_gltf_node, Ref<GLTFState> p_state) { |
| 6011 | +#ifndef MODULE_GRIDMAP_ENABLED |
| 6012 | + ERR_FAIL_MSG("gridmap module is disabled."); |
| 6013 | +#else |
6001 | 6014 | Array cells = p_grid_map->get_used_cells(); |
6002 | 6015 | for (int32_t k = 0; k < cells.size(); k++) { |
6003 | 6016 | GLTFNode *new_gltf_node = memnew(GLTFNode); |
@@ -6025,8 +6038,8 @@ void GLTFDocument::_convert_grid_map_to_gltf(GridMap *p_grid_map, GLTFNodeIndex |
6025 | 6038 | new_gltf_node->set_original_name(p_grid_map->get_mesh_library()->get_item_name(cell)); |
6026 | 6039 | new_gltf_node->set_name(_gen_unique_name(p_state, p_grid_map->get_mesh_library()->get_item_name(cell))); |
6027 | 6040 | } |
6028 | | -} |
6029 | 6041 | #endif // MODULE_GRIDMAP_ENABLED |
| 6042 | +} |
6030 | 6043 |
|
6031 | 6044 | void GLTFDocument::_convert_multi_mesh_instance_to_gltf( |
6032 | 6045 | MultiMeshInstance3D *p_multi_mesh_instance, |
|
0 commit comments