|
Blender
V2.93
|
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 bDeformGroup * | BKE_object_defgroup_add (struct Object *ob) |
| struct bDeformGroup * | BKE_object_defgroup_add_name (struct Object *ob, const char *name) |
| struct MDeformVert * | BKE_object_defgroup_data_create (struct ID *id) |
| bool | BKE_object_defgroup_clear (struct Object *ob, struct bDeformGroup *dg, const bool use_selection) |
| bool | BKE_object_defgroup_clear_all (struct Object *ob, const 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) |
| bool * | BKE_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, const int defgroup_tot, int *r_defgroup_subset_map) |
| bool * | BKE_object_defgroup_lock_flags_get (struct Object *ob, const int defbase_tot) |
| bool * | BKE_object_defgroup_validmap_get (struct Object *ob, const int defbase_tot) |
| bool * | BKE_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) |
Functions for dealing with objects and deform verts, used by painting and tools.
Definition in file BKE_object_deform.h.
| struct bDeformGroup* BKE_object_defgroup_add | ( | Object * | ob | ) |
Add a vgroup of default name to object. Does not handle MDeformVert data at all!
Definition at line 135 of file object_deform.c.
References BKE_object_defgroup_add_name(), and DATA_.
Referenced by brush_draw_apply(), data_transfer_layersmapping_vgroups(), data_transfer_layersmapping_vgroups_multisrc_to_dst(), ED_wpaint_ensure_data(), vertex_group_add_exec(), and vertex_group_assign_new_exec().
| struct bDeformGroup* BKE_object_defgroup_add_name | ( | Object * | ob, |
| const char * | name | ||
| ) |
Add a vgroup of given name to object. Does not handle MDeformVert data at all!
Definition at line 117 of file object_deform.c.
References Object::actdef, BKE_object_defgroup_new(), BLI_listbase_count(), Object::defbase, NULL, OB_TYPE_SUPPORT_VGROUP, and Object::type.
Referenced by BKE_object_defgroup_add(), brush_draw_apply(), data_transfer_layersmapping_vgroups(), data_transfer_layersmapping_vgroups_multisrc_to_dst(), dgroup_skinnable_cb(), ED_wpaint_ensure_data(), SkinInfo::link_armature(), output_toggle_exec(), skin_armature_bone_create(), and vgroup_add_unique_bone_cb().
| bool BKE_object_defgroup_array_get | ( | ID * | id, |
| MDeformVert ** | dvert_arr, | ||
| int * | dvert_tot | ||
| ) |
Get MDeformVert vgroup data from given object. Should only be used in Object mode.
Definition at line 548 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().
| bool BKE_object_defgroup_check_lock_relative | ( | const bool * | lock_flags, |
| const bool * | validmap, | ||
| int | index | ||
| ) |
Checks if the lock relative mode is applicable.
Definition at line 705 of file object_deform.c.
Referenced by drw_mesh_weight_state_extract(), weight_sample_invoke(), and wpaint_stroke_test_start().
| 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.
Definition at line 717 of file object_deform.c.
References NULL.
Referenced by drw_mesh_weight_state_extract(), weight_sample_invoke(), and wpaint_stroke_test_start().
| bool BKE_object_defgroup_clear | ( | Object * | ob, |
| bDeformGroup * | dg, | ||
| const bool | use_selection | ||
| ) |
Remove all verts (or only selected ones) from given vgroup. Work in Object and Edit modes.
| use_selection | Only operate on selection. |
Definition at line 171 of file object_deform.c.
References BKE_defvert_find_index(), BKE_defvert_remove_group(), BLI_findindex(), BMEditMesh::bm, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_test, BM_ELEM_SELECT, BM_ITER_MESH, BM_VERTS_OF_MESH, CD_MDEFORMVERT, CustomData_get_offset(), Object::data, Lattice::def, Object::defbase, Lattice::dvert, Mesh::dvert, MDeformVert::dw, Mesh::edit_mesh, BPoint::f1, Mesh::mvert, OB_LATTICE, OB_MESH, object_defgroup_lattice_get(), Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, SELECT, Mesh::totvert, Object::type, and BMesh::vdata.
Referenced by BKE_object_defgroup_clear_all(), object_defgroup_remove_edit_mode(), and vertex_group_remove_from_exec().
| bool BKE_object_defgroup_clear_all | ( | Object * | ob, |
| const bool | use_selection | ||
| ) |
Remove all verts (or only selected ones) from all vgroups. Work in Object and Edit modes.
| use_selection | Only operate on selection. |
Definition at line 247 of file object_deform.c.
References BKE_object_defgroup_clear(), Object::defbase, ListBase::first, and bDeformGroup::next.
Referenced by vertex_group_remove_from_exec().
| struct MDeformVert* BKE_object_defgroup_data_create | ( | ID * | id | ) |
Create MDeformVert data for given ID. Work in Object mode only.
Definition at line 143 of file object_deform.c.
References CD_CALLOC, CD_MDEFORMVERT, CustomData_add_layer(), Lattice::dvert, Mesh::dvert, GS, id, ID_LT, ID_ME, MEM_callocN, ID::name, NULL, Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, and Mesh::totvert.
Referenced by add_verts_to_dgroups(), ED_vgroup_array_copy(), ED_vgroup_vert_add(), ED_wpaint_ensure_data(), and vgroup_assign_verts().
| void BKE_object_defgroup_index_map_apply | ( | struct MDeformVert * | dvert, |
| int | dvert_len, | ||
| const int * | map, | ||
| int | map_len | ||
| ) |
Definition at line 508 of file object_deform.c.
References MDeformWeight::def_nr, MDeformVert::dw, MEM_reallocN, MEM_SAFE_FREE, NULL, and MDeformVert::totweight.
Referenced by join_mesh_single(), and mesh_merge_transform().
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 479 of file object_deform.c.
References BKE_object_defgroup_name_index(), BLI_listbase_count(), BLI_listbase_is_empty(), Object::defbase, ListBase::first, MEM_freeN, MEM_malloc_arrayN, bDeformGroup::name, bDeformGroup::next, and NULL.
Referenced by arrayModifier_doArray(), and join_mesh_single().
| bool* BKE_object_defgroup_lock_flags_get | ( | Object * | ob, |
| const int | defbase_tot | ||
| ) |
gets the status of "flag" for each bDeformGroup in ob->defbase and returns an array containing them
Definition at line 581 of file object_deform.c.
References Object::defbase, DG_LOCK_WEIGHT, ListBase::first, bDeformGroup::flag, MEM_freeN, MEM_mallocN, bDeformGroup::next, and NULL.
Referenced by drw_mesh_weight_state_extract(), vgroup_normalize_all(), weight_sample_invoke(), and wpaint_stroke_test_start().
| void BKE_object_defgroup_mirror_selection | ( | struct Object * | ob, |
| int | defbase_tot, | ||
| const bool * | dg_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 771 of file object_deform.c.
References BKE_object_defgroup_name_index(), BLI_string_flip_side_name(), Object::defbase, 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().
| void BKE_object_defgroup_remap_update_users | ( | Object * | ob, |
| const int * | map | ||
| ) |
Update users of vgroups from this object, according to given map.
Use it when you remove or reorder vgroups in the object.
| map | an array mapping old indices to new indices. |
Definition at line 72 of file object_deform.c.
References Freestyle::a, eModifierType_Cloth, eModifierType_Explode, ListBase::first, Object::modifiers, ModifierData::next, ParticleSystem::next, Object::particlesystem, PSYS_TOT_VG, ClothModifierData::sim_parms, Object::soft, ModifierData::type, SoftBody::vertgroup, ExplodeModifierData::vgroup, ParticleSystem::vgroup, ClothSimSettings::vgroup_bend, ClothSimSettings::vgroup_mass, and ClothSimSettings::vgroup_struct.
Referenced by ED_vgroup_array_copy(), object_defgroup_remove_update_users(), and vgroup_do_remap().
| void BKE_object_defgroup_remove | ( | Object * | ob, |
| bDeformGroup * | defgroup | ||
| ) |
Remove given vgroup from object. Work in Object and Edit modes.
Definition at line 405 of file object_deform.c.
References BKE_gpencil_vgroup_remove(), BKE_object_batch_cache_dirty_tag(), BKE_object_is_in_editmode_vgroup(), OB_GPENCIL, object_defgroup_remove_edit_mode(), object_defgroup_remove_object_mode(), and Object::type.
Referenced by data_transfer_layersmapping_vgroups_multisrc_to_dst(), output_toggle_exec(), and vgroup_delete_active().
| void BKE_object_defgroup_remove_all | ( | struct Object * | ob | ) |
Remove all vgroups from object. Work in Object and Edit modes.
Definition at line 469 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().
| void BKE_object_defgroup_remove_all_ex | ( | struct Object * | ob, |
| bool | only_unlocked | ||
| ) |
Remove all vgroups from object. Work in Object and Edit modes. When only_unlocked=true, locked vertex groups are not removed.
Definition at line 426 of file object_deform.c.
References Object::actdef, BKE_object_is_in_editmode_vgroup(), CD_MDEFORMVERT, CustomData_free_layer_active(), Object::data, Object::defbase, DG_LOCK_WEIGHT, Lattice::dvert, Mesh::dvert, ListBase::first, bDeformGroup::flag, MEM_freeN, bDeformGroup::next, NULL, OB_LATTICE, OB_MESH, object_defgroup_lattice_get(), object_defgroup_remove_edit_mode(), object_defgroup_remove_object_mode(), Mesh::totvert, and Object::type.
Referenced by BKE_object_defgroup_remove_all(), and vertex_group_remove_exec().
| bool* BKE_object_defgroup_selected_get | ( | struct Object * | ob, |
| int | defbase_tot, | ||
| int * | r_dg_flags_sel_tot | ||
| ) |
Definition at line 671 of file object_deform.c.
References BKE_object_pose_armature_get(), BKE_pose_channel_find_name(), bPoseChannel::bone, BONE_SELECTED, Object::defbase, ListBase::first, Bone::flag, MEM_mallocN, bDeformGroup::name, bDeformGroup::next, and Object::pose.
Referenced by BKE_object_defgroup_subset_from_select_type(), drw_mesh_weight_state_extract(), vgroup_selected_get(), weight_sample_invoke(), and wpaint_stroke_test_start().
| 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 744 of file object_deform.c.
Referenced by drw_mesh_weight_state_extract(), weight_sample_invoke(), and wpaint_stroke_test_start().
| bool* BKE_object_defgroup_subset_from_select_type | ( | Object * | ob, |
| eVGroupSelect | subset_type, | ||
| int * | r_defgroup_tot, | ||
| int * | r_subset_count | ||
| ) |
Return the subset type of the Vertex Group Selection
Definition at line 801 of file object_deform.c.
References Object::actdef, BKE_object_defgroup_selected_get(), BKE_object_defgroup_validmap_get(), BLI_listbase_count(), Object::defbase, MEM_mallocN, NULL, WT_VGROUP_ACTIVE, WT_VGROUP_ALL, WT_VGROUP_BONE_DEFORM, WT_VGROUP_BONE_DEFORM_OFF, and WT_VGROUP_BONE_SELECT.
Referenced by data_transfer_layersmapping_vgroups(), vertex_group_clean_exec(), vertex_group_invert_exec(), vertex_group_levels_exec(), vertex_group_limit_total_exec(), vertex_group_normalize_all_exec(), vertex_group_quantize_exec(), vertex_group_smooth_exec(), vgroup_copy_active_to_sel(), vgroup_normalize_active_vertex(), and view3d_panel_vgroup().
| void BKE_object_defgroup_subset_to_index_array | ( | const bool * | defgroup_validmap, |
| const int | defgroup_tot, | ||
| int * | r_defgroup_subset_map | ||
| ) |
store indices from the defgroup_validmap (faster lookups in some cases)
Definition at line 865 of file object_deform.c.
Referenced by vgroup_smooth_subset().
| bool* BKE_object_defgroup_validmap_get | ( | struct Object * | ob, |
| const int | defbase_tot | ||
| ) |
Definition at line 602 of file object_deform.c.
References BKE_modifiers_get_virtual_modifierlist(), BLI_assert, BLI_ghash_free(), BLI_ghash_insert(), BLI_ghash_len(), BLI_ghash_lookup(), BLI_ghash_lookup_p(), BLI_ghash_str_new_ex(), BLI_listbase_is_empty(), bPoseChannel::bone, BONE_NO_DEFORM, bPose::chanbase, Object::defbase, eModifierMode_Realtime, eModifierMode_Virtual, eModifierType_Armature, ListBase::first, Bone::flag, MEM_mallocN, ModifierData::mode, Object::modifiers, bPoseChannel::name, bDeformGroup::name, bPoseChannel::next, ModifierData::next, bDeformGroup::next, NULL, ArmatureModifierData::object, POINTER_FROM_INT, Object::pose, and ModifierData::type.
Referenced by BKE_object_defgroup_subset_from_select_type(), drw_mesh_weight_state_extract(), paint_weight_gradient_exec(), weight_sample_invoke(), and wpaint_stroke_test_start().