Blender  V3.3
Functions
BKE_object_deform.h File Reference

Functions for dealing with objects and deform verts, used by painting and tools. More...

Go to the source code of this file.

Functions

void BKE_object_defgroup_remap_update_users (struct Object *ob, const int *map)
 
bool BKE_object_defgroup_array_get (struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot)
 
struct bDeformGroupBKE_object_defgroup_add (struct Object *ob)
 
struct bDeformGroupBKE_object_defgroup_add_name (struct Object *ob, const char *name)
 
struct MDeformVertBKE_object_defgroup_data_create (struct ID *id)
 
bool BKE_object_defgroup_clear (struct Object *ob, struct bDeformGroup *dg, bool use_selection)
 
bool BKE_object_defgroup_clear_all (struct Object *ob, bool use_selection)
 
void BKE_object_defgroup_remove (struct Object *ob, struct bDeformGroup *defgroup)
 
void BKE_object_defgroup_remove_all_ex (struct Object *ob, bool only_unlocked)
 
void BKE_object_defgroup_remove_all (struct Object *ob)
 
int * BKE_object_defgroup_index_map_create (struct Object *ob_src, struct Object *ob_dst, int *r_map_len)
 
void BKE_object_defgroup_index_map_apply (struct MDeformVert *dvert, int dvert_len, const int *map, int map_len)
 
boolBKE_object_defgroup_subset_from_select_type (struct Object *ob, enum eVGroupSelect subset_type, int *r_defgroup_tot, int *r_subset_count)
 
void BKE_object_defgroup_subset_to_index_array (const bool *defgroup_validmap, int defgroup_tot, int *r_defgroup_subset_map)
 
boolBKE_object_defgroup_lock_flags_get (struct Object *ob, int defbase_tot)
 
boolBKE_object_defgroup_validmap_get (struct Object *ob, int defbase_tot)
 
boolBKE_object_defgroup_selected_get (struct Object *ob, int defbase_tot, int *r_dg_flags_sel_tot)
 
bool BKE_object_defgroup_check_lock_relative (const bool *lock_flags, const bool *validmap, int index)
 
bool BKE_object_defgroup_check_lock_relative_multi (int defbase_tot, const bool *lock_flags, const bool *selected, int sel_tot)
 
void BKE_object_defgroup_split_locked_validmap (int defbase_tot, const bool *locked, const bool *deform, bool *r_locked, bool *r_unlocked)
 
void BKE_object_defgroup_mirror_selection (struct Object *ob, int defbase_tot, const bool *selection, bool *dg_flags_sel, int *r_dg_flags_sel_tot)
 

Detailed Description

Functions for dealing with objects and deform verts, used by painting and tools.

Definition in file BKE_object_deform.h.

Function Documentation

◆ BKE_object_defgroup_add()

struct bDeformGroup* BKE_object_defgroup_add ( struct Object ob)

◆ BKE_object_defgroup_add_name()

struct bDeformGroup* BKE_object_defgroup_add_name ( struct Object ob,
const char *  name 
)

◆ BKE_object_defgroup_array_get()

bool BKE_object_defgroup_array_get ( struct ID id,
struct MDeformVert **  dvert_arr,
int *  dvert_tot 
)

Get MDeformVert vgroup data from given object. Should only be used in Object mode.

Returns
True if the id type supports weights.

Definition at line 498 of file object_deform.c.

References Lattice::dvert, Mesh::dvert, GS, id, ID_LT, ID_ME, ID::name, NULL, object_defgroup_lattice_get(), Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, and Mesh::totvert.

Referenced by ED_vgroup_nr_vert_add(), ED_vgroup_vert_add(), ED_vgroup_vert_remove(), object_defgroup_remove_object_mode(), and vgroup_do_remap().

◆ BKE_object_defgroup_check_lock_relative()

bool BKE_object_defgroup_check_lock_relative ( const bool lock_flags,
const bool validmap,
int  index 
)

Checks if the lock relative mode is applicable.

Returns
true if an unlocked deform group is active.

Definition at line 647 of file object_deform.c.

Referenced by drw_mesh_weight_state_extract(), weight_sample_invoke(), and wpaint_stroke_test_start().

◆ BKE_object_defgroup_check_lock_relative_multi()

bool BKE_object_defgroup_check_lock_relative_multi ( int  defbase_tot,
const bool lock_flags,
const bool selected,
int  sel_tot 
)

Additional check for whether the lock relative mode is applicable in multi-paint mode.

Returns
true if none of the selected groups are locked.

Definition at line 654 of file object_deform.c.

References NULL.

Referenced by drw_mesh_weight_state_extract(), weight_sample_invoke(), and wpaint_stroke_test_start().

◆ BKE_object_defgroup_clear()

bool BKE_object_defgroup_clear ( struct Object ob,
struct bDeformGroup dg,
bool  use_selection 
)

◆ BKE_object_defgroup_clear_all()

bool BKE_object_defgroup_clear_all ( struct Object ob,
bool  use_selection 
)

Remove all verts (or only selected ones) from all vgroups. Work in Object and Edit modes.

Parameters
use_selectionOnly operate on selection.
Returns
True if any vertex was removed, false otherwise.

