Recent spinlock commit made scheduling unsafe for threading
[blender.git] / source / blender / bmesh / intern / bmesh_marking.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Contributor(s): Joseph Eagar.
19  *
20  * ***** END GPL LICENSE BLOCK *****
21  */
22
23 #ifndef __BMESH_MARKING_H__
24 #define __BMESH_MARKING_H__
25
26 /** \file blender/bmesh/intern/bmesh_marking.h
27  *  \ingroup bmesh
28  */
29
30 typedef struct BMEditSelection {
31         struct BMEditSelection *next, *prev;
32         BMElem *ele;
33         char htype;
34 } BMEditSelection;
35
36 /* geometry hiding code */
37 #define BM_elem_hide_set(bm, ele, hide) _bm_elem_hide_set(bm, &(ele)->head, hide)
38 void _bm_elem_hide_set(BMesh *bm, BMHeader *ele, const bool hide);
39 void BM_vert_hide_set(BMVert *v, const bool hide);
40 void BM_edge_hide_set(BMEdge *e, const bool hide);
41 void BM_face_hide_set(BMFace *f, const bool hide);
42
43 /* Selection code */
44 void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select);
45
46 void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag,
47                                     const bool respecthide, const char hflag_test);
48 void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
49                                      const bool respecthide, const char hflag_test);
50
51 void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag,
52                                    const bool respecthide);
53 void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag,
54                                     const bool respecthide);
55
56 /* individual element select functions, BM_elem_select_set is a shortcut for these
57  * that automatically detects which one to use*/
58 void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select);
59 void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select);
60 void BM_face_select_set(BMesh *bm, BMFace *f, const bool select);
61
62 void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode);
63 void BM_mesh_select_mode_clean(BMesh *bm);
64
65 void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
66 void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode);
67 void BM_mesh_select_mode_flush(BMesh *bm);
68
69 void BM_mesh_deselect_flush(BMesh *bm);
70 void BM_mesh_select_flush(BMesh *bm);
71
72 int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, const bool respecthide);
73 int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, const bool respecthide);
74
75 /* edit selection stuff */
76 void    BM_mesh_active_face_set(BMesh *bm, BMFace *f);
77 BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected);
78 BMEdge *BM_mesh_active_edge_get(BMesh *bm);
79 BMVert *BM_mesh_active_vert_get(BMesh *bm);
80 BMElem *BM_mesh_active_elem_get(BMesh *bm);
81
82 void    BM_editselection_center(BMEditSelection *ese, float r_center[3]);
83 void    BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);
84 void    BM_editselection_plane(BMEditSelection *ese,  float r_plane[3]);
85
86 #define BM_select_history_check(bm, ele)        _bm_select_history_check(bm,        &(ele)->head)
87 #define BM_select_history_remove(bm, ele)       _bm_select_history_remove(bm,       &(ele)->head)
88 #define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
89 #define BM_select_history_store(bm, ele)        _bm_select_history_store(bm,        &(ele)->head)
90
91 bool _bm_select_history_check(BMesh *bm,  const BMHeader *ele);
92 bool _bm_select_history_remove(BMesh *bm,       BMHeader *ele);
93 void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele);
94 void _bm_select_history_store(BMesh *bm,        BMHeader *ele);
95
96 void BM_select_history_validate(BMesh *bm);
97 void BM_select_history_clear(BMesh *em);
98 bool BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese);
99
100 #endif /* __BMESH_MARKING_H__ */