summaryrefslogtreecommitdiffstats
path: root/modules/gltf/editor
diff options
context:
space:
mode:
authordemolke <demolke@gmail.com>2024-07-06 13:38:45 +0200
committerdemolke <demolke@gmail.com>2024-07-06 14:22:09 +0200
commit7864abbeec103b2a3a2aa9713642a19b5a962b7e (patch)
tree027f4c6ebb339cfd9ebe35cecc66a6993a7bc8a0 /modules/gltf/editor
parent20ba2f00bd9199b675176a8e1ac151f96bfb5cfa (diff)
downloadredot-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.cpp14
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"];