summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-07-20 22:22:16 +0200
committerGitHub <noreply@github.com>2020-07-20 22:22:16 +0200
commit0a1dd5b6e40a628892d8dc95bd05f1dc72d8b4ab (patch)
treeff68d168575c53b546362d0819a14b982ed29db3 /editor
parentaada93afc0ecc699440805ad2574d3e94b7c0abd (diff)
parent71ae0ff46d75e0e94cc2ef839b0bc82db2bfc7de (diff)
Merge pull request #38763 from fire/38751
Allow gltf2 morph targets including animations with no default value…
Diffstat (limited to 'editor')
-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];
}