[Bf-blender-cvs] [75dad2a04b2] master: Multires: Fix crash on exit when sculpting with modifiers
Sergey Sharybin
noreply at git.blender.org
Thu Mar 7 16:20:45 CET 2019
Commit: 75dad2a04b23c8848f9ade4ad70b7c352bdcdb94
Author: Sergey Sharybin
Date: Thu Mar 7 16:07:34 2019 +0100
Branches: master
https://developer.blender.org/rB75dad2a04b23c8848f9ade4ad70b7c352bdcdb94
Multires: Fix crash on exit when sculpting with modifiers
The SubdivCCG structure was re-allocated, but the cached one in
the sculpt session was still pointing to an original one.
This is rather a workaround, but is least evil from what i can
currently think. Remember something similar was also required in
2.7 as well.
Definitely need to revision this change.
===================================================================
M source/blender/modifiers/intern/MOD_multires.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 86d680554c5..7cd9dfa05aa 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -34,6 +34,7 @@
#include "BKE_mesh.h"
#include "BKE_multires.h"
#include "BKE_modifier.h"
+#include "BKE_paint.h"
#include "BKE_subdiv.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_subdiv_mesh.h"
@@ -168,6 +169,14 @@ static Mesh *applyModifier(ModifierData *md,
/* NOTE: CCG takes ownership over Subdiv. */
result = multires_as_ccg(mmd, ctx, mesh, subdiv);
result->runtime.subdiv_ccg_tot_level = mmd->totlvl;
+ /* TODO(sergey): Usually it is sculpt stroke's update variants which
+ * takes care of this, but is possible that we need this before the
+ * stroke: i.e. when exiting blender right after stroke is done.
+ * Annoying and not so much black-boxed as far as sculpting goes, and
+ * surely there is a better way of solving this. */
+ if (ctx->object->sculpt != NULL) {
+ ctx->object->sculpt->subdiv_ccg = result->runtime.subdiv_ccg;
+ }
/* NOTE: CCG becomes an owner of Subdiv descriptor, so can not share
* this pointer. Not sure if it's needed, but might have a second look
* on the ownership model here. */
More information about the Bf-blender-cvs
mailing list