diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-12 15:10:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-12 15:10:13 +0300 |
commit | 94934199e733b022589ea82a7038b191804c5b7c (patch) | |
tree | 83404410bd2b42c7776cdebcb86f3a670160e25c /source/blender/io/alembic | |
parent | 03727082e9dd5a30d249361c9be6555116bcf2bd (diff) | |
parent | 973ab436f07c652cb6aa13bedc351df06bce6561 (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender/io/alembic')
-rw-r--r-- | source/blender/io/alembic/intern/abc_customdata.h | 5 | ||||
-rw-r--r-- | source/blender/io/alembic/intern/abc_reader_mesh.cc | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/io/alembic/intern/abc_customdata.h b/source/blender/io/alembic/intern/abc_customdata.h index e47cef871db..04572c736af 100644 --- a/source/blender/io/alembic/intern/abc_customdata.h +++ b/source/blender/io/alembic/intern/abc_customdata.h @@ -68,6 +68,8 @@ struct CDStreamConfig { Alembic::AbcGeom::index_t index; Alembic::AbcGeom::index_t ceil_index; + const char **modifier_error_message; + CDStreamConfig() : mloop(NULL), totloop(0), @@ -80,7 +82,8 @@ struct CDStreamConfig { weight(0.0f), time(0.0f), index(0), - ceil_index(0) + ceil_index(0), + modifier_error_message(NULL) { } }; diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index f22f2a53a78..c85b1c60102 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -200,6 +200,7 @@ static void read_mpolys(CDStreamConfig &config, const AbcMeshData &mesh_data) unsigned int loop_index = 0; unsigned int rev_loop_index = 0; unsigned int uv_index = 0; + bool seen_invalid_geometry = false; for (int i = 0; i < face_counts->size(); i++) { const int face_size = (*face_counts)[i]; @@ -215,10 +216,18 @@ static void read_mpolys(CDStreamConfig &config, const AbcMeshData &mesh_data) /* NOTE: Alembic data is stored in the reverse order. */ rev_loop_index = loop_index + (face_size - 1); + uint last_vertex_index = 0; for (int f = 0; f < face_size; f++, loop_index++, rev_loop_index--) { MLoop &loop = mloops[rev_loop_index]; loop.v = (*face_indices)[loop_index]; + if (f > 0 && loop.v == last_vertex_index) { + /* This face is invalid, as it has consecutive loops from the same vertex. This is caused + * by invalid geometry in the Alembic file, such as in T76514. */ + seen_invalid_geometry = true; + } + last_vertex_index = loop.v; + if (do_uvs) { MLoopUV &loopuv = mloopuvs[rev_loop_index]; @@ -236,6 +245,12 @@ static void read_mpolys(CDStreamConfig &config, const AbcMeshData &mesh_data) } BKE_mesh_calc_edges(config.mesh, false, false); + if (seen_invalid_geometry) { + if (config.modifier_error_message) { + *config.modifier_error_message = "Mesh hash invalid geometry; more details on the console"; + } + BKE_mesh_validate(config.mesh, true, true); + } } static void process_no_normals(CDStreamConfig &config) @@ -608,6 +623,7 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh, CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh); config.time = sample_sel.getRequestedTime(); + config.modifier_error_message = err_str; read_mesh_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config); |