Allow gltf2 morph targets with no default values. Changes for bug 38751
(cherry picked from commit 71ae0ff46d
)
This commit is contained in:
parent
3bdb39bec4
commit
f189d0e1f3
|
@ -1230,10 +1230,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")) {
|
if (d.has("weights")) {
|
||||||
const Array &weights = d["weights"];
|
const Array &weights = d["weights"];
|
||||||
ERR_FAIL_COND_V(mesh.mesh->get_blend_shape_count() != weights.size(), ERR_PARSE_ERROR);
|
ERR_FAIL_COND_V(mesh.blend_weights.size() != weights.size(), ERR_PARSE_ERROR);
|
||||||
mesh.blend_weights.resize(weights.size());
|
|
||||||
for (int j = 0; j < weights.size(); j++) {
|
for (int j = 0; j < weights.size(); j++) {
|
||||||
mesh.blend_weights.write[j] = weights[j];
|
mesh.blend_weights.write[j] = weights[j];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue