Sculpt: Face Sets Init operator

This operator initializes all face sets in the sculpt at once using
different mesh properties. It can create face sets by mesh connectivity,
material slots, face normals, UV seams, creases, sharp edges, bevel
weights and face maps.

For properties that are already in the faces, this is implemented as a
loop. Properties that depend on edge attributes use a similar operation
to sculpt flood fill, but using face adjacency instead of edge vertex
connectivity.

As Multires also stores the face sets in the base mesh, this should work
in the face sets Multires implementation without any changes.

This is implemented as a separate operator as this resets the visibility
and creates all face sets at once, while the create face set operator
creates a single face sets, leaving the rest of the face sets in the
mesh as they are.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7209
This commit is contained in:
Pablo Dobarro
2020-03-21 23:24:53 +01:00
parent a218be3080
commit 99530ef4ed
2 changed files with 380 additions and 0 deletions

View File

@@ -3135,6 +3135,10 @@ class VIEW3D_MT_face_sets(Menu):
op = layout.operator("sculpt.face_sets_create", text='Face Set From Visible')
op.mode = 'VISIBLE'
layout.separator()
layout.menu("VIEW3D_MT_face_sets_init", text="Init Face Sets")
layout.separator()
op = layout.operator("sculpt.face_set_change_visibility", text='Invert Visible Face Sets')
@@ -3169,6 +3173,37 @@ class VIEW3D_MT_sculpt_set_pivot(Menu):
props = layout.operator("sculpt.set_pivot_position", text="Pivot to Surface Under Cursor")
props.mode = 'SURFACE'
class VIEW3D_MT_face_sets_init(Menu):
bl_label = "Face Sets Init"
def draw(self, _context):
layout = self.layout
op = layout.operator("sculpt.face_sets_init", text='By Loose Parts')
op.mode = 'LOOSE_PARTS'
op = layout.operator("sculpt.face_sets_init", text='By Materials')
op.mode = 'MATERIALS'
op = layout.operator("sculpt.face_sets_init", text='By Normals')
op.mode = 'NORMALS'
op = layout.operator("sculpt.face_sets_init", text='By UV Seams')
op.mode = 'UV_SEAMS'
op = layout.operator("sculpt.face_sets_init", text='By Edge Creases')
op.mode = 'CREASES'
op = layout.operator("sculpt.face_sets_init", text='By Edge Bevel Weight')
op.mode = 'BEVEL_WEIGHT'
op = layout.operator("sculpt.face_sets_init", text='By Sharp Edges')
op.mode = 'SHARP_EDGES'
op = layout.operator("sculpt.face_sets_init", text='By Face Maps')
op.mode = 'FACE_MAPS'
class VIEW3D_MT_particle(Menu):
bl_label = "Particle"
@@ -7335,6 +7370,7 @@ classes = (
VIEW3D_MT_sculpt_set_pivot,
VIEW3D_MT_mask,
VIEW3D_MT_face_sets,
VIEW3D_MT_face_sets_init,
VIEW3D_MT_particle,
VIEW3D_MT_particle_context_menu,
VIEW3D_MT_particle_showhide,