[Bf-blender-cvs] [bbd7f94d8a5] master: Cleanup: Python GPU: change prefix 'bpygpu_' to 'py_' in static functions

Germano Cavalcante noreply at git.blender.org
Fri Dec 11 20:06:31 CET 2020


Commit: bbd7f94d8a51e4a6c57dbcc49cea1fb2afcb8ff3
Author: Germano Cavalcante
Date:   Fri Dec 11 16:05:58 2020 -0300
Branches: master
https://developer.blender.org/rBbbd7f94d8a51e4a6c57dbcc49cea1fb2afcb8ff3

Cleanup: Python GPU: change prefix 'bpygpu_' to 'py_' in static functions

===================================================================

M	source/blender/python/gpu/gpu_py_batch.c
M	source/blender/python/gpu/gpu_py_element.c
M	source/blender/python/gpu/gpu_py_matrix.c
M	source/blender/python/gpu/gpu_py_offscreen.c
M	source/blender/python/gpu/gpu_py_select.c
M	source/blender/python/gpu/gpu_py_shader.c
M	source/blender/python/gpu/gpu_py_vertex_buffer.c
M	source/blender/python/gpu/gpu_py_vertex_format.c

===================================================================

diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c
index 81d1cb7055d..9fb7aea162a 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -48,7 +48,7 @@
 /** \name Utility Functions
  * \{ */
 
