Page MenuHome

Sculpt: Mask expand operator

Authored by Pablo Dobarro (pablodp606) on Mon, Sep 2, 3:13 PM.



This operator is a combined version of mask expand and mask by normal from the sculpt branch. It can be used to quickly isolate parts of a model based on topology or curvature.

  • Shift + A starts the operator in topology mode from the active vertex
  • Shift + Alt + A starts the operator in curvature mode from the active vertex

Auto pivot position and mask invert are on by default. When the mask filter is merged the code that smooths the final mask can be enabled.

Diff Detail

rB Blender

Event Timeline

  • Add option to keep the previous mask, fix some bugs
Brecht Van Lommel (brecht) requested changes to this revision.Fri, Sep 6, 7:28 PM
  • When starting the tool, it doesn't immediately do anything, only when you move the mouse a tiny amount. It should show something immediately to make it clear the tool was started.
  • It should be possible to cancel the modal tool with ESCKEY and RIGHTMOUSE, and confirm with RETKEY and PADENTER.
  • It would also help if this showed some text in the header or status bar, to give some indicating that a modal tool was started.

Add this to the Sculpt menu in the header as well, not just as a shortcut.


int prevclick[2] = {(int)prevclik_f[0], (int)prevclik_f[1]};


I think the mask should be inverted from the start?

Like set everything to black at the start of the modal operator, then update the mask to be white when you drag.

Otherwise it's not obvious that you started the correct operation.


Free before undo push. Not important but might as well slightly reduce memory peak.


mask expand -> Mask Expand


Mask expand -> Mask Expand

And similar for the properties

This revision now requires changes to proceed.Fri, Sep 6, 7:28 PM
Pablo Dobarro (pablodp606) marked 6 inline comments as done.Sat, Sep 7, 2:35 AM
Pablo Dobarro (pablodp606) updated this revision to Diff 17936.
  • Review update
Brecht Van Lommel (brecht) requested changes to this revision.Mon, Sep 9, 8:19 PM
  • Cancelling does not refresh the mask until you rotate the view.
  • Use ED workspace status_text to show something in the status bar, so it's clear a modal tool is active.
This revision now requires changes to proceed.Mon, Sep 9, 8:19 PM
  • Rebase
  • Enable mask smoothing with the mask filter
  • Add status message
  • Fix indentation
  • Fix updates

When I run ./blender --debug-memory and use this tool, after I exit I see these leaks:

prev mask len: 98312 0x7f81c9620238
BKE_pbvh_search_gather len: 256 0x7f81e915ecf8
  • Fix memory leak

Some lines were lost in a rebase

This revision is now accepted and ready to land.Tue, Sep 10, 2:24 PM
This revision was automatically updated to reflect the committed changes.