Mesh: Move sculpt mask to a generic attribute
Store paint masks as generic float attributes, with the name
`".sculpt_mask"`. This is similar to 060a534141, which made
the same change for face sets. The benefits are general
consistency, nicer code, and more support in newer areas
that deal with attributes like geometry nodes.
The RNA API is replaced with one created in Python. The new
API only presents a single layer as an attribute class, so it
should be simpler to use in general:
- Before: `object.data.vertex_paint_masks[0].data[0].value`
- After: `object.data.vertex_paint_mask.data[0].value`
Pull Request: https://projects.blender.org/blender/blender/pulls/115119
This commit is contained in:
@@ -669,6 +669,19 @@ class Mesh(bpy_types.ID):
|
||||
def edge_creases_remove(self):
|
||||
_name_convention_attribute_remove(self.attributes, "crease_edge")
|
||||
|
||||
@property
|
||||
def vertex_paint_mask(self):
|
||||
"""
|
||||
Mask values for sculpting and painting, corresponding to the ".sculpt_mask" attribute.
|
||||
"""
|
||||
return _name_convention_attribute_get(self.attributes, ".sculpt_mask", 'POINT', 'FLOAT')
|
||||
|
||||
def vertex_paint_mask_ensure(self):
|
||||
return _name_convention_attribute_ensure(self.attributes, ".sculpt_mask", 'POINT', 'FLOAT')
|
||||
|
||||
def vertex_paint_mask_remove(self):
|
||||
_name_convention_attribute_remove(self.attributes, ".sculpt_mask")
|
||||
|
||||
def shade_flat(self):
|
||||
"""
|
||||
Render and display faces uniform, using face normals,
|
||||
|
||||
Reference in New Issue
Block a user