diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-01-22 21:54:23 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-01-22 21:54:23 +0400 |
commit | 1a93d8834319b890ff0cbc70231b14635603ae95 (patch) | |
tree | 87ee1ecd503872e91116566db9df4730b3ebccbe /source/blender/modifiers/intern/MOD_weightvgproximity.c | |
parent | df51fd74cf826c42a90212082abb27e99484257a (diff) |
Add weight preview to WeightVG modifiers, and first, simple/basic refactor of how modifiers can generate preview.
User side:
* Preview for DynamicPaint should keep the same behavior (for now). Weight preview should be somawhat quicker, though.
* Preview for WeightVG modifiers is only active in WeightPaint mode, and if the affected vgroup is the active one.
* Last active preview modifier in stack wins!
Note: that modifier preview topic is yet to be further refined, quite raw/incomplete for now.
Dev side:
* In draw code, renamed DRAW_DYNAMIC_PAINT_PREVIEW flag to DRAW_MODIFIERS_PREVIEW
* Removed use of MOD_DPAINT_PREVIEW_READY in DynamicPaint code (seems unecessary, and if it was, should be of more general scope).
* Added eModifierTypeFlag_UsesPreview to ModifierTypeFlag, for modifiers that can generate some preview data.
* Added three new modifier funcs, to handle preview modifiers in draw code / mod stack.
* For weights preview: added the generic DM_update_weight_mcol func, which can update WEIGHT_MCOL layer with either a given array of weights (currently used by DynamicPaint only), or from current active vgroup(s).
So now, draw code is fully generic (i.e. no more modifier-type checking in it). Mod stack code is generic to some extent, but will need more work.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgproximity.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 55b625f7865..c1aa68d1544 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -268,6 +268,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; + /* No need to ask for CD_WEIGHT_MCOL... */ + return dataMask; } @@ -353,6 +355,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der int *tidx, *indices = NULL; int numIdx = 0; int i; + /* Flags. */ +#if 0 + int do_prev = (wmd->modifier.mode & eModifierMode_DoWeightPreview); +#endif #if DO_PROFILE TIMEIT_START(perf) @@ -505,6 +511,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Update vgroup. Note we never add nor remove vertices from vgroup here. */ weightvg_update_vg(dvert, defgrp_idx, dw, numIdx, indices, org_w, FALSE, 0.0f, FALSE, 0.0f); + /* If weight preview enabled... */ +#if 0 /* XXX Currently done in mod stack :/ */ + if(do_prev) + DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices); +#endif + /* Freeing stuff. */ MEM_freeN(org_w); MEM_freeN(new_w); @@ -535,8 +547,9 @@ ModifierTypeInfo modifierType_WeightVGProximity = { /* structSize */ sizeof(WeightVGProximityModifierData), /* type */ eModifierTypeType_NonGeometrical, /* flags */ eModifierTypeFlag_AcceptsMesh -/* |eModifierTypeFlag_SupportsMapping*/ - |eModifierTypeFlag_SupportsEditmode, + |eModifierTypeFlag_SupportsMapping + |eModifierTypeFlag_SupportsEditmode + |eModifierTypeFlag_UsesPreview, /* copyData */ copyData, /* deformVerts */ NULL, |