[Bf-blender-cvs] [b71b1ae384a] master: Python GPU: Improve the Python GPU API documentation
Germano Cavalcante
noreply at git.blender.org
Tue Mar 16 16:55:56 CET 2021
Commit: b71b1ae384a3e8cda43bb005a1beeddbf30f86ed
Author: Germano Cavalcante
Date: Tue Mar 16 12:48:00 2021 -0300
Branches: master
https://developer.blender.org/rBb71b1ae384a3e8cda43bb005a1beeddbf30f86ed
Python GPU: Improve the Python GPU API documentation
This fixes some errors of continuity and consistency of formatting on
https://docs.blender.org/api/current/gpu.html
This also details the description of some parameters.
Differential Revision: https://developer.blender.org/D10531
===================================================================
M source/blender/python/gpu/gpu_py_batch.c
M source/blender/python/gpu/gpu_py_buffer.c
M source/blender/python/gpu/gpu_py_element.c
M source/blender/python/gpu/gpu_py_framebuffer.c
M source/blender/python/gpu/gpu_py_offscreen.c
M source/blender/python/gpu/gpu_py_shader.c
M source/blender/python/gpu/gpu_py_state.c
M source/blender/python/gpu/gpu_py_texture.c
M source/blender/python/gpu/gpu_py_uniformbuffer.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 8e803350b53..5214d156adf 100644
--- a/source/blender/python/gpu/gpu_py_batch.c
+++ b/source/blender/python/gpu/gpu_py_batch.c
@@ -295,18 +295,10 @@ PyDoc_STRVAR(
"\n"
" Reusable container for drawable geometry.\n"
"\n"
- " :arg 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"
+ " :arg type: The primitive type of geometry to be drawn.\n"
+ " Possible values are `POINTS`, `LINES`, `TRIS`, `LINE_STRIP`, `LINE_LOOP`, `TRI_STRIP`, "
+ "`TRI_FAN`, `LINES_ADJ`, `TRIS_ADJ` and `LINE_STRIP_ADJ`.\n"
+ " :type type: str\n"
" :arg buf: Vertex buffer containing all or some of the attributes required for drawing.\n"
" :type buf: :class:`gpu.types.GPUVertBuf`\n"
" :arg elem: An optional index buffer.\n"
diff --git a/source/blender/python/gpu/gpu_py_buffer.c b/source/blender/python/gpu/gpu_py_buffer.c
index 420a7873517..d0965e83e33 100644
--- a/source/blender/python/gpu/gpu_py_buffer.c
+++ b/source/blender/python/gpu/gpu_py_buffer.c
@@ -589,23 +589,19 @@ static PyBufferProcs pygpu_buffer__tp_as_buffer = {
};
#endif
-PyDoc_STRVAR(pygpu_buffer__tp_doc,
- ".. class:: Buffer(format, dimensions, data)\n"
- "\n"
- " For Python access to GPU functions requiring a pointer.\n"
- "\n"
- " :arg format: One of these primitive types: {\n"
- " `FLOAT`,\n"
- " `INT`,\n"
- " `UINT`,\n"
- " `UBYTE`,\n"
- " `UINT_24_8`,\n"
- " `10_11_11_REV`,\n"
- " :type type: `str`\n"
- " :arg dimensions: Array describing the dimensions.\n"
- " :type dimensions: `int`\n"
- " :arg data: Optional data array.\n"
- " :type data: `array`\n");
+PyDoc_STRVAR(
+ pygpu_buffer__tp_doc,
+ ".. class:: Buffer(format, dimensions, data)\n"
+ "\n"
+ " For Python access to GPU functions requiring a pointer.\n"
+ "\n"
+ " :arg format: Format type to interpret the buffer.\n"
+ " Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n"
+ " :type type: str\n"
+ " :arg dimensions: Array describing the dimensions.\n"
+ " :type dimensions: int\n"
+ " :arg data: Optional data array.\n"
+ " :type data: sequence\n");
PyTypeObject BPyGPU_BufferType = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "Buffer",
.tp_basicsize = sizeof(BPyGPUBuffer),
diff --git a/source/blender/python/gpu/gpu_py_element.c b/source/blender/python/gpu/gpu_py_element.c
index 2beabe6a93d..0cb5e9a2785 100644
--- a/source/blender/python/gpu/gpu_py_element.c
+++ b/source/blender/python/gpu/gpu_py_element.c
@@ -184,12 +184,9 @@ PyDoc_STRVAR(pygpu_IndexBuf__tp_doc,
"\n"
" Contains an index buffer.\n"
"\n"
- " :param type: One of these primitive types: {\n"
- " `POINTS`,\n"
- " `LINES`,\n"
- " `TRIS`,\n"
- " `LINE_STRIP_ADJ` }\n"
- " :type type: `str`\n"
+ " :arg type: The primitive type this index buffer is composed of.\n"
+ " Possible values are `POINTS`, `LINES`, `TRIS` and `LINE_STRIP_ADJ`.\n"
+ " :type type: str\n"
" :param seq: Indices this index buffer will contain.\n"
" Whether a 1D or 2D sequence is required depends on the type.\n"
" Optionally the sequence can support the buffer protocol.\n"
diff --git a/source/blender/python/gpu/gpu_py_framebuffer.c b/source/blender/python/gpu/gpu_py_framebuffer.c
index 5bf577f3b96..34d17bb10c3 100644
--- a/source/blender/python/gpu/gpu_py_framebuffer.c
+++ b/source/blender/python/gpu/gpu_py_framebuffer.c
@@ -356,9 +356,9 @@ PyDoc_STRVAR(pygpu_framebuffer_clear_doc,
" :arg color: float sequence each representing ``(r, g, b, a)``.\n"
" :type color: sequence of 3 or 4 floats\n"
" :arg depth: depth value.\n"
- " :type depth: `float`\n"
+ " :type depth: float\n"
" :arg stencil: stencil value.\n"
- " :type stencil: `int`\n");
+ " :type stencil: int\n");
static PyObject *pygpu_framebuffer_clear(BPyGPUFrameBuffer *self, PyObject *args, PyObject *kwds)
{
PYGPU_FRAMEBUFFER_CHECK_OBJ(self);
@@ -417,7 +417,7 @@ PyDoc_STRVAR(pygpu_framebuffer_viewport_set_doc,
"\n"
" :param x, y: lower left corner of the viewport_set rectangle, in pixels.\n"
" :param xsize, ysize: width and height of the viewport_set.\n"
- " :type x, y, xsize, ysize: `int`\n");
+ " :type x, y, xsize, ysize: int\n");
static PyObject *pygpu_framebuffer_viewport_set(BPyGPUFrameBuffer *self,
PyObject *args,
void *UNUSED(type))
@@ -510,10 +510,10 @@ PyDoc_STRVAR(pygpu_framebuffer__tp_doc,
"\n"
" :arg depth_slot: GPUTexture to attach or a `dict` containing keywords: "
"'texture', 'layer' and 'mip'.\n"
- " :type depth_slot: :class:`gpu.types.GPUTexture`, `dict` or `Nonetype`\n"
+ " :type depth_slot: :class:`gpu.types.GPUTexture`, dict or Nonetype\n"
" :arg color_slots: Tuple where each item can be a GPUTexture or a `dict` "
"containing keywords: 'texture', 'layer' and 'mip'.\n"
- " :type color_slots: `tuple` or `Nonetype`\n");
+ " :type color_slots: tuple or Nonetype\n");
PyTypeObject BPyGPUFrameBuffer_Type = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUFrameBuffer",
.tp_basicsize = sizeof(BPyGPUFrameBuffer),
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index 4a2b359bf39..9e9a0b9066a 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -184,7 +184,7 @@ PyDoc_STRVAR(pygpu_offscreen_unbind_doc,
"\n"
" :arg restore: Restore the OpenGL state, can only be used when the state has been "
"saved before.\n"
- " :type restore: `bool`\n");
+ " :type restore: bool\n");
static PyObject *pygpu_offscreen_unbind(BPyGPUOffScreen *self, PyObject *args, PyObject *kwds)
{
bool restore = true;
@@ -412,9 +412,9 @@ PyDoc_STRVAR(pygpu_offscreen__tp_doc,
" This object gives access to off screen buffers.\n"
"\n"
" :arg width: Horizontal dimension of the buffer.\n"
- " :type width: `int`\n"
+ " :type width: int\n"
" :arg height: Vertical dimension of the buffer.\n"
- " :type height: `int`\n");
+ " :type height: int\n");
PyTypeObject BPyGPUOffScreen_Type = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUOffScreen",
.tp_basicsize = sizeof(BPyGPUOffScreen),
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 4237e2d4b2d..fc3a7d1360b 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -130,9 +130,9 @@ PyDoc_STRVAR(pygpu_shader_uniform_from_name_doc,
" Get uniform location by name.\n"
"\n"
" :param name: Name of the uniform variable whose location is to be queried.\n"
- " :type name: `str`\n"
+ " :type name: str\n"
" :return: Location of the uniform variable.\n"
- " :rtype: `int`\n");
+ " :rtype: int\n");
static PyObject *pygpu_shader_uniform_from_name(BPyGPUShader *self, PyObject *arg)
{
const char *name = PyUnicode_AsUTF8(arg);
@@ -157,9 +157,9 @@ PyDoc_STRVAR(
" Get uniform block location by name.\n"
"\n"
" :param name: Name of the uniform block variable whose location is to be queried.\n"
- " :type name: `str`\n"
+ " :type name: str\n"
" :return: The location of the uniform block variable.\n"
- " :rtype: `int`\n");
+ " :rtype: int\n");
static PyObject *pygpu_shader_uniform_block_from_name(BPyGPUShader *self, PyObject *arg)
{
const char *name = PyUnicode_AsUTF8(arg);
@@ -559,7 +559,7 @@ PyDoc_STRVAR(pygpu_shader_calc_format_doc,
" Build a new format based on the attributes of the shader.\n"
"\n"
" :return: vertex attribute format for the shader\n"
- " :rtype: GPUVertFormat\n");
+ " :rtype: :class:`gpu.types.GPUVertFormat`\n");
static PyObject *pygpu_shader_calc_format(BPyGPUShader *self, PyObject *UNUSED(arg))
{
BPyGPUVertFormat *ret = (BPyGPUVertFormat *)BPyGPUVertFormat_CreatePyObject(NULL);
diff --git a/source/blender/python/gpu/gpu_py_state.c b/source/blender/python/gpu/gpu_py_state.c
index d1b3a01e2e4..110f5a6ff55 100644
--- a/source/blender/python/gpu/gpu_py_state.c
+++ b/source/blender/python/gpu/gpu_py_state.c
@@ -78,24 +78,27 @@ static const struct PyC_StringEnumItems pygpu_state_faceculling_items[] = {
/** \name Manage Stack
* \{ */
-PyDoc_STRVAR(pygpu_state_blend_set_doc,
- ".. function:: blend_set(mode)\n"
- "\n"
- " Defines the fixed pipeline blending equation.\n"
- "\n"
- " :param mode: One of these modes: {\n"
- " `NONE`,\n"
- " `ALPHA`,\n"
- " `ALPHA_PREMULT`,\n"
- " `ADDITIVE`,\n"
- " `ADDITIVE_PREMULT`,\n"
- " `MULTIPLY`,\n"
- " `SUBTRACT`,\n"
- "
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list