summaryrefslogtreecommitdiffstats
path: root/modules/gltf
diff options
context:
space:
mode:
authorywmaa <ywmaa.personal@gmail.com>2024-01-30 12:05:40 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-08-19 12:23:21 +0200
commitc460f1de24824e66bf3217868ac0c1c30657b2d7 (patch)
tree9f19dc7c197d80d9de66f2586290afef587fe2db /modules/gltf
parent7a4a6fbc039fefbccbb23a66285722ad20bf418a (diff)
downloadredot-engine-c460f1de24824e66bf3217868ac0c1c30657b2d7.tar.gz
Add Option for Export Geometry Nodes Instances in blend importer
Diffstat (limited to 'modules/gltf')
-rw-r--r--modules/gltf/editor/editor_scene_importer_blend.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp
index ec3ea9bcae..4201dcd2ad 100644
--- a/modules/gltf/editor/editor_scene_importer_blend.cpp
+++ b/modules/gltf/editor/editor_scene_importer_blend.cpp
@@ -227,6 +227,18 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
} else {
parameters_map["export_normals"] = false;
}
+
+ if (blender_major_version > 4 || (blender_major_version == 4 && blender_minor_version >= 1)) {
+ if (p_options.has(SNAME("blender/meshes/export_geometry_nodes_instances")) && p_options[SNAME("blender/meshes/export_geometry_nodes_instances")]) {
+ parameters_map["export_gn_mesh"] = true;
+ if (blender_major_version == 4 && blender_minor_version == 1) {
+ // There is a bug in Blender 4.1 where it can't export lights and geometry nodes at the same time, one must be disabled.
+ parameters_map["export_lights"] = false;
+ }
+ } else {
+ parameters_map["export_gn_mesh"] = false;
+ }
+ }
if (p_options.has(SNAME("blender/meshes/tangents")) && p_options[SNAME("blender/meshes/tangents")]) {
parameters_map["export_tangents"] = true;
} else {
@@ -350,6 +362,7 @@ void EditorSceneFormatImporterBlend::get_import_options(const String &p_path, Li
ADD_OPTION_BOOL("blender/meshes/colors", false);
ADD_OPTION_BOOL("blender/meshes/uvs", true);
ADD_OPTION_BOOL("blender/meshes/normals", true);
+ ADD_OPTION_BOOL("blender/meshes/export_geometry_nodes_instances", false);
ADD_OPTION_BOOL("blender/meshes/tangents", true);
ADD_OPTION_ENUM("blender/meshes/skins", "None,4 Influences (Compatible),All Influences", BLEND_BONE_INFLUENCES_ALL);
ADD_OPTION_BOOL("blender/meshes/export_bones_deforming_mesh_only", false);