diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 11 |
3 files changed, 24 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index e466964c73f..6b9392a4169 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -371,11 +371,12 @@ typedef struct CDMaskLink { * evaluation, assuming the data indicated by dataMask is required at the * end of the stack. */ -struct CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, +struct CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, struct Object *ob, struct ModifierData *md, CustomDataMask dataMask, - int required_mode); + int required_mode, + ModifierData *previewmd, CustomDataMask previewmask); struct ModifierData *modifiers_getLastPreview(struct Scene *scene, struct ModifierData *md, int required_mode); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index fc226288f04..6a21f33ac15 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1482,7 +1482,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos ModifierData *firstmd, *md, *previewmd = NULL; CDMaskLink *datamasks, *curr; /* XXX Always copying POLYINDEX, else tessellated data are no more valid! */ - CustomDataMask mask, nextmask, append_mask = CD_MASK_ORIGINDEX; + CustomDataMask mask, nextmask, previewmask = 0, append_mask = CD_MASK_ORIGINDEX; float (*deformedVerts)[3] = NULL; DerivedMesh *dm = NULL, *orcodm, *clothorcodm, *finaldm; int numVerts = me->totvert; @@ -1532,17 +1532,24 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if (useRenderParams) required_mode = eModifierMode_Render; else required_mode = eModifierMode_Realtime; - datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode); - curr = datamasks; - if (do_mod_wmcol || do_mod_mcol) { /* Find the last active modifier generating a preview, or NULL if none. */ /* XXX Currently, DPaint modifier just ignores this. * Needs a stupid hack... * The whole "modifier preview" thing has to be (re?)designed, anyway! */ previewmd = modifiers_getLastPreview(scene, md, required_mode); + + /* even if the modifier doesn't need the data, to make a preview it may */ + if (previewmd) { + if (do_mod_wmcol) { + previewmask = CD_MASK_MDEFORMVERT; + } + } } + datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, previewmd, previewmask); + curr = datamasks; + if (deform_r) *deform_r = NULL; *final_r = NULL; @@ -2028,7 +2035,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D dm = NULL; md = modifiers_getVirtualModifierList(ob); - datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode); + datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, NULL, 0); curr = datamasks; for (i = 0; md; i++, md = md->next, curr = curr->next) { diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 1ebe99eb660..c17830639e4 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -363,7 +363,9 @@ bool modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode return 1; } -CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md, CustomDataMask dataMask, int required_mode) +CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md, + CustomDataMask dataMask, int required_mode, + ModifierData *previewmd, CustomDataMask previewmask) { CDMaskLink *dataMasks = NULL; CDMaskLink *curr, *prev; @@ -374,10 +376,15 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierDat curr = MEM_callocN(sizeof(CDMaskLink), "CDMaskLink"); - if (modifier_isEnabled(scene, md, required_mode)) + if (modifier_isEnabled(scene, md, required_mode)) { if (mti->requiredDataMask) curr->mask = mti->requiredDataMask(ob, md); + if (previewmd == md) { + curr->mask |= previewmask; + } + } + /* prepend new datamask */ curr->next = dataMasks; dataMasks = curr; |