From ee8aad79c1590cd0e98ba67961909ebfa8f6a803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 16 Aug 2019 14:52:08 +0200 Subject: Fix T56408: Hair children recalc on every frame on Alembic mesh This fixes the glitching hairs described in T56408, T63534, and possibly also T63534. The fix consists of returning the original mesh (i.e. as visible in edit mode) when constructing the ORCO mesh. This allows a static set of coordinates to be used when computing the child hair positions. The original mesh is only returned when it has the same topology (at least same number of vertices, loops, and polys. It's up the author of the Alembic file to ensure stable geometry when it's desired to be compatible with Blender's hair system. Reviewers: mont29, brecht Differential Revision: https://developer.blender.org/D5492 --- source/blender/modifiers/intern/MOD_meshsequencecache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index 760830ffb24..0f57b759e38 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -114,10 +114,20 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } } + /* If this invocation is for the ORCO mesh, and the mesh in Alembic hasn't changed topology, we + * must return the mesh as-is instead of deforming it. */ + if (ctx->flag & MOD_APPLY_ORCO && + !ABC_mesh_topology_changed(mcmd->reader, ctx->object, mesh, time, &err_str)) { + return mesh; + } + if (me != NULL) { MVert *mvert = mesh->mvert; MEdge *medge = mesh->medge; MPoly *mpoly = mesh->mpoly; + + /* TODO(sybren+bastien): possibly check relevant custom data layers (UV/color depending on + * flags) and duplicate those too. */ if ((me->mvert == mvert) || (me->medge == medge) || (me->mpoly == mpoly)) { /* We need to duplicate data here, otherwise we'll modify org mesh, see T51701. */ BKE_id_copy_ex(NULL, -- cgit v1.2.3