Blender  V3.3
Macros
object_vgroup.c File Reference
#include <math.h>
#include <stddef.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_curve_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_workspace_types.h"
#include "BLI_alloca.h"
#include "BLI_array.h"
#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_utildefines_stack.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_lattice.h"
#include "BKE_layer.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "BLT_translation.h"
#include "DNA_armature_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "UI_resources.h"
#include "object_intern.h"

Go to the source code of this file.

Macros

#define IS_BM_VERT_READ(v)   (use_hide ? (BM_elem_flag_test(v, BM_ELEM_HIDDEN) == 0) : true)
 
#define IS_BM_VERT_WRITE(v)   (use_select ? (BM_elem_flag_test(v, BM_ELEM_SELECT) != 0) : true)
 
#define IS_ME_VERT_READ(v)   (use_hide ? (((v)->flag & ME_HIDE) == 0) : true)
 
#define IS_ME_VERT_WRITE(v)   (use_select ? (((v)->flag & SELECT) != 0) : true)
 
#define WEIGHT_ACCUMULATE
 
#define VGROUP_MIRR_OP
 

Functions

Shared Operator Poll Functions
static bool vertex_group_supported_poll_ex (bContext *C, const Object *ob)
 
static bool vertex_group_supported_poll (bContext *C)
 
static bool vertex_group_poll_ex (bContext *C, Object *ob)
 
static bool vertex_group_poll (bContext *C)
 
static bool vertex_group_mesh_poll_ex (bContext *C, Object *ob)
 
static bool vertex_group_mesh_with_dvert_poll (bContext *C)
 
static bool UNUSED_FUNCTION() vertex_group_poll_edit (bContext *C)
 
static bool vertex_group_vert_poll_ex (bContext *C, const bool needs_select, const short ob_type_flag)
 
static bool vertex_group_mesh_vert_poll (bContext *C)
 
static bool vertex_group_vert_select_poll (bContext *C)
 
static bool vertex_group_vert_select_unlocked_poll (bContext *C)
 
static bool vertex_group_vert_select_mesh_poll (bContext *C)
 
Local Utility Functions
static bool object_array_for_wpaint_filter (const Object *ob, void *user_data)
 
static Object ** object_array_for_wpaint (bContext *C, uint *r_objects_len)
 
static bool vertex_group_use_vert_sel (Object *ob)
 
static Latticevgroup_edit_lattice (Object *ob)
 
Public Utility Functions
bool ED_vgroup_sync_from_pose (Object *ob)
 
void ED_vgroup_data_clamp_range (ID *id, const int total)
 
bool ED_vgroup_parray_alloc (ID *id, MDeformVert ***dvert_arr, int *dvert_tot, const bool use_vert_sel)
 
void ED_vgroup_parray_mirror_sync (Object *ob, MDeformVert **dvert_array, const int dvert_tot, const bool *vgroup_validmap, const int vgroup_tot)
 
void ED_vgroup_parray_mirror_assign (Object *ob, MDeformVert **dvert_array, const int dvert_tot)
 
void ED_vgroup_parray_remove_zero (MDeformVert **dvert_array, const int dvert_tot, const bool *vgroup_validmap, const int vgroup_tot, const float epsilon, const bool keep_single)
 
bool ED_vgroup_array_copy (Object *ob, Object *ob_from)
 
void ED_vgroup_parray_to_weight_array (const MDeformVert **dvert_array, const int dvert_tot, float *dvert_weights, const int def_nr)
 
void ED_vgroup_parray_from_weight_array (MDeformVert **dvert_array, const int dvert_tot, const float *dvert_weights, const int def_nr, const bool remove_zero)
 
static void mesh_defvert_mirror_update_internal (Object *ob, MDeformVert *dvert_dst, MDeformVert *dvert_src, const int def_nr)
 
static void ED_mesh_defvert_mirror_update_em (Object *ob, BMVert *eve, int def_nr, int vidx, const int cd_dvert_offset)
 
static void ED_mesh_defvert_mirror_update_ob (Object *ob, int def_nr, int vidx)
 
void ED_vgroup_vert_active_mirror (Object *ob, int def_nr)
 
static void vgroup_remove_weight (Object *ob, const int def_nr)
 
static bool vgroup_normalize_active_vertex (Object *ob, eVGroupSelect subset_type)
 
static void vgroup_copy_active_to_sel (Object *ob, eVGroupSelect subset_type)
 
High Level Vertex Group Add/Remove

Wrap lower level BKE functions.

Note
that operations on many vertices should use ED_vgroup_parray_alloc.
static void ED_vgroup_nr_vert_add (Object *ob, const int def_nr, const int vertnum, const float weight, const int assignmode)
 
void ED_vgroup_vert_add (Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode)
 
void ED_vgroup_vert_remove (Object *ob, bDeformGroup *dg, int vertnum)
 
