120 selected_bone_uses_group.
append(bone_for_group_exists);
123 Span<bool> use_vertex_group = selected_bone_uses_group;
127 r_vertex_mask[i] =
false;
131 if (use_vertex_group.
get(dw.def_nr,
false)) {
132 if (dw.weight > threshold) {
133 r_vertex_mask[i] =
true;
149 r_vertex_mask[i] = found;
155 for (
bool &value :
array) {
162 uint *r_num_masked_vertices)
166 uint num_masked_vertices = 0;
168 if (vertex_mask[i_src]) {
169 r_vertex_map[i_src] = num_masked_vertices;
170 num_masked_vertices++;
173 r_vertex_map[i_src] = -1;
177 *r_num_masked_vertices = num_masked_vertices;
183 uint *r_num_masked_edges)
187 uint num_masked_edges = 0;
192 if (vertex_mask[edge.
v1] && vertex_mask[edge.
v2]) {
193 r_edge_map[i] = num_masked_edges;
201 *r_num_masked_edges = num_masked_edges;
208 uint *r_num_masked_polys,
209 uint *r_num_masked_loops)
216 uint num_masked_loops = 0;
220 bool all_verts_in_mask =
true;
222 for (
const MLoop &loop : loops_src) {
223 if (!vertex_mask[loop.v]) {
224 all_verts_in_mask =
false;
229 if (all_verts_in_mask) {
232 num_masked_loops += poly_src.
totloop;
236 *r_num_masked_polys = r_masked_poly_indices.
size();
237 *r_num_masked_loops = num_masked_loops;
246 const int i_dst = vertex_map[i_src];
267 const int i_dst = edge_map[i_src];
277 e_dst.
v1 = vertex_map[e_src.
v1];
278 e_dst.
v2 = vertex_map[e_src.
v2];
289 for (
const int i_dst : masked_poly_indices.
index_range()) {
290 const int i_src = masked_poly_indices[i_dst];
295 const int i_ml_dst = new_loop_starts[i_dst];
300 const MLoop *ml_src = src_mesh.
mloop + i_ml_src;
306 ml_dst[i].
v = vertex_map[ml_src[i].
v];
307 ml_dst[i].
e = edge_map[ml_src[i].e];
325 if (dvert ==
nullptr) {
351 if (defgrp_index == -1) {
364 uint num_masked_vertices;
368 uint num_masked_edges;
373 uint num_masked_polys;
374 uint num_masked_loops;
383 mesh, num_masked_vertices, num_masked_edges, 0, num_masked_loops, num_masked_polys);
388 *
mesh, *
result, vertex_map, edge_map, masked_poly_indices, new_loop_starts);
399 bool UNUSED(useRenderParams))
427 uiItemR(row,
ptr,
"armature", 0,
nullptr, ICON_NONE);
430 uiItemR(sub,
ptr,
"invert_vertex_group", 0,
"", ICON_ARROW_LEFTRIGHT);
436 uiItemR(layout,
ptr,
"threshold", 0,
nullptr, ICON_NONE);
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_get_layer(const struct CustomData *data, int type)
void CustomData_copy_data(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
struct Mesh * BKE_mesh_new_nomain_from_template(const struct Mesh *me_src, int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len)
void BKE_mesh_calc_edges_loose(struct Mesh *mesh)
void(* IDWalkFunc)(void *userData, struct Object *ob, struct ID **idpoin, int cb_flag)
@ eModifierTypeFlag_SupportsMapping
@ eModifierTypeFlag_SupportsEditmode
@ eModifierTypeFlag_AcceptsMesh
void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, const int flag)
@ eModifierTypeType_Nonconstructive
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
void DEG_add_object_relation(struct DepsNodeHandle *node_handle, struct Object *object, eDepsObjectComponentType component, const char *description)
void DEG_add_modifier_to_transform_relation(struct DepsNodeHandle *node_handle, const char *description)
#define CD_MASK_MDEFORMVERT
#define DNA_struct_default_get(struct_name)
struct MaskModifierData MaskModifierData
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
static void compute_vertex_mask__armature_mode(MDeformVert *dvert, Object *ob, Object *armature_ob, float threshold, MutableSpan< bool > r_vertex_mask)
static Mesh * modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, bool UNUSED(useRenderParams))
static void compute_vertex_mask__vertex_group_mode(MDeformVert *dvert, int defgrp_index, float threshold, MutableSpan< bool > r_vertex_mask)
static void computed_masked_edges(const Mesh *mesh, Span< bool > vertex_mask, MutableSpan< int > r_edge_map, uint *r_num_masked_edges)
static void requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md), CustomData_MeshMasks *r_cddata_masks)
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
static void copy_masked_edges_to_new_mesh(const Mesh &src_mesh, Mesh &dst_mesh, Span< int > vertex_map, Span< int > edge_map)
static void invert_boolean_array(MutableSpan< bool > array)
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
static void copy_masked_polys_to_new_mesh(const Mesh &src_mesh, Mesh &dst_mesh, Span< int > vertex_map, Span< int > edge_map, Span< int > masked_poly_indices, Span< int > new_loop_starts)
static void initData(ModifierData *md)
static void panelRegister(ARegionType *region_type)
ModifierTypeInfo modifierType_Mask
static void copy_masked_vertices_to_new_mesh(const Mesh &src_mesh, Mesh &dst_mesh, Span< int > vertex_map)
static void computed_masked_polygons(const Mesh *mesh, Span< bool > vertex_mask, Vector< int > &r_masked_poly_indices, Vector< int > &r_loop_starts, uint *r_num_masked_polys, uint *r_num_masked_loops)
static void compute_masked_vertices(Span< bool > vertex_mask, MutableSpan< int > r_vertex_map, uint *r_num_masked_vertices)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
void modifier_vgroup_ui(uiLayout *layout, PointerRNA *ptr, PointerRNA *ob_ptr, const char *vgroup_prop, const char *invert_vgroup_prop, const char *text)
StructRNA RNA_MaskModifier
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr T get(int64_t index, const T &fallback) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
void append_unchecked(ForwardT &&value)
void append(const T &value)
void reserve(const int64_t min_capacity)
int RNA_enum_get(PointerRNA *ptr, const char *name)
struct CustomData pdata ldata
struct DepsNodeHandle * node