Blender V5.3
bmesh_marking.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_enum_flags.hh"
12#include "BLI_map.hh"
13
14#include "bmesh_class.hh"
15
16namespace blender {
17
23
25 None = 0,
26 RecalcLenVert = (1 << 0),
27 RecalcLenEdge = (1 << 1),
28 RecalcLenFace = (1 << 2),
37 Down = (1 << 3),
38};
40
41#define BMSelectFlushFlag_All \
42 (BMSelectFlushFlag::RecalcLenVert | BMSelectFlushFlag::RecalcLenEdge | \
43 BMSelectFlushFlag::RecalcLenFace)
44
45#define BMSelectFlushFlag_Default BMSelectFlushFlag_All
46
47/* Geometry hiding code. */
48
49#define BM_elem_hide_set(bm, ele, hide) _bm_elem_hide_set(bm, &(ele)->head, hide)
50void _bm_elem_hide_set(BMesh *bm, BMHeader *head, bool hide);
51void BM_vert_hide_set(BMVert *v, bool hide);
52void BM_edge_hide_set(BMEdge *e, bool hide);
53void BM_face_hide_set(BMFace *f, bool hide);
54
55/* Selection code. */
56
61void BM_elem_select_set(BMesh *bm, BMElem *ele, bool select);
62
64 BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test);
66 BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test);
67
68void BM_mesh_elem_hflag_enable_all(BMesh *bm, char htype, char hflag, bool respecthide);
69void BM_mesh_elem_hflag_disable_all(BMesh *bm, char htype, char hflag, bool respecthide);
70
71/* Individual element select functions, #BM_elem_select_set is a shortcut for these
72 * that automatically detects which one to use. */
73
80void BM_vert_select_set(BMesh *bm, BMVert *v, bool select);
86void BM_edge_select_set(BMesh *bm, BMEdge *e, bool select);
93void BM_face_select_set(BMesh *bm, BMFace *f, bool select);
94
95/* Lower level functions which don't do flushing. */
96
97void BM_edge_select_set_noflush(BMesh *bm, BMEdge *e, bool select);
98void BM_face_select_set_noflush(BMesh *bm, BMFace *f, bool select);
99
103bool BM_mesh_select_is_mixed(const BMesh *bm);
104
113void BM_mesh_select_mode_clean_ex(BMesh *bm, short selectmode);
114void BM_mesh_select_mode_clean(BMesh *bm);
115
122void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
133void BM_mesh_select_mode_flush_ex(BMesh *bm, short selectmode, BMSelectFlushFlag flag);
134void BM_mesh_select_mode_flush(BMesh *bm);
135
142void BM_mesh_select_flush_from_verts(BMesh *bm, bool select);
143
144int BM_mesh_elem_hflag_count_enabled(BMesh *bm, char htype, char hflag, bool respecthide);
145int BM_mesh_elem_hflag_count_disabled(BMesh *bm, char htype, char hflag, bool respecthide);
146
147/* Edit selection stuff. */
148
149void BM_mesh_active_face_set(BMesh *bm, BMFace *f);
150int BM_mesh_active_face_index_get(BMesh *bm, bool is_sloppy, bool is_selected);
153
154BMFace *BM_mesh_active_face_get(BMesh *bm, bool is_sloppy, bool is_selected);
155BMEdge *BM_mesh_active_edge_get(BMesh *bm);
156BMVert *BM_mesh_active_vert_get(BMesh *bm);
157BMElem *BM_mesh_active_elem_get(BMesh *bm);
158
168void BM_editselection_center(BMEditSelection *ese, float r_center[3]);
169void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);
175void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]);
176
177#define BM_select_history_check(bm, ele) _bm_select_history_check(bm, &(ele)->head)
178#define BM_select_history_remove(bm, ele) _bm_select_history_remove(bm, &(ele)->head)
179#define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
180#define BM_select_history_store(bm, ele) _bm_select_history_store(bm, &(ele)->head)
181#define BM_select_history_store_head_notest(bm, ele) \
182 _bm_select_history_store_head_notest(bm, &(ele)->head)
183#define BM_select_history_store_head(bm, ele) _bm_select_history_store_head(bm, &(ele)->head)
184#define BM_select_history_store_after_notest(bm, ese_ref, ele) \
185 _bm_select_history_store_after_notest(bm, ese_ref, &(ele)->head)
186#define BM_select_history_store_after(bm, ese, ese_ref) \
187 _bm_select_history_store_after(bm, ese_ref, &(ele)->head)
188
189bool _bm_select_history_check(BMesh *bm, const BMHeader *ele);
190bool _bm_select_history_remove(BMesh *bm, BMHeader *ele);
191void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele);
192void _bm_select_history_store(BMesh *bm, BMHeader *ele);
193void _bm_select_history_store_head_notest(BMesh *bm, BMHeader *ele);
194void _bm_select_history_store_head(BMesh *bm, BMHeader *ele);
195void _bm_select_history_store_after(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele);
196void _bm_select_history_store_after_notest(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele);
197
198void BM_select_history_validate(BMesh *bm);
199void BM_select_history_clear(BMesh *bm);
203[[nodiscard]] char BM_select_history_htype_all(const BMesh *bm);
207bool BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese);
211struct GHash *BM_select_history_map_create(BMesh *bm);
212
217 Map<void *, void *> *vert_map,
218 Map<void *, void *> *edge_map,
219 Map<void *, void *> *face_map,
220 bool use_chain);
221
222#define BM_SELECT_HISTORY_BACKUP(bm) \
223 { \
224 ListBaseT<BMEditSelection> _bm_prev_selected = (bm)->selected; \
225 BLI_listbase_clear(&(bm)->selected)
226
227#define BM_SELECT_HISTORY_RESTORE(bm) \
228 (bm)->selected = _bm_prev_selected; \
229 } \
230 (void)0
231
232} // namespace blender
#define ENUM_OPERATORS(_enum_type)
#define select(A, B, C)
BMesh Iterators.
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BM_editselection_center(BMEditSelection *ese, float r_center[3])
char BM_select_history_htype_all(const BMesh *bm)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void BM_mesh_select_mode_clean(BMesh *bm)
int BM_mesh_active_edge_index_get(BMesh *bm)
void BM_mesh_select_mode_flush(BMesh *bm)
int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, const bool respecthide)
BMEdge * BM_mesh_active_edge_get(BMesh *bm)
void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode)
Select Mode Clean.
GHash * BM_select_history_map_create(BMesh *bm)
void _bm_select_history_store_after_notest(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele)
void BM_face_select_set_noflush(BMesh *bm, BMFace *f, const bool select)
void BM_mesh_active_face_set(BMesh *bm, BMFace *f)
void BM_vert_hide_set(BMVert *v, const bool hide)
void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag, const bool respecthide, const bool overwrite, const char hflag_test)
void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select)
void BM_face_select_set(BMesh *bm, BMFace *f, const bool select)
Select Face.
unsigned char uint8_t
Definition BKE_text.h:79
bool _bm_select_history_remove(BMesh *bm, BMHeader *ele)
int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void _bm_select_history_store_head(BMesh *bm, BMHeader *ele)
void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
int BM_mesh_active_face_index_get(BMesh *bm, bool is_sloppy, bool is_selected)
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
void BM_select_history_validate(BMesh *bm)
void _bm_elem_hide_set(BMesh *bm, BMHeader *head, const bool hide)
BMFace * BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag, const bool respecthide, const bool overwrite, const char hflag_test)
BMElem * BM_mesh_active_elem_get(BMesh *bm)
void BM_face_hide_set(BMFace *f, const bool hide)
bool _bm_select_history_check(BMesh *bm, const BMHeader *ele)
void BM_select_history_merge_from_targetmap(BMesh *bm, Map< void *, void * > *vert_map, Map< void *, void * > *edge_map, Map< void *, void * > *face_map, const bool use_chain)
void BM_select_history_clear(BMesh *bm)
void _bm_select_history_store_head_notest(BMesh *bm, BMHeader *ele)
void BM_mesh_select_flush_from_verts(BMesh *bm, const bool select)
void _bm_select_history_store(BMesh *bm, BMHeader *ele)
bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
int BM_mesh_active_vert_index_get(BMesh *bm)
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
void BM_edge_select_set_noflush(BMesh *bm, BMEdge *e, const bool select)
BMVert * BM_mesh_active_vert_get(BMesh *bm)
void _bm_select_history_store_after(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele)
void BM_edge_hide_set(BMEdge *e, const bool hide)
bool BM_mesh_select_is_mixed(const BMesh *bm)
void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, BMSelectFlushFlag flag)
Select Mode Flush.
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
Select Edge.
struct BMEditSelection * next
struct BMEditSelection * prev