Merge pull request #38763 from fire/38751

Allow gltf2 morph targets including animations with no default value…
This commit is contained in:
Rémi Verschelde 2020-07-20 22:22:16 +02:00 committed by GitHub
commit 0a1dd5b6e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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];
}