diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-07-01 12:07:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-07-01 12:29:22 +0300 |
commit | 0a026033ae46c83a84fcca54112190e1aa80d51f (patch) | |
tree | 0a8b4e77b0247a6b480c3d9c82953dd25cf3b5bc /source/blender/bmesh/intern/bmesh_operator_api_inline.h | |
parent | 4b0aeaf327d383ec760171261a1087abbb714d04 (diff) |
BMesh: make toolflags optional
Saves 8 bytes per vert/edge/face.
Gives overall ~20-25% memory saving for dyntopo sculpting
and modifiers that use BMesh.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_operator_api_inline.h')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operator_api_inline.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h index 00fcd9e7a9b..eb1c161f19d 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h +++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h @@ -39,32 +39,37 @@ /* flags 15 and 16 (1 << 14 and 1 << 15) are reserved for bmesh api use */ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) -BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag) +BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, const BMFlagLayer *oflags, const short oflag) { + BLI_assert(bm->use_toolflags); return oflags[bm->toolflag_index].f & oflag; } ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) -BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, BMFlagLayer *oflags, const short oflag) +BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, const BMFlagLayer *oflags, const short oflag) { + BLI_assert(bm->use_toolflags); return (oflags[bm->toolflag_index].f & oflag) != 0; } ATTR_NONNULL(1, 2) BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag) { + BLI_assert(bm->use_toolflags); oflags[bm->toolflag_index].f |= oflag; } ATTR_NONNULL(1, 2) BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag) { + BLI_assert(bm->use_toolflags); oflags[bm->toolflag_index].f &= (short)~oflag; } ATTR_NONNULL(1, 2) BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val) { + BLI_assert(bm->use_toolflags); if (val) oflags[bm->toolflag_index].f |= oflag; else oflags[bm->toolflag_index].f &= (short)~oflag; } @@ -72,6 +77,7 @@ BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short o ATTR_NONNULL(1, 2) BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag) { + BLI_assert(bm->use_toolflags); oflags[bm->toolflag_index].f ^= oflag; } |