summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>2020-05-15 10:17:53 -0700
committerK. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>2020-07-11 10:56:07 -0700
commit71ae0ff46d75e0e94cc2ef839b0bc82db2bfc7de (patch)
treebc7f5d365d88e3aabba12f9f6088bad35fb8b63c
parent9678a41b19e142bbc4c00f761a3a5a0cf2d4458e (diff)
Allow gltf2 morph targets with no default values. Changes for bug 38751
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 683db0e31d..bb144d2ed6 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -1229,10 +1229,14 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
}
}
+ mesh.blend_weights.resize(mesh.mesh->get_blend_shape_count());
+ for (int32_t weight_i = 0; weight_i < mesh.blend_weights.size(); weight_i++) {
+ mesh.blend_weights.write[weight_i] = 0.0f;
+ }
+
if (d.has("weights")) {
const Array &weights = d["weights"];
- ERR_FAIL_COND_V(mesh.mesh->get_blend_shape_count() != weights.size(), ERR_PARSE_ERROR);
- mesh.blend_weights.resize(weights.size());
+ ERR_FAIL_COND_V(mesh.blend_weights.size() != weights.size(), ERR_PARSE_ERROR);
for (int j = 0; j < weights.size(); j++) {
mesh.blend_weights.write[j] = weights[j];
}