diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-08-20 10:23:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-08-20 10:26:51 +0300 |
commit | 8037f3602f12080a1692746e5ee0b6c46c7c3d76 (patch) | |
tree | cbad4e4bffc75d264b21f2c9133ad28f22bd78de /source/blender/gpu/intern/gpu_matrix.c | |
parent | 33b265c4fb532523b8707d99799bf36b25b7b1e3 (diff) |
PyAPI: Add exceptions to stack push/pop
Raise exception when stack limits are reached.
Diffstat (limited to 'source/blender/gpu/intern/gpu_matrix.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_matrix.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c index f03a076a9fd..7f024a18ba7 100644 --- a/source/blender/gpu/intern/gpu_matrix.c +++ b/source/blender/gpu/intern/gpu_matrix.c @@ -30,7 +30,9 @@ */ #define SUPPRESS_GENERIC_MATRIX_API +#define USE_GPU_PY_MATRIX_API /* only so values are declared */ #include "GPU_matrix.h" +#undef USE_GPU_PY_MATRIX_API #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" @@ -622,3 +624,24 @@ bool gpuMatricesDirty(void) { return state.dirty; } + + +/* -------------------------------------------------------------------- */ + +/** \name Python API Helpers + * \{ */ +BLI_STATIC_ASSERT(GPU_PY_MATRIX_STACK_LEN + 1 == MATRIX_STACK_DEPTH, "define mismatch"); + +/* Return int since caller is may subtract. */ + +int GPU_matrix_stack_level_get_model_view(void) +{ + return (int)state.model_view_stack.top; +} + +int GPU_matrix_stack_level_get_projection(void) +{ + return (int)state.projection_stack.top; +} + +/** \} */ |