diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-13 13:29:19 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-13 13:29:19 +0300 |
commit | ca1721270a6d3fa8d67b59a014ab94004e24026b (patch) | |
tree | 486441fca1d4a8fc984890dd55309510474d05d0 | |
parent | 5fde907fd3eae07d01ea28003a723f704da817b4 (diff) |
Fix T71503: Wrap + displace + multires + Sculpt crash
The root of the issue goes to the discontinuity between the way how
mesh_calc_modifiers() and BKE_sculpt_multires_active() works.
At some point detection of original data usage by a modifier got
broken: the mesh_final based check is unreliable because deform-only
modifiers will create mesh_final for the connectivity information.
This made it so modifier stack evaluation would skip multires
evaluation, but the sculpt code will assume the multires is properly
applied.
This change makes it an explicit check about whether there are any
non-deform-only modifiers applied.
Pair programming and review together with Bastien, thanks!
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index d61c498b71f..cc9db5eafb5 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1015,6 +1015,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, } /* Apply all remaining constructive and deforming modifiers. */ + bool have_non_onlydeform_modifiers_appled = false; for (; md; md = md->next, md_datamask = md_datamask->next) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -1026,7 +1027,8 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, continue; } - if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && mesh_final) { + if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && + have_non_onlydeform_modifiers_appled) { modifier_setError(md, "Modifier requires original data, bad stack position"); continue; } @@ -1110,6 +1112,8 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, modwrap_deformVerts(md, &mectx, mesh_final, deformed_verts, num_deformed_verts); } else { + have_non_onlydeform_modifiers_appled = true; + /* determine which data layers are needed by following modifiers */ CustomData_MeshMasks nextmask; if (md_datamask->next) { |