GPv3: Basic vertex group operators

Adds vertex groups and basic operator support to the `GreasePencil` data
block.

Vertex groups in the `GreasePencil` ID are used as the source of truth
for vertex groups names and ordering in the UI. Individual drawings also
have vertex group lists, but they should not be modified directly by
users or the API. The main purpose of storing vertex group names in in a
drawing's `CurveGeometry` is to make it self-contained, so that vertex
weights can be associated with names without requiring the
`GreasePencil` parent data.

Vertex group operators are implemented generically for some ID types.
Grease Pencil needs its own handling in these operators. After
manipulating `vertex_group_names` the `validate_drawing_vertex_groups`
utility function should be called to ensure that drawings only contain a
true subset of the `GreasePencil` data block.

Operators for assigning/removing/selecting/deselecting vertices are also
implemented here. To avoid putting grease pencil logic into the generic
`object_deform.cc` file a number of utility functions have been added in
`BKE_grease_pencil_vgroup.hh`.

Fixes #117337

Pull Request: https://projects.blender.org/blender/blender/pulls/117476
This commit is contained in:
Lukas Tönne
2024-01-31 17:45:59 +01:00
parent 4d4f8bbfe4
commit 7e7165b085
10 changed files with 329 additions and 17 deletions
@@ -226,7 +226,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
def poll(cls, context):
engine = context.engine
obj = context.object
return (obj and obj.type in {'MESH', 'LATTICE'} and (engine in cls.COMPAT_ENGINES))
return (obj and obj.type in {'MESH', 'LATTICE', 'GREASEPENCIL'} and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout