Page MenuHome

Sculpt: Mask filter and dirty mask generator
ClosedPublic

Authored by Pablo Dobarro (pablodp606) on Aug 15 2019, 9:22 PM.

Details

Summary

Dirty mask was inside the mask filter in the sculpt branch, but it didn't make much sense. I split it into a different operator. It still misses some parameters from the vertex color operator that I can add later when we know how these operators are going to be used from the interface.

Diff Detail

Repository
rB Blender

Event Timeline

  • Update only modified nodes, fix warnings
  • Add mask filter pie menu
  • Use exec instead of invoke

This allows repeating the operator with Shift+R without opening the pie menu again

Sebastian Parborg (zeddb) requested changes to this revision.Thu, Sep 5, 2:37 PM

From just reading the changes, this seems fine to me.

However, this patch doesn't apply cleanly for me in the latest master. Could you update your patch?

This revision now requires changes to proceed.Thu, Sep 5, 2:37 PM
  • Rebase, fix unused warnings

Other than my comments below, I didn't really find any other issues.

source/blender/editors/sculpt_paint/sculpt.c
333

Missing prototype warning. I'm guessing you want to have this be a static function?

7502

I'm getting a "set but unused warning here". I think you can just remove this variable.

7684

Same as with the other prop, just remove this.

Brecht Van Lommel (brecht) requested changes to this revision.Fri, Sep 6, 6:59 PM

The filter tool doesn't show an adjust operator settings panel, which I think would be useful to tweak the iterations? It's not immediately obvious from the code why it's not showing here though.

release/scripts/startup/bl_ui/space_view3d.py
4817

Mask edit -> Mask Edit

4827

These operations should not only be in the pie menu, but also the Sculpt menu in the header.

source/blender/editors/sculpt_paint/sculpt.c
7491

Mask filter -> Mask Filter

7521

Auto iteration count -> Auto Iteration Count

7542

Weird indentation.

7549–7551

Change to:

float angle = max_ff(saacosf(dot), 0.0f);
return angle;

saacosf avoids NaN in some rare float precision cases.

7570

Always use {} for if.

7590–7593

Move to utility function from other patches

7600

Dirty mask -> Dirty Mask

7609

Slightly faster to compute the vertex count once instead of for every iteration.

int num_verts = sculpt_vertex_count_get(ss);
or (int i = 0; i < num_verts; i++) {
}

This goes for all similar loops in this patch.

7658–7660

Maybe free nodes before undo push. Doesn't really better but has slightly slower memory peak then.

7672

Dirty mask -> Dirty Mask

This revision now requires changes to proceed.Fri, Sep 6, 6:59 PM
Pablo Dobarro (pablodp606) marked 15 inline comments as done.Fri, Sep 6, 11:53 PM
Pablo Dobarro (pablodp606) updated this revision to Diff 17932.
  • Update for revision

I never get a sculpt mode operator to work with the redo panel. But even if it does, on a high poly mesh some filters need a high number of iterations to get a usable result. Adjusting the filter in the redo panel from the iteration 100 to the 101 will recalculate 101 iterations, so it is going to be faster running the filter again. I would like this to work similarly to the mesh filter, adjusting the iteration count in real time from a modal operator.

  • Add Dirty Mask to the menu
Brecht Van Lommel (brecht) added inline comments.
source/blender/editors/sculpt_paint/sculpt.c
335–342

Slightly faster:

float mask = sculpt_vertex_mask_get(ss, index);
if (mask > max) {
  sculpt_vertex_mask_set(ss, index, max);
}
else if (mask < min) {
  sculpt_vertex_mask_set(ss, index, min);
}
7366

Add ; after sculpt_vertex_neighbors_iter_end(ni) to solve weird indentation.

7377

Add ; after sculpt_vertex_neighbors_iter_end(ni) to solve weird indentation.

7538

Add ; after sculpt_vertex_neighbors_iter_end(ni) to solve weird indentation.

This revision is now accepted and ready to land.Sun, Sep 8, 11:48 AM
Pablo Dobarro (pablodp606) marked 3 inline comments as done.Mon, Sep 9, 4:29 PM
This revision was automatically updated to reflect the committed changes.