30 valid_names.
add_new(defgroup->name);
41 int defgroup_index = 0;
43 if (!valid_names.
contains(defgroup->name)) {
59 bDeformGroup *defgroup = MEM_cnew<bDeformGroup>(__func__);
60 name.copy(defgroup->
name);
73 if (mask.is_empty()) {
77 ListBase &vertex_group_names = curves.vertex_group_names;
83 bDeformGroup *defgroup = MEM_cnew<bDeformGroup>(__func__);
84 name.copy(defgroup->
name);
91 mask.foreach_index([&](
const int point_i) {
102 ListBase &vertex_group_names = curves.vertex_group_names;
105 const VArray<bool> selection = *attributes.lookup_or_default<
bool>(
116 bDeformGroup *defgroup = MEM_cnew<bDeformGroup>(__func__);
117 name.copy(defgroup->
name);
134 bool changed =
false;
136 ListBase &vertex_group_names = curves.vertex_group_names;
146 const VArray<bool> selection = *attributes.lookup_or_default<
bool>(
149 if (!use_selection || selection[i]) {
176 for (
MDeformVert &dvert : curves.deform_verts_for_write()) {
189 ListBase &vertex_group_names = curves.vertex_group_names;
203 const int num_elements = attributes.
domain_size(selection_domain);
209 switch (selection_domain) {
212 for (const int point_i : range) {
213 if (BKE_defvert_find_index(&dverts[point_i], def_nr)) {
214 selection.span[point_i] = select;
222 for (const int curve_i : range) {
223 const IndexRange points = points_by_curve[curve_i];
224 bool any_point_in_group = false;
225 for (const int point_i : points) {
226 if (BKE_defvert_find_index(&dverts[point_i], def_nr)) {
227 any_point_in_group = true;
231 if (any_point_in_group) {
232 selection.span[curve_i] = select;
Low-level operations for curves.
Low-level operations for grease pencil.
Utility functions for vertex groups in grease pencil objects.
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
constexpr IndexRange index_range() const
bool contains(const Key &key) const
void add_new(const Key &key)
constexpr bool is_empty() const
int domain_size(const AttrDomain domain) const
bke::CurvesGeometry & strokes_for_write()
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
void clear_vertex_groups(GreasePencil &grease_pencil)
bool remove_from_vertex_group(Drawing &drawing, StringRef name, bool use_selection)
int ensure_vertex_group(const StringRef name, ListBase &vertex_group_names)
void select_from_group(Drawing &drawing, const AttrDomain selection_domain, StringRef name, bool select)
void assign_to_vertex_group(Drawing &drawing, StringRef name, float weight)
void assign_to_vertex_group_from_mask(CurvesGeometry &curves, const IndexMask &mask, StringRef name, float weight)
void validate_drawing_vertex_groups(GreasePencil &grease_pencil)
void remove_defgroup_index(MutableSpan< MDeformVert > dverts, int defgroup_index)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
float wrap(float value, float max, float min)
ListBase vertex_group_names