diff options
author | Adam Scott <ascott.ca@gmail.com> | 2022-03-24 17:15:23 -0400 |
---|---|---|
committer | Adam Scott <ascott.ca@gmail.com> | 2022-03-24 17:15:23 -0400 |
commit | 5e6d4baa48b0104f1f0778d098aa145b8ce368a8 (patch) | |
tree | 00c1e50b3a88184f82b6b03fdba657599cb525c6 /modules/fbx/data | |
parent | 391633760b0ea292af079287faf79c1aee6d9254 (diff) |
Add GLTF, DAE and FBX importers enforcement for blend shape mask array
Diffstat (limited to 'modules/fbx/data')
-rw-r--r-- | modules/fbx/data/fbx_mesh_data.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/fbx/data/fbx_mesh_data.cpp b/modules/fbx/data/fbx_mesh_data.cpp index 643a74f83e..1d59851778 100644 --- a/modules/fbx/data/fbx_mesh_data.cpp +++ b/modules/fbx/data/fbx_mesh_data.cpp @@ -371,6 +371,17 @@ ImporterMeshInstance3D *FBXMeshData::create_fbx_mesh(const ImportState &state, c Array mesh_array = surface->surface_tool->commit_to_arrays(); Array blend_shapes = surface->morphs; + // Enforce blend shape mask array format + for (int i = 0; i < blend_shapes.size(); i++) { + Array bsdata = blend_shapes[i]; + + for (int j = 0; j < Mesh::ARRAY_MAX; j++) { + if (!(Mesh::ARRAY_FORMAT_BLEND_SHAPE_MASK & (1 << j))) { + bsdata[j] = Variant(); + } + } + } + if (surface->material.is_valid()) { mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES, mesh_array, blend_shapes, Dictionary(), surface->material, surface->material->get_name()); } else { |