diff options
author | demolke <demolke@gmail.com> | 2024-07-06 13:38:45 +0200 |
---|---|---|
committer | demolke <demolke@gmail.com> | 2024-07-06 14:22:09 +0200 |
commit | 7864abbeec103b2a3a2aa9713642a19b5a962b7e (patch) | |
tree | 027f4c6ebb339cfd9ebe35cecc66a6993a7bc8a0 /modules/gltf/editor | |
parent | 20ba2f00bd9199b675176a8e1ac151f96bfb5cfa (diff) | |
download | redot-engine-7864abbeec103b2a3a2aa9713642a19b5a962b7e.tar.gz |
Update vertex color import to handle Blender 4.2 upwards
Blender commit https://projects.blender.org/blender/blender/commit/0f0a8df8a922cdb0796c0b3fdbdc5c669efb3059 which is landing in 4.2 deprecated `vertex_colors` GLTF property, use `export_vertex_color` instead.
Diffstat (limited to 'modules/gltf/editor')
-rw-r--r-- | modules/gltf/editor/editor_scene_importer_blend.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp index 79a2184745..519e2646a0 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.cpp +++ b/modules/gltf/editor/editor_scene_importer_blend.cpp @@ -188,10 +188,18 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_ } else { parameters_map["export_lights"] = false; } - if (p_options.has(SNAME("blender/meshes/colors")) && p_options[SNAME("blender/meshes/colors")]) { - parameters_map["export_colors"] = true; + if (blender_major_version > 4 || (blender_major_version == 4 && blender_minor_version >= 2)) { + if (p_options.has(SNAME("blender/meshes/colors")) && p_options[SNAME("blender/meshes/colors")]) { + parameters_map["export_vertex_color"] = "MATERIAL"; + } else { + parameters_map["export_vertex_color"] = "NONE"; + } } else { - parameters_map["export_colors"] = false; + if (p_options.has(SNAME("blender/meshes/colors")) && p_options[SNAME("blender/meshes/colors")]) { + parameters_map["export_colors"] = true; + } else { + parameters_map["export_colors"] = false; + } } if (p_options.has(SNAME("blender/nodes/visible"))) { int32_t visible = p_options["blender/nodes/visible"]; |