[Bf-blender-cvs] [6ae84ddc6e7] blender2.8: Py API Docs: GPUBatch documentation

Jacques Lucke noreply at git.blender.org
Tue Nov 13 13:00:22 CET 2018


Commit: 6ae84ddc6e7c40d89896c3c5a4f7c67dceb586d5
Author: Jacques Lucke
Date:   Tue Nov 13 12:59:50 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB6ae84ddc6e7c40d89896c3c5a4f7c67dceb586d5

Py API Docs: GPUBatch documentation

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

M	source/blender/python/gpu/gpu_py_batch.c

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

diff --git a/source/blender/python/gpu/gpu_py_batch.c b/source/blender/python/gpu/gpu_py_batch.c
index b3bdf663621..add813dd928 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -130,7 +130,16 @@ static PyObject *bpygpu_Batch_new(PyTypeObject *UNUSED(type), PyObject *args, Py
 }
 
 PyDoc_STRVAR(bpygpu_Batch_vertbuf_add_doc,
-"TODO"
+".. method:: vertbuf_add(buf)\n"
+"\n"
+"   Add another vertex buffer to the Batch. \n"
+"   It is not possible to add more vertices to the batch using this method. \n"
+"   Instead it can be used to add more attributes to the existing vertices. \n"
+"   A good use case would be when you have a separate vertex buffer for vertex positions and vertex normals. \n"
+"   Current a batch can have at most " STRINGIFY(GPU_BATCH_VBO_MAX_LEN) " vertex buffers. \n"
+"\n"
+"   :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)
 {
@@ -165,7 +174,14 @@ static PyObject *bpygpu_Batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_b
 }
 
 PyDoc_STRVAR(bpygpu_Batch_program_set_doc,
-"TODO"
+".. method:: program_set(program)\n"
+"\n"
+"   Assign a shader to this batch that will be used for drawing when not overwritten later. \n"
+"   Note: This method has to be called in the draw context that the batch will be drawn in. \n"
+"   This function does not need to be called when you always set the shader when calling `batch.draw`. \n"
+"\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)
 {
@@ -307,21 +323,21 @@ PyDoc_STRVAR(py_gpu_batch_doc,
 "Contains VAOs + VBOs + Shader representing a drawable entity."
 "\n"
 "   :param type: One of these primitive types: {\n"
-"       'POINTS',\n"
-"       'LINES',\n"
-"       'TRIS',\n"
-"       'LINE_STRIP',\n"
-"       'LINE_LOOP',\n"
-"       'TRI_STRIP',\n"
-"       'TRI_FAN',\n"
-"       'LINES_ADJ',\n"
-"       'TRIS_ADJ',\n"
-"       'LINE_STRIP_ADJ'}\n"
-"   :type type: `str`\n"
-"   :param buf: Vertex buffer.\n"
-"   :type buf: :class: `gpu.types.GPUVertBuf`\n"
-"   :param elem: Optional Index buffer.\n"
-"   :type elem: :class: `gpu.types.GPUIndexBuf`\n"
+"       `POINTS`,\n"
+"       `LINES`,\n"
+"       `TRIS`,\n"
+"       `LINE_STRIP`,\n"
+"       `LINE_LOOP`,\n"
+"       `TRI_STRIP`,\n"
+"       `TRI_FAN`,\n"
+"       `LINES_ADJ`,\n"
+"       `TRIS_ADJ`,\n"
+"       `LINE_STRIP_ADJ` }\n"
+"   :type type: :class:`str`\n"
+"   :param buf: Vertex buffer containing all or some of the attributes required for drawing.\n"
+"   :type buf: :class:`gpu.types.GPUVertBuf`\n"
+"   :param elem: Optional index buffer.\n"
+"   :type elem: :class:`gpu.types.GPUIndexBuf`\n"
 );
 PyTypeObject BPyGPUBatch_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)



More information about the Bf-blender-cvs mailing list