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>2020-09-29 15:34:01 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-09-29 17:10:16 +0300
commitbab2260b59c7bffe1e16b5e860ac36b5fdc31bf0 (patch)
tree814d0b54a1618ce2c1359ac16888e10cb90479cf /source/blender/io/alembic/intern/abc_reader_mesh.cc
parent5845c06a63a6b96f038f5a46d538b0f9737102e9 (diff)
Fix T71981: Alembic vertex interpolation can jumble mesh
Add an option to disable Alembic vertex interpolation. Bump subversion from 5 to 6. Alembic stores mesh samples at specific time keys; when a frame in Blender maps to a timecode between two samples, Blender will interpolate the mesh vertex positions. This interpolation only happens when the mesh has a constant topology, but sometimes this was not detected properly when the vertices change order, but the number of mesh elements remains the same. This would result in a mesh with jumbled up vertices (T71981). With this patch, users have the ability to disable vertex interpolation. An alternative would be to have better detection of topology changes, but that that'll cause a considerable slowdown. Maniphest Tasks: T71981 Differential Revision: https://developer.blender.org/D9041
Diffstat (limited to 'source/blender/io/alembic/intern/abc_reader_mesh.cc')
-rw-r--r--source/blender/io/alembic/intern/abc_reader_mesh.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc
index ead908e87c2..e69c0edfec8 100644
--- a/source/blender/io/alembic/intern/abc_reader_mesh.cc
+++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc
@@ -155,8 +155,8 @@ static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data)
MVert *mverts = config.mvert;
const P3fArraySamplePtr &positions = mesh_data.positions;
- if (config.weight != 0.0f && mesh_data.ceil_positions != NULL &&
- mesh_data.ceil_positions->size() == positions->size()) {
+ if (config.use_vertex_interpolation && config.weight != 0.0f &&
+ mesh_data.ceil_positions != NULL && mesh_data.ceil_positions->size() == positions->size()) {
read_mverts_interp(mverts, positions, mesh_data.ceil_positions, config.weight);
return;
}
@@ -457,7 +457,7 @@ static void read_mesh_sample(const std::string &iobject_full_name,
}
}
-CDStreamConfig get_config(Mesh *mesh)
+CDStreamConfig get_config(Mesh *mesh, const bool use_vertex_interpolation)
{
CDStreamConfig config;
@@ -471,6 +471,7 @@ CDStreamConfig get_config(Mesh *mesh)
config.totpoly = mesh->totpoly;
config.loopdata = &mesh->ldata;
config.add_customdata_cb = add_customdata_cb;
+ config.use_vertex_interpolation = use_vertex_interpolation;
return config;
}
@@ -646,7 +647,9 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh,
}
}
- CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh);
+ Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
+ const bool use_vertex_interpolation = read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
+ CDStreamConfig config = get_config(mesh_to_export, use_vertex_interpolation);
config.time = sample_sel.getRequestedTime();
config.modifier_error_message = err_str;
@@ -936,11 +939,13 @@ Mesh *AbcSubDReader::read_mesh(Mesh *existing_mesh,
}
/* Only read point data when streaming meshes, unless we need to create new ones. */
- CDStreamConfig config = get_config(new_mesh ? new_mesh : existing_mesh);
+ Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
+ const bool use_vertex_interpolation = read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
+ CDStreamConfig config = get_config(mesh_to_export, use_vertex_interpolation);
config.time = sample_sel.getRequestedTime();
read_subd_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config);
- return config.mesh;
+ return mesh_to_export;
}
} // namespace blender::io::alembic