Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-03-07 18:07:34 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-03-07 18:09:15 +0300
commit75dad2a04b23c8848f9ade4ad70b7c352bdcdb94 (patch)
tree74bd1525192715fb9eb054d1d18942a5e0c03eaf /source/blender/modifiers
parent9e1d113570aa131b0a7c0fb62f1c38a040cd6c36 (diff)
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.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c9
1 files changed, 9 insertions, 0 deletions
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. */