Definition at line 208 of file object_deform.c.

References BKE_object_defgroup_clear(), BKE_object_defgroup_list(), ListBase::first, and bDeformGroup::next.

Referenced by vertex_group_remove_from_exec().

◆ BKE_object_defgroup_data_create()

struct MDeformVert* BKE_object_defgroup_data_create ( struct ID id)

◆ BKE_object_defgroup_index_map_apply()

void BKE_object_defgroup_index_map_apply ( struct MDeformVert dvert,
int  dvert_len,
const int *  map,
int  map_len 
)

◆ BKE_object_defgroup_index_map_create()

int* BKE_object_defgroup_index_map_create ( struct Object ob_src,
struct Object ob_dst,
int *  r_map_len 
)

Compute mapping for vertex groups with matching name, -1 is used for no remapping. Returns null if no remapping is required. The returned array has to be freed.

Definition at line 431 of file object_deform.c.

References BKE_object_defgroup_list(), BKE_object_defgroup_name_index(), BLI_listbase_count(), BLI_listbase_is_empty(), ListBase::first, MEM_freeN, MEM_malloc_arrayN, bDeformGroup::name, bDeformGroup::next, and NULL.

Referenced by arrayModifier_doArray(), and join_mesh_single().

◆ BKE_object_defgroup_lock_flags_get()

bool* BKE_object_defgroup_lock_flags_get ( struct Object ob,
int  defbase_tot 
)

Gets the status of "flag" for each bDeformGroup in the object data's vertex group list and returns an array containing them

Definition at line 528 of file object_deform.c.

References BKE_object_defgroup_list_mutable(), DG_LOCK_WEIGHT, ListBase::first, bDeformGroup::flag, MEM_freeN, MEM_mallocN, bDeformGroup::next, and NULL.

Referenced by drw_mesh_weight_state_extract(), paint_weight_gradient_exec(), vgroup_normalize_all(), weight_sample_invoke(), and wpaint_stroke_test_start().

◆ BKE_object_defgroup_mirror_selection()

void BKE_object_defgroup_mirror_selection ( struct Object ob,
int  defbase_tot,
const bool selection,
bool dg_flags_sel,
int *  r_dg_flags_sel_tot 
)

Marks mirror vgroups in output and counts them. Output and counter assumed to be already initialized. Designed to be usable after BKE_object_defgroup_selected_get to extend selection to mirror.

Definition at line 698 of file object_deform.c.

References BKE_object_defgroup_list(), BKE_object_defgroup_name_index(), BLI_string_flip_side_name(), ListBase::first, MAXBONENAME, bDeformGroup::name, bDeformGroup::next, and STREQ.

Referenced by drw_mesh_weight_state_extract(), vgroup_selected_get(), weight_sample_invoke(), and wpaint_stroke_test_start().

◆ BKE_object_defgroup_remap_update_users()

void BKE_object_defgroup_remap_update_users ( struct Object ob,
const int *  map 
)

◆ BKE_object_defgroup_remove()

void BKE_object_defgroup_remove ( struct Object ob,
struct bDeformGroup defgroup 
)

◆ BKE_object_defgroup_remove_all()

void BKE_object_defgroup_remove_all ( struct Object ob)

Remove all vgroups from object. Work in Object and Edit modes.

Definition at line 426 of file object_deform.c.

References BKE_object_defgroup_remove_all_ex().

Referenced by data_transfer_layersmapping_vgroups(), ED_vgroup_array_copy(), and vertex_group_remove_exec().

◆ BKE_object_defgroup_remove_all_ex()

void BKE_object_defgroup_remove_all_ex ( struct Object ob,
bool  only_unlocked 
)

◆ BKE_object_defgroup_selected_get()

bool* BKE_object_defgroup_selected_get ( struct Object ob,
int  defbase_tot,
int *  r_dg_flags_sel_tot 
)

◆ BKE_object_defgroup_split_locked_validmap()

void BKE_object_defgroup_split_locked_validmap ( int  defbase_tot,
const bool locked,
const bool deform,
bool r_locked,
bool r_unlocked 
)

Takes a pair of boolean masks of all locked and all deform groups, and computes a pair of masks for locked deform and unlocked deform groups. Output buffers may reuse the input ones.

Definition at line 676 of file object_deform.c.

Referenced by drw_mesh_weight_state_extract(), weight_sample_invoke(), and wpaint_stroke_test_start().

◆ BKE_object_defgroup_subset_from_select_type()

bool* BKE_object_defgroup_subset_from_select_type ( struct Object ob,
enum eVGroupSelect  subset_type,
int *  r_defgroup_tot,
int *  r_subset_count 
)

◆ BKE_object_defgroup_subset_to_index_array()

void BKE_object_defgroup_subset_to_index_array ( const bool defgroup_validmap,
int  defgroup_tot,
int *  r_defgroup_subset_map 
)

Store indices from the defgroup_validmap (faster lookups in some cases).

Definition at line 789 of file object_deform.c.

Referenced by vgroup_smooth_subset().

◆ BKE_object_defgroup_validmap_get()

bool* BKE_object_defgroup_validmap_get ( struct Object ob,
int  defbase_tot 
)