Fix T71554: 'Hide Unselected' not working for certain selections
[blender.git] / source / blender / blenkernel / BKE_object_deform.h
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 #ifndef __BKE_OBJECT_DEFORM_H__
18 #define __BKE_OBJECT_DEFORM_H__
19
20 /** \file
21  * \ingroup bke
22  * \brief Functions for dealing with objects and deform verts,
23  *        used by painting and tools.
24  */
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 struct ID;
31 struct MDeformVert;
32 struct Object;
33 struct bDeformGroup;
34
35 /* General vgroup operations */
36 void BKE_object_defgroup_remap_update_users(struct Object *ob, int *map);
37
38 bool BKE_object_defgroup_array_get(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
39
40 struct bDeformGroup *BKE_object_defgroup_add(struct Object *ob);
41 struct bDeformGroup *BKE_object_defgroup_add_name(struct Object *ob, const char *name);
42 struct MDeformVert *BKE_object_defgroup_data_create(struct ID *id);
43
44 bool BKE_object_defgroup_clear(struct Object *ob,
45                                struct bDeformGroup *dg,
46                                const bool use_selection);
47 bool BKE_object_defgroup_clear_all(struct Object *ob, const bool use_selection);
48
49 void BKE_object_defgroup_remove(struct Object *ob, struct bDeformGroup *defgroup);
50 void BKE_object_defgroup_remove_all_ex(struct Object *ob, bool only_unlocked);
51 void BKE_object_defgroup_remove_all(struct Object *ob);
52
53 int *BKE_object_defgroup_index_map_create(struct Object *ob_src,
54                                           struct Object *ob_dst,
55                                           int *r_map_len);
56 void BKE_object_defgroup_index_map_apply(struct MDeformVert *dvert,
57                                          int dvert_len,
58                                          const int *map,
59                                          int map_len);
60
61 /* Select helpers */
62 enum eVGroupSelect;
63 bool *BKE_object_defgroup_subset_from_select_type(struct Object *ob,
64                                                   enum eVGroupSelect subset_type,
65                                                   int *r_defgroup_tot,
66                                                   int *r_subset_count);
67 void BKE_object_defgroup_subset_to_index_array(const bool *defgroup_validmap,
68                                                const int defgroup_tot,
69                                                int *r_defgroup_subset_map);
70
71 /* ********** */
72
73 bool *BKE_object_defgroup_lock_flags_get(struct Object *ob, const int defbase_tot);
74 bool *BKE_object_defgroup_validmap_get(struct Object *ob, const int defbase_tot);
75 bool *BKE_object_defgroup_selected_get(struct Object *ob,
76                                        int defbase_tot,
77                                        int *r_dg_flags_sel_tot);
78
79 void BKE_object_defgroup_mirror_selection(struct Object *ob,
80                                           int defbase_tot,
81                                           const bool *selection,
82                                           bool *dg_flags_sel,
83                                           int *r_dg_flags_sel_tot);
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif /* __BKE_OBJECT_DEFORM_H__ */