Page MenuHome

Sculpt: Face Set Edit Operator
ClosedPublic

Authored by Pablo Dobarro (pablodp606) on Apr 7 2020, 4:17 PM.
Tokens
"Love" token, awarded by andruxa696."Love" token, awarded by Tonatiuh."Love" token, awarded by MetinSeven."Yellow Medal" token, awarded by amonpaike."Like" token, awarded by lopoIsaac."Love" token, awarded by jmztn."100" token, awarded by Frozen_Death_Knight."Like" token, awarded by Loner."Like" token, awarded by erickblender.

Details

Summary

This operator performs an edit operation in the active face set defined
by the cursor position and updates the visibility. For now, it has a
Grow and Shrink operations, similar to Select More/Less in edit mode or
to the mask filter Grow/Shrink modes. More operations can be added in
the future.

In multires, this updates the visibility of an entire face from the base
mesh at once, which makes it very convenient to edit the visible area
without manipulating the face set directly.

Diff Detail

Repository
rB Blender
Branch
sculpt-face-set-edit (branched from master)
Build Status
Buildable 8305
Build 8305: arc lint + arc unit

Event Timeline

What I don't understand here is why you're using BMesh? Such conversion is not cheap. If it is for neighborhood information I think BKE_mesh_mapping.h is for the help here.
You can double-check with Bastien or Campbell whether BKE_mesh_mapping is indeed more memory/performance friendly.

source/blender/editors/sculpt_paint/sculpt_face_set.c
1069

Why do you need normals?

1075

Some notes:

  • If you're overriding all elements use malloc semantic.
  • If you're allocating array use array allocation semantic (MEM_calloc_arrayN, MEM_malloc_arrayN).
  • If you need copy of entire managed memory block use MEM_dupallocN.
  • If you need to copy an entire buffer from unmanaged source to your memory use memcpy.
Pablo Dobarro (pablodp606) marked 2 inline comments as done.

-Review Update: Use mesh map instead of BMesh

source/blender/editors/sculpt_paint/sculpt_face_set.c
1020

Why abs is used on the face set?

source/blender/editors/sculpt_paint/sculpt_face_set.c
1020

Because its visibility is encoded in the integer sign and this just needs to compare IDs

source/blender/editors/sculpt_paint/sculpt_face_set.c
1020

I would say that:

  • SculptSession::face_sets should be commented with this information .
  • Better naming is to be used, to make it clear whether visibility is encoded or not.

The least resistant path seems to be to consider face_setto always be an encoded face set id + visibility, and when visibility is not included call it face_set_id. So here it would be:

if (abs(prev_face_sets[neighbor_face_index]) == active_face_set_id) {
Pablo Dobarro (pablodp606) marked an inline comment as done.
  • Review Update
This revision is now accepted and ready to land.Jun 6 2020, 2:25 PM
This revision was automatically updated to reflect the committed changes.