[Bf-blender-cvs] [ca1721270a6] blender-v2.81-release: Fix T71503: Wrap + displace + multires + Sculpt crash

Sergey Sharybin noreply at git.blender.org
Wed Nov 13 11:37:42 CET 2019


Commit: ca1721270a6d3fa8d67b59a014ab94004e24026b
Author: Sergey Sharybin
Date:   Wed Nov 13 11:29:19 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rBca1721270a6d3fa8d67b59a014ab94004e24026b

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!

===================================================================

M	source/blender/blenkernel/intern/DerivedMesh.c

===================================================================

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) {



More information about the Bf-blender-cvs mailing list