static float get_vert_def_nr (Object *ob, const int def_nr, const int vertnum)
 
float ED_vgroup_vert_weight (Object *ob, bDeformGroup *dg, int vertnum)
 
void ED_vgroup_select_by_name (Object *ob, const char *name)
 
Vertex Group Add Operator
static int vertex_group_add_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_group_add (wmOperatorType *ot)
 
Vertex Group Remove Operator
static int vertex_group_remove_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_remove (wmOperatorType *ot)
 
Vertex Group Assign Operator
static int vertex_group_assign_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_group_assign (wmOperatorType *ot)
 
Vertex Group Assign New Operator
static int vertex_group_assign_new_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_assign_new (wmOperatorType *ot)
 
Vertex Group Remove From Operator
static int vertex_group_remove_from_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_remove_from (wmOperatorType *ot)
 
Vertex Group Select Operator
static int vertex_group_select_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_group_select (wmOperatorType *ot)
 
Vertex Group Deselect Operator
static int vertex_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_group_deselect (wmOperatorType *ot)
 
Vertex Group Copy Operator
static int vertex_group_copy_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_group_copy (wmOperatorType *ot)
 
Vertex Group Levels Operator
static int vertex_group_levels_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_levels (wmOperatorType *ot)
 
Vertex Group Normalize Operator
static int vertex_group_normalize_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_group_normalize (wmOperatorType *ot)
 
Vertex Group Normalize All Operator
static int vertex_group_normalize_all_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_normalize_all (wmOperatorType *ot)
 
Vertex Group Fix Position Operator
static int vertex_group_fix_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_fix (wmOperatorType *ot)
 
Vertex Group Lock Operator
static int vertex_group_lock_exec (bContext *C, wmOperator *op)
 
static char * vertex_group_lock_description (struct bContext *UNUSED(C), struct wmOperatorType *UNUSED(op), struct PointerRNA *params)
 
void OBJECT_OT_vertex_group_lock (wmOperatorType *ot)
 
Vertex Group Invert Operator
static int vertex_group_invert_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_invert (wmOperatorType *ot)
 
static int vertex_group_smooth_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_smooth (wmOperatorType *ot)
 
Vertex Group Clean Operator
static int vertex_group_clean_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_clean (wmOperatorType *ot)
 
Vertex Group Quantize Operator
static int vertex_group_quantize_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_quantize (wmOperatorType *ot)
 
Vertex Group Limit Total Operator
static int vertex_group_limit_total_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_limit_total (wmOperatorType *ot)
 
Vertex Group Mirror Operator
static int vertex_group_mirror_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_mirror (wmOperatorType *ot)
 
Vertex Group Copy to Selected Operator
static int vertex_group_copy_to_selected_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_copy_to_selected (wmOperatorType *ot)
 
Vertex Group Set Active Operator
static int set_active_group_exec (bContext *C, wmOperator *op)
 
static const EnumPropertyItemvgroup_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
 
void OBJECT_OT_vertex_group_set_active (wmOperatorType *ot)
 
Vertex Group Move Operator
static int vgroup_move_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_move (wmOperatorType *ot)
 
Vertex Group Weight Paste Operator
static void vgroup_copy_active_to_sel_single (Object *ob, const int def_nr)
 
static bool check_vertex_group_accessible (wmOperator *op, Object *ob, int def_nr)
 
static int vertex_weight_paste_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_weight_paste (wmOperatorType *ot)
 
Vertex Group Weight Delete Operator
static int vertex_weight_delete_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_weight_delete (wmOperatorType *ot)
 
Vertex Group Set Active by Weight Operator
static int vertex_weight_set_active_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_weight_set_active (wmOperatorType *ot)
 
Vertex Group Normalize Active Vertex Operator
static int vertex_weight_normalize_active_vertex_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_weight_normalize_active_vertex (wmOperatorType *ot)
 
Vertex Group Copy Weights from Active Operator
static int vertex_weight_copy_exec (bContext *C, wmOperator *UNUSED(op))
 
void OBJECT_OT_vertex_weight_copy (wmOperatorType *ot)
 

Operator Function Implementations

enum  { VGROUP_TOGGLE , VGROUP_LOCK , VGROUP_UNLOCK , VGROUP_INVERT }
 
enum  { VGROUP_MASK_ALL , VGROUP_MASK_SELECTED , VGROUP_MASK_UNSELECTED , VGROUP_MASK_INVERT_UNSELECTED }
 
static const EnumPropertyItem vgroup_lock_actions []
 
static const EnumPropertyItem vgroup_lock_mask []
 
static void vgroup_select_verts (Object *ob, int select)
 
static void vgroup_duplicate (Object *ob)
 
static bool vgroup_normalize (Object *ob)
 
