[Bf-blender-cvs] [d0dad026043] blender2.8: Cleanup: use lowercase prefix for local API's

Campbell Barton noreply at git.blender.org
Fri Aug 18 00:55:57 CEST 2017


Commit: d0dad0260434c4420fa9756264c1cc5e745e5ec9
Author: Campbell Barton
Date:   Fri Aug 18 08:58:06 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBd0dad0260434c4420fa9756264c1cc5e745e5ec9

Cleanup: use lowercase prefix for local API's

Also some minor corrections.

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

M	intern/gawain/gawain/gwn_batch.h
M	source/blender/python/gawain/gwn_py_api.h
M	source/blender/python/gawain/gwn_py_types.c
M	source/blender/python/gawain/gwn_py_types.h

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

diff --git a/intern/gawain/gawain/gwn_batch.h b/intern/gawain/gawain/gwn_batch.h
index 750463ca10f..9bcb7437163 100644
--- a/intern/gawain/gawain/gwn_batch.h
+++ b/intern/gawain/gawain/gwn_batch.h
@@ -77,7 +77,7 @@ void GWN_batch_uniform_1f(Gwn_Batch*, const char* name, float value);
 void GWN_batch_uniform_2f(Gwn_Batch*, const char* name, float x, float y);
 void GWN_batch_uniform_3f(Gwn_Batch*, const char* name, float x, float y, float z);
 void GWN_batch_uniform_4f(Gwn_Batch*, const char* name, float x, float y, float z, float w);
-void GWN_batch_uniform_2fv(Gwn_Batch*, const char* name, const float data[3]);
+void GWN_batch_uniform_2fv(Gwn_Batch*, const char* name, const float data[2]);
 void GWN_batch_uniform_3fv(Gwn_Batch*, const char* name, const float data[3]);
 void GWN_batch_uniform_4fv(Gwn_Batch*, const char* name, const float data[4]);
 
diff --git a/source/blender/python/gawain/gwn_py_api.h b/source/blender/python/gawain/gwn_py_api.h
index 115ff6c5f24..aacb14094bc 100644
--- a/source/blender/python/gawain/gwn_py_api.h
+++ b/source/blender/python/gawain/gwn_py_api.h
@@ -22,7 +22,7 @@
 #define __GWN_PY_API__
 
 /** \file blender/python/gawain/gwn_py_api.h
- *  \ingroup pygen
+ *  \ingroup pygawain
  */
 
 PyObject *BPyInit_gawain(void);
diff --git a/source/blender/python/gawain/gwn_py_types.c b/source/blender/python/gawain/gwn_py_types.c
index 903dce14e8e..daa48995894 100644
--- a/source/blender/python/gawain/gwn_py_types.c
+++ b/source/blender/python/gawain/gwn_py_types.c
@@ -20,6 +20,9 @@
 
 /** \file blender/python/gawain/gwn_py_types.c
  *  \ingroup pygawain
+ *
+ * - Use ``bpygwn_`` for local API.
+ * - Use ``BPyGwn_`` for public API.
  */
 
 #include <Python.h>
