Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-02-22 15:44:57 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-02-24 16:58:15 +0300
commit5be72125bf4dfddf5dfe720caa12b3163f540faf (patch)
treea2621e56ff36667e94c3c8c1c280dd610f0ab473 /source/blender/python
parent8f6fd07b54653befe9568cca2752603c74ab5667 (diff)
Cleanup: Move some utilities to 'gpu_py.h'
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/gpu/gpu_py.c19
-rw-r--r--source/blender/python/gpu/gpu_py.h13
-rw-r--r--source/blender/python/gpu/gpu_py_api.c20
-rw-r--r--source/blender/python/gpu/gpu_py_api.h12
-rw-r--r--source/blender/python/gpu/gpu_py_batch.c1
-rw-r--r--source/blender/python/gpu/gpu_py_element.c1
-rw-r--r--source/blender/python/gpu/gpu_py_framebuffer.c2
-rw-r--r--source/blender/python/gpu/gpu_py_offscreen.c2
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c2
-rw-r--r--source/blender/python/gpu/gpu_py_texture.c1
-rw-r--r--source/blender/python/gpu/gpu_py_uniformbuffer.c1
11 files changed, 35 insertions, 39 deletions
diff --git a/source/blender/python/gpu/gpu_py.c b/source/blender/python/gpu/gpu_py.c
index 2c5daaf1962..7aea940da94 100644
--- a/source/blender/python/gpu/gpu_py.c
+++ b/source/blender/python/gpu/gpu_py.c
@@ -23,6 +23,7 @@
#include <Python.h>
+#include "GPU_init_exit.h"
#include "GPU_primitive.h"
#include "GPU_texture.h"
@@ -58,3 +59,21 @@ struct PyC_StringEnumItems bpygpu_dataformat_items[] = {
{0, NULL},
};
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Utilities
+ * \{ */
+
+bool bpygpu_is_init_or_error(void)
+{
+ if (!GPU_is_init()) {
+ PyErr_SetString(PyExc_SystemError,
+ "GPU functions for drawing are not available in background mode");
+
+ return false;
+ }
+
+ return true;
+}
+
+/** \} */
diff --git a/source/blender/python/gpu/gpu_py.h b/source/blender/python/gpu/gpu_py.h
index 28b3e41a08f..39e5997f866 100644
--- a/source/blender/python/gpu/gpu_py.h
+++ b/source/blender/python/gpu/gpu_py.h
@@ -22,3 +22,16 @@
extern struct PyC_StringEnumItems bpygpu_primtype_items[];
extern struct PyC_StringEnumItems bpygpu_dataformat_items[];
+
+bool bpygpu_is_init_or_error(void);
+
+#define BPYGPU_IS_INIT_OR_ERROR_OBJ \
+ if (UNLIKELY(!bpygpu_is_init_or_error())) { \
+ return NULL; \
+ } \
+ ((void)0)
+#define BPYGPU_IS_INIT_OR_ERROR_INT \
+ if (UNLIKELY(!bpygpu_is_init_or_error())) { \
+ return -1; \
+ } \
+ ((void)0)
diff --git a/source/blender/python/gpu/gpu_py_api.c b/source/blender/python/gpu/gpu_py_api.c
index 7213dc59886..68f7eb9816c 100644
--- a/source/blender/python/gpu/gpu_py_api.c
+++ b/source/blender/python/gpu/gpu_py_api.c
@@ -30,8 +30,6 @@
#include "../generic/python_utildefines.h"
-#include "GPU_init_exit.h"
-
#include "gpu_py_matrix.h"
#include "gpu_py_select.h"
#include "gpu_py_state.h"
@@ -40,24 +38,6 @@
#include "gpu_py_api.h" /* own include */
/* -------------------------------------------------------------------- */
-/** \name Utils to invalidate functions
- * \{ */
-
-bool bpygpu_is_init_or_error(void)
-{
- if (!GPU_is_init()) {
- PyErr_SetString(PyExc_SystemError,
- "GPU functions for drawing are not available in background mode");
-
- return false;
- }
-
- return true;
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
/** \name GPU Module
* \{ */
diff --git a/source/blender/python/gpu/gpu_py_api.h b/source/blender/python/gpu/gpu_py_api.h
index 5e399a233aa..38452ad67c1 100644
--- a/source/blender/python/gpu/gpu_py_api.h
+++ b/source/blender/python/gpu/gpu_py_api.h
@@ -25,15 +25,3 @@
// #define BPYGPU_USE_GPUOBJ_FREE_METHOD
PyObject *BPyInit_gpu(void);
-
-bool bpygpu_is_init_or_error(void);
-#define BPYGPU_IS_INIT_OR_ERROR_OBJ \
- if (UNLIKELY(!bpygpu_is_init_or_error())) { \
- return NULL; \
- } \
- ((void)0)
-#define BPYGPU_IS_INIT_OR_ERROR_INT \
- if (UNLIKELY(!bpygpu_is_init_or_error())) { \
- return -1; \
- } \
- ((void)0)
diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c
index 9989077670b..ef795268158 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -39,7 +39,6 @@
#include "../generic/py_capi_utils.h"
#include "gpu_py.h"
-#include "gpu_py_api.h"
#include "gpu_py_element.h"
#include "gpu_py_shader.h"
#include "gpu_py_vertex_buffer.h"
diff --git a/source/blender/python/gpu/gpu_py_element.c b/source/blender/python/gpu/gpu_py_element.c
index 0e5094cbbc0..2beabe6a93d 100644
--- a/source/blender/python/gpu/gpu_py_element.c
+++ b/source/blender/python/gpu/gpu_py_element.c
@@ -33,7 +33,6 @@
#include "../generic/python_utildefines.h"
#include "gpu_py.h"
-#include "gpu_py_api.h"
#include "gpu_py_element.h" /* own include */
/* -------------------------------------------------------------------- */
diff --git a/source/blender/python/gpu/gpu_py_framebuffer.c b/source/blender/python/gpu/gpu_py_framebuffer.c
index 04d49a9f15d..5bf577f3b96 100644
--- a/source/blender/python/gpu/gpu_py_framebuffer.c
+++ b/source/blender/python/gpu/gpu_py_framebuffer.c
@@ -34,7 +34,7 @@
#include "../generic/python_utildefines.h"
#include "../mathutils/mathutils.h"
-#include "gpu_py_api.h"
+#include "gpu_py.h"
#include "gpu_py_texture.h"
#include "gpu_py_framebuffer.h" /* own include */
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index a98d9649f6f..9d5671ff702 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -52,7 +52,7 @@
#include "../generic/py_capi_utils.h"
-#include "gpu_py_api.h"
+#include "gpu_py.h"
#include "gpu_py_offscreen.h" /* own include */
/* Define the free method to avoid breakage. */
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 2f9b67bdb6a..4237e2d4b2d 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -33,7 +33,7 @@
#include "../generic/python_utildefines.h"
#include "../mathutils/mathutils.h"
-#include "gpu_py_api.h"
+#include "gpu_py.h"
#include "gpu_py_texture.h"
#include "gpu_py_uniformbuffer.h"
#include "gpu_py_vertex_format.h"
diff --git a/source/blender/python/gpu/gpu_py_texture.c b/source/blender/python/gpu/gpu_py_texture.c
index 85246bffac7..12855b8dbcc 100644
--- a/source/blender/python/gpu/gpu_py_texture.c
+++ b/source/blender/python/gpu/gpu_py_texture.c
@@ -33,7 +33,6 @@
#include "../generic/py_capi_utils.h"
#include "gpu_py.h"
-#include "gpu_py_api.h"
#include "gpu_py_buffer.h"
#include "gpu_py_texture.h" /* own include */
diff --git a/source/blender/python/gpu/gpu_py_uniformbuffer.c b/source/blender/python/gpu/gpu_py_uniformbuffer.c
index d1b86455918..c60d6216834 100644
--- a/source/blender/python/gpu/gpu_py_uniformbuffer.c
+++ b/source/blender/python/gpu/gpu_py_uniformbuffer.c
@@ -34,7 +34,6 @@
#include "../generic/py_capi_utils.h"
#include "gpu_py.h"
-#include "gpu_py_api.h"
#include "gpu_py_buffer.h"
#include "gpu_py_uniformbuffer.h" /* own include */