summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorLyuma <xn.lyuma@gmail.com>2020-12-24 00:01:07 -0800
committerLyuma <xn.lyuma@gmail.com>2020-12-24 00:01:07 -0800
commitd976003b16a8dd364372529e47df5aee3f00818a (patch)
treeaf8ef24a3cda910fc54625aeb110219d269649d0 /editor/import
parent3fdf4bfe71311000bf706c16d79b475308a200ac (diff)
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.
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/scene_importer_mesh.cpp6
1 files changed, 6 insertions, 0 deletions
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<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);