-static bool bpygpu_batch_is_program_or_error(BPyGPUBatch *self)
+static bool py_batch_is_program_or_error(BPyGPUBatch *self)
 {
   if (!self->batch->shader) {
     PyErr_SetString(PyExc_RuntimeError, "batch does not have any program assigned to it");
@@ -63,7 +63,7 @@ static bool bpygpu_batch_is_program_or_error(BPyGPUBatch *self)
 /** \name GPUBatch Type
  * \{ */
 
-static PyObject *bpygpu_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
+static PyObject *py_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
 {
   BPYGPU_IS_INIT_OR_ERROR_OBJ;
 
@@ -121,7 +121,7 @@ static PyObject *bpygpu_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, Py
   return (PyObject *)ret;
 }
 
-PyDoc_STRVAR(bpygpu_Batch_vertbuf_add_doc,
+PyDoc_STRVAR(py_Batch_vertbuf_add_doc,
 ".. method:: vertbuf_add(buf)\n"
 "\n"
 "   Add another vertex buffer to the Batch.\n"
@@ -134,7 +134,7 @@ PyDoc_STRVAR(bpygpu_Batch_vertbuf_add_doc,
 "   :param buf: The vertex buffer that will be added to the batch.\n"
 "   :type buf: :class:`gpu.types.GPUVertBuf`\n"
 );
-static PyObject *bpygpu_Batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_buf)
+static PyObject *py_Batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_buf)
 {
   if (!BPyGPUVertBuf_Check(py_buf)) {
     PyErr_Format(PyExc_TypeError, "Expected a GPUVertBuf, got %s", Py_TYPE(py_buf)->tp_name);
@@ -167,7 +167,7 @@ static PyObject *bpygpu_Batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_b
 }
 
 PyDoc_STRVAR(
-    bpygpu_Batch_program_set_doc,
+    py_Batch_program_set_doc,
     ".. method:: program_set(program)\n"
     "\n"
     "   Assign a shader to this batch that will be used for drawing when not overwritten later.\n"
@@ -177,7 +177,7 @@ PyDoc_STRVAR(
     "\n"
     "   :param program: The program/shader the batch will use in future draw calls.\n"
     "   :type program: :class:`gpu.types.GPUShader`\n");
-static PyObject *bpygpu_Batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader)
+static PyObject *py_Batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader)
 {
   if (!BPyGPUShader_Check(py_shader)) {
     PyErr_Format(PyExc_TypeError, "Expected a GPUShader, got %s", Py_TYPE(py_shader)->tp_name);
@@ -208,7 +208,7 @@ static PyObject *bpygpu_Batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_sh
   Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(bpygpu_Batch_draw_doc,
+PyDoc_STRVAR(py_Batch_draw_doc,
              ".. method:: draw(program=None)\n"
              "\n"
              "   Run the drawing program with the parameters assigned to the batch.\n"
@@ -216,7 +216,7 @@ PyDoc_STRVAR(bpygpu_Batch_draw_doc,
              "   :param program: Program that performs the drawing operations.\n"
              "      If ``None`` is passed, the last program set to this batch will run.\n"
              "   :type program: :class:`gpu.types.GPUShader`\n");
-static PyObject *bpygpu_Batch_draw(BPyGPUBatch *self, PyObject *args)
+static PyObject *py_Batch_draw(BPyGPUBatch *self, PyObject *args)
 {
   BPyGPUShader *py_program = NULL;
 
@@ -224,7 +224,7 @@ static PyObject *bpygpu_Batch_draw(BPyGPUBatch *self, PyObject *args)
     return NULL;
   }
   if (py_program == NULL) {
-    if (!bpygpu_batch_is_program_or_error(self)) {
+    if (!py_batch_is_program_or_error(self)) {
       return NULL;
     }
   }
@@ -236,42 +236,42 @@ static PyObject *bpygpu_Batch_draw(BPyGPUBatch *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
-static PyObject *bpygpu_Batch_program_use_begin(BPyGPUBatch *self)
+static PyObject *py_Batch_program_use_begin(BPyGPUBatch *self)
 {
-  if (!bpygpu_batch_is_program_or_error(self)) {
+  if (!py_batch_is_program_or_error(self)) {
     return NULL;
   }
   GPU_shader_bind(self->batch->shader);
   Py_RETURN_NONE;
 }
 
-static PyObject *bpygpu_Batch_program_use_end(BPyGPUBatch *self)
+static PyObject *py_Batch_program_use_end(BPyGPUBatch *self)
 {
-  if (!bpygpu_batch_is_program_or_error(self)) {
+  if (!py_batch_is_program_or_error(self)) {
     return NULL;
   }
   GPU_shader_unbind();
   Py_RETURN_NONE;
 }
 
-static struct PyMethodDef bpygpu_Batch_methods[] = {
-    {"vertbuf_add", (PyCFunction)bpygpu_Batch_vertbuf_add, METH_O, bpygpu_Batch_vertbuf_add_doc},
-    {"program_set", (PyCFunction)bpygpu_Batch_program_set, METH_O, bpygpu_Batch_program_set_doc},
-    {"draw", (PyCFunction)bpygpu_Batch_draw, METH_VARARGS, bpygpu_Batch_draw_doc},
-    {"_program_use_begin", (PyCFunction)bpygpu_Batch_program_use_begin, METH_NOARGS, ""},
-    {"_program_use_end", (PyCFunction)bpygpu_Batch_program_use_end, METH_NOARGS, ""},
+static struct PyMethodDef py_Batch_methods[] = {
+    {"vertbuf_add", (PyCFunction)py_Batch_vertbuf_add, METH_O, py_Batch_vertbuf_add_doc},
+    {"program_set", (PyCFunction)py_Batch_program_set, METH_O, py_Batch_program_set_doc},
+    {"draw", (PyCFunction)py_Batch_draw, METH_VARARGS, py_Batch_draw_doc},
+    {"_program_use_begin", (PyCFunction)py_Batch_program_use_begin, METH_NOARGS, ""},
+    {"_program_use_end", (PyCFunction)py_Batch_program_use_end, METH_NOARGS, ""},
     {NULL, NULL, 0, NULL},
 };
 
 #ifdef USE_GPU_PY_REFERENCES
 
-static int bpygpu_Batch_traverse(BPyGPUBatch *self, visitproc visit, void *arg)
+static int py_Batch_traverse(BPyGPUBatch *self, visitproc visit, void *arg)
 {
   Py_VISIT(self->references);
   return 0;
 }
 
-static int bpygpu_Batch_clear(BPyGPUBatch *self)
+static int py_Batch_clear(BPyGPUBatch *self)
 {
   Py_CLEAR(self->references);
   return 0;
@@ -279,14 +279,14 @@ static int bpygpu_Batch_clear(BPyGPUBatch *self)
 
 #endif
 
-static void bpygpu_Batch_dealloc(BPyGPUBatch *self)
+static void py_Batch_dealloc(BPyGPUBatch *self)
 {
   GPU_batch_discard(self->batch);
 
 #ifdef USE_GPU_PY_REFERENCES
   if (self->references) {
     PyObject_GC_UnTrack(self);
-    bpygpu_Batch_clear(self);
+    py_Batch_clear(self);
     Py_XDECREF(self->references);
   }
 #endif
@@ -319,17 +319,17 @@ PyDoc_STRVAR(
 PyTypeObject BPyGPUBatch_Type = {
     PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUBatch",
     .tp_basicsize = sizeof(BPyGPUBatch),
-    .tp_dealloc = (destructor)bpygpu_Batch_dealloc,
+    .tp_dealloc = (destructor)py_Batch_dealloc,
 #ifdef USE_GPU_PY_REFERENCES
     .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
     .tp_doc = py_gpu_batch_doc,
-    .tp_traverse = (traverseproc)bpygpu_Batch_traverse,
-    .tp_clear = (inquiry)bpygpu_Batch_clear,
+    .tp_traverse = (traverseproc)py_Batch_traverse,
+    .tp_clear = (inquiry)py_Batch_clear,
 #else
     .tp_flags = Py_TPFLAGS_DEFAULT,
 #endif
-    .tp_methods = bpygpu_Batch_methods,
-    .tp_new = bpygpu_Batch_new,
+    .tp_methods = py_Batch_methods,
+    .tp_new = py_Batch_new,
 };
 
 /** \} */
diff --git a/source/blender/python/gpu/gpu_py_element.c b/source/blender/python/gpu/gpu_py_element.c
index c863c9a586f..0a1aecde986 100644
--- a/source/blender/python/gpu/gpu_py_element.c
+++ b/source/blender/python/gpu/gpu_py_element.c
@@ -39,7 +39,7 @@
 /** \name IndexBuf Type
  * \{ */
 
-static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
+static PyObject *py_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
 {
   BPYGPU_IS_INIT_OR_ERROR_OBJ;
 
@@ -175,7 +175,7 @@ static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
   return BPyGPUIndexBuf_CreatePyObject(GPU_indexbuf_build(&builder));
 }
 
-static void bpygpu_IndexBuf_dealloc(BPyGPUIndexBuf *self)
+static void py_IndexBuf_dealloc(BPyGPUIndexBuf *self)
 {
   GPU_indexbuf_discard(self->elem);
   Py_TYPE(self)->tp_free(self);
@@ -199,10 +199,10 @@ PyDoc_STRVAR(py_gpu_element_doc,
 PyTypeObject BPyGPUIndexBuf_Type = {
     PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUIndexBuf",
     .tp_basicsize = sizeof(BPyGPUIndexBuf),
-    .tp_dealloc = (destructor)bpygpu_IndexBuf_dealloc,
+    .tp_dealloc = (destructor)py_IndexBuf_dealloc,
     .tp_flags = Py_TPFLAGS_DEFAULT,
     .tp_doc = py_gpu_element_doc,
-    .tp_new = bpygpu_IndexBuf_new,
+    .tp_new = py_IndexBuf_new,
 };
 
 /** \} */
diff --git a/source/blender/python/gpu/gpu_py_matrix.c b/source/blender/python/gpu/gpu_py_matrix.c
index 93cca78bad9..a479f270770 100644
--- a/source/blender/python/gpu/gpu_py_matrix.c
+++ b/source/blender/python/gpu/gpu_py_matrix.c
@@ -44,7 +44,7 @@
 /** \name Helper Functions
  * \{ */
 
-static bool bpygpu_stack_is_push_model_view_ok_or_error(void)
+static bool py_stack_is_push_model_view_ok_or_error(void)
 {
   if (GPU_matrix_stack_level_get_model_view() >= GPU_PY_MATRIX_STACK_LEN) {
     PyErr_SetString(
@@ -55,7 +55,7 @@ static bool bpygpu_stack_is_push_model_view_ok_or_error(void)
   return true;
 }
 
-static bool bpygpu_stack_is_push_projection_ok_or_error(void)
+static bool py_stack_is_push_projection_ok_or_error(void)
 {
   if (GPU_matrix_stack_level_get_projection() >= GPU_PY_MATRIX_STACK_LEN) {
     PyErr_SetString(
@@ -66,7 +66,7 @@ static bool bpygpu_stack_is_push_projection_ok_or_error(void)
   return true;
 }
 
-static bool bpygpu_stack_is_pop_model_view_ok_or_error(void)
+static bool py_stack_is_pop_model_view_ok_or_error(void)
 {
   if (GPU_matrix_stack_level_get_model_view() == 0) {
     PyErr_SetString(PyExc_RuntimeError, "Minimum model-view stack depth reached");
@@ -75,7 +75,7 @@ static bool bpygpu_stack_is_pop_model_view_ok_or_error(void)
   return true;
 }
 
-static bool bpygpu_stack_is_pop_projection_ok_or_error(void)
+static bool py_stack_is_pop_projection_ok_or_error(void)
 {
   if (GPU_matrix_stack_level_get_projection() == 0) {
     PyErr_SetString(PyExc_RuntimeError, "Minimum projection stack depth reached");
@@ -90,52 +90,52 @@ static bool bpygpu_stack_is_pop_projection_ok_or_error(void)
 /** \name Manage Stack
  * \{ */
 
-PyDoc_STRVAR(bpygpu_matrix_push_doc,
+PyDoc_STRVAR(py_matrix_push_doc,
              ".. function:: push()\n"
              "\n"
              "   Add to the model-view matrix stack.\n");
-static PyObject *bpygpu_matrix_push

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list