diff options
author | Sybren A. Stüvel <sybren> | 2020-09-29 15:34:01 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-09-29 17:10:16 +0300 |
commit | bab2260b59c7bffe1e16b5e860ac36b5fdc31bf0 (patch) | |
tree | 814d0b54a1618ce2c1359ac16888e10cb90479cf /source/blender/blenloader | |
parent | 5845c06a63a6b96f038f5a46d538b0f9737102e9 (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/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 3c95a998d90..1b9e53ded63 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -724,18 +724,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /** - * Versioning code until next subversion bump goes here. - * - * \note Be sure to check when bumping the version: - * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend - * - "versioning_userdef.c", #do_versions_theme - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ - + if (!MAIN_VERSION_ATLEAST(bmain, 291, 6)) { /* Darken Inactive Overlay. */ if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "fade_alpha")) { for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { @@ -759,5 +748,30 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) mesh->symmetry = mesh->editflag & (ME_SYMMETRY_X | ME_SYMMETRY_Y | ME_SYMMETRY_Z); } } + + /* Alembic importer: allow vertex interpolation by default. */ + for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) { + LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { + if (md->type != eModifierType_MeshSequenceCache) { + continue; + } + + MeshSeqCacheModifierData *data = (MeshSeqCacheModifierData *)md; + data->read_flag |= MOD_MESHSEQ_INTERPOLATE_VERTICES; + } + } + } + + /** + * Versioning code until next subversion bump goes here. + * + * \note Be sure to check when bumping the version: + * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend + * - "versioning_userdef.c", #do_versions_theme + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ } } |