Fix blendshapes and calculation of bone_aabbs

Blendshapes without a skeleton already worked.
However, due to a faulty ERR_FAIL_COND, it was impossible to create a mesh with both bones and blendshapes.
This also fixes an assumption that all surfaces reference the same number of bones as surface 0.
This commit is contained in:
Lyuma 2020-12-24 00:01:07 -08:00
parent 3fdf4bfe71
commit d976003b16
2 changed files with 11 additions and 3 deletions

View file

@ -62,9 +62,15 @@ void EditorSceneImporterMesh::add_surface(Mesh::PrimitiveType p_primitive, const
s.arrays = p_arrays;
s.name = p_name;
Vector<Vector3> vertex_array = p_arrays[Mesh::ARRAY_VERTEX];
int vertex_count = vertex_array.size();
ERR_FAIL_COND(vertex_count == 0);
for (int i = 0; i < blend_shapes.size(); i++) {
Array bsdata = p_blend_shapes[i];
ERR_FAIL_COND(bsdata.size() != Mesh::ARRAY_MAX);
Vector<Vector3> vertex_data = bsdata[Mesh::ARRAY_VERTEX];
ERR_FAIL_COND(vertex_data.size() != vertex_count);
Surface::BlendShape bs;
bs.arrays = bsdata;
s.blend_shape_data.push_back(bs);