-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cython: bmesh enums - BMHeader flags
- Loading branch information
1 parent
a10a787
commit dc1f8cd
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# cython: language_level=3 | ||
|
||
import cython | ||
from libc.stdint cimport uint8_t | ||
|
||
from .bmesh_fast import BMHeader | ||
|
||
|
||
cdef enum BMElemHFlag: | ||
BM_ELEM_SELECT = (1 << 0) # 1 | ||
BM_ELEM_HIDDEN = (1 << 1) # 2 | ||
BM_ELEM_SEAM = (1 << 2) # 4 | ||
BM_ELEM_SMOOTH = (1 << 3) # 8 | ||
BM_ELEM_TAG = (1 << 4) # 16 | ||
BM_ELEM_DRAW = (1 << 5) # 32 | ||
BM_ELEM_TAG_ALT = (1 << 6) # 64 | ||
BM_ELEM_INTERNAL_TAG = (1 << 7) # 128 | ||
|
||
# Helper functions to check flags | ||
@cython.inline | ||
cdef bint BM_elem_flag_test(BMHeader head, uint8_t hflag) nogil: | ||
return head.hflag & hflag | ||
|
||
@cython.inline | ||
cdef void BM_elem_flag_set(BMHeader head, uint8_t hflag) nogil: | ||
head.hflag |= hflag | ||
|
||
@cython.inline | ||
cdef void BM_elem_flag_clear(BMHeader head, uint8_t hflag) nogil: | ||
head.hflag &= ~hflag | ||
|
||
@cython.inline | ||
cdef void BM_elem_flag_toggle(BMHeader head, uint8_t hflag) nogil: | ||
head.hflag ^= hflag |