[Bf-blender-cvs] [c8975b0fc71] blender2.8: Py API Docs: GPUVertFormat documentation

Jacques Lucke noreply at git.blender.org
Tue Nov 13 15:26:12 CET 2018


Commit: c8975b0fc71c0e02f7bb7bc4680077b5745a6931
Author: Jacques Lucke
Date:   Tue Nov 13 15:25:22 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBc8975b0fc71c0e02f7bb7bc4680077b5745a6931

Py API Docs: GPUVertFormat documentation

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

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_vertex_buffer.c b/source/blender/python/gpu/gpu_py_vertex_buffer.c
index 37357fa115c..19d47a3e4e7 100644
--- a/source/blender/python/gpu/gpu_py_vertex_buffer.c
+++ b/source/blender/python/gpu/gpu_py_vertex_buffer.c
@@ -253,7 +253,7 @@ PyDoc_STRVAR(bpygpu_VertBuf_attr_fill_doc,
 "   :param id: Either the name or the id of the attribute.\n"
 "   :type id: int or str\n"
 "   :param data: Sequence of data that should be stored in the buffer\n"
-"   :type data: sequence of individual values or tuples\n"
+"   :type data: sequence of values or tuples\n"
 );
 static PyObject *bpygpu_VertBuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds)
 {
diff --git a/source/blender/python/gpu/gpu_py_vertex_format.c b/source/blender/python/gpu/gpu_py_vertex_format.c
index 0f863d04227..27f3791ec15 100644
--- a/source/blender/python/gpu/gpu_py_vertex_format.c
+++ b/source/blender/python/gpu/gpu_py_vertex_format.c
@@ -162,7 +162,22 @@ static PyObject *bpygpu_VertFormat_new(PyTypeObject *UNUSED(type), PyObject *arg
 }
 
 PyDoc_STRVAR(bpygpu_VertFormat_attr_add_doc,
-"TODO"
+".. method:: attr_add(id, comp_type, len, fetch_mode)\n"
+"\n"
+"   Add a new attribute to the format.\n"
+"\n"
+"   :param id: Name the attribute. Often `position`, `normal`, ...\n"
+"   :type id: str\n"
+"   :param comp_type: The data type that will be used store the value in memory.\n"
+"      Possible values are `I8`, `U8`, `I16`, `U16`, `I32`, `U32`, `F32` and `I10`.\n"
+"   :type comp_type: `str`\n"
+"   :param len: How many individual values the attribute consists of (e.g. 2 for uv coordinates).\n"
+"   :type len: int\n"
+"   :param fetch_mode: How values from memory will be converted when used in the shader.\n"
+"      This is mainly useful for memory optimizations when you want to store values with reduced precision.\n"
+"      E.g. you can store a float in only 1 byte but it will be converted to a normal 4 byte float when used.\n"
+"      Possible values are `FLOAT`, `INT`, `INT_TO_FLOAT_UNIT` and `INT_TO_FLOAT`.\n"
+"   :type fetch_mode: `str`\n"
 );
 static PyObject *bpygpu_VertFormat_attr_add(BPyGPUVertFormat *self, PyObject *args, PyObject *kwds)
 {
@@ -206,12 +221,18 @@ static void bpygpu_VertFormat_dealloc(BPyGPUVertFormat *self)
 	Py_TYPE(self)->tp_free(self);
 }
 
+PyDoc_STRVAR(bpygpu_VertFormat_doc,
+".. class:: GPUVertFormat()\n"
+"\n"
+"   This object contains information about the structure of a vertex buffer.\n"
+);
 PyTypeObject BPyGPUVertFormat_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	.tp_name = "GPUVertFormat",
 	.tp_basicsize = sizeof(BPyGPUVertFormat),
 	.tp_dealloc = (destructor)bpygpu_VertFormat_dealloc,
 	.tp_flags = Py_TPFLAGS_DEFAULT,
+	.tp_doc = bpygpu_VertFormat_doc,
 	.tp_methods = bpygpu_VertFormat_methods,
 	.tp_new = bpygpu_VertFormat_new,
 };



More information about the Bf-blender-cvs mailing list