@@ -57,7 +60,7 @@
  * Use with PyArg_ParseTuple's "O&" formatting.
  * \{ */
 
-static int BPy_Gwn_ParseVertCompType(PyObject *o, void *p)
+static int bpygwn_ParseVertCompType(PyObject *o, void *p)
 {
 	Py_ssize_t comp_type_id_len;
 	const char *comp_type_id = _PyUnicode_AsStringAndSize(o, &comp_type_id_len);
@@ -96,7 +99,7 @@ success:
 	return 1;
 }
 
-static int BPy_Gwn_ParseVertFetchMode(PyObject *o, void *p)
+static int bpygwn_ParseVertFetchMode(PyObject *o, void *p)
 {
 	Py_ssize_t mode_id_len;
 	const char *mode_id = _PyUnicode_AsStringAndSize(o, &mode_id_len);
@@ -130,7 +133,7 @@ success:
 	return 1;
 }
 
-static int BPy_Gwn_ParsePrimType(PyObject *o, void *p)
+static int bpygwn_ParsePrimType(PyObject *o, void *p)
 {
 	Py_ssize_t mode_id_len;
 	const char *mode_id = _PyUnicode_AsStringAndSize(o, &mode_id_len);
@@ -226,7 +229,7 @@ static void fill_format_tuple(void *data_dst_void, PyObject *py_src, const Gwn_V
 
 #undef PY_AS_NATIVE_SWITCH
 
-static bool pygwn_vertbuf_fill_impl(
+static bool bpygwn_vertbuf_fill_impl(
         Gwn_VertBuf *vbo,
         uint data_id, PyObject *seq)
 {
@@ -294,7 +297,7 @@ finally:
 
 /* handy, but not used just now */
 #if 0
-static int pygwn_find_id(const Gwn_VertFormat *fmt, const char *id)
+static int bpygwn_find_id(const Gwn_VertFormat *fmt, const char *id)
 {
 	for (int i = 0; i < fmt->attrib_ct; i++) {
 		for (uint j = 0; j < fmt->name_ct; j++) {
@@ -315,7 +318,7 @@ static int pygwn_find_id(const Gwn_VertFormat *fmt, const char *id)
 /** \name VertFormat Type
  * \{ */
 
-static PyObject *BPy_Gwn_VertFormat_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
+static PyObject *bpygwn_VertFormat_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
 {
 	if (PyTuple_GET_SIZE(args) || (kwds && PyDict_Size(kwds))) {
 		PyErr_SetString(PyExc_TypeError,
@@ -323,15 +326,15 @@ static PyObject *BPy_Gwn_VertFormat_new(PyTypeObject *UNUSED(type), PyObject *ar
 		return NULL;
 	}
 
-	BPy_Gwn_VertFormat *ret = (BPy_Gwn_VertFormat *)BPy_Gwn_VertFormat_CreatePyObject(NULL);
+	BPyGwn_VertFormat *ret = (BPyGwn_VertFormat *)BPyGwn_VertFormat_CreatePyObject(NULL);
 
 	return (PyObject *)ret;
 }
 
-PyDoc_STRVAR(BPy_Gwn_VertFormat_attr_add_doc,
+PyDoc_STRVAR(bpygwn_VertFormat_attr_add_doc,
 "TODO"
 );
-static PyObject *BPy_Gwn_VertFormat_attr_add(BPy_Gwn_VertFormat *self, PyObject *args, PyObject *kwds)
+static PyObject *bpygwn_VertFormat_attr_add(BPyGwn_VertFormat *self, PyObject *args, PyObject *kwds)
 {
 	static const char *kwlist[] = {"id", "comp_type", "len", "fetch_mode", NULL};
 
@@ -350,9 +353,9 @@ static PyObject *BPy_Gwn_VertFormat_attr_add(BPy_Gwn_VertFormat *self, PyObject
 	if (!PyArg_ParseTupleAndKeywords(
 	        args, kwds, "$sO&IO&:attr_add", (char **)kwlist,
 	        &params.id,
-	        BPy_Gwn_ParseVertCompType, &params.comp_type,
+	        bpygwn_ParseVertCompType, &params.comp_type,
 	        &params.len,
-	        BPy_Gwn_ParseVertFetchMode, &params.fetch_mode))
+	        bpygwn_ParseVertFetchMode, &params.fetch_mode))
 	{
 		return NULL;
 	}
@@ -361,26 +364,26 @@ static PyObject *BPy_Gwn_VertFormat_attr_add(BPy_Gwn_VertFormat *self, PyObject
 	return PyLong_FromLong(attr_id);
 }
 
-static struct PyMethodDef BPy_Gwn_VertFormat_methods[] = {
-	{"attr_add", (PyCFunction) BPy_Gwn_VertFormat_attr_add,
-	 METH_VARARGS | METH_KEYWORDS, BPy_Gwn_VertFormat_attr_add_doc},
+static struct PyMethodDef bpygwn_VertFormat_methods[] = {
+	{"attr_add", (PyCFunction)bpygwn_VertFormat_attr_add,
+	 METH_VARARGS | METH_KEYWORDS, bpygwn_VertFormat_attr_add_doc},
 	{NULL, NULL, 0, NULL}
 };
 
 
-static void BPy_Gwn_VertFormat_dealloc(BPy_Gwn_VertFormat *self)
+static void bpygwn_VertFormat_dealloc(BPyGwn_VertFormat *self)
 {
 	Py_TYPE(self)->tp_free(self);
 }
 
-PyTypeObject BPy_Gwn_VertFormat_Type = {
+PyTypeObject BPyGwn_VertFormat_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	.tp_name = "Gwn_VertFormat",
-	.tp_basicsize = sizeof(BPy_Gwn_VertFormat),
-	.tp_dealloc = (destructor)BPy_Gwn_VertFormat_dealloc,
+	.tp_basicsize = sizeof(BPyGwn_VertFormat),
+	.tp_dealloc = (destructor)bpygwn_VertFormat_dealloc,
 	.tp_flags = Py_TPFLAGS_DEFAULT,
-	.tp_methods = BPy_Gwn_VertFormat_methods,
-	.tp_new = BPy_Gwn_VertFormat_new,
+	.tp_methods = bpygwn_VertFormat_methods,
+	.tp_new = bpygwn_VertFormat_new,
 };
 
 /** \} */
@@ -391,12 +394,12 @@ PyTypeObject BPy_Gwn_VertFormat_Type = {
 /** \name VertBuf Type
  * \{ */
 
-static PyObject *BPy_Gwn_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
+static PyObject *bpygwn_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
 {
 	const char * const keywords[] = {"len", "format", NULL};
 
 	struct {
-		BPy_Gwn_VertFormat *py_fmt;
+		BPyGwn_VertFormat *py_fmt;
 		uint len;
 	} params;
 
@@ -404,7 +407,7 @@ static PyObject *BPy_Gwn_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
 	        args, kwds,
 	        "$IO!:Gwn_VertBuf.__new__", (char **)keywords,
 	        &params.len,
-	        &BPy_Gwn_VertFormat_Type, &params.py_fmt))
+	        &BPyGwn_VertFormat_Type, &params.py_fmt))
 	{
 		return NULL;
 	}
@@ -413,13 +416,13 @@ static PyObject *BPy_Gwn_VertBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
 
 	GWN_vertbuf_data_alloc(vbo, params.len);
 
-	return BPy_Gwn_VertBuf_CreatePyObject(vbo);
+	return BPyGwn_VertBuf_CreatePyObject(vbo);
 }
 
-PyDoc_STRVAR(BPy_Gwn_VertBuf_fill_doc,
+PyDoc_STRVAR(bpygwn_VertBuf_fill_doc,
 "TODO"
 );
-static PyObject *BPy_Gwn_VertBuf_fill(BPy_Gwn_VertBuf *self, PyObject *args, PyObject *kwds)
+static PyObject *bpygwn_VertBuf_fill(BPyGwn_VertBuf *self, PyObject *args, PyObject *kwds)
 {
 	static const char *kwlist[] = {"id", "data", NULL};
 
@@ -442,32 +445,32 @@ static PyObject *BPy_Gwn_VertBuf_fill(BPy_Gwn_VertBuf *self, PyObject *args, PyO
 		             params.id);
 	}
 
-	if (!pygwn_vertbuf_fill_impl(self->buf, params.id, params.py_seq_data)) {
+	if (!bpygwn_vertbuf_fill_impl(self->buf, params.id, params.py_seq_data)) {
 		return NULL;
 	}
 	Py_RETURN_NONE;
 }
 
-static struct PyMethodDef BPy_Gwn_VertBuf_methods[] = {
-	{"fill", (PyCFunction) BPy_Gwn_VertBuf_fill,
-	 METH_VARARGS | METH_KEYWORDS, BPy_Gwn_VertBuf_fill_doc},
+static struct PyMethodDef bpygwn_VertBuf_methods[] = {
+	{"fill", (PyCFunction) bpygwn_VertBuf_fill,
+	 METH_VARARGS | METH_KEYWORDS, bpygwn_VertBuf_fill_doc},
 	{NULL, NULL, 0, NULL}
 };
 
-static void BPy_Gwn_VertBuf_dealloc(BPy_Gwn_VertBuf *self)
+static void bpygwn_VertBuf_dealloc(BPyGwn_VertBuf *self)
 {
 	GWN_vertbuf_discard(self->buf);
 	Py_TYPE(self)->tp_free(self);
 }
 
-PyTypeObject BPy_Gwn_VertBuf_Type = {
+PyTypeObject BPyGwn_VertBuf_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	.tp_name = "Gwn_VertBuf",
-	.tp_basicsize = sizeof(BPy_Gwn_VertBuf),
-	.tp_dealloc = (destructor)BPy_Gwn_VertBuf_dealloc,
+	.tp_basicsize = sizeof(BPyGwn_VertBuf),
+	.tp_dealloc = (destructor)bpygwn_VertBuf_dealloc,
 	.tp_flags = Py_TPFLAGS_DEFAULT,
-	.tp_methods = BPy_Gwn_VertBuf_methods,
-	.tp_new = BPy_Gwn_VertBuf_new,
+	.tp_methods = bpygwn_VertBuf_methods,
+	.tp_new = bpygwn_VertBuf_new,
 };
 
 /** \} */
@@ -478,26 +481,26 @@ PyTypeObject BPy_Gwn_VertBuf_Type = {
 /** \name VertBatch Type
  * \{ */
 
-static PyObject *BPy_Gwn_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
+static PyObject *bpygwn_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
 {
 	const char * const keywords[] = {"type", "buf", NULL};
 
 	struct {
 		Gwn_PrimType type_id;
-		BPy_Gwn_VertBuf *py_buf;
+		BPyGwn_VertBuf *py_buf;
 	} params;
 
 	if (!PyArg_ParseTupleAndKeywords(
 	        args, kwds,
 	        "$O&O!:Gwn_Batch.__new__", (char **)keywords,
-	        BPy_Gwn_ParsePrimType, &params.type_id,
-	        &BPy_Gwn_VertBuf_Type, &params.py_buf))
+	        bpygwn_ParsePrimType, &params.type_id,
+	        &BPyGwn_VertBuf_Type, &params.py_buf))
 	{
 		return NULL;
 	}
 
 	Gwn_Batch *batch = GWN_batch_create(params.type_id, params.py_buf->buf, NULL);
-	BPy_Gwn_Batch *ret = (BPy_Gwn_Batch *)BPy_Gwn_Batch_CreatePyObject(batch);
+	BPyGwn_Batch *ret = (BPyGwn_Batch *)BPyGwn_Batch_CreatePyObject(batch);
 
 #ifdef USE_GWN_PY_REFERENCES
 	ret->references = PyList_New(1);
@@ -509,12 +512,12 @@ static PyObject *BPy_Gwn_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, P
 	return (PyObject *)ret;
 }
 
-PyDoc_STRVAR(BPy_Gwn_VertBatch_vertbuf_add_doc,
+PyDoc_STRVAR(bpygwn_VertBatch_vertbuf_add_doc,
 "TODO"
 );
-static PyObject *BPy_Gwn_VertBatch_vertbuf_add(BPy_Gwn_Batch *self, BPy_Gwn_VertBuf 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list