static int * getSurroundingVerts (Mesh *me, int vert, int *count)
 
static void getSingleCoordinate (MVert *points, int count, float coord[3])
 
static void getVerticalAndHorizontalChange (const float norm[3], float d, const float coord[3], const float start[3], float distToStart, float *end, float(*changes)[2], float *dists, int index)
 
static void moveCloserToDistanceFromPlane (Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, Mesh *me, int index, const float norm[3], const float coord[3], float d, float distToBe, float strength, float cp)
 
static void vgroup_fix (const bContext *C, Scene *UNUSED(scene), Object *ob, float distToBe, float strength, float cp)
 
static void vgroup_levels_subset (Object *ob, const bool *vgroup_validmap, const int vgroup_tot, const int UNUSED(subset_count), const float offset, const float gain)
 
static bool vgroup_normalize_all (Object *ob, const bool *vgroup_validmap, const int vgroup_tot, const int subset_count, const bool lock_active, ReportList *reports)
 
static boolvgroup_selected_get (Object *ob)
 
static void vgroup_lock_all (Object *ob, int action, int mask)
 
static void vgroup_invert_subset (Object *ob, const bool *vgroup_validmap, const int vgroup_tot, const int UNUSED(subset_count), const bool auto_assign, const bool auto_remove)
 
static void vgroup_smooth_subset (Object *ob, const bool *vgroup_validmap, const int vgroup_tot, const int subset_count, const float fac, const int repeat, const float fac_expand)
 
static int inv_cmp_mdef_vert_weights (const void *a1, const void *a2)
 
static int vgroup_limit_total_subset (Object *ob, const bool *vgroup_validmap, const int vgroup_tot, const int subset_count, const int max_weights)
 
static void vgroup_clean_subset (Object *ob, const bool *vgroup_validmap, const int vgroup_tot, const int UNUSED(subset_count), const float epsilon, const bool keep_single)
 
static void vgroup_quantize_subset (Object *ob, const bool *vgroup_validmap, const int vgroup_tot, const int UNUSED(subset_count), const int steps)
 
static void dvert_mirror_op (MDeformVert *dvert, MDeformVert *dvert_mirr, const char sel, const char sel_mirr, const int *flip_map, const int flip_map_len, const bool mirror_weights, const bool flip_vgroups, const bool all_vgroups, const int act_vgroup)
 
void ED_vgroup_mirror (Object *ob, const bool mirror_weights, const bool flip_vgroups, const bool all_vgroups, const bool use_topology, int *r_totmirr, int *r_totfail)
 
static void vgroup_delete_active (Object *ob)
 
static void vgroup_assign_verts (Object *ob, const float weight)
 

Vertex Group Sort Operator

enum  { SORT_TYPE_NAME = 0 , SORT_TYPE_BONEHIERARCHY = 1 }
 
static char * vgroup_init_remap (Object *ob)
 
static int vgroup_do_remap (Object *ob, const char *name_array, wmOperator *op)
 
static int vgroup_sort_name (const void *def_a_ptr, const void *def_b_ptr)
 
static void vgroup_sort_bone_hierarchy (Object *ob, ListBase *bonebase)
 
static int vertex_group_sort_exec (bContext *C, wmOperator *op)
 
void OBJECT_OT_vertex_group_sort (wmOperatorType *ot)
 

Shared Weight Transfer Operator Properties

static const EnumPropertyItem WT_vertex_group_select_item []
 
const EnumPropertyItemED_object_vgroup_selection_itemf_helper (const bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *prop, bool *r_free, const uint selection_mask)
 
