summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMartin Capitanio <capnm@capitanio.org>2023-04-12 16:05:31 +0200
committerYuri Sizov <yuris@humnom.net>2023-04-24 16:28:29 +0200
commit2992a996293894d0b74b2129adaaea430a24cec7 (patch)
treed9e494918ea67fa954338de1ae683cd11f7404e3 /modules
parentf3907e2fe0353ae91015412bd64e7abbe08e5a9e (diff)
Fix blend_shape (shapekey) empty name import.
Corresponds to the Blender glTF-Importer PR https://github.com/KhronosGroup/glTF-Blender-IO/pull/1902 (cherry picked from commit 8b6fa79eee25d721a05518b56615eb5576147eba)
Diffstat (limited to 'modules')
-rw-r--r--modules/gltf/gltf_document.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index d93485a800..7087c30688 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -2820,7 +2820,13 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {
if (j == 0) {
const Array &target_names = extras.has("targetNames") ? (Array)extras["targetNames"] : Array();
for (int k = 0; k < targets.size(); k++) {
- import_mesh->add_blend_shape(k < target_names.size() ? (String)target_names[k] : String("morph_") + itos(k));
+ String bs_name;
+ if (k < target_names.size() && ((String)target_names[k]).size() != 0) {
+ bs_name = (String)target_names[k];
+ } else {
+ bs_name = String("morph_") + itos(k);
+ }
+ import_mesh->add_blend_shape(bs_name);
}
}