1 /* SPDX-FileCopyrightText: 2023 Blender Authors
3 * SPDX-License-Identifier: GPL-2.0-or-later */
9 * \brief Utility functions for vertex groups in grease pencil objects
12 #include "DNA_grease_pencil_types.h"
14 #include "BKE_attribute.hh"
16 namespace blender::bke::greasepencil
{
18 /** Make sure drawings only contain vertex groups of the #GreasePencil. */
19 void validate_drawing_vertex_groups(GreasePencil
&grease_pencil
);
21 /** Find or create a vertex group in a drawing. */
22 int ensure_vertex_group(const StringRef name
, ListBase
&vertex_group_names
);
24 /** Assign selected vertices to the vertex group. */
25 void assign_to_vertex_group(Drawing
&drawing
, StringRef name
, float weight
);
27 void assign_to_vertex_group_from_mask(CurvesGeometry
&curves
,
28 const IndexMask
&mask
,
33 * Remove selected vertices from the vertex group.
34 * \return True if at least one vertex was removed from the group.
36 bool remove_from_vertex_group(Drawing
&drawing
, StringRef name
, bool use_selection
);
38 /** Remove vertices from all vertex groups. */
39 void clear_vertex_groups(GreasePencil
&grease_pencil
);
41 /** Select or deselect vertices assigned to this group. */
42 void select_from_group(Drawing
&drawing
,
43 const AttrDomain selection_domain
,
47 } // namespace blender::bke::greasepencil