static const EnumPropertyItemrna_vertex_group_with_single_itemf (bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
 
static const EnumPropertyItemrna_vertex_group_select_itemf (bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
 
static void vgroup_operator_subset_select_props (wmOperatorType *ot, bool use_active)
 

Macro Definition Documentation

◆ IS_BM_VERT_READ

#define IS_BM_VERT_READ (   v)    (use_hide ? (BM_elem_flag_test(v, BM_ELEM_HIDDEN) == 0) : true)

◆ IS_BM_VERT_WRITE

#define IS_BM_VERT_WRITE (   v)    (use_select ? (BM_elem_flag_test(v, BM_ELEM_SELECT) != 0) : true)

◆ IS_ME_VERT_READ

#define IS_ME_VERT_READ (   v)    (use_hide ? (((v)->flag & ME_HIDE) == 0) : true)

◆ IS_ME_VERT_WRITE

#define IS_ME_VERT_WRITE (   v)    (use_select ? (((v)->flag & SELECT) != 0) : true)

◆ VGROUP_MIRR_OP

#define VGROUP_MIRR_OP
Value:
dvert_mirror_op(dvert, \
dvert_mirr, \
sel, \
sel_mirr, \
flip_map, \
flip_map_len, \
mirror_weights, \
flip_vgroups, \
all_vgroups, \
def_nr)
static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr, const char sel, const char sel_mirr, const int *flip_map, const int flip_map_len, const bool mirror_weights, const bool flip_vgroups, const bool all_vgroups, const int act_vgroup)

◆ WEIGHT_ACCUMULATE

#define WEIGHT_ACCUMULATE
Value:
{ \
float weight_other = weight_accum_prev[i_other]; \
float tot_factor = 1.0f; \
if (expand_sign == 1) { /* expand */ \
if (weight_other < weight_accum_prev[i]) { \
weight_other = (weight_accum_prev[i] * expand) + (weight_other * iexpand); \
tot_factor = iexpand; \
} \
} \
else if (expand_sign == -1) { /* contract */ \
if (weight_other > weight_accum_prev[i]) { \
weight_other = (weight_accum_prev[i] * expand) + (weight_other * iexpand); \
tot_factor = iexpand; \
} \
} \
weight += tot_factor * weight_other; \
weight_tot += tot_factor; \
} \
((void)0)
SyclQueue void void size_t num_bytes void

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VGROUP_TOGGLE 
VGROUP_LOCK 
VGROUP_UNLOCK 
VGROUP_INVERT 

Definition at line 1675 of file object_vgroup.c.

◆ anonymous enum

anonymous enum
Enumerator
VGROUP_MASK_ALL 
VGROUP_MASK_SELECTED 
VGROUP_MASK_UNSELECTED 
VGROUP_MASK_INVERT_UNSELECTED 

Definition at line 1694 of file object_vgroup.c.

◆ anonymous enum

anonymous enum
Enumerator
SORT_TYPE_NAME 
SORT_TYPE_BONEHIERARCHY 

Definition at line 4132 of file object_vgroup.c.

Function Documentation

◆ check_vertex_group_accessible()

static bool check_vertex_group_accessible ( wmOperator op,
Object ob,
int  def_nr 
)
static

◆ dvert_mirror_op()

static void dvert_mirror_op ( MDeformVert dvert,
MDeformVert dvert_mirr,
const char  sel,
const char  sel_mirr,
const int *  flip_map,
const int  flip_map_len,
const bool  mirror_weights,
const bool  flip_vgroups,
const bool  all_vgroups,
const int  act_vgroup 
)
static

◆ ED_mesh_defvert_mirror_update_em()

static void ED_mesh_defvert_mirror_update_em ( Object ob,
BMVert eve,
int  def_nr,
int  vidx,
const int  cd_dvert_offset 
)
static

◆ ED_mesh_defvert_mirror_update_ob()

static void ED_mesh_defvert_mirror_update_ob ( Object ob,
int  def_nr,
int  vidx 
)
static

◆ ED_object_vgroup_selection_itemf_helper()

const EnumPropertyItem* ED_object_vgroup_selection_itemf_helper ( const bContext C,
PointerRNA UNUSEDptr,
PropertyRNA prop,
bool r_free,
const uint  selection_mask 
)

◆ ED_vgroup_array_copy()

bool ED_vgroup_array_copy ( struct Object ob,
struct Object ob_from 
)

◆ ED_vgroup_data_clamp_range()

void ED_vgroup_data_clamp_range ( struct ID id,
int  total 
)

◆ ED_vgroup_mirror()

void ED_vgroup_mirror ( Object ob,
const bool  mirror_weights,
const bool  flip_vgroups,
const bool  all_vgroups,
const bool  use_topology,
int *  r_totmirr,
int *  r_totfail 
)

◆ ED_vgroup_nr_vert_add()

static void ED_vgroup_nr_vert_add ( Object ob,
const int  def_nr,
const int  vertnum,
const float  weight,
const int  assignmode 
)
static

◆ ED_vgroup_parray_alloc()

bool ED_vgroup_parray_alloc ( ID id,
MDeformVert ***  dvert_arr,
int *  dvert_tot,
const bool  use_vert_sel 
)

◆ ED_vgroup_parray_from_weight_array()

void ED_vgroup_parray_from_weight_array ( MDeformVert **  dvert_array,
const int  dvert_tot,
const float dvert_weights,
const int  def_nr,
const bool  remove_zero 
)

◆ ED_vgroup_parray_mirror_assign()

void ED_vgroup_parray_mirror_assign ( struct Object ob,
struct MDeformVert **  dvert_array,
int  dvert_tot 
)

Fill in the pointers for mirror verts (as if all mirror verts were selected too).

similar to ED_vgroup_parray_mirror_sync but only fill in mirror points.

Definition at line 294 of file object_vgroup.c.

References BKE_editmesh_from_object(), BLI_assert, BMEditMesh::bm, BM_mesh_elem_table_ensure(), BM_VERT, Object::data, ED_mesh_mirror_get_vert(), ED_vgroup_parray_alloc(), MEM_freeN, and NULL.

Referenced by vgroup_clean_subset(), and vgroup_quantize_subset().

◆ ED_vgroup_parray_mirror_sync()

void ED_vgroup_parray_mirror_sync ( struct Object ob,
struct MDeformVert **  dvert_array,
int  dvert_tot,
const bool vgroup_validmap,
int  vgroup_tot 
)

For use with tools that use ED_vgroup_parray_alloc with use_vert_sel == true. This finds the unselected mirror deform verts and copies the weights to them from the selected.

Note
dvert_array has mirrored weights filled in, in case cleanup operations are needed on both.

Definition at line 251 of file object_vgroup.c.

References BKE_defvert_mirror_subset(), BKE_editmesh_from_object(), BKE_object_defgroup_flip_map(), BLI_assert, BMEditMesh::bm, BM_mesh_elem_table_ensure(), BM_VERT, Object::data, ED_mesh_mirror_get_vert(), ED_vgroup_parray_alloc(), MEM_freeN, and NULL.

Referenced by vgroup_invert_subset(), vgroup_levels_subset(), and vgroup_smooth_subset().

◆ ED_vgroup_parray_remove_zero()

void ED_vgroup_parray_remove_zero ( MDeformVert **  dvert_array,
const int  dvert_tot,
const bool vgroup_validmap,
const int  vgroup_tot,
const float  epsilon,
const bool  keep_single 
)

◆ ED_vgroup_parray_to_weight_array()

void ED_vgroup_parray_to_weight_array ( const MDeformVert **  dvert_array,
const int  dvert_tot,
float dvert_weights,
const int  def_nr 
)

Definition at line 448 of file object_vgroup.c.

References BKE_defvert_find_weight().

Referenced by vgroup_smooth_subset().

◆ ED_vgroup_select_by_name()

void ED_vgroup_select_by_name ( Object ob,
const char *  name 
)

◆ ED_vgroup_sync_from_pose()

bool ED_vgroup_sync_from_pose ( Object ob)

◆ ED_vgroup_vert_active_mirror()

void ED_vgroup_vert_active_mirror ( struct Object ob,
int  def_nr 
)

◆ ED_vgroup_vert_add()

void ED_vgroup_vert_add ( struct Object ob,
struct bDeformGroup dg,
int  vertnum,
float  weight,
int  assignmode 
)

◆ ED_vgroup_vert_remove()

void ED_vgroup_vert_remove ( struct Object ob,
struct bDeformGroup dg,
int  vertnum 
)

◆ ED_vgroup_vert_weight()

float ED_vgroup_vert_weight ( Object ob,
bDeformGroup dg,
int  vertnum 
)

Definition at line 971 of file object_vgroup.c.

References BKE_object_defgroup_list(), BLI_findindex(), and get_vert_def_nr().

Referenced by heat_bone_weighting().

◆ get_vert_def_nr()

static float get_vert_def_nr ( Object ob,
const int  def_nr,
const int  vertnum 
)
static

◆ getSingleCoordinate()

static void getSingleCoordinate ( MVert points,
int  count,
float  coord[3] 
)
static

Definition at line 1271 of file object_vgroup.c.

References add_v3_v3(), count, mul_v3_fl(), and zero_v3().

Referenced by vgroup_fix().

◆ getSurroundingVerts()

static int* getSurroundingVerts ( Mesh me,
int  vert,
int *  count 
)
static

◆ getVerticalAndHorizontalChange()

static void getVerticalAndHorizontalChange ( const float  norm[3],
float  d,
const float  coord[3],
const float  start[3],
float  distToStart,
float end,
float(*)  changes[2],
float dists,
int  index 
)
static

◆ inv_cmp_mdef_vert_weights()

static int inv_cmp_mdef_vert_weights ( const void a1,
const void a2 
)
static

Definition at line 2091 of file object_vgroup.c.

References MDeformWeight::weight.

Referenced by vgroup_limit_total_subset().

◆ mesh_defvert_mirror_update_internal()

static void mesh_defvert_mirror_update_internal ( Object ob,
MDeformVert dvert_dst,
MDeformVert dvert_src,
const int  def_nr 
)
static

◆ moveCloserToDistanceFromPlane()

static void moveCloserToDistanceFromPlane ( Depsgraph depsgraph,
Scene UNUSEDscene,
Object ob,
Mesh me,
int  index,
const float  norm[3],
const float  coord[3],
float  d,
float  distToBe,
float  strength,
float  cp 
)
static

◆ object_array_for_wpaint()

static Object** object_array_for_wpaint ( bContext C,
uint r_objects_len 
)
static

◆ object_array_for_wpaint_filter()

static bool object_array_for_wpaint_filter ( const Object ob,
void user_data 
)
static

Definition at line 75 of file object_vgroup.c.

References C, user_data, and vertex_group_supported_poll_ex().

Referenced by object_array_for_wpaint().

◆ OBJECT_OT_vertex_group_add()

void OBJECT_OT_vertex_group_add ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_assign()

void OBJECT_OT_vertex_group_assign ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_assign_new()

void OBJECT_OT_vertex_group_assign_new ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_clean()

void OBJECT_OT_vertex_group_clean ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_copy()

void OBJECT_OT_vertex_group_copy ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_copy_to_selected()

void OBJECT_OT_vertex_group_copy_to_selected ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_deselect()

void OBJECT_OT_vertex_group_deselect ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_fix()

void OBJECT_OT_vertex_group_fix ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_invert()

void OBJECT_OT_vertex_group_invert ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_levels()

void OBJECT_OT_vertex_group_levels ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_limit_total()

void OBJECT_OT_vertex_group_limit_total ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_lock()

void OBJECT_OT_vertex_group_lock ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_mirror()

void OBJECT_OT_vertex_group_mirror ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_move()

void OBJECT_OT_vertex_group_move ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_normalize()

void OBJECT_OT_vertex_group_normalize ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_normalize_all()

void OBJECT_OT_vertex_group_normalize_all ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_quantize()

void OBJECT_OT_vertex_group_quantize ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_remove()

void OBJECT_OT_vertex_group_remove ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_remove_from()

void OBJECT_OT_vertex_group_remove_from ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_select()

void OBJECT_OT_vertex_group_select ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_set_active()

void OBJECT_OT_vertex_group_set_active ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_smooth()

void OBJECT_OT_vertex_group_smooth ( wmOperatorType ot)

◆ OBJECT_OT_vertex_group_sort()

void OBJECT_OT_vertex_group_sort ( wmOperatorType ot)

◆ OBJECT_OT_vertex_weight_copy()

void OBJECT_OT_vertex_weight_copy ( wmOperatorType ot)

◆ OBJECT_OT_vertex_weight_delete()

void OBJECT_OT_vertex_weight_delete ( wmOperatorType ot)

◆ OBJECT_OT_vertex_weight_normalize_active_vertex()

void OBJECT_OT_vertex_weight_normalize_active_vertex ( wmOperatorType ot)

◆ OBJECT_OT_vertex_weight_paste()

void OBJECT_OT_vertex_weight_paste ( wmOperatorType ot)

◆ OBJECT_OT_vertex_weight_set_active()

void OBJECT_OT_vertex_weight_set_active ( wmOperatorType ot)

◆ rna_vertex_group_select_itemf()

static const EnumPropertyItem* rna_vertex_group_select_itemf ( bContext C,
PointerRNA ptr,
PropertyRNA prop,
bool r_free 
)
static

◆ rna_vertex_group_with_single_itemf()

static const EnumPropertyItem* rna_vertex_group_with_single_itemf ( bContext C,
PointerRNA ptr,
PropertyRNA prop,
bool r_free 
)
static

◆ set_active_group_exec()

static int set_active_group_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_add_exec()

static int vertex_group_add_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_group_assign_exec()

static int vertex_group_assign_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_group_assign_new_exec()

static int vertex_group_assign_new_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_clean_exec()

static int vertex_group_clean_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_copy_exec()

static int vertex_group_copy_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_group_copy_to_selected_exec()

static int vertex_group_copy_to_selected_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_deselect_exec()

static int vertex_group_deselect_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_group_fix_exec()

static int vertex_group_fix_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_invert_exec()

static int vertex_group_invert_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_levels_exec()

static int vertex_group_levels_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_limit_total_exec()

static int vertex_group_limit_total_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_lock_description()

static char* vertex_group_lock_description ( struct bContext UNUSEDC,
struct wmOperatorType UNUSEDop,
struct PointerRNA params 
)
static

◆ vertex_group_lock_exec()

static int vertex_group_lock_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_mesh_poll_ex()

static bool vertex_group_mesh_poll_ex ( bContext C,
Object ob 
)
static

◆ vertex_group_mesh_vert_poll()

static bool vertex_group_mesh_vert_poll ( bContext C)
static

Definition at line 2772 of file object_vgroup.c.

References C, OB_MESH, and vertex_group_vert_poll_ex().

Referenced by OBJECT_OT_vertex_group_smooth().

◆ vertex_group_mesh_with_dvert_poll()

static bool vertex_group_mesh_with_dvert_poll ( bContext C)
static

◆ vertex_group_mirror_exec()

static int vertex_group_mirror_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_normalize_all_exec()

static int vertex_group_normalize_all_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_normalize_exec()

static int vertex_group_normalize_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_group_poll()

static bool vertex_group_poll ( bContext C)
static

◆ vertex_group_poll_edit()

static bool UNUSED_FUNCTION() vertex_group_poll_edit ( bContext C)
static

◆ vertex_group_poll_ex()

static bool vertex_group_poll_ex ( bContext C,
Object ob 
)
static

◆ vertex_group_quantize_exec()

static int vertex_group_quantize_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_remove_exec()

static int vertex_group_remove_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_remove_from_exec()

static int vertex_group_remove_from_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_select_exec()

static int vertex_group_select_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_group_smooth_exec()

static int vertex_group_smooth_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_sort_exec()

static int vertex_group_sort_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_group_supported_poll()

static bool vertex_group_supported_poll ( bContext C)
static

Definition at line 2666 of file object_vgroup.c.

References C, ED_object_context(), and vertex_group_supported_poll_ex().

Referenced by OBJECT_OT_vertex_group_add().

◆ vertex_group_supported_poll_ex()

static bool vertex_group_supported_poll_ex ( bContext C,
const Object ob 
)
static

◆ vertex_group_use_vert_sel()

static bool vertex_group_use_vert_sel ( Object ob)
static

◆ vertex_group_vert_poll_ex()

static bool vertex_group_vert_poll_ex ( bContext C,
const bool  needs_select,
const short  ob_type_flag 
)
static

◆ vertex_group_vert_select_mesh_poll()

static bool vertex_group_vert_select_mesh_poll ( bContext C)
static

◆ vertex_group_vert_select_poll()

static bool vertex_group_vert_select_poll ( bContext C)
static

◆ vertex_group_vert_select_unlocked_poll()

static bool vertex_group_vert_select_unlocked_poll ( bContext C)
static

◆ vertex_weight_copy_exec()

static int vertex_weight_copy_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_weight_delete_exec()

static int vertex_weight_delete_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_weight_normalize_active_vertex_exec()

static int vertex_weight_normalize_active_vertex_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ vertex_weight_paste_exec()

static int vertex_weight_paste_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_weight_set_active_exec()

static int vertex_weight_set_active_exec ( bContext C,
wmOperator op 
)
static

◆ vgroup_assign_verts()

static void vgroup_assign_verts ( Object ob,
const float  weight 
)
static

◆ vgroup_clean_subset()

static void vgroup_clean_subset ( Object ob,
const bool vgroup_validmap,
const int  vgroup_tot,
const int   UNUSEDsubset_count,
const float  epsilon,
const bool  keep_single 
)
static

◆ vgroup_copy_active_to_sel()

static void vgroup_copy_active_to_sel ( Object ob,
eVGroupSelect  subset_type 
)
static

◆ vgroup_copy_active_to_sel_single()

static void vgroup_copy_active_to_sel_single ( Object ob,
const int  def_nr 
)
static

◆ vgroup_delete_active()

static void vgroup_delete_active ( Object ob)
static

◆ vgroup_do_remap()

static int vgroup_do_remap ( Object ob,
const char *  name_array,
wmOperator op 
)
static

◆ vgroup_duplicate()

static void vgroup_duplicate ( Object ob)
static

◆ vgroup_edit_lattice()

static Lattice* vgroup_edit_lattice ( Object ob)
static

◆ vgroup_fix()

static void vgroup_fix ( const bContext C,
Scene UNUSEDscene,
Object ob,
float  distToBe,
float  strength,
float  cp 
)
static

◆ vgroup_init_remap()

static char* vgroup_init_remap ( Object ob)
static

◆ vgroup_invert_subset()

static void vgroup_invert_subset ( Object ob,
const bool vgroup_validmap,
const int  vgroup_tot,
const int   UNUSEDsubset_count,
const bool  auto_assign,
const bool  auto_remove 
)
static

◆ vgroup_itemf()

static const EnumPropertyItem* vgroup_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
bool r_free 
)
static

