1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 */ 16 17 #pragma once 18 19 /** \file 20 * \ingroup bke 21 * \brief Functions for dealing with objects and deform verts, 22 * used by painting and tools. 23 */ 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 struct ID; 30 struct MDeformVert; 31 struct Object; 32 struct bDeformGroup; 33 34 /* General vgroup operations */ 35 void BKE_object_defgroup_remap_update_users(struct Object *ob, const int *map); 36 37 bool BKE_object_defgroup_array_get(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); 38 39 struct bDeformGroup *BKE_object_defgroup_add(struct Object *ob); 40 struct bDeformGroup *BKE_object_defgroup_add_name(struct Object *ob, const char *name); 41 struct MDeformVert *BKE_object_defgroup_data_create(struct ID *id); 42 43 bool BKE_object_defgroup_clear(struct Object *ob, 44 struct bDeformGroup *dg, 45 const bool use_selection); 46 bool BKE_object_defgroup_clear_all(struct Object *ob, const bool use_selection); 47 48 void BKE_object_defgroup_remove(struct Object *ob, struct bDeformGroup *defgroup); 49 void BKE_object_defgroup_remove_all_ex(struct Object *ob, bool only_unlocked); 50 void BKE_object_defgroup_remove_all(struct Object *ob); 51 52 int *BKE_object_defgroup_index_map_create(struct Object *ob_src, 53 struct Object *ob_dst, 54 int *r_map_len); 55 void BKE_object_defgroup_index_map_apply(struct MDeformVert *dvert, 56 int dvert_len, 57 const int *map, 58 int map_len); 59 60 /* Select helpers */ 61 enum eVGroupSelect; 62 bool *BKE_object_defgroup_subset_from_select_type(struct Object *ob, 63 enum eVGroupSelect subset_type, 64 int *r_defgroup_tot, 65 int *r_subset_count); 66 void BKE_object_defgroup_subset_to_index_array(const bool *defgroup_validmap, 67 const int defgroup_tot, 68 int *r_defgroup_subset_map); 69 70 /* ********** */ 71 72 bool *BKE_object_defgroup_lock_flags_get(struct Object *ob, const int defbase_tot); 73 bool *BKE_object_defgroup_validmap_get(struct Object *ob, const int defbase_tot); 74 bool *BKE_object_defgroup_selected_get(struct Object *ob, 75 int defbase_tot, 76 int *r_dg_flags_sel_tot); 77 78 bool BKE_object_defgroup_check_lock_relative(const bool *lock_flags, 79 const bool *validmap, 80 int index); 81 bool BKE_object_defgroup_check_lock_relative_multi(int defbase_tot, 82 const bool *lock_flags, 83 const bool *selected, 84 int sel_tot); 85 void BKE_object_defgroup_split_locked_validmap( 86 int defbase_tot, const bool *locked, const bool *deform, bool *r_locked, bool *r_unlocked); 87 88 void BKE_object_defgroup_mirror_selection(struct Object *ob, 89 int defbase_tot, 90 const bool *selection, 91 bool *dg_flags_sel, 92 int *r_dg_flags_sel_tot); 93 94 #ifdef __cplusplus 95 } 96 #endif 97