Blender V5.0
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 "bmesh_class.hh"
12
18
19enum class BMSelectFlushFlag : uint8_t {
20 None = 0,
21 RecalcLenVert = (1 << 0),
22 RecalcLenEdge = (1 << 1),
23 RecalcLenFace = (1 << 2),
32 Down = (1 << 3),
33};
35
36#define BMSelectFlushFlag_All \
37 (BMSelectFlushFlag::RecalcLenVert | BMSelectFlushFlag::RecalcLenEdge | \
38 BMSelectFlushFlag::RecalcLenFace)
39
40#define BMSelectFlushFlag_Default BMSelectFlushFlag_All
41
42/* Geometry hiding code. */
43
44#define BM_elem_hide_set(bm, ele, hide) _bm_elem_hide_set(bm, &(ele)->head, hide)
45void _bm_elem_hide_set(BMesh *bm, BMHeader *head, bool hide);
46void BM_vert_hide_set(BMVert *v, bool hide);
47void BM_edge_hide_set(BMEdge *e, bool hide);
48void BM_face_hide_set(BMFace *f, bool hide);
49
50/* Selection code. */
51
57
59 BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test);
61 BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test);
62
63void BM_mesh_elem_hflag_enable_all(BMesh *bm, char htype, char hflag, bool respecthide);
64void BM_mesh_elem_hflag_disable_all(BMesh *bm, char htype, char hflag, bool respecthide);
65
66/* Individual element select functions, #BM_elem_select_set is a shortcut for these
67 * that automatically detects which one to use. */
68
88void BM_face_select_set(BMesh *bm, BMFace *f, bool select);
89
90/* Lower level functions which don't do flushing. */
91
94
99
108void BM_mesh_select_mode_clean_ex(BMesh *bm, short selectmode);
110
117void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
130
138
139int BM_mesh_elem_hflag_count_enabled(BMesh *bm, char htype, char hflag, bool respecthide);
140int BM_mesh_elem_hflag_count_disabled(BMesh *bm, char htype, char hflag, bool respecthide);
141
142/* Edit selection stuff. */
143
145int BM_mesh_active_face_index_get(BMesh *bm, bool is_sloppy, bool is_selected);
148
149BMFace *BM_mesh_active_face_get(BMesh *bm, bool is_sloppy, bool is_selected);
153
163void BM_editselection_center(BMEditSelection *ese, float r_center[3]);
164void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);
170void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]);
171
172#define BM_select_history_check(bm, ele) _bm_select_history_check(bm, &(ele)->head)
173#define BM_select_history_remove(bm, ele) _bm_select_history_remove(bm, &(ele)->head)
174#define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
175#define BM_select_history_store(bm, ele) _bm_select_history_store(bm, &(ele)->head)
176#define BM_select_history_store_head_notest(bm, ele) \
177 _bm_select_history_store_head_notest(bm, &(ele)->head)
178#define BM_select_history_store_head(bm, ele) _bm_select_history_store_head(bm, &(ele)->head)
179#define BM_select_history_store_after_notest(bm, ese_ref, ele) \
180 _bm_select_history_store_after_notest(bm, ese_ref, &(ele)->head)
181#define BM_select_history_store_after(bm, ese, ese_ref) \
182 _bm_select_history_store_after(bm, ese_ref, &(ele)->head)
183
192
198[[nodiscard]] char BM_select_history_htype_all(const BMesh *bm);
207
212 BMesh *bm, GHash *vert_map, GHash *edge_map, GHash *face_map, bool use_chain);
213
214#define BM_SELECT_HISTORY_BACKUP(bm) \
215 { \
216 ListBase _bm_prev_selected = (bm)->selected; \
217 BLI_listbase_clear(&(bm)->selected)
218
219#define BM_SELECT_HISTORY_RESTORE(bm) \
220 (bm)->selected = _bm_prev_selected; \
221 } \
222 (void)0
#define ENUM_OPERATORS(_type, _max)
BMesh * bm
BMVert * BM_mesh_active_vert_get(BMesh *bm)
void BM_select_history_merge_from_targetmap(BMesh *bm, GHash *vert_map, GHash *edge_map, GHash *face_map, bool use_chain)
void BM_select_history_clear(BMesh *bm)
BMSelectFlushFlag
bool _bm_select_history_check(BMesh *bm, const BMHeader *ele)
void _bm_select_history_store_head_notest(BMesh *bm, BMHeader *ele)
int BM_mesh_active_face_index_get(BMesh *bm, bool is_sloppy, bool is_selected)
char BM_select_history_htype_all(const BMesh *bm)
int BM_mesh_active_edge_index_get(BMesh *bm)
void BM_mesh_select_mode_flush(BMesh *bm)
void BM_mesh_select_mode_clean_ex(BMesh *bm, short selectmode)
Select Mode Clean.
void BM_edge_select_set(BMesh *bm, BMEdge *e, bool select)
Select Edge.
void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
BMEdge * BM_mesh_active_edge_get(BMesh *bm)
void BM_mesh_elem_hflag_enable_test(BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, char htype, char hflag, bool respecthide)
bool _bm_select_history_remove(BMesh *bm, BMHeader *ele)
int BM_mesh_elem_hflag_count_enabled(BMesh *bm, char htype, char hflag, bool respecthide)
void _bm_select_history_store_head(BMesh *bm, BMHeader *ele)
void BM_mesh_select_flush_from_verts(BMesh *bm, bool select)
void _bm_select_history_store_after(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele)
void BM_vert_select_set(BMesh *bm, BMVert *v, bool select)
Select Vert.
void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele)
int BM_mesh_active_vert_index_get(BMesh *bm)
bool BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese)
void BM_mesh_select_mode_flush_ex(BMesh *bm, short selectmode, BMSelectFlushFlag flag)
Select Mode Flush.
void BM_edge_select_set_noflush(BMesh *bm, BMEdge *e, bool select)
void _bm_elem_hide_set(BMesh *bm, BMHeader *head, bool hide)
void BM_vert_hide_set(BMVert *v, bool hide)
BMElem * BM_mesh_active_elem_get(BMesh *bm)
void BM_mesh_select_mode_clean(BMesh *bm)
void BM_editselection_center(BMEditSelection *ese, float r_center[3])
void _bm_select_history_store_after_notest(BMesh *bm, BMEditSelection *ese_ref, BMHeader *ele)
void BM_select_history_validate(BMesh *bm)
void BM_elem_select_set(BMesh *bm, BMElem *ele, bool select)
BMFace * BM_mesh_active_face_get(BMesh *bm, bool is_sloppy, bool is_selected)
void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
void BM_face_select_set_noflush(BMesh *bm, BMFace *f, bool select)
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
void BM_face_select_set(BMesh *bm, BMFace *f, bool select)
Select Face.
void BM_mesh_elem_hflag_enable_all(BMesh *bm, char htype, char hflag, bool respecthide)
int BM_mesh_elem_hflag_count_disabled(BMesh *bm, char htype, char hflag, bool respecthide)
struct GHash * BM_select_history_map_create(BMesh *bm)
void BM_mesh_active_face_set(BMesh *bm, BMFace *f)
void _bm_select_history_store(BMesh *bm, BMHeader *ele)
void BM_edge_hide_set(BMEdge *e, bool hide)
void BM_mesh_elem_hflag_disable_test(BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test)
bool BM_mesh_select_is_mixed(const BMesh *bm)
void BM_face_hide_set(BMFace *f, bool hide)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define select(A, B, C)
struct BMEditSelection * next
struct BMEditSelection * prev
uint8_t flag
Definition wm_window.cc:145