Cleanup: prefer 'arg' over 'params' for sphinx documentation

While both are supported, 'arg' is in more common use so prefer it.
This commit is contained in:
Campbell Barton 2022-09-19 14:22:31 +10:00
parent 8a9f6a2e0a
commit 4baa6e57bd
27 changed files with 224 additions and 221 deletions

View File

@ -29,7 +29,7 @@ RE_DEF_COMPLETE = re.compile(
def reduce_newlines(text):
"""Reduces multiple newlines to a single newline.
:param text: text with multiple newlines
:arg text: text with multiple newlines
:type text: str
:returns: text with single newlines
:rtype: str
@ -43,7 +43,7 @@ def reduce_newlines(text):
def reduce_spaces(text):
"""Reduces multiple whitespaces to a single space.
:param text: text with multiple spaces
:arg text: text with multiple spaces
:type text: str
:returns: text with single spaces
:rtype: str
@ -57,7 +57,7 @@ def reduce_spaces(text):
def get_doc(obj):
"""Get the doc string or comments for an object.
:param object: object
:arg object: object
:returns: doc string
:rtype: str
@ -71,11 +71,11 @@ def get_doc(obj):
def get_argspec(func, *, strip_self=True, doc=None, source=None):
"""Get argument specifications.
:param strip_self: strip `self` from argspec
:arg strip_self: strip `self` from argspec
:type strip_self: bool
:param doc: doc string of func (optional)
:arg doc: doc string of func (optional)
:type doc: str
:param source: source code of func (optional)
:arg source: source code of func (optional)
:type source: str
:returns: argument specification
:rtype: str
@ -131,11 +131,11 @@ def get_argspec(func, *, strip_self=True, doc=None, source=None):
def complete(line, cursor, namespace):
"""Complete callable with calltip.
:param line: incomplete text line
:arg line: incomplete text line
:type line: str
:param cursor: current character position
:arg cursor: current character position
:type cursor: int
:param namespace: namespace
:arg namespace: namespace
:type namespace: dict
:returns: (matches, world, scrollback)
:rtype: (list of str, str, str)

View File

@ -76,7 +76,7 @@ def module_list(path):
Return the list containing the names of the modules available in
the given folder.
:param path: folder path
:arg path: folder path
:type path: str
:returns: modules
:rtype: list
@ -107,7 +107,7 @@ def complete(line):
"""
Returns a list containing the completion possibilities for an import line.
:param line:
:arg line:
incomplete line which contains an import statement::

View File

@ -27,9 +27,9 @@ def is_struct_seq(obj):
def complete_names(word, namespace):
"""Complete variable names or attributes
:param word: word to be completed
:arg word: word to be completed
:type word: str
:param namespace: namespace
:arg namespace: namespace
:type namespace: dict
:returns: completion matches
:rtype: list of str
@ -50,12 +50,12 @@ def complete_indices(word, namespace, *, obj=None, base=None):
* integer numbers for list
* any keys for dictionary
:param word: word to be completed
:arg word: word to be completed
:type word: str
:param namespace: namespace
:arg namespace: namespace
:type namespace: dict
:param obj: object evaluated from base
:param base: sub-string which can be evaluated into an object.
:arg obj: object evaluated from base
:arg base: sub-string which can be evaluated into an object.
:type base: str
:returns: completion matches
:rtype: list of str
@ -103,11 +103,11 @@ def complete(word, namespace, *, private=True):
"""Complete word within a namespace with the standard rlcompleter
module. Also supports index or key access [].
:param word: word to be completed
:arg word: word to be completed
:type word: str
:param namespace: namespace
:arg namespace: namespace
:type namespace: dict
:param private: whether private attribute/methods should be returned
:arg private: whether private attribute/methods should be returned
:type private: bool
:returns: completion matches
:rtype: list of str

View File

@ -43,13 +43,13 @@ def complete(line, cursor, namespace, private):
* index completion for lists and dictionaries
* module completion (from/import)
:param line: incomplete text line
:arg line: incomplete text line
:type line: str
:param cursor: current character position
:arg cursor: current character position
:type cursor: int
:param namespace: namespace
:arg namespace: namespace
:type namespace: dict
:param private: whether private variables should be listed
:arg private: whether private variables should be listed
:type private: bool
:returns: list of completions, word
:rtype: list, str
@ -82,13 +82,13 @@ def expand(line, cursor, namespace, *, private=True):
"""This method is invoked when the user asks autocompletion,
e.g. when Ctrl+Space is clicked.
:param line: incomplete text line
:arg line: incomplete text line
:type line: str
:param cursor: current character position
:arg cursor: current character position
:type cursor: int
:param namespace: namespace
:arg namespace: namespace
:type namespace: dict
:param private: whether private variables should be listed
:arg private: whether private variables should be listed
:type private: bool
:returns:

View File

@ -928,7 +928,8 @@ class TextureFromPool : public Texture, NonMovable {
* Dummy type to bind texture as image.
* It is just a GPUTexture in disguise.
*/
class Image {};
class Image {
};
static inline Image *as_image(GPUTexture *tex)
{

View File

@ -3415,7 +3415,7 @@ static void lineart_triangle_intersect_in_bounding_area(LineartTriangle *tri,
}
tt->testing_e[th->thread_id] = (LineartEdge *)tri;
if(!((testing_triangle->flags | tri->flags) & LRT_TRIANGLE_FORCE_INTERSECTION)){
if (!((testing_triangle->flags | tri->flags) & LRT_TRIANGLE_FORCE_INTERSECTION)) {
if ((testing_triangle->flags & LRT_TRIANGLE_NO_INTERSECTION) ||
(testing_triangle->flags & tri->flags & LRT_TRIANGLE_INTERSECTION_ONLY)) {
continue;

View File

@ -127,7 +127,7 @@ PyDoc_STRVAR(pygpu_batch_vertbuf_add_doc,
" 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"
" :arg buf: The vertex buffer that will be added to the batch.\n"
" :type buf: :class:`gpu.types.GPUVertBuf`\n"
);
static PyObject *pygpu_batch_vertbuf_add(BPyGPUBatch *self, BPyGPUVertBuf *py_buf)
@ -171,7 +171,7 @@ PyDoc_STRVAR(
" This function does not need to be called when you always\n"
" set the shader when calling :meth:`gpu.types.GPUBatch.draw`.\n"
"\n"
" :param program: The program/shader the batch will use in future draw calls.\n"
" :arg program: The program/shader the batch will use in future draw calls.\n"
" :type program: :class:`gpu.types.GPUShader`\n");
static PyObject *pygpu_batch_program_set(BPyGPUBatch *self, BPyGPUShader *py_shader)
{
@ -209,7 +209,7 @@ PyDoc_STRVAR(pygpu_batch_draw_doc,
"\n"
" Run the drawing program with the parameters assigned to the batch.\n"
"\n"
" :param program: Program that performs the drawing operations.\n"
" :arg 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 *pygpu_batch_draw(BPyGPUBatch *self, PyObject *args)

View File

@ -180,7 +180,7 @@ PyDoc_STRVAR(pygpu_IndexBuf__tp_doc,
" :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"
" :arg 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"
" :type seq: 1D or 2D sequence\n");

View File

@ -421,9 +421,10 @@ PyDoc_STRVAR(pygpu_framebuffer_viewport_set_doc,
" Set the viewport for this framebuffer object.\n"
" Note: The viewport state is not saved upon framebuffer rebind.\n"
"\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");
" :arg x, y: lower left corner of the viewport_set rectangle, in pixels.\n"
" :type x, y: int\n"
" :arg xsize, ysize: width and height of the viewport_set.\n"
" :type xsize, ysize: int\n");
static PyObject *pygpu_framebuffer_viewport_set(BPyGPUFrameBuffer *self,
PyObject *args,
void *UNUSED(type))
@ -462,14 +463,14 @@ PyDoc_STRVAR(
"\n"
" Read a block of pixels from the frame buffer.\n"
"\n"
" :param x, y: Lower left corner of a rectangular block of pixels.\n"
" :param xsize, ysize: Dimensions of the pixel rectangle.\n"
" :arg x, y: Lower left corner of a rectangular block of pixels.\n"
" :arg xsize, ysize: Dimensions of the pixel rectangle.\n"
" :type x, y, xsize, ysize: int\n"
" :param channels: Number of components to read.\n"
" :arg channels: Number of components to read.\n"
" :type channels: int\n"
" :param slot: The framebuffer slot to read data from.\n"
" :arg slot: The framebuffer slot to read data from.\n"
" :type slot: int\n"
" :param format: The format that describes the content of a single channel.\n"
" :arg format: The format that describes the content of a single channel.\n"
" Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n"
" :type format: str\n"
" :arg data: Optional Buffer object to fill with the pixels values.\n"
@ -569,9 +570,10 @@ PyDoc_STRVAR(pygpu_framebuffer_read_depth_doc,
"\n"
" Read a pixel depth block from the frame buffer.\n"
"\n"
" :param x, y: Lower left corner of a rectangular block of pixels.\n"
" :param xsize, ysize: Dimensions of the pixel rectangle.\n"
" :type x, y, xsize, ysize: int\n"
" :arg x, y: Lower left corner of a rectangular block of pixels.\n"
" :type x, y: int\n"
" :arg xsize, ysize: Dimensions of the pixel rectangle.\n"
" :type xsize, ysize: int\n"
" :arg data: Optional Buffer object to fill with the pixels values.\n"
" :type data: :class:`gpu.types.Buffer`\n"
" :return: The Buffer with the read pixels.\n"

View File

@ -266,7 +266,7 @@ PyDoc_STRVAR(pygpu_matrix_multiply_matrix_doc,
"\n"
" Multiply the current stack matrix.\n"
"\n"
" :param matrix: A 4x4 matrix.\n"
" :arg matrix: A 4x4 matrix.\n"
" :type matrix: :class:`mathutils.Matrix`\n");
static PyObject *pygpu_matrix_multiply_matrix(PyObject *UNUSED(self), PyObject *value)
{
@ -283,7 +283,7 @@ PyDoc_STRVAR(pygpu_matrix_scale_doc,
"\n"
" Scale the current stack matrix.\n"
"\n"
" :param scale: Scale the current stack matrix.\n"
" :arg scale: Scale the current stack matrix.\n"
" :type scale: sequence of 2 or 3 floats\n");
static PyObject *pygpu_matrix_scale(PyObject *UNUSED(self), PyObject *value)
{
@ -305,7 +305,7 @@ static PyObject *pygpu_matrix_scale(PyObject *UNUSED(self), PyObject *value)
PyDoc_STRVAR(pygpu_matrix_scale_uniform_doc,
".. function:: scale_uniform(scale)\n"
"\n"
" :param scale: Scale the current stack matrix.\n"
" :arg scale: Scale the current stack matrix.\n"
" :type scale: float\n");
static PyObject *pygpu_matrix_scale_uniform(PyObject *UNUSED(self), PyObject *value)
{
@ -323,7 +323,7 @@ PyDoc_STRVAR(pygpu_matrix_translate_doc,
"\n"
" Scale the current stack matrix.\n"
"\n"
" :param offset: Translate the current stack matrix.\n"
" :arg offset: Translate the current stack matrix.\n"
" :type offset: sequence of 2 or 3 floats\n");
static PyObject *pygpu_matrix_translate(PyObject *UNUSED(self), PyObject *value)
{
@ -373,7 +373,7 @@ PyDoc_STRVAR(pygpu_matrix_load_matrix_doc,
"\n"
" Load a matrix into the stack.\n"
"\n"
" :param matrix: A 4x4 matrix.\n"
" :arg matrix: A 4x4 matrix.\n"
" :type matrix: :class:`mathutils.Matrix`\n");
static PyObject *pygpu_matrix_load_matrix(PyObject *UNUSED(self), PyObject *value)
{
@ -390,7 +390,7 @@ PyDoc_STRVAR(pygpu_matrix_load_projection_matrix_doc,
"\n"
" Load a projection matrix into the stack.\n"
"\n"
" :param matrix: A 4x4 matrix.\n"
" :arg matrix: A 4x4 matrix.\n"
" :type matrix: :class:`mathutils.Matrix`\n");
static PyObject *pygpu_matrix_load_projection_matrix(PyObject *UNUSED(self), PyObject *value)
{

View File

@ -31,7 +31,7 @@ PyDoc_STRVAR(pygpu_select_load_id_doc,
"\n"
" Set the selection ID.\n"
"\n"
" :param id: Number (32-bit uint).\n"
" :arg id: Number (32-bit uint).\n"
" :type select: int\n");
static PyObject *pygpu_select_load_id(PyObject *UNUSED(self), PyObject *value)
{

View File

@ -163,7 +163,7 @@ PyDoc_STRVAR(pygpu_shader_uniform_from_name_doc,
"\n"
" Get uniform location by name.\n"
"\n"
" :param name: Name of the uniform variable whose location is to be queried.\n"
" :arg name: Name of the uniform variable whose location is to be queried.\n"
" :type name: str\n"
" :return: Location of the uniform variable.\n"
" :rtype: int\n");
@ -184,16 +184,15 @@ static PyObject *pygpu_shader_uniform_from_name(BPyGPUShader *self, PyObject *ar
return PyLong_FromLong(uniform);
}
PyDoc_STRVAR(
pygpu_shader_uniform_block_from_name_doc,
".. method:: uniform_block_from_name(name)\n"
"\n"
" 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"
" :return: The location of the uniform block variable.\n"
" :rtype: int\n");
PyDoc_STRVAR(pygpu_shader_uniform_block_from_name_doc,
".. method:: uniform_block_from_name(name)\n"
"\n"
" Get uniform block location by name.\n"
"\n"
" :arg name: Name of the uniform block variable whose location is to be queried.\n"
" :type name: str\n"
" :return: The location of the uniform block variable.\n"
" :rtype: int\n");
static PyObject *pygpu_shader_uniform_block_from_name(BPyGPUShader *self, PyObject *arg)
{
const char *name = PyUnicode_AsUTF8(arg);
@ -245,11 +244,11 @@ PyDoc_STRVAR(pygpu_shader_uniform_vector_float_doc,
"\n"
" Set the buffer to fill the uniform.\n"
"\n"
" :param location: Location of the uniform variable to be modified.\n"
" :arg location: Location of the uniform variable to be modified.\n"
" :type location: int\n"
" :param buffer: The data that should be set. Can support the buffer protocol.\n"
" :arg buffer: The data that should be set. Can support the buffer protocol.\n"
" :type buffer: sequence of floats\n"
" :param length: Size of the uniform data type:\n\n"
" :arg length: Size of the uniform data type:\n\n"
" - 1: float\n"
" - 2: vec2 or float[2]\n"
" - 3: vec3 or float[3]\n"
@ -257,7 +256,7 @@ PyDoc_STRVAR(pygpu_shader_uniform_vector_float_doc,
" - 9: mat3\n"
" - 16: mat4\n"
" :type length: int\n"
" :param count: Specifies the number of elements, vector or matrices that are to "
" :arg count: Specifies the number of elements, vector or matrices that are to "
"be modified.\n"
" :type count: int\n");
static PyObject *pygpu_shader_uniform_vector_float(BPyGPUShader *self, PyObject *args)
@ -305,9 +304,9 @@ PyDoc_STRVAR(pygpu_shader_uniform_bool_doc,
"\n"
" Specify the value of a uniform variable for the current program object.\n"
"\n"
" :param name: Name of the uniform variable whose value is to be changed.\n"
" :arg name: Name of the uniform variable whose value is to be changed.\n"
" :type name: str\n"
" :param seq: Value that will be used to update the specified uniform variable.\n"
" :arg seq: Value that will be used to update the specified uniform variable.\n"
" :type seq: sequence of bools\n");
static PyObject *pygpu_shader_uniform_bool(BPyGPUShader *self, PyObject *args)
{
@ -370,9 +369,9 @@ PyDoc_STRVAR(pygpu_shader_uniform_float_doc,
"\n"
" Specify the value of a uniform variable for the current program object.\n"
"\n"
" :param name: Name of the uniform variable whose value is to be changed.\n"
" :arg name: Name of the uniform variable whose value is to be changed.\n"
" :type name: str\n"
" :param value: Value that will be used to update the specified uniform variable.\n"
" :arg value: Value that will be used to update the specified uniform variable.\n"
" :type value: single number or sequence of numbers\n");
static PyObject *pygpu_shader_uniform_float(BPyGPUShader *self, PyObject *args)
{
@ -439,9 +438,9 @@ PyDoc_STRVAR(pygpu_shader_uniform_int_doc,
"\n"
" Specify the value of a uniform variable for the current program object.\n"
"\n"
" :param name: name of the uniform variable whose value is to be changed.\n"
" :arg name: name of the uniform variable whose value is to be changed.\n"
" :type name: str\n"
" :param seq: Value that will be used to update the specified uniform variable.\n"
" :arg seq: Value that will be used to update the specified uniform variable.\n"
" :type seq: sequence of numbers\n");
static PyObject *pygpu_shader_uniform_int(BPyGPUShader *self, PyObject *args)
{
@ -510,9 +509,9 @@ PyDoc_STRVAR(pygpu_shader_uniform_sampler_doc,
"\n"
" Specify the value of a texture uniform variable for the current GPUShader.\n"
"\n"
" :param name: name of the uniform variable whose texture is to be specified.\n"
" :arg name: name of the uniform variable whose texture is to be specified.\n"
" :type name: str\n"
" :param texture: Texture to attach.\n"
" :arg texture: Texture to attach.\n"
" :type texture: :class:`gpu.types.GPUTexture`\n");
static PyObject *pygpu_shader_uniform_sampler(BPyGPUShader *self, PyObject *args)
{
@ -536,9 +535,9 @@ PyDoc_STRVAR(
"\n"
" Specify the value of an uniform buffer object variable for the current GPUShader.\n"
"\n"
" :param name: name of the uniform variable whose UBO is to be specified.\n"
" :arg name: name of the uniform variable whose UBO is to be specified.\n"
" :type name: str\n"
" :param ubo: Uniform Buffer to attach.\n"
" :arg ubo: Uniform Buffer to attach.\n"
" :type texture: :class:`gpu.types.GPUUniformBuf`\n");
static PyObject *pygpu_shader_uniform_block(BPyGPUShader *self, PyObject *args)
{
@ -562,16 +561,15 @@ static PyObject *pygpu_shader_uniform_block(BPyGPUShader *self, PyObject *args)
Py_RETURN_NONE;
}
PyDoc_STRVAR(
pygpu_shader_attr_from_name_doc,
".. method:: attr_from_name(name)\n"
"\n"
" Get attribute location by name.\n"
"\n"
" :param name: The name of the attribute variable whose location is to be queried.\n"
" :type name: str\n"
" :return: The location of an attribute variable.\n"
" :rtype: int\n");
PyDoc_STRVAR(pygpu_shader_attr_from_name_doc,
".. method:: attr_from_name(name)\n"
"\n"
" Get attribute location by name.\n"
"\n"
" :arg name: The name of the attribute variable whose location is to be queried.\n"
" :type name: str\n"
" :return: The location of an attribute variable.\n"
" :rtype: int\n");
static PyObject *pygpu_shader_attr_from_name(BPyGPUShader *self, PyObject *arg)
{
const char *name = PyUnicode_AsUTF8(arg);
@ -743,17 +741,17 @@ PyDoc_STRVAR(
" ``fragOutput = blender_srgb_to_framebuffer_space(fragOutput)``\n"
" to transform the output sRGB colors to the frame-buffer color-space.\n"
"\n"
" :param vertexcode: Vertex shader code.\n"
" :arg vertexcode: Vertex shader code.\n"
" :type vertexcode: str\n"
" :param fragcode: Fragment shader code.\n"
" :arg fragcode: Fragment shader code.\n"
" :type value: str\n"
" :param geocode: Geometry shader code.\n"
" :arg geocode: Geometry shader code.\n"
" :type value: str\n"
" :param libcode: Code with functions and presets to be shared between shaders.\n"
" :arg libcode: Code with functions and presets to be shared between shaders.\n"
" :type value: str\n"
" :param defines: Preprocessor directives.\n"
" :arg defines: Preprocessor directives.\n"
" :type value: str\n"
" :param name: Name of shader code, for debugging purposes.\n"
" :arg name: Name of shader code, for debugging purposes.\n"
" :type value: str\n");
PyTypeObject BPyGPUShader_Type = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUShader",
@ -812,9 +810,9 @@ PyDoc_STRVAR(
"``CLIPPED`` value to the config parameter. Note that in this case you also need to "
"manually set the value of ``mat4 ModelMatrix``.\n"
"\n"
" :param shader_name: One of the builtin shader names.\n"
" :arg shader_name: One of the builtin shader names.\n"
" :type shader_name: str\n"
" :param config: One of these types of shader configuration:\n"
" :arg config: One of these types of shader configuration:\n"
"\n"
" - ``DEFAULT``\n"
" - ``CLIPPED``\n"
@ -858,7 +856,7 @@ PyDoc_STRVAR(pygpu_shader_create_from_info_doc,
"\n"
" Create shader from a GPUShaderCreateInfo.\n"
"\n"
" :param shader_info: GPUShaderCreateInfo\n"
" :arg shader_info: GPUShaderCreateInfo\n"
" :type shader_info: :class:`bpy.types.GPUShaderCreateInfo`\n"
" :return: Shader object corresponding to the given name.\n"
" :rtype: :class:`bpy.types.GPUShader`\n");

View File

@ -189,11 +189,11 @@ PyDoc_STRVAR(pygpu_interface_info_smooth_doc,
"\n"
" Add an attribute with qualifier of type `smooth` to the interface block.\n"
"\n"
" :param type: One of these types:\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
"\n"
" :type type: str\n"
" :param name: name of the attribute.\n"
" :arg name: name of the attribute.\n"
" :type name: str\n");
static PyObject *pygpu_interface_info_smooth(BPyGPUStageInterfaceInfo *self, PyObject *args)
{
@ -213,11 +213,11 @@ PyDoc_STRVAR(pygpu_interface_info_flat_doc,
"\n"
" Add an attribute with qualifier of type `flat` to the interface block.\n"
"\n"
" :param type: One of these types:\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
"\n"
" :type type: str\n"
" :param name: name of the attribute.\n"
" :arg name: name of the attribute.\n"
" :type name: str\n");
static PyObject *pygpu_interface_info_flat(BPyGPUStageInterfaceInfo *self, PyObject *args)
{
@ -238,11 +238,11 @@ PyDoc_STRVAR(
"\n"
" Add an attribute with qualifier of type `no_perspective` to the interface block.\n"
"\n"
" :param type: One of these types:\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
"\n"
" :type type: str\n"
" :param name: name of the attribute.\n"
" :arg name: name of the attribute.\n"
" :type name: str\n");
static PyObject *pygpu_interface_info_no_perspective(BPyGPUStageInterfaceInfo *self,
PyObject *args)
@ -370,7 +370,7 @@ PyDoc_STRVAR(pygpu_interface_info__tp_doc,
"\n"
" List of varyings between shader stages.\n\n"
"\n"
" :param name: Name of the interface block.\n"
" :arg name: Name of the interface block.\n"
" :type value: str\n");
constexpr PyTypeObject pygpu_interface_info_type()
{
@ -403,13 +403,13 @@ PyDoc_STRVAR(pygpu_shader_info_vertex_in_doc,
"\n"
" Add a vertex shader input attribute.\n"
"\n"
" :param slot: The attribute index.\n"
" :arg slot: The attribute index.\n"
" :type slot: int\n"
" :param type: One of these types:\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
"\n"
" :type type: str\n"
" :param name: name of the attribute.\n"
" :arg name: name of the attribute.\n"
" :type name: str\n");
static PyObject *pygpu_shader_info_vertex_in(BPyGPUShaderCreateInfo *self, PyObject *args)
{
@ -436,7 +436,7 @@ PyDoc_STRVAR(pygpu_shader_info_vertex_out_doc,
"\n"
" Add a vertex shader output interface block.\n"
"\n"
" :param interface: Object describing the block.\n"
" :arg interface: Object describing the block.\n"
" :type interface: :class:`gpu.types.GPUStageInterfaceInfo`\n");
static PyObject *pygpu_shader_info_vertex_out(BPyGPUShaderCreateInfo *self,
BPyGPUStageInterfaceInfo *o)
@ -462,15 +462,15 @@ PyDoc_STRVAR(pygpu_shader_info_fragment_out_doc,
"\n"
" Specify a fragment output corresponding to a framebuffer target slot.\n"
"\n"
" :param slot: The attribute index.\n"
" :arg slot: The attribute index.\n"
" :type slot: int\n"
" :param type: One of these types:\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
"\n"
" :type type: str\n"
" :param name: Name of the attribute.\n"
" :arg name: Name of the attribute.\n"
" :type name: str\n"
" :param blend: Dual Source Blending Index. It can be 'NONE', 'SRC_0' or 'SRC_1'.\n"
" :arg blend: Dual Source Blending Index. It can be 'NONE', 'SRC_0' or 'SRC_1'.\n"
" :type blend: str\n");
static PyObject *pygpu_shader_info_fragment_out(BPyGPUShaderCreateInfo *self,
PyObject *args,
@ -521,12 +521,12 @@ PyDoc_STRVAR(
"\n"
" Specify a uniform variable whose type can be one of those declared in `typedef_source`.\n"
"\n"
" :param slot: The uniform variable index.\n"
" :arg slot: The uniform variable index.\n"
" :type slot: int\n"
" :param type_name: Name of the data type. It can be a struct type defined in the source "
" :arg type_name: Name of the data type. It can be a struct type defined in the source "
"passed through the :meth:`gpu.types.GPUShaderCreateInfo.typedef_source`.\n"
" :type type_name: str\n"
" :param name: The uniform variable name.\n"
" :arg name: The uniform variable name.\n"
" :type name: str\n");
static PyObject *pygpu_shader_info_uniform_buf(BPyGPUShaderCreateInfo *self, PyObject *args)
{
@ -556,19 +556,19 @@ PyDoc_STRVAR(
"\n"
" Specify an image resource used for arbitrary load and store operations.\n"
"\n"
" :param slot: The image resource index.\n"
" :arg slot: The image resource index.\n"
" :type slot: int\n"
" :param format: The GPUTexture format that is passed to the shader. Possible values are:\n"
" :arg format: The GPUTexture format that is passed to the shader. Possible values are:\n"
"" PYDOC_TEX_FORMAT_ITEMS
" :type format: str\n"
" :param type: The data type describing how the image is to be read in the shader. "
" :arg type: The data type describing how the image is to be read in the shader. "
"Possible values are:\n"
"\n" PYDOC_IMAGE_TYPES
"\n"
" :type type: str\n"
" :param name: The image resource name.\n"
" :arg name: The image resource name.\n"
" :type name: str\n"
" :param qualifiers: Set containing values that describe how the image resource is to be "
" :arg qualifiers: Set containing values that describe how the image resource is to be "
"read or written. Possible values are:\n"
"" PYDOC_QUALIFIERS
""
@ -636,14 +636,14 @@ PyDoc_STRVAR(
"\n"
" Specify an image texture sampler.\n"
"\n"
" :param slot: The image texture sampler index.\n"
" :arg slot: The image texture sampler index.\n"
" :type slot: int\n"
" :param type: The data type describing the format of each sampler unit. Possible values "
" :arg type: The data type describing the format of each sampler unit. Possible values "
"are:\n"
"\n" PYDOC_IMAGE_TYPES
"\n"
" :type type: str\n"
" :param name: The image texture sampler name.\n"
" :arg name: The image texture sampler name.\n"
" :type name: str\n");
static PyObject *pygpu_shader_info_sampler(BPyGPUShaderCreateInfo *self, PyObject *args)
{
@ -748,13 +748,13 @@ PyDoc_STRVAR(pygpu_shader_info_push_constant_doc,
"\n"
" Specify a global access constant.\n"
"\n"
" :param type: One of these types:\n"
" :arg type: One of these types:\n"
"\n" PYDOC_TYPE_LIST
"\n"
" :type type: str\n"
" :param name: Name of the constant.\n"
" :arg name: Name of the constant.\n"
" :type name: str\n"
" :param size: If not zero, indicates that the constant is an array with the "
" :arg size: If not zero, indicates that the constant is an array with the "
"specified size.\n"
" :type size: uint\n");
static PyObject *pygpu_shader_info_push_constant(BPyGPUShaderCreateInfo *self,
@ -812,7 +812,7 @@ PyDoc_STRVAR(
"\n"
" \"void main {gl_Position = vec4(pos, 1.0);}\"\n"
"\n"
" :param source: The vertex shader source code.\n"
" :arg source: The vertex shader source code.\n"
" :type source: str\n"
"\n"
" .. seealso:: `GLSL Cross Compilation "
@ -853,7 +853,7 @@ PyDoc_STRVAR(
"\n"
" \"void main {fragColor = vec4(0.0, 0.0, 0.0, 1.0);}\"\n"
"\n"
" :param source: The fragment shader source code.\n"
" :arg source: The fragment shader source code.\n"
" :type source: str\n"
"\n"
" .. seealso:: `GLSL Cross Compilation "
@ -894,7 +894,7 @@ PyDoc_STRVAR(pygpu_shader_info_typedef_source_doc,
"\n"
" \"struct MyType {int foo; float bar;};\"\n"
"\n"
" :param source: The source code defining types.\n"
" :arg source: The source code defining types.\n"
" :type source: str\n");
static PyObject *pygpu_shader_info_typedef_source(BPyGPUShaderCreateInfo *self, PyObject *o)
{
@ -933,9 +933,9 @@ PyDoc_STRVAR(pygpu_shader_info_define_doc,
"\n"
" #define name value\n"
"\n"
" :param name: Token name.\n"
" :arg name: Token name.\n"
" :type name: str\n"
" :param value: Text that replaces token occurrences.\n"
" :arg value: Text that replaces token occurrences.\n"
" :type value: str\n");
static PyObject *pygpu_shader_info_define(BPyGPUShaderCreateInfo *self, PyObject *args)
{

View File

@ -72,7 +72,7 @@ PyDoc_STRVAR(
"\n"
" Defines the fixed pipeline blending equation.\n"
"\n"
" :param mode: The type of blend mode.\n"
" :arg mode: The type of blend mode.\n"
" * ``NONE`` No blending.\n"
" * ``ALPHA`` The original color channels are interpolated according to the alpha "
"value.\n"
@ -114,7 +114,7 @@ PyDoc_STRVAR(pygpu_state_clip_distances_set_doc,
"\n"
" Sets the number of `gl_ClipDistance` planes used for clip geometry.\n"
"\n"
" :param distances_enabled: Number of clip distances enabled.\n"
" :arg distances_enabled: Number of clip distances enabled.\n"
" :type distances_enabled: int\n");
static PyObject *pygpu_state_clip_distances_set(PyObject *UNUSED(self), PyObject *value)
{
@ -136,7 +136,7 @@ PyDoc_STRVAR(pygpu_state_depth_test_set_doc,
"\n"
" Defines the depth_test equation.\n"
"\n"
" :param mode: The depth test equation name.\n"
" :arg mode: The depth test equation name.\n"
" Possible values are `NONE`, `ALWAYS`, `LESS`, `LESS_EQUAL`, `EQUAL`, "
"`GREATER` and `GREATER_EQUAL`.\n"
" :type mode: str\n");
@ -166,7 +166,7 @@ PyDoc_STRVAR(pygpu_state_depth_mask_set_doc,
"\n"
" Write to depth component.\n"
"\n"
" :param value: True for writing to the depth component.\n"
" :arg value: True for writing to the depth component.\n"
" :type near: bool\n");
static PyObject *pygpu_state_depth_mask_set(PyObject *UNUSED(self), PyObject *value)
{
@ -193,9 +193,10 @@ PyDoc_STRVAR(pygpu_state_viewport_set_doc,
" Specifies the viewport of the active framebuffer.\n"
" Note: The viewport state is not saved upon framebuffer rebind.\n"
"\n"
" :param x, y: lower left corner of the viewport_set rectangle, in pixels.\n"
" :param width, height: width and height of the viewport_set.\n"
" :type x, y, xsize, ysize: int\n");
" :arg x, y: lower left corner of the viewport_set rectangle, in pixels.\n"
" :type x, y: int\n"
" :arg xsize, ysize: width and height of the viewport_set.\n"
" :type xsize, ysize: int\n");
static PyObject *pygpu_state_viewport_set(PyObject *UNUSED(self), PyObject *args)
{
int x, y, xsize, ysize;
@ -230,7 +231,7 @@ PyDoc_STRVAR(pygpu_state_line_width_set_doc,
"\n"
" Specify the width of rasterized lines.\n"
"\n"
" :param size: New width.\n"
" :arg size: New width.\n"
" :type mode: float\n");
static PyObject *pygpu_state_line_width_set(PyObject *UNUSED(self), PyObject *value)
{
@ -258,7 +259,7 @@ PyDoc_STRVAR(pygpu_state_point_size_set_doc,
"\n"
" Specify the diameter of rasterized points.\n"
"\n"
" :param size: New diameter.\n"
" :arg size: New diameter.\n"
" :type mode: float\n");
static PyObject *pygpu_state_point_size_set(PyObject *UNUSED(self), PyObject *value)
{
@ -276,7 +277,7 @@ PyDoc_STRVAR(pygpu_state_color_mask_set_doc,
"\n"
" Enable or disable writing of frame buffer color components.\n"
"\n"
" :param r, g, b, a: components red, green, blue, and alpha.\n"
" :arg r, g, b, a: components red, green, blue, and alpha.\n"
" :type r, g, b, a: bool\n");
static PyObject *pygpu_state_color_mask_set(PyObject *UNUSED(self), PyObject *args)
{
@ -294,7 +295,7 @@ PyDoc_STRVAR(pygpu_state_face_culling_set_doc,
"\n"
" Specify whether none, front-facing or back-facing facets can be culled.\n"
"\n"
" :param mode: `NONE`, `FRONT` or `BACK`.\n"
" :arg mode: `NONE`, `FRONT` or `BACK`.\n"
" :type mode: str\n");
static PyObject *pygpu_state_face_culling_set(PyObject *UNUSED(self), PyObject *value)
{
@ -312,7 +313,7 @@ PyDoc_STRVAR(pygpu_state_front_facing_set_doc,
"\n"
" Specifies the orientation of front-facing polygons.\n"
"\n"
" :param invert: True for clockwise polygons as front-facing.\n"
" :arg invert: True for clockwise polygons as front-facing.\n"
" :type mode: bool\n");
static PyObject *pygpu_state_front_facing_set(PyObject *UNUSED(self), PyObject *value)
{
@ -331,7 +332,7 @@ PyDoc_STRVAR(pygpu_state_program_point_size_set_doc,
" If enabled, the derived point size is taken from the (potentially clipped) "
"shader builtin gl_PointSize.\n"
"\n"
" :param enable: True for shader builtin gl_PointSize.\n"
" :arg enable: True for shader builtin gl_PointSize.\n"
" :type enable: bool\n");
static PyObject *pygpu_state_program_point_size_set(PyObject *UNUSED(self), PyObject *value)
{

View File

@ -280,7 +280,7 @@ PyDoc_STRVAR(
"\n"
" Fill texture with specific value.\n"
"\n"
" :param format: The format that describes the content of a single item.\n"
" :arg format: The format that describes the content of a single item.\n"
" Possible values are `FLOAT`, `INT`, `UINT`, `UBYTE`, `UINT_24_8` and `10_11_11_REV`.\n"
" :type format: str\n"
" :arg value: sequence each representing the value to fill.\n"

View File

@ -261,9 +261,9 @@ PyDoc_STRVAR(pygpu_vertbuf_attr_fill_doc,
"\n"
" Insert data into the buffer for a single attribute.\n"
"\n"
" :param id: Either the name or the id of the attribute.\n"
" :arg 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"
" :arg data: Sequence of data that should be stored in the buffer\n"
" :type data: sequence of floats, ints, vectors or matrices\n");
static PyObject *pygpu_vertbuf_attr_fill(BPyGPUVertBuf *self, PyObject *args, PyObject *kwds)
{
@ -327,9 +327,9 @@ PyDoc_STRVAR(pygpu_vertbuf__tp_doc,
"\n"
" Contains a VBO.\n"
"\n"
" :param format: Vertex format.\n"
" :arg format: Vertex format.\n"
" :type format: :class:`gpu.types.GPUVertFormat`\n"
" :param len: Amount of vertices that will fit into this buffer.\n"
" :arg len: Amount of vertices that will fit into this buffer.\n"
" :type len: int\n");
PyTypeObject BPyGPUVertBuf_Type = {
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUVertBuf",

View File

@ -63,15 +63,15 @@ PyDoc_STRVAR(
"\n"
" Add a new attribute to the format.\n"
"\n"
" :param id: Name the attribute. Often `position`, `normal`, ...\n"
" :arg 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"
" :arg 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\n"
" :arg len: How many individual values the attribute consists of\n"
" (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"
" :arg 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\n"
" reduced precision. E.g. you can store a float in only 1 byte but it will be\n"
" converted to a normal 4 byte float when used.\n"

View File

@ -84,7 +84,7 @@ PyDoc_STRVAR(BPY_rna_operator_poll_message_set_doc,
" When message is callable, "
"additional user defined positional arguments are passed to the message function.\n"
"\n"
" :param message: The message or a function that returns the message.\n"
" :arg message: The message or a function that returns the message.\n"
" :type message: string or a callable that returns a string or None.\n");
static PyObject *BPY_rna_operator_poll_message_set(PyObject *UNUSED(self), PyObject *args)

View File

@ -185,16 +185,16 @@ PyDoc_STRVAR(
" It will be called every time the specified region in the space type will be drawn.\n"
" Note: All arguments are positional only for now.\n"
"\n"
" :param callback:\n"
" :arg callback:\n"
" A function that will be called when the region is drawn.\n"
" It gets the specified arguments as input.\n"
" :type callback: function\n"
" :param args: Arguments that will be passed to the callback.\n"
" :arg args: Arguments that will be passed to the callback.\n"
" :type args: tuple\n"
" :param region_type: The region type the callback draws in; usually ``WINDOW``. "
" :arg region_type: The region type the callback draws in; usually ``WINDOW``. "
"(:class:`bpy.types.Region.type`)\n"
" :type region_type: str\n"
" :param draw_type: Usually ``POST_PIXEL`` for 2D drawing and ``POST_VIEW`` for 3D drawing. "
" :arg draw_type: Usually ``POST_PIXEL`` for 2D drawing and ``POST_VIEW`` for 3D drawing. "
"In some cases ``PRE_VIEW`` can be used. ``BACKDROP`` can be used for backdrops in the node "
"editor.\n"
" :type draw_type: str\n"
@ -206,9 +206,9 @@ PyDoc_STRVAR(pyrna_draw_handler_remove_doc,
"\n"
" Remove a draw handler that was added previously.\n"
"\n"
" :param handler: The draw handler that should be removed.\n"
" :arg handler: The draw handler that should be removed.\n"
" :type handler: object\n"
" :param region_type: Region type the callback was added to.\n"
" :arg region_type: Region type the callback was added to.\n"
" :type region_type: str\n");
static struct PyMethodDef pyrna_space_methods[] = {

View File

@ -1102,7 +1102,7 @@ PyDoc_STRVAR(
" the OpenColorIO configuration. The notable exception is user interface theming colors, "
" which are in sRGB color space.\n"
"\n"
" :param rgb: (r, g, b) color values\n"
" :arg rgb: (r, g, b) color values\n"
" :type rgb: 3d vector\n");
PyTypeObject color_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "Color", /* tp_name */

View File

@ -774,9 +774,9 @@ PyDoc_STRVAR(
"\n"
" .. seealso:: `Euler angles <https://en.wikipedia.org/wiki/Euler_angles>`__ on Wikipedia.\n"
"\n"
" :param angles: Three angles, in radians.\n"
" :arg angles: Three angles, in radians.\n"
" :type angles: 3d vector\n"
" :param order: Optional order of the angles, a permutation of ``XYZ``.\n"
" :arg order: Optional order of the angles, a permutation of ``XYZ``.\n"
" :type order: str\n");
PyTypeObject euler_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "Euler", /* tp_name */

View File

@ -3321,8 +3321,7 @@ PyDoc_STRVAR(
" This object gives access to Matrices in Blender, supporting square and rectangular\n"
" matrices from 2x2 up to 4x4.\n"
"\n"
" :param rows: Sequence of rows.\n"
" When omitted, a 4x4 identity matrix is constructed.\n"
" :arg rows: Sequence of rows. When omitted, a 4x4 identity matrix is constructed.\n"
" :type rows: 2d number sequence\n");
PyTypeObject matrix_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "Matrix", /*tp_name*/

View File

@ -1662,9 +1662,9 @@ PyDoc_STRVAR(quaternion_doc,
"\n"
" This object gives access to Quaternions in Blender.\n"
"\n"
" :param seq: size 3 or 4\n"
" :arg seq: size 3 or 4\n"
" :type seq: :class:`Vector`\n"
" :param angle: rotation angle, in radians\n"
" :arg angle: rotation angle, in radians\n"
" :type angle: float\n"
"\n"
" The constructor takes arguments in various forms:\n"

View File

@ -3188,7 +3188,7 @@ PyDoc_STRVAR(vector_doc,
"\n"
" This object gives access to Vectors in Blender.\n"
"\n"
" :param seq: Components of the vector, must be a sequence of at least two\n"
" :arg seq: Components of the vector, must be a sequence of at least two\n"
" :type seq: sequence of numbers\n");
PyTypeObject vector_Type = {
PyVarObject_HEAD_INIT(NULL, 0)

View File

@ -16,10 +16,12 @@ seed(0)
def get_generate_modifiers_list(test_object_name, randomize=False):
"""
Construct a list of 'Generate' modifiers with default parameters.
:param test_object_name: str - name of test object. Some modifiers like boolean need an extra parameter beside
the default one. E.g. boolean needs object, mask needs vertex group etc...
The extra parameter name will be <test_object_name>_<modifier_type>
:param randomize: bool - if True shuffle the list of modifiers.
:arg test_object_name: Name of test object. Some modifiers like boolean need an extra parameter beside
the default one. E.g. boolean needs object, mask needs vertex group etc...
The extra parameter name will be <test_object_name>_<modifier_type>
:type test_object_name: str
:arg randomize: If True shuffle the list of modifiers.
:type randomize: bool
:return: list of 'Generate' modifiers with default parameters.
"""

View File

@ -43,10 +43,10 @@ class ModifierSpec:
def __init__(self, modifier_name: str, modifier_type: str, modifier_parameters: dict, frame_end=0):
"""
Constructs a modifier spec.
:param modifier_name: str - name of object modifier, e.g. "myFirstSubsurfModif"
:param modifier_type: str - type of object modifier, e.g. "SUBSURF"
:param modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"quality" : 4}
:param frame_end: int - frame at which simulation needs to be baked or modifier needs to be applied.
:arg modifier_name: str - name of object modifier, e.g. "myFirstSubsurfModif"
:arg modifier_type: str - type of object modifier, e.g. "SUBSURF"
:arg modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"quality" : 4}
:arg frame_end: int - frame at which simulation needs to be baked or modifier needs to be applied.
"""
self.modifier_name = modifier_name
self.modifier_type = modifier_type
@ -66,10 +66,10 @@ class ParticleSystemSpec:
def __init__(self, modifier_name: str, modifier_type: str, modifier_parameters: dict, frame_end: int):
"""
Constructs a particle system spec.
:param modifier_name: str - name of object modifier, e.g. "Particles"
:param modifier_type: str - type of object modifier, e.g. "PARTICLE_SYSTEM"
:param modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"seed" : 1}
:param frame_end: int - the last frame of the simulation at which the modifier is applied
:arg modifier_name: str - name of object modifier, e.g. "Particles"
:arg modifier_type: str - type of object modifier, e.g. "PARTICLE_SYSTEM"
:arg modifier_parameters: dict - {name : val} dictionary giving modifier parameters, e.g. {"seed" : 1}
:arg frame_end: int - the last frame of the simulation at which the modifier is applied
"""
self.modifier_name = modifier_name
self.modifier_type = modifier_type
@ -97,11 +97,11 @@ class OperatorSpecEditMode:
):
"""
Constructs an OperatorSpecEditMode. Raises ValueError if selec_mode is invalid.
:param operator_name: str - name of mesh operator from bpy.ops.mesh, e.g. "bevel" or "fill"
:param operator_parameters: dict - {name : val} dictionary containing operator parameters.
:param select_mode: str - mesh selection mode, must be either 'VERT', 'EDGE' or 'FACE'
:param selection: sequence - vertices/edges/faces indices to select, e.g. [0, 9, 10].
:param: select_history: bool - load selection into bmesh selection history.
:arg operator_name: str - name of mesh operator from bpy.ops.mesh, e.g. "bevel" or "fill"
:arg operator_parameters: dict - {name : val} dictionary containing operator parameters.
:arg select_mode: str - mesh selection mode, must be either 'VERT', 'EDGE' or 'FACE'
:arg selection: sequence - vertices/edges/faces indices to select, e.g. [0, 9, 10].
:arg: select_history: bool - load selection into bmesh selection history.
"""
self.operator_name = operator_name
self.operator_parameters = operator_parameters
@ -125,8 +125,8 @@ class OperatorSpecObjectMode:
def __init__(self, operator_name: str, operator_parameters: dict):
"""
:param operator_name: str - name of the object operator from bpy.ops.object, e.g. "shade_smooth" or "shape_keys"
:param operator_parameters: dict - contains operator parameters.
:arg operator_name: str - name of the object operator from bpy.ops.object, e.g. "shade_smooth" or "shape_keys"
:arg operator_parameters: dict - contains operator parameters.
"""
self.operator_name = operator_name
self.operator_parameters = operator_parameters
@ -144,9 +144,9 @@ class DeformModifierSpec:
def __init__(self, frame_number: int, modifier_list: list, object_operator_spec: OperatorSpecObjectMode = None):
"""
Constructs a Deform Modifier spec (for user input)
:param frame_number: int - the frame at which animated keyframe is inserted
:param modifier_list: ModifierSpec - contains modifiers
:param object_operator_spec: OperatorSpecObjectMode - contains object operators
:arg frame_number: int - the frame at which animated keyframe is inserted
:arg modifier_list: ModifierSpec - contains modifiers
:arg object_operator_spec: OperatorSpecObjectMode - contains object operators
"""
self.frame_number = frame_number
self.modifier_list = modifier_list
@ -163,12 +163,12 @@ class MeshTest(ABC):
def __init__(self, test_object_name, exp_object_name, test_name=None, threshold=None, do_compare=True):
"""
:param test_object_name: str - Name of object of mesh type to run the operations on.
:param exp_object_name: str - Name of object of mesh type that has the expected
:arg test_object_name: str - Name of object of mesh type to run the operations on.
:arg exp_object_name: str - Name of object of mesh type that has the expected
geometry after running the operations.
:param test_name: str - Name of the test.
:param threshold: exponent: To allow variations and accept difference to a certain degree.
:param do_compare: bool - True if we want to compare the test and expected objects, False otherwise.
:arg test_name: str - Name of the test.
:arg threshold: exponent: To allow variations and accept difference to a certain degree.
:arg do_compare: bool - True if we want to compare the test and expected objects, False otherwise.
"""
self.test_object_name = test_object_name
self.exp_object_name = exp_object_name
@ -302,10 +302,10 @@ class MeshTest(ABC):
def do_selection(self, mesh: bpy.types.Mesh, select_mode: str, selection, select_history: bool):
"""
Do selection on a mesh.
:param mesh: bpy.types.Mesh - input mesh
:param: select_mode: str - selection mode. Must be 'VERT', 'EDGE' or 'FACE'
:param: selection: sequence - indices of selection.
:param: select_history: bool - load selection into bmesh selection history
:arg mesh: bpy.types.Mesh - input mesh
:arg: select_mode: str - selection mode. Must be 'VERT', 'EDGE' or 'FACE'
:arg: selection: sequence - indices of selection.
:arg: select_history: bool - load selection into bmesh selection history
Example: select_mode='VERT' and selection={1,2,3} selects veritces 1, 2 and 3 of input mesh
"""
@ -366,9 +366,9 @@ class MeshTest(ABC):
def compare_meshes(evaluated_object, expected_object, threshold):
"""
Compares evaluated object mesh with expected object mesh.
:param evaluated_object: first object for comparison.
:param expected_object: second object for comparison.
:param threshold: exponent: To allow variations and accept difference to a certain degree.
:arg evaluated_object: first object for comparison.
:arg expected_object: second object for comparison.
:arg threshold: exponent: To allow variations and accept difference to a certain degree.
:return: dict: Contains results of different comparisons.
"""
objects = bpy.data.objects
@ -439,14 +439,14 @@ class SpecMeshTest(MeshTest):
"""
Constructor for SpecMeshTest.
:param test_name: str - Name of the test.
:param test_object_name: str - Name of object of mesh type to run the operations on.
:param exp_object_name: str - Name of object of mesh type that has the expected
geometry after running the operations.
:param operations_stack: list - stack holding operations to perform on the test_object.
:param apply_modifier: bool - True if we want to apply the modifiers right after adding them to the object.
- True if we want to apply the modifier to list of modifiers, after some operation.
This affects operations of type ModifierSpec and DeformModifierSpec.
:arg test_name: str - Name of the test.
:arg test_object_name: str - Name of object of mesh type to run the operations on.
:arg exp_object_name: str - Name of object of mesh type that has the expected
geometry after running the operations.
:arg operations_stack: list - stack holding operations to perform on the test_object.
:arg apply_modifier: bool - True if we want to apply the modifiers right after adding them to the object.
- True if we want to apply the modifier to list of modifiers, after some operation.
This affects operations of type ModifierSpec and DeformModifierSpec.
"""
super().__init__(test_object_name, exp_object_name, test_name, threshold)
@ -491,9 +491,9 @@ class SpecMeshTest(MeshTest):
def _set_parameters_impl(self, modifier, modifier_parameters, nested_settings_path, modifier_name):
"""
Doing a depth first traversal of the modifier parameters and setting their values.
:param: modifier: Of type modifier, its altered to become a setting in recursion.
:param: modifier_parameters : dict or sequence, a simple/nested dictionary of modifier parameters.
:param: nested_settings_path : list(stack): helps in tracing path to each node.
:arg: modifier: Of type modifier, its altered to become a setting in recursion.
:arg: modifier_parameters : dict or sequence, a simple/nested dictionary of modifier parameters.
:arg: nested_settings_path : list(stack): helps in tracing path to each node.
"""
if not isinstance(modifier_parameters, dict):
param_setting = None
@ -540,8 +540,8 @@ class SpecMeshTest(MeshTest):
def _add_modifier(self, test_object, modifier_spec: ModifierSpec):
"""
Add modifier to object.
:param test_object: bpy.types.Object - Blender object to apply modifier on.
:param modifier_spec: ModifierSpec - ModifierSpec object with parameters
:arg test_object: bpy.types.Object - Blender object to apply modifier on.
:arg modifier_spec: ModifierSpec - ModifierSpec object with parameters
"""
bakers_list = ['CLOTH', 'SOFT_BODY', 'DYNAMIC_PAINT', 'FLUID']
scene = bpy.context.scene
@ -645,8 +645,8 @@ class SpecMeshTest(MeshTest):
def _apply_operator_edit_mode(self, test_object, operator: OperatorSpecEditMode):
"""
Apply operator on test object.
:param test_object: bpy.types.Object - Blender object to apply operator on.
:param operator: OperatorSpecEditMode - OperatorSpecEditMode object with parameters.
:arg test_object: bpy.types.Object - Blender object to apply operator on.
:arg operator: OperatorSpecEditMode - OperatorSpecEditMode object with parameters.
"""
self.do_selection(
test_object.data,
@ -695,7 +695,7 @@ class SpecMeshTest(MeshTest):
def _apply_deform_modifier(self, test_object, operation: list):
"""
param: operation: list: List of modifiers or combination of modifier and object operator.
arg: operation: list: List of modifiers or combination of modifier and object operator.
"""
scene = bpy.context.scene
@ -761,7 +761,7 @@ class RunTest:
def __init__(self, tests, apply_modifiers=False, do_compare=False):
"""
Construct a test suite.
:param tests: list - list of modifier or operator test cases. Each element in the list must contain the
:arg tests: list - list of modifier or operator test cases. Each element in the list must contain the
following
in the correct order:
0) test_name: str - unique test name
@ -825,7 +825,7 @@ class RunTest:
def run_test(self, test_name: str):
"""
Run a single test from self.tests list
:param test_name: int - name of test
:arg test_name: int - name of test
:return: bool - True if test passed, False otherwise.
"""
case = None

View File

@ -46,8 +46,8 @@ class AbstractBlenderRunnerTest(unittest.TestCase):
Returns Blender's stdout + stderr combined into one string.
:param filepath: taken relative to self.testdir.
:param timeout: in seconds
:arg filepath: taken relative to self.testdir.
:arg timeout: in seconds
"""
assert self.blender, "Path to Blender binary is to be set in setUpClass()"