◆ vgroup_levels_subset()

static void vgroup_levels_subset ( Object ob,
const bool vgroup_validmap,
const int  vgroup_tot,
const int   UNUSEDsubset_count,
const float  offset,
const float  gain 
)
static

◆ vgroup_limit_total_subset()

static int vgroup_limit_total_subset ( Object ob,
const bool vgroup_validmap,
const int  vgroup_tot,
const int  subset_count,
const int  max_weights 
)
static

◆ vgroup_lock_all()

static void vgroup_lock_all ( Object ob,
int  action,
int  mask 
)
static

◆ vgroup_move_exec()

static int vgroup_move_exec ( bContext C,
wmOperator op 
)
static

◆ vgroup_normalize()

static bool vgroup_normalize ( Object ob)
static

◆ vgroup_normalize_active_vertex()

static bool vgroup_normalize_active_vertex ( Object ob,
eVGroupSelect  subset_type 
)
static

◆ vgroup_normalize_all()

static bool vgroup_normalize_all ( Object ob,
const bool vgroup_validmap,
const int  vgroup_tot,
const int  subset_count,
const bool  lock_active,
ReportList reports 
)
static

◆ vgroup_operator_subset_select_props()

static void vgroup_operator_subset_select_props ( wmOperatorType ot,
bool  use_active 
)
static

