From d976003b16a8dd364372529e47df5aee3f00818a Mon Sep 17 00:00:00 2001 From: Lyuma Date: Thu, 24 Dec 2020 00:01:07 -0800 Subject: 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. --- editor/import/scene_importer_mesh.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'editor/import') diff --git a/editor/import/scene_importer_mesh.cpp b/editor/import/scene_importer_mesh.cpp index 263e6afe0c..d7c3b60d5a 100644 --- a/editor/import/scene_importer_mesh.cpp +++ b/editor/import/scene_importer_mesh.cpp @@ -62,9 +62,15 @@ void EditorSceneImporterMesh::add_surface(Mesh::PrimitiveType p_primitive, const s.arrays = p_arrays; s.name = p_name; + Vector 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 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); -- cgit v1.2.3