From a05345e139cc886de77bc4fcb52791fa2bb650ad Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 2 Nov 2024 17:46:42 +1100 Subject: [PATCH] PyDoc: various corrections to function doc-strings Add missing arguments, corrections & remove unchecked type info. --- scripts/modules/bpy_extras/anim_utils.py | 20 ++++++++++++------- scripts/modules/bpy_types.py | 4 +--- .../python/mathutils/mathutils_geometry.cc | 6 ++++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/scripts/modules/bpy_extras/anim_utils.py b/scripts/modules/bpy_extras/anim_utils.py index 5b37a4b76d6..e9c10f43fbe 100644 --- a/scripts/modules/bpy_extras/anim_utils.py +++ b/scripts/modules/bpy_extras/anim_utils.py @@ -78,8 +78,9 @@ class BakeOptions: def bake_action( obj, *, - action, frames, - bake_options: BakeOptions, + action, + frames, + bake_options, ): """ :arg obj: Object to bake. @@ -89,7 +90,8 @@ def bake_action( :type action: :class:`bpy.types.Action` or None :arg frames: Frames to bake. :type frames: iterable of int - + :arg bake_options: Options for baking. + :type bake_options: :class:`anim_utils.BakeOptions` :return: an action or None :rtype: :class:`bpy.types.Action` """ @@ -108,13 +110,15 @@ def bake_action_objects( object_action_pairs, *, frames, - bake_options: BakeOptions + bake_options, ): """ A version of :func:`bake_action_objects_iter` that takes frames and returns the output. :arg frames: Frames to bake. :type frames: iterable of int + :arg bake_options: Options for baking. + :type bake_options: :class:`anim_utils.BakeOptions` :return: A sequence of Action or None types (aligned with `object_action_pairs`) :rtype: sequence of :class:`bpy.types.Action` @@ -131,7 +135,7 @@ def bake_action_objects( def bake_action_objects_iter( object_action_pairs, - bake_options: BakeOptions + bake_options, ): """ An coroutine that bakes actions for multiple objects. @@ -139,6 +143,8 @@ def bake_action_objects_iter( :arg object_action_pairs: Sequence of object action tuples, action is the destination for the baked data. When None a new action will be created. :type object_action_pairs: Sequence of (:class:`bpy.types.Object`, :class:`bpy.types.Action`) + :arg bake_options: Options for baking. + :type bake_options: :class:`anim_utils.BakeOptions` """ scene = bpy.context.scene frame_back = scene.frame_current @@ -165,7 +171,7 @@ def bake_action_iter( obj, *, action, - bake_options: BakeOptions + bake_options, ): """ An coroutine that bakes action for a single object. @@ -176,7 +182,7 @@ def bake_action_iter( to be created. :type action: :class:`bpy.types.Action` or None :arg bake_options: Boolean options of what to include into the action bake. - :type bake_options: :class: `anim_utils.BakeOptions` + :type bake_options: :class:`anim_utils.BakeOptions` :return: an action or None :rtype: :class:`bpy.types.Action` diff --git a/scripts/modules/bpy_types.py b/scripts/modules/bpy_types.py index f859ee68f56..ef9c751c617 100644 --- a/scripts/modules/bpy_types.py +++ b/scripts/modules/bpy_types.py @@ -860,7 +860,7 @@ class Gizmo(_StructRNA): :type matrix: :class:`mathutils.Matrix` :arg select_id: The selection id. Only use when drawing within :class:`Gizmo.draw_select`. - :type select_it: int + :type select_id: int """ import gpu @@ -899,8 +899,6 @@ class Gizmo(_StructRNA): :type type: string :arg verts: Coordinates. :type verts: sequence of 2D or 3D coordinates. - :arg display_name: Optional callback that takes the full path, returns the name to display. - :type display_name: Callable that takes a string and returns a string. :return: The newly created shape. :rtype: Undefined (it may change). """ diff --git a/source/blender/python/mathutils/mathutils_geometry.cc b/source/blender/python/mathutils/mathutils_geometry.cc index 71fe8752a9c..4cd949680b1 100644 --- a/source/blender/python/mathutils/mathutils_geometry.cc +++ b/source/blender/python/mathutils/mathutils_geometry.cc @@ -164,6 +164,7 @@ PyDoc_STRVAR( " :type v3: :class:`mathutils.Vector`\n" " :arg v4: Second point of the second line\n" " :type v4: :class:`mathutils.Vector`\n" + " :return: The intersection on each line or None when the lines are co-linear.\n" " :rtype: tuple of :class:`mathutils.Vector`'s\n"); static PyObject *M_Geometry_intersect_line_line(PyObject * /*self*/, PyObject *args) { @@ -242,6 +243,7 @@ PyDoc_STRVAR( " :type p_b: :class:`mathutils.Vector`\n" " :arg radius_b: Radius of the second circle\n" " :type radius_b: float\n" + " :return: 2 points on between intersecting circles or None when there is no intersection.\n" " :rtype: tuple of :class:`mathutils.Vector`'s or None when there is no intersection\n"); static PyObject *M_Geometry_intersect_sphere_sphere_2d(PyObject * /*self*/, PyObject *args) { @@ -1616,7 +1618,7 @@ PyDoc_STRVAR( " For edges, the orig indices start with the input edges and then continue\n" " with the edges implied by each of the faces (n of them for an n-gon).\n" " If the need_ids argument is supplied, and False, then the code skips the preparation\n" - " of the orig arrays, which may save some time." + " of the orig arrays, which may save some time.\n" "\n" " :arg vert_coords: Vertex coordinates (2d)\n" " :type vert_coords: list of :class:`mathutils.Vector`\n" @@ -1630,7 +1632,7 @@ PyDoc_STRVAR( "3 => like 2 but detect holes and omit them from output. " "4 => like 2 but with extra edges to make valid BMesh faces. " "5 => like 4 but detect holes and omit them from output.\n" - " :type output_type: int\\n" + " :type output_type: int\n" " :arg epsilon: For nearness tests; should not be zero\n" " :type epsilon: float\n" " :arg need_ids: are the orig output arrays needed?\n"