◆ vgroup_quantize_subset()

static void vgroup_quantize_subset ( Object ob,
const bool vgroup_validmap,
const int  vgroup_tot,
const int   UNUSEDsubset_count,
const int  steps 
)
static

◆ vgroup_remove_weight()

static void vgroup_remove_weight ( Object ob,
const int  def_nr 
)
static

◆ vgroup_select_verts()

static void vgroup_select_verts ( Object ob,
int  select 
)
static

◆ vgroup_selected_get()

static bool* vgroup_selected_get ( Object ob)
static

◆ vgroup_smooth_subset()

static void vgroup_smooth_subset ( Object ob,
const bool vgroup_validmap,
const int  vgroup_tot,
const int  subset_count,
const float  fac,
const int  repeat,
const float  fac_expand 
)
static

◆ vgroup_sort_bone_hierarchy()

static void vgroup_sort_bone_hierarchy ( Object ob,
ListBase bonebase 
)
static

Sorts the weight groups according to the bone hierarchy of the associated armature (similar to how bones are ordered in the Outliner)

Definition at line 4107 of file object_vgroup.c.

References BKE_modifiers_is_deformed_by_armature(), BKE_object_defgroup_find_name(), BKE_object_defgroup_list_mutable(), BLI_addhead(), BLI_remlink(), bArmature::bonebase, Bone::childbase, Object::data, ListBase::last, Bone::name, NULL, and Bone::prev.

Referenced by vertex_group_sort_exec().

◆ vgroup_sort_name()

static int vgroup_sort_name ( const void def_a_ptr,
const void def_b_ptr 
)
static

Definition at line 4095 of file object_vgroup.c.

References BLI_strcasecmp_natural(), and bDeformGroup::name.

Referenced by vertex_group_sort_exec().

Variable Documentation

◆ vgroup_lock_actions

const EnumPropertyItem vgroup_lock_actions[]
static
Initial value:
= {
"TOGGLE",
0,
"Toggle",
"Unlock all vertex groups if there is at least one locked group, lock all in other case"},
{VGROUP_LOCK, "LOCK", 0, "Lock", "Lock all vertex groups"},
{VGROUP_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock all vertex groups"},
{VGROUP_INVERT, "INVERT", 0, "Invert", "Invert the lock state of all vertex groups"},
{0, NULL, 0, NULL, NULL},
}
@ VGROUP_LOCK
@ VGROUP_TOGGLE
@ VGROUP_INVERT
@ VGROUP_UNLOCK

Definition at line 1682 of file object_vgroup.c.

Referenced by OBJECT_OT_vertex_group_lock().

◆ vgroup_lock_mask

const EnumPropertyItem vgroup_lock_mask[]
static
Initial value:
= {
{VGROUP_MASK_ALL, "ALL", 0, "All", "Apply action to all vertex groups"},
{VGROUP_MASK_SELECTED, "SELECTED", 0, "Selected", "Apply to selected vertex groups"},
{VGROUP_MASK_UNSELECTED, "UNSELECTED", 0, "Unselected", "Apply to unselected vertex groups"},
"INVERT_UNSELECTED",
0,
"Invert Unselected",
"Apply the opposite of Lock/Unlock to unselected vertex groups"},
{0, NULL, 0, NULL, NULL},
}
@ VGROUP_MASK_UNSELECTED
@ VGROUP_MASK_INVERT_UNSELECTED
@ VGROUP_MASK_SELECTED
@ VGROUP_MASK_ALL

Definition at line 1701 of file object_vgroup.c.

Referenced by OBJECT_OT_vertex_group_lock().

◆ WT_vertex_group_select_item

const EnumPropertyItem WT_vertex_group_select_item[]
static
Initial value:
= {
{WT_VGROUP_ACTIVE, "ACTIVE", 0, "Active Group", "The active Vertex Group"},
"BONE_SELECT",
0,
"Selected Pose Bones",
"All Vertex Groups assigned to Selection"},
"BONE_DEFORM",
0,
"Deform Pose Bones",
"All Vertex Groups assigned to Deform Bones"},
{WT_VGROUP_ALL, "ALL", 0, "All Groups", "All Vertex Groups"},
{0, NULL, 0, NULL, NULL},
}
@ WT_VGROUP_BONE_SELECT
@ WT_VGROUP_ALL
@ WT_VGROUP_ACTIVE
@ WT_VGROUP_BONE_DEFORM

Definition at line 678 of file object_vgroup.c.

Referenced by ED_object_vgroup_selection_itemf_helper().