Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-09-28 15:12:33 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-09-28 15:12:42 +0300
commit3158fc2593e1afc29280187d9e427a6c21a8f37f (patch)
tree9de3211ac2b847d9ca6d85297a9b199e360234a4 /source/blender/io
parentb88a9cf1714ba2b81b51035f6f302c10e2ebc6a2 (diff)
Fix T80967: Alembic, crash when the imported sim from Houdini starts
Compare mesh loop count with number of loop normals before reading the loop normals. Houdini doesn't always write the correct loop normals to Alembic. When a mesh is animated and then replaced by a fluid simulation, Houdini will still write the original mesh's loop normals, but the mesh verts/loops/polys are from the simulation. In such cases the normals cannot be mapped to the mesh, so it's better to ignore them.
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/alembic/intern/abc_reader_mesh.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc
index 5a42be2bb02..ead908e87c2 100644
--- a/source/blender/io/alembic/intern/abc_reader_mesh.cc
+++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc
@@ -271,10 +271,19 @@ static void process_loop_normals(CDStreamConfig &config, const N3fArraySamplePtr
return;
}
+ Mesh *mesh = config.mesh;
+ if (loop_count != mesh->totloop) {
+ /* This happens in certain Houdini exports. When a mesh is animated and then replaced by a
+ * fluid simulation, Houdini will still write the original mesh's loop normals, but the mesh
+ * verts/loops/polys are from the simulation. In such cases the normals cannot be mapped to the
+ * mesh, so it's better to ignore them. */
+ process_no_normals(config);
+ return;
+ }
+
float(*lnors)[3] = static_cast<float(*)[3]>(
MEM_malloc_arrayN(loop_count, sizeof(float[3]), "ABC::FaceNormals"));
- Mesh *mesh = config.mesh;
MPoly *mpoly = mesh->mpoly;
const N3fArraySample &loop_normals = *loop_normals_ptr;
int abc_index = 0;