From 5e6d4baa48b0104f1f0778d098aa145b8ce368a8 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Thu, 24 Mar 2022 17:15:23 -0400 Subject: Add GLTF, DAE and FBX importers enforcement for blend shape mask array --- modules/fbx/data/fbx_mesh_data.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules/fbx') 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 { -- cgit v1.2.3