Skip to content

Commit

Permalink
Cython: bmesh enums - BMHeader flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jfranmatheu committed Feb 14, 2025
1 parent a10a787 commit dc1f8cd
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions retopoflow/cy/bmesh_enums.pxd
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

0 comments on commit dc1f8cd

Please sign in to comment.