From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Modifier Stack Preview Proposal

While working on a way for the WeightVG modifiers to show there modified weights to the user, in the 3D View, I found that this feature was currently not really designed in Blender. Right now, only DPaint does it, in a somewhat hackish way…

However, imho, it makes sense to have a way for tools like modifiers, to graphically show to the user various info, in a colored form. DynamicPaint and WeightVG modifiers would immediately use it, but we can imagine other tools, like e.g. physical simulations, that could also output some info this way (e.g. an "error map", a "force map", …).



User POV

The proposition implies two new UI options, one at object level (Display panel), the other in the header of the modifiers stack.

Add a single, global switch to modifier stack

A global ON/OFF button in the header of the modifier stack (e.g. next to the dropdown list of available modifiers), that unconditionally completely disables the stack evaluation. It would be much more practical than going over each modifier to turn it off manually, as soon as you have more than 3 or 4 in the stack.

Specific modes like WeightPaint, VCol paint, UV Editors

In these editors, the relevant custom data layer would now systematically be drawn in its final state, i.e. after the modifier stack has been evaluated. Hence, if you want to see/work on the original data, you’ll have to disable some modifiers (or the whole stack).

Something similar to the edit cage for Edit mode, in fact. But always ON (else it would need far too much new buttons and complex code in modifiers, imho).

Note
Maybe we could also get rid of that edit cage option, btw, and make it ON too (user would then simply disable the modifier stack when he want to edit the org geometry). Or, conversely, to reuse/extend that flag to get the same behavior with weights, vcol and UVs in their respective editing contexts…


Object Mode

In this mode, a new object draw option would enable/disable the "draw preview" feature (Object properties, Display panel). It seems to be the best place, as it gives you a nice, unintrusive yet precise level of control of this feature.



Dev POV

Here are the dev steps I would like to do to implement that proposition.

Rename CD_WEIGHT_MCOL to CD_PREVIEW_MCOL

Here I’m not really sure : Would it be better to rename that cdlayer and use it for both weights preview (in WPaint mode), and generic colored preview (in Object mode) ? Or rather add a new PREVIEW_MCOL layer, only used in Object mode preview ?

But the fact is that, currently, that layer is already (ab)used as preview one by the DynamicPaint code.

2 new Object flags

  • OB_DRAW_PREVIEW, for ob->dtx (the first bit seems free, or we can extend it to a short…).
  • OB_RESTRICT_MODSTACK, for ob->restrictflag? Not sure for this one, though… But definitively need such a flag!
Out-of-topic note
An OB_RESTRICT_CONSTSTACK (and same for bones) might also be a nice idea, for the same reasons as for modifiers… But let’s keep to the topic!


Modifying Mod stack code

So that the modifiers-applied relevant data layer get displayed. This nearly already done for WeightPaint, VColPaint and UVEdit would probably need some edits to their draw code as well (didn’t investigate those yet).

It will also need some more important changes, to enable the preview in Object mode. Mainly, adding a new flag to applyModifier functions, so that the modifier knows whether he should compute its preview data, or not!

In fact, I’d like to replace all those useRenderParams, isFinalCalc, etc. by a single flags parameter and bitwise enums or defines. While having to change the signature of such func, let’s make it more flexible…