Commit: 3158fc2593e1afc29280187d9e427a6c21a8f37f Author: Sybren A. Stüvel Date: Mon Sep 28 14:12:33 2020 +0200 Branches: master https://developer.blender.org/rB3158fc2593e1afc29280187d9e427a6c21a8f37f
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. =================================================================== M source/blender/io/alembic/intern/abc_reader_mesh.cc =================================================================== 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; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs