PyDoc: use Python's type annotation syntax for doc-strings

Replace plain-text type information with the type syntax used
for Python's type annotations as it's more concise, especially for
callbacks which often didn't include useful type information.

Note that this change only applies to inline doc-strings,
generated doc-strings from RNA need to be updated separately.

Details:

- Many minor corrections were made when "list" was incorrectly used
  instead of "sequence".
- Some type information wasn't defined in the doc-strings and has been
  added.
- Verbose type info would benefit from support for type aliases.
This commit is contained in:
Campbell Barton
2024-11-03 15:42:19 +11:00
parent 3347aa4017
commit 3bcfb151c1
90 changed files with 722 additions and 676 deletions

View File

@@ -69,7 +69,7 @@ PyDoc_STRVAR(
" Return 2 paths to blender scripts directories.\n"
"\n"
" :return: (system, user) strings will be empty when not found.\n"
" :rtype: tuple of strings\n");
" :rtype: tuple[str, str]\n");
static PyObject *bpy_script_paths(PyObject * /*self*/)
{
PyObject *ret = PyTuple_New(2);
@@ -105,13 +105,13 @@ PyDoc_STRVAR(
" Returns a list of paths to external files referenced by the loaded .blend file.\n"
"\n"
" :arg absolute: When true the paths returned are made absolute.\n"
" :type absolute: boolean\n"
" :type absolute: bool\n"
" :arg packed: When true skip file paths for packed data.\n"
" :type packed: boolean\n"
" :type packed: bool\n"
" :arg local: When true skip linked library paths.\n"
" :type local: boolean\n"
" :type local: bool\n"
" :return: path list.\n"
" :rtype: list of strings\n");
" :rtype: list[str]\n");
static PyObject *bpy_blend_paths(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
eBPathForeachFlag flag = eBPathForeachFlag(0);
@@ -176,11 +176,11 @@ PyDoc_STRVAR(
" mirroring bone names.\n"
"\n"
" :arg name: Bone name to flip.\n"
" :type name: string\n"
" :type name: str\n"
" :arg strip_digits: Whether to remove ``.###`` suffix.\n"
" :type strip_digits: bool\n"
" :return: The flipped name.\n"
" :rtype: string\n");
" :rtype: str\n");
static PyObject *bpy_flip_name(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
const char *name_src = nullptr;
@@ -267,9 +267,9 @@ PyDoc_STRVAR(
" Return a system resource path.\n"
"\n"
" :arg type: string in ['DATAFILES', 'SCRIPTS', 'EXTENSIONS', 'PYTHON'].\n"
" :type type: string\n"
" :type type: str\n"
" :arg path: Optional subdirectory.\n"
" :type path: string or bytes\n");
" :type path: str | bytes\n");
static PyObject *bpy_system_resource(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
const PyC_StringEnumItems type_items[] = {
@@ -318,13 +318,13 @@ PyDoc_STRVAR(
" Return the base path for storing system files.\n"
"\n"
" :arg type: string in ['USER', 'LOCAL', 'SYSTEM'].\n"
" :type type: string\n"
" :type type: str\n"
" :arg major: major version, defaults to current.\n"
" :type major: int\n"
" :arg minor: minor version, defaults to current.\n"
" :type minor: string\n"
" :type minor: str\n"
" :return: the resource path (not necessarily existing).\n"
" :rtype: string\n");
" :rtype: str\n");
static PyObject *bpy_resource_path(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
const PyC_StringEnumItems type_items[] = {
@@ -371,7 +371,7 @@ PyDoc_STRVAR(
" :arg code: The code to test.\n"
" :type code: code\n"
" :arg namespace: The namespace of values which are allowed.\n"
" :type namespace: dict\n"
" :type namespace: dict[str, Any]\n"
" :arg verbose: Print the reason for considering insecure to the ``stderr``.\n"
" :type verbose: bool\n"
" :return: True when the script is considered trusted.\n"
@@ -415,9 +415,9 @@ PyDoc_STRVAR(
" Simple string escaping function used for animation paths.\n"
"\n"
" :arg string: text\n"
" :type string: string\n"
" :type string: str\n"
" :return: The escaped string.\n"
" :rtype: string\n");
" :rtype: str\n");
static PyObject *bpy_escape_identifier(PyObject * /*self*/, PyObject *value)
{
Py_ssize_t value_str_len;
@@ -455,9 +455,9 @@ PyDoc_STRVAR(
" This performs the reverse of `escape_identifier`.\n"
"\n"
" :arg string: text\n"
" :type string: string\n"
" :type string: str\n"
" :return: The un-escaped string.\n"
" :rtype: string\n");
" :rtype: str\n");
static PyObject *bpy_unescape_identifier(PyObject * /*self*/, PyObject *value)
{
Py_ssize_t value_str_len;
@@ -505,7 +505,7 @@ PyDoc_STRVAR(
".. function:: context_members()\n"
"\n"
" :return: A dict where the key is the context and the value is a tuple of it's members.\n"
" :rtype: dict\n");
" :rtype: dict[str, tuple[str]]\n");
static PyObject *bpy_context_members(PyObject * /*self*/)
{
@@ -552,9 +552,8 @@ PyDoc_STRVAR(
bpy_rna_enum_items_static_doc,
".. function:: rna_enum_items_static()\n"
"\n"
" :return: A dict where the key the name of the enum, the value is a tuple of "
":class:`bpy.types.EnumPropertyItem`.\n"
" :rtype: dict of \n");
" :return: A dict where the key the name of the enum, the value is a tuple of enum items.\n"
" :rtype: dict[str, tuple[:class:`bpy.types.EnumPropertyItem`]]\n");
static PyObject *bpy_rna_enum_items_static(PyObject * /*self*/)
{
#define DEF_ENUM(id) {STRINGIFY(id), id},
@@ -588,7 +587,7 @@ PyDoc_STRVAR(
".. function:: _ghost_backend()\n"
"\n"
" :return: An identifier for the GHOST back-end.\n"
" :rtype: string\n");
" :rtype: str\n");
static PyObject *bpy_ghost_backend(PyObject * /*self*/)
{
return PyUnicode_FromString(WM_ghost_backend());
@@ -607,7 +606,7 @@ PyDoc_STRVAR(
".. function:: _wm_capabilities()\n"
"\n"
" :return: A dictionary of capabilities (string keys, boolean values).\n"
" :rtype: dict\n");
" :rtype: dict[str, bool]\n");
static PyObject *bpy_wm_capabilities(PyObject *self)
{
static _Py_Identifier PyId_capabilities = {"_wm_capabilities_", -1};

View File

@@ -30,11 +30,11 @@ PyDoc_STRVAR(
" Create a new icon from triangle geometry.\n"
"\n"
" :arg range: Pair of ints.\n"
" :type range: tuple.\n"
" :type range: tuple[int, int]\n"
" :arg coords: Sequence of bytes (6 floats for one triangle) for (X, Y) coordinates.\n"
" :type coords: byte sequence.\n"
" :arg colors: Sequence of ints (12 for one triangles) for RGBA.\n"
" :type colors: byte sequence.\n"
" :type coords: bytes\n"
" :arg colors: Sequence of bytes (12 for one triangles) for RGBA.\n"
" :type colors: bytes\n"
" :return: Unique icon value (pass to interface ``icon_value`` argument).\n"
" :rtype: int\n");
static PyObject *bpy_app_icons_new_triangles(PyObject * /*self*/, PyObject *args, PyObject *kw)
@@ -97,7 +97,7 @@ PyDoc_STRVAR(
" Create a new icon from triangle geometry.\n"
"\n"
" :arg filepath: File path.\n"
" :type filepath: string or bytes.\n"
" :type filepath: str | bytes.\n"
" :return: Unique icon value (pass to interface ``icon_value`` argument).\n"
" :rtype: int\n");
static PyObject *bpy_app_icons_new_triangles_from_file(PyObject * /*self*/,

View File

@@ -81,7 +81,7 @@ PyDoc_STRVAR(
" ``functools.partial`` can be used to assign some parameters.\n"
"\n"
" :arg function: The function that should called.\n"
" :type function: Callable[[], Union[float, None]]\n"
" :type function: Callable[[], float | None]\n"
" :arg first_interval: Seconds until the callback should be called the first time.\n"
" :type first_interval: float\n"
" :arg persistent: Don't remove timer when a new file is loaded.\n"
@@ -128,7 +128,7 @@ PyDoc_STRVAR(
" Unregister timer.\n"
"\n"
" :arg function: Function to unregister.\n"
" :type function: Callable[[], Union[float, None]]\n");
" :type function: Callable[[], float | None]\n");
static PyObject *bpy_app_timers_unregister(PyObject * /*self*/, PyObject *function)
{
if (!BLI_timer_unregister(intptr_t(function))) {
@@ -146,7 +146,7 @@ PyDoc_STRVAR(
" Check if this function is registered as a timer.\n"
"\n"
" :arg function: Function to check.\n"
" :type function: Callable[[], Union[float, None]]\n"
" :type function: Callable[[], float | None]\n"
" :return: True when this function is registered, otherwise False.\n"
" :rtype: bool\n");
static PyObject *bpy_app_timers_is_registered(PyObject * /*self*/, PyObject *function)

View File

@@ -308,10 +308,10 @@ PyDoc_STRVAR(
" Does nothing when Blender is built without internationalization support.\n"
"\n"
" :arg module_name: The name identifying the addon.\n"
" :type module_name: string\n"
" :type module_name: str\n"
" :arg translations_dict: A dictionary built like that:\n"
" ``{locale: {msg_key: msg_translation, ...}, ...}``\n"
" :type translations_dict: dict\n"
" :type translations_dict: dict[str, dict[str, str]]\n"
"\n");
static PyObject *app_translations_py_messages_register(BlenderAppTranslations *self,
PyObject *args,
@@ -367,7 +367,7 @@ PyDoc_STRVAR(
" Does nothing when Blender is built without internationalization support.\n"
"\n"
" :arg module_name: The name identifying the addon.\n"
" :type module_name: string\n"
" :type module_name: str\n"
"\n");
static PyObject *app_translations_py_messages_unregister(BlenderAppTranslations *self,
PyObject *args,
@@ -602,9 +602,9 @@ PyDoc_STRVAR(
"returns ``msgid``).\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
" :type msgid: str\n"
" :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n"
" :type msgctxt: string or None\n"
" :type msgctxt: str | None\n"
" :return: The translated string (or msgid if no translation was found).\n"
"\n");
static PyObject *app_translations_pgettext(BlenderAppTranslations * /*self*/,
@@ -624,9 +624,9 @@ PyDoc_STRVAR(app_translations_pgettext_n_doc,
" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to extract.\n"
" :type msgid: string\n"
" :type msgid: str\n"
" :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n"
" :type msgctxt: string or None\n"
" :type msgctxt: str | None\n"
" :return: The original string.\n"
"\n");
static PyObject *app_translations_pgettext_n(BlenderAppTranslations * /*self*/,
@@ -658,9 +658,9 @@ PyDoc_STRVAR(
" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
" :type msgid: str\n"
" :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n"
" :type msgctxt: string or None\n"
" :type msgctxt: str | None\n"
" :return: The translated string (or msgid if no translation was found).\n"
"\n");
static PyObject *app_translations_pgettext_iface(BlenderAppTranslations * /*self*/,
@@ -682,9 +682,9 @@ PyDoc_STRVAR(
" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
" :type msgid: str\n"
" :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n"
" :type msgctxt: string or None\n"
" :type msgctxt: str | None\n"
" :return: The translated string (or msgid if no translation was found).\n"
"\n");
static PyObject *app_translations_pgettext_tip(BlenderAppTranslations * /*self*/,
@@ -706,9 +706,9 @@ PyDoc_STRVAR(
" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
" :type msgid: str\n"
" :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n"
" :type msgctxt: string or None\n"
" :type msgctxt: str | None\n"
" :return: The translated string (or msgid if no translation was found).\n"
"\n");
static PyObject *app_translations_pgettext_rpt(BlenderAppTranslations * /*self*/,
@@ -730,9 +730,9 @@ PyDoc_STRVAR(
" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
" :type msgid: str\n"
" :arg msgctxt: The translation context (defaults to BLT_I18NCONTEXT_DEFAULT).\n"
" :type msgctxt: string or None\n"
" :type msgctxt: str | None\n"
" :return: The translated string (or ``msgid`` if no translation was found).\n"
"\n");
static PyObject *app_translations_pgettext_data(BlenderAppTranslations * /*self*/,
@@ -755,7 +755,7 @@ PyDoc_STRVAR(
" For non-complete locales, missing elements will be None.\n"
"\n"
" :arg locale: The ISO locale string to explode.\n"
" :type msgid: string\n"
" :type msgid: str\n"
" :return: A tuple ``(language, country, variant, language_country, language@variant)``.\n"
"\n");
static PyObject *app_translations_locale_explode(BlenderAppTranslations * /*self*/,

View File

@@ -166,7 +166,7 @@ PyDoc_STRVAR(
" Each object has attributes matching bpy.data which are lists of strings to be linked.\n"
"\n"
" :arg filepath: The path to a blend file.\n"
" :type filepath: string or bytes\n"
" :type filepath: str | bytes\n"
" :arg link: When False reference to the original file is lost.\n"
" :type link: bool\n"
" :arg relative: When True the path is stored relative to the open blend file.\n"

View File

@@ -49,9 +49,9 @@ PyDoc_STRVAR(
" Indirectly referenced data-blocks will be expanded and written too.\n"
"\n"
" :arg filepath: The path to write the blend-file.\n"
" :type filepath: string or bytes\n"
" :arg datablocks: set of data-blocks (:class:`bpy.types.ID` instances).\n"
" :type datablocks: set\n"
" :type filepath: str | bytes\n"
" :arg datablocks: set of data-blocks.\n"
" :type datablocks: set[:class:`bpy.types.ID`]\n"
" :arg path_remap: Optionally remap paths when writing the file:\n"
"\n"
" - ``NONE`` No path manipulation (default).\n"
@@ -59,7 +59,7 @@ PyDoc_STRVAR(
" - ``RELATIVE_ALL`` Remap all paths to be relative to the new location.\n"
" - ``ABSOLUTE`` Make all paths absolute on writing.\n"
"\n"
" :type path_remap: string\n"
" :type path_remap: str\n"
" :arg fake_user: When True, data-blocks will be written with fake-user flag enabled.\n"
" :type fake_user: bool\n"
" :arg compress: When True, write a compressed blend file.\n"

View File

@@ -37,10 +37,12 @@
" :arg key: Represents the type of data being subscribed to\n" \
"\n" \
" Arguments include\n" \
" - :class:`bpy.types.Property` instance.\n" \
" - :class:`bpy.types.Struct` type.\n" \
" - (:class:`bpy.types.Struct`, str) type and property name.\n" \
" :type key: Multiple\n"
" - A property instance.\n" \
" - A struct type.\n" \
" - A tuple representing a (struct, property name) pair.\n" \
" :type key: :class:`bpy.types.Property` | " \
":class:`bpy.types.Struct` | " \
"tuple[:class:`bpy.types.Struct`, str]\n"
/**
* There are multiple ways we can get RNA from Python,
@@ -198,12 +200,12 @@ PyDoc_STRVAR(
" loaded, or can be cleared explicitly via :func:`bpy.msgbus.clear_by_owner`.\n"
"\n" BPY_MSGBUS_RNA_MSGKEY_DOC
" :arg owner: Handle for this subscription (compared by identity).\n"
" :type owner: Any type.\n"
" :type owner: Any\n"
" :arg options: Change the behavior of the subscriber.\n"
"\n"
" - ``PERSISTENT`` when set, the subscriber will be kept when remapping ID data.\n"
"\n"
" :type options: set of str.\n"
" :type options: set[str]\n"
"\n"
".. note::\n"
"\n"

View File

@@ -53,31 +53,31 @@ using blender::Array;
#define BPY_PROPDEF_OPTIONS_DOC \
" :arg options: Enumerator in :ref:`rna_enum_property_flag_items`.\n" \
" :type options: set\n"
" :type options: set[str]\n"
#define BPY_PROPDEF_OPTIONS_ENUM_DOC \
" :arg options: Enumerator in :ref:`rna_enum_property_flag_enum_items`.\n" \
" :type options: set\n"
" :type options: set[str]\n"
#define BPY_PROPDEF_OPTIONS_OVERRIDE_DOC \
" :arg override: Enumerator in :ref:`rna_enum_property_override_flag_items`.\n" \
" :type override: set\n"
" :type override: set[str]\n"
#define BPY_PROPDEF_OPTIONS_OVERRIDE_COLLECTION_DOC \
" :arg override: Enumerator in :ref:`rna_enum_property_override_flag_collection_items`.\n" \
" :type override: set\n"
" :type override: set[str]\n"
#define BPY_PROPDEF_SUBTYPE_STRING_DOC \
" :arg subtype: Enumerator in :ref:`rna_enum_property_subtype_string_items`.\n" \
" :type subtype: string\n"
" :type subtype: str\n"
#define BPY_PROPDEF_SUBTYPE_NUMBER_DOC \
" :arg subtype: Enumerator in :ref:`rna_enum_property_subtype_number_items`.\n" \
" :type subtype: string\n"
" :type subtype: str\n"
#define BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC \
" :arg subtype: Enumerator in :ref:`rna_enum_property_subtype_number_array_items`.\n" \
" :type subtype: string\n"
" :type subtype: str\n"
/** \} */
@@ -2648,40 +2648,49 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p)
#define BPY_PROPDEF_NAME_DOC \
" :arg name: Name used in the user interface.\n" \
" :type name: string\n"
" :type name: str\n"
#define BPY_PROPDEF_DESC_DOC \
" :arg description: Text used for the tooltip and api documentation.\n" \
" :type description: string\n"
" :type description: str\n"
#define BPY_PROPDEF_CTXT_DOC \
" :arg translation_context: Text used as context to disambiguate translations.\n" \
" :type translation_context: string\n"
" :type translation_context: str\n"
#define BPY_PROPDEF_UNIT_DOC \
" :arg unit: Enumerator in :ref:`rna_enum_property_unit_items`.\n" \
" :type unit: string\n"
" :type unit: str\n"
#define BPY_PROPDEF_NUM_MIN_DOC \
#define BPY_PROPDEF_NUM_MIN_DOC_(ty) \
" :arg min: Hard minimum, trying to assign a value below will silently assign this minimum " \
"instead.\n"
"instead.\n" \
" :type min: " ty "\n"
#define BPY_PROPDEF_NUM_MAX_DOC \
#define BPY_PROPDEF_NUM_MAX_DOC_(ty) \
" :arg max: Hard maximum, trying to assign a value above will silently assign this maximum " \
"instead.\n"
"instead.\n" \
" :type max: " ty "\n"
#define BPY_PROPDEF_NUM_SOFTMIN_DOC \
" :arg soft_min: Soft minimum (>= *min*), user won't be able to drag the widget below this " \
"value in the UI.\n"
#define BPY_PROPDEF_NUM_MINMAX_DOC(ty) BPY_PROPDEF_NUM_MIN_DOC_(ty) BPY_PROPDEF_NUM_MAX_DOC_(ty)
#define BPY_PROPDEF_NUM_SOFTMAX_DOC \
" :arg soft_max: Soft maximum (<= *max*), user won't be able to drag the widget above this " \
"value in the UI.\n"
#define BPY_PROPDEF_NUM_SOFT_MIN_DOC_(ty) \
" :arg soft_min: Soft minimum (>= *min*), " \
"user won't be able to drag the widget below this value in the UI.\n" \
" :type soft_min: " ty "\n"
#define BPY_PROPDEF_NUM_SOFT_MAX_DOC_(ty) \
" :arg soft_max: Soft maximum (<= *max*), " \
"user won't be able to drag the widget above this value in the UI.\n" \
" :type soft_max: " ty "\n"
#define BPY_PROPDEF_NUM_SOFT_MINMAX_DOC(ty) \
BPY_PROPDEF_NUM_SOFT_MIN_DOC_(ty) BPY_PROPDEF_NUM_SOFT_MAX_DOC_(ty)
#define BPY_PROPDEF_VECSIZE_DOC \
" :arg size: Vector dimensions in [1, " STRINGIFY(PYRNA_STACK_ARRAY) "]. " \
"An int sequence can be used to define multi-dimension arrays.\n" \
" :type size: int or int sequence\n"
" :type size: int | Sequence[int]\n"
#define BPY_PROPDEF_INT_STEP_DOC \
" :arg step: Step of increment/decrement in UI, in [1, 100], defaults to 1 (WARNING: unused " \
@@ -2703,23 +2712,25 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p)
" :arg update: Function to be called when this value is modified,\n" \
" This function must take 2 values (self, context) and return None.\n" \
" *Warning* there are no safety checks to avoid infinite recursion.\n" \
" :type update: function\n"
" :type update: Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.Context`], " \
"None]\n"
#define BPY_PROPDEF_POLL_DOC \
" :arg poll: function to be called to determine whether an item is valid for this " \
"property.\n" \
" The function must take 2 values (self, object) and return Bool.\n" \
" :type poll: function\n"
" :type poll: Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.bpy_struct`], " \
"bool]\n"
#define BPY_PROPDEF_GET_DOC \
#define BPY_PROPDEF_GET_DOC(ty) \
" :arg get: Function to be called when this value is 'read',\n" \
" This function must take 1 value (self) and return the value of the property.\n" \
" :type get: function\n"
" :type get: Callable[[:class:`bpy.types.bpy_struct`], " ty "]\n"
#define BPY_PROPDEF_SET_DOC \
#define BPY_PROPDEF_SET_DOC(ty) \
" :arg set: Function to be called when this value is 'written',\n" \
" This function must take 2 values (self, value) and return None.\n" \
" :type set: function\n"
" :type set: Callable[[:class:`bpy.types.bpy_struct`, " ty "], None]\n"
#define BPY_PROPDEF_SEARCH_DOC \
" :arg search: Function to be called to show candidates for this string (shown in the UI).\n" \
@@ -2729,7 +2740,9 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p)
" - A single string (representing a candidate to display).\n" \
" - A tuple-pair of strings, where the first is a candidate and the second\n" \
" is additional information about the candidate.\n" \
" :type search: function\n" \
" :type search: Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.Context`, str], " \
"Iterable[str | tuple[str, str]]" \
"]\n" \
" :arg search_options: Set of strings in:\n" \
"\n" \
" - 'SORT' sorts the resulting items.\n" \
@@ -2737,19 +2750,19 @@ static int bpy_prop_arg_parse_tag_defines(PyObject *o, void *p)
" **WARNING** disabling this flag causes the search callback to run on redraw,\n" \
" so only disable this flag if it's not likely to cause performance issues.\n" \
"\n" \
" :type search_options: set\n"
" :type search_options: set[str]\n"
#define BPY_PROPDEF_POINTER_TYPE_DOC \
" :arg type: A subclass of :class:`bpy.types.PropertyGroup` or :class:`bpy.types.ID`.\n" \
" :type type: class\n"
" :arg type: A subclass of a property group or ID types.\n" \
" :type type: :class:`bpy.types.PropertyGroup` | :class:`bpy.types.ID`\n"
#define BPY_PROPDEF_COLLECTION_TYPE_DOC \
" :arg type: A subclass of :class:`bpy.types.PropertyGroup`.\n" \
" :type type: class\n"
" :arg type: A subclass of a property group.\n" \
" :type type: :class:`bpy.types.PropertyGroup`\n"
#define BPY_PROPDEF_TAGS_DOC \
" :arg tags: Enumerator of tags that are defined by parent class.\n" \
" :type tags: set\n"
" :type tags: set[str]\n"
#if 0
static int bpy_struct_id_used(StructRNA *srna, char *identifier)
@@ -2790,7 +2803,7 @@ PyDoc_STRVAR(
" Returns a new boolean property definition.\n"
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_OPTIONS_DOC
BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC);
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("bool") BPY_PROPDEF_SET_DOC("bool"));
static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -2943,9 +2956,10 @@ PyDoc_STRVAR(
" Returns a new vector boolean property definition.\n"
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC
" :arg default: sequence of booleans the length of *size*.\n"
" :type default: sequence\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC
" :type default: Sequence[bool]\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC
BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC);
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("Sequence[bool]")
BPY_PROPDEF_SET_DOC("tuple[bool]"));
static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -3131,12 +3145,11 @@ PyDoc_STRVAR(
"set=None)\n"
"\n"
" Returns a new int property definition.\n"
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_NUM_MIN_DOC
" :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC
" :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC
" :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC
BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC);
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC
BPY_PROPDEF_NUM_MINMAX_DOC("int") BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("int")
BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC
BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UPDATE_DOC
BPY_PROPDEF_GET_DOC("int") BPY_PROPDEF_SET_DOC("int"));
static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -3311,13 +3324,12 @@ PyDoc_STRVAR(
" Returns a new vector int property definition.\n"
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC
" :arg default: sequence of ints the length of *size*.\n"
" :type default: sequence\n" BPY_PROPDEF_NUM_MIN_DOC
" :type min: int\n" BPY_PROPDEF_NUM_MAX_DOC " :type max: int\n" BPY_PROPDEF_NUM_SOFTMIN_DOC
" :type soft_min: int\n" BPY_PROPDEF_NUM_SOFTMAX_DOC
" :type soft_max: int\n" BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC
BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC
BPY_PROPDEF_VECSIZE_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC
BPY_PROPDEF_SET_DOC);
" :type default: Sequence[int]\n" BPY_PROPDEF_NUM_MINMAX_DOC("int")
BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("int")
BPY_PROPDEF_INT_STEP_DOC BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC
BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_VECSIZE_DOC
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("Sequence[int]")
BPY_PROPDEF_SET_DOC("tuple[int]"));
static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -3510,14 +3522,12 @@ PyDoc_STRVAR(
"set=None)\n"
"\n"
" Returns a new float (single precision) property definition.\n"
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_NUM_MIN_DOC
" :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC
" :type max: float\n" BPY_PROPDEF_NUM_SOFTMIN_DOC
" :type soft_min: float\n" BPY_PROPDEF_NUM_SOFTMAX_DOC
" :type soft_max: float\n" BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC
BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC
BPY_PROPDEF_SUBTYPE_NUMBER_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_UPDATE_DOC
BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC);
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC BPY_PROPDEF_NUM_MINMAX_DOC(
"float") BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("float")
BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC BPY_PROPDEF_OPTIONS_DOC
BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_NUMBER_DOC
BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("float")
BPY_PROPDEF_SET_DOC("float"));
static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -3691,15 +3701,14 @@ PyDoc_STRVAR(
"\n"
" Returns a new vector float property definition.\n"
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC
" :arg default: sequence of floats the length of *size*.\n"
" :type default: sequence\n" BPY_PROPDEF_NUM_MIN_DOC
" :type min: float\n" BPY_PROPDEF_NUM_MAX_DOC
" :type max: float\n" BPY_PROPDEF_NUM_SOFTMIN_DOC
" :type soft_min: float\n" BPY_PROPDEF_NUM_SOFTMAX_DOC
" :type soft_max: float\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC
BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC
BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_VECSIZE_DOC
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC);
" :arg default: Sequence of floats the length of *size*.\n"
" :type default: Sequence[float]\n" BPY_PROPDEF_NUM_MINMAX_DOC(
"float") BPY_PROPDEF_NUM_SOFT_MINMAX_DOC("float")
BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC
BPY_PROPDEF_FLOAT_STEP_DOC BPY_PROPDEF_FLOAT_PREC_DOC
BPY_PROPDEF_SUBTYPE_NUMBER_ARRAY_DOC BPY_PROPDEF_UNIT_DOC BPY_PROPDEF_VECSIZE_DOC
BPY_PROPDEF_UPDATE_DOC BPY_PROPDEF_GET_DOC("Sequence[float]")
BPY_PROPDEF_SET_DOC("tuple[float]"));
static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -3907,11 +3916,11 @@ PyDoc_STRVAR(
" Returns a new string property definition.\n"
"\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC
" :arg default: initializer string.\n"
" :type default: string\n"
" :type default: str\n"
" :arg maxlen: maximum length of the string.\n"
" :type maxlen: int\n" BPY_PROPDEF_OPTIONS_DOC BPY_PROPDEF_OPTIONS_OVERRIDE_DOC
BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_SUBTYPE_STRING_DOC BPY_PROPDEF_UPDATE_DOC
BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC BPY_PROPDEF_SEARCH_DOC);
BPY_PROPDEF_GET_DOC("str") BPY_PROPDEF_SET_DOC("str") BPY_PROPDEF_SEARCH_DOC);
static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -4115,17 +4124,28 @@ PyDoc_STRVAR(
" Python must keep a reference to the strings returned by the callback or Blender\n"
" will misbehave or even crash."
"\n"
" :type items: sequence of string tuples or a function\n" BPY_PROPDEF_NAME_DOC
BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC
" :type items: Sequence["
"tuple[str, str, str] | "
"tuple[str, str, str, int] | "
"tuple[str, str, str, int, int] | "
"None] | "
"Callable[[:class:`bpy.types.bpy_struct`, :class:`bpy.types.Context` | None], "
/* NOTE(@ideasman42): a type alias would be useful here (same as above). */
"Sequence["
"tuple[str, str, str] | "
"tuple[str, str, str, int] | "
"tuple[str, str, str, int, int] | "
"None]"
"]\n" BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_CTXT_DOC
" :arg default: The default value for this enum, a string from the identifiers used in "
"*items*, or integer matching an item number.\n"
" If the *ENUM_FLAG* option is used this must be a set of such string identifiers "
"instead.\n"
" WARNING: Strings cannot be specified for dynamic enums\n"
" (i.e. if a callback function is given as *items* parameter).\n"
" :type default: string, integer or set\n" BPY_PROPDEF_OPTIONS_ENUM_DOC
" :type default: str | int | set[str]\n" BPY_PROPDEF_OPTIONS_ENUM_DOC
BPY_PROPDEF_OPTIONS_OVERRIDE_DOC BPY_PROPDEF_TAGS_DOC BPY_PROPDEF_UPDATE_DOC
BPY_PROPDEF_GET_DOC BPY_PROPDEF_SET_DOC);
BPY_PROPDEF_GET_DOC("int") BPY_PROPDEF_SET_DOC("int"));
static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -4640,7 +4660,7 @@ PyDoc_STRVAR(
" :arg cls: The class containing the property (must be a positional argument).\n"
" :type cls: type\n"
" :arg attr: Property name (must be passed as a keyword).\n"
" :type attr: string\n"
" :type attr: str\n"
"\n"
".. note:: Typically this function doesn't need to be accessed directly.\n"
" Instead use ``del cls.attr``\n");

View File

@@ -3645,9 +3645,9 @@ PyDoc_STRVAR(
"\n"
" In rare cases you may want to set this option to false.\n"
"\n"
" :type ghost: boolean\n"
" :type ghost: bool\n"
" :return: True when the property has been set.\n"
" :rtype: boolean\n");
" :rtype: bool\n");
static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
PropertyRNA *prop;
@@ -3719,7 +3719,7 @@ PyDoc_STRVAR(
" Check if a property is hidden.\n"
"\n"
" :return: True when the property is hidden.\n"
" :rtype: boolean\n");
" :rtype: bool\n");
static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
@@ -3750,7 +3750,7 @@ PyDoc_STRVAR(
" Check if a property is readonly.\n"
"\n"
" :return: True when the property is readonly (not writable).\n"
" :rtype: boolean\n");
" :rtype: bool\n");
static PyObject *pyrna_struct_is_property_readonly(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
@@ -3781,7 +3781,7 @@ PyDoc_STRVAR(
" Check if a property is overridable.\n"
"\n"
" :return: True when the property is overridable.\n"
" :rtype: boolean\n");
" :rtype: bool\n");
static PyObject *pyrna_struct_is_property_overridable_library(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
@@ -3812,7 +3812,7 @@ PyDoc_STRVAR(
" Define a property as overridable or not (only for custom properties!).\n"
"\n"
" :return: True when the overridable status of the property was successfully set.\n"
" :rtype: boolean\n");
" :rtype: bool\n");
static PyObject *pyrna_struct_property_overridable_library_set(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
@@ -3845,10 +3845,10 @@ PyDoc_STRVAR(
" Returns the property from the path, raise an exception when not found.\n"
"\n"
" :arg path: path which this property resolves.\n"
" :type path: string\n"
" :type path: str\n"
" :arg coerce: optional argument, when True, the property will be converted\n"
" into its Python representation.\n"
" :type coerce: boolean\n");
" :type coerce: bool\n");
static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
{
const char *path;
@@ -3903,7 +3903,7 @@ PyDoc_STRVAR(
"\n"
" :arg property: Optional property name which can be used if the path is\n"
" to a property of this object.\n"
" :type property: string\n"
" :type property: str\n"
" :return: The path from :class:`bpy.types.bpy_struct.id_data`\n"
" to this struct and property (when given).\n"
" :rtype: str\n");
@@ -4046,7 +4046,7 @@ PyDoc_STRVAR(
" such as textures can be changed at runtime.\n"
"\n"
" :return: a new instance of this object with the type initialized again.\n"
" :rtype: subclass of :class:`bpy.types.bpy_struct`\n");
" :rtype: :class:`bpy.types.bpy_struct`\n");
static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
{
@@ -4099,7 +4099,7 @@ PyDoc_STRVAR(
".. classmethod:: bl_rna_get_subclass_py(id, default=None)\n"
"\n"
" :arg id: The RNA type identifier.\n"
" :type id: string\n"
" :type id: str\n"
" :return: The class or default when not found.\n"
" :rtype: type\n");
static PyObject *pyrna_struct_bl_rna_get_subclass_py(PyObject *cls, PyObject *args)
@@ -4123,7 +4123,7 @@ PyDoc_STRVAR(
".. classmethod:: bl_rna_get_subclass(id, default=None)\n"
"\n"
" :arg id: The RNA type identifier.\n"
" :type id: string\n"
" :type id: str\n"
" :return: The RNA type or default when not found.\n"
" :rtype: :class:`bpy.types.Struct` subclass\n");
static PyObject *pyrna_struct_bl_rna_get_subclass(PyObject *cls, PyObject *args)
@@ -5043,7 +5043,7 @@ PyDoc_STRVAR(
" (matching Python's dict.keys() functionality).\n"
"\n"
" :return: the identifiers for each member of this collection.\n"
" :rtype: list of strings\n");
" :rtype: list[str]\n");
static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
{
PyObject *ret = PyList_New(0);
@@ -5075,7 +5075,7 @@ PyDoc_STRVAR(
" (matching Python's dict.items() functionality).\n"
"\n"
" :return: (key, value) pairs for each member of this collection.\n"
" :rtype: list of tuples\n");
" :rtype: list[tuple[str, :class:`bpy.types.bpy_struct`]]\n");
static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
{
PyObject *ret = PyList_New(0);
@@ -5119,8 +5119,8 @@ PyDoc_STRVAR(
" Return the values of collection\n"
" (matching Python's dict.values() functionality).\n"
"\n"
" :return: the members of this collection.\n"
" :rtype: list\n");
" :return: The members of this collection.\n"
" :rtype: list[:class:`bpy.types.bpy_struct`]\n");
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self)
{
/* Re-use slice. */
@@ -5136,10 +5136,10 @@ PyDoc_STRVAR(
" when not found (matches Python's dictionary function of the same name).\n"
"\n"
" :arg key: The key associated with the custom property.\n"
" :type key: string\n"
" :type key: str\n"
" :arg default: Optional argument for the value to return if\n"
" *key* is not found.\n"
" :type default: Undefined\n"
" :type default: Any\n"
"\n" BPY_DOC_ID_PROP_TYPE_NOTE);
static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
{
@@ -5181,10 +5181,10 @@ PyDoc_STRVAR(
" when not found (matches Python's dictionary function of the same name).\n"
"\n"
" :arg key: The key associated with the custom property.\n"
" :type key: string\n"
" :type key: str\n"
" :arg default: Optional argument for the value to return if\n"
" *key* is not found.\n"
" :type default: Undefined\n"
" :type default: Any\n"
"\n" BPY_DOC_ID_PROP_TYPE_NOTE);
static PyObject *pyrna_struct_pop(BPy_StructRNA *self, PyObject *args)
{
@@ -5254,10 +5254,10 @@ PyDoc_STRVAR(
" (matches Python's dictionary function of the same name).\n"
"\n"
" :arg key: The identifier for the collection member.\n"
" :type key: string\n"
" :type key: str\n"
" :arg default: Optional argument for the value to return if\n"
" *key* is not found.\n"
" :type default: Undefined\n");
" :type default: Any\n");
static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args)
{
PointerRNA newptr;
@@ -5308,7 +5308,7 @@ PyDoc_STRVAR(
" (matches Python's string find function of the same name).\n"
"\n"
" :arg key: The identifier for the collection member.\n"
" :type key: string\n"
" :type key: str\n"
" :return: index of the key.\n"
" :rtype: int\n");
static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key_ob)
@@ -9142,7 +9142,7 @@ PyDoc_STRVAR(
" :class:`bpy.types.Operator`, :class:`bpy.types.KeyingSetInfo`,\n"
" :class:`bpy.types.RenderEngine`, :class:`bpy.types.AssetShelf`,\n"
" :class:`bpy.types.FileHandler`\n"
" :type cls: class\n"
" :type cls: type\n"
" :raises ValueError:\n"
" if the class is not a subclass of a registerable blender class.\n"
"\n"
@@ -9327,7 +9327,7 @@ PyDoc_STRVAR(
" :arg cls: Blender type class, \n"
" see :mod:`bpy.utils.register_class` for classes which can \n"
" be registered.\n"
" :type cls: class\n"
" :type cls: type\n"
"\n"
" .. note::\n"
"\n"

View File

@@ -296,7 +296,7 @@ char pyrna_struct_keyframe_insert_doc[] =
"necessary.\n"
"\n"
" :arg data_path: path to the property to key, analogous to the fcurve's data path.\n"
" :type data_path: string\n"
" :type data_path: str\n"
" :arg index: array index of the property to key.\n"
" Defaults to -1 which will key all indices or a single channel if the property is not "
"an array.\n"
@@ -319,12 +319,12 @@ char pyrna_struct_keyframe_insert_doc[] =
" - ``INSERTKEY_AVAILABLE`` Only insert into already existing F-Curves.\n"
" - ``INSERTKEY_CYCLE_AWARE`` Take cyclic extrapolation into account "
"(Cycle-Aware Keying option).\n"
" :type options: set\n"
" :type options: set[str]\n"
" :arg keytype: Type of the key: 'KEYFRAME', 'BREAKDOWN', 'MOVING_HOLD', 'EXTREME', "
"'JITTER', or 'GENERATED'\n"
" :type keytype: string\n"
" :type keytype: str\n"
" :return: Success of keyframe insertion.\n"
" :rtype: boolean\n";
" :rtype: bool\n";
PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
using namespace blender::animrig;
@@ -455,7 +455,7 @@ char pyrna_struct_keyframe_delete_doc[] =
"\n"
" :arg data_path: path to the property to remove a key, analogous to the fcurve's data "
"path.\n"
" :type data_path: string\n"
" :type data_path: str\n"
" :arg index: array index of the property to remove a key. Defaults to -1 removing all "
"indices or a single channel if the property is not an array.\n"
" :type index: int\n"
@@ -465,7 +465,7 @@ char pyrna_struct_keyframe_delete_doc[] =
"yet.\n"
" :type group: str\n"
" :return: Success of keyframe deletion.\n"
" :rtype: boolean\n";
" :rtype: bool\n";
PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
{
/* args, pyrna_struct_keyframe_parse handles these */
@@ -575,12 +575,12 @@ char pyrna_struct_driver_add_doc[] =
" Adds driver(s) to the given property\n"
"\n"
" :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
" :type path: string\n"
" :type path: str\n"
" :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
"channel if the property is not an array.\n"
" :type index: int\n"
" :return: The driver(s) added.\n"
" :rtype: :class:`bpy.types.FCurve` or list if index is -1 with an array property.\n";
" :return: The driver added or a list of drivers when index is -1.\n"
" :rtype: :class:`bpy.types.FCurve` | list[:class:`bpy.types.FCurve`]\n";
PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
{
const char *path, *path_full;
@@ -659,12 +659,12 @@ char pyrna_struct_driver_remove_doc[] =
" Remove driver(s) from the given property\n"
"\n"
" :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
" :type path: string\n"
" :type path: str\n"
" :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
"channel if the property is not an array.\n"
" :type index: int\n"
" :return: Success of driver removal.\n"
" :rtype: boolean\n";
" :rtype: bool\n";
PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
{
const char *path, *path_full;

View File

@@ -567,6 +567,8 @@ static PyObject *bpy_context_temp_override_extract_known_args(const char *const
return kwds_parse;
}
/* NOTE(@ideasman42): `ContextTempOverride` isn't accessible from (without creating an instance),
* it should be exposed although it doesn't seem especially important either. */
PyDoc_STRVAR(
/* Wrap. */
bpy_context_temp_override_doc,
@@ -593,7 +595,7 @@ PyDoc_STRVAR(
" :type region: :class:`bpy.types.Region`\n"
" :arg keywords: Additional keywords override context members.\n"
" :return: The context manager .\n"
" :rtype: context manager\n");
" :rtype: ContextTempOverride\n");
static PyObject *bpy_context_temp_override(PyObject *self, PyObject *args, PyObject *kwds)
{
const PointerRNA *context_ptr = pyrna_struct_as_ptr(self, &RNA_Context);

View File

@@ -135,7 +135,7 @@ PyDoc_STRVAR(
"\n"
" :arg filepath: The file path for the newly temporary data. "
"When None, the path of the currently open file is used.\n"
" :type filepath: str, bytes or NoneType\n"
" :type filepath: str | bytes | None\n"
"\n"
" :return: Blend file data which is freed once the context exists.\n"
" :rtype: :class:`bpy.types.BlendData`\n");

View File

@@ -322,12 +322,13 @@ PyDoc_STRVAR(
" Assigns callbacks to a gizmos property.\n"
"\n"
" :arg target: Target property name.\n"
" :type target: string\n"
" :type target: str\n"
" :arg get: Function that returns the value for this property (single value or sequence).\n"
" :type get: callable\n"
" :type get: Callable[[], float | Sequence[float]]\n"
" :arg set: Function that takes a single value argument and applies it.\n"
" :type set: callable\n"
" :arg range: Function that returns a (min, max) tuple for gizmos that use a range.\n"
" :type set: Callable[[tuple[float, ...]], Any]\n"
" :arg range: Function that returns a (min, max) tuple for gizmos that use a range. "
"The returned value is not used.\n"
" :type range: callable\n");
static PyObject *bpy_gizmo_target_set_handler(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
@@ -439,9 +440,9 @@ PyDoc_STRVAR(
" Get the value of this target property.\n"
"\n"
" :arg target: Target property name.\n"
" :type target: string\n"
" :return: The value of the target property.\n"
" :rtype: Single value or array based on the target type\n");
" :type target: str\n"
" :return: The value of the target property as a value or array based on the target type.\n"
" :rtype: float | tuple[float, ...]\n");
static PyObject *bpy_gizmo_target_get_value(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
struct {
@@ -510,7 +511,7 @@ PyDoc_STRVAR(
" Set the value of this target property.\n"
"\n"
" :arg target: Target property name.\n"
" :type target: string\n");
" :type target: str\n");
static PyObject *bpy_gizmo_target_set_value(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
struct {
@@ -598,7 +599,7 @@ PyDoc_STRVAR(
"\n"
" :arg target: Target property name.\n"
" :return: The range of this property (min, max).\n"
" :rtype: tuple pair.\n");
" :rtype: tuple[float, float]\n");
static PyObject *bpy_gizmo_target_get_range(PyObject * /*self*/, PyObject *args, PyObject *kw)
{
struct {

View File

@@ -119,21 +119,20 @@ PyDoc_STRVAR(
".. method:: user_map(subset, key_types, value_types)\n"
"\n"
" Returns a mapping of all ID data-blocks in current ``bpy.data`` to a set of all "
"datablocks using them.\n"
"data-blocks using them.\n"
"\n"
" For list of valid set members for key_types & value_types, see: "
":class:`bpy.types.KeyingSetPath.id_type`.\n"
"\n"
" :arg subset: When passed, only these data-blocks and their users will be "
"included as keys/values in the map.\n"
" :type subset: sequence\n"
" :type subset: Sequence[:class:`bpy.types.ID`]\n"
" :arg key_types: Filter the keys mapped by ID types.\n"
" :type key_types: set of strings\n"
" :type key_types: set[str]\n"
" :arg value_types: Filter the values in the set by ID types.\n"
" :type value_types: set of strings\n"
" :return: dictionary of :class:`bpy.types.ID` instances, with sets of ID's as "
"their values.\n"
" :rtype: dict\n");
" :type value_types: set[str]\n"
" :return: dictionary that maps data-blocks ID's to their users.\n"
" :rtype: dict[:class:`bpy.types.ID`, set[:class:`bpy.types.ID`]]\n");
static PyObject *bpy_user_map(PyObject * /*self*/, PyObject *args, PyObject *kwds)
{
#if 0 /* If someone knows how to get a proper 'self' in that case... */
@@ -287,8 +286,8 @@ PyDoc_STRVAR(
" ID collections), but less safe/versatile (it can break Blender, e.g. by removing "
"all scenes...).\n"
"\n"
" :arg ids: Iterables of IDs (types can be mixed).\n"
" :type subset: sequence\n");
" :arg ids: Sequence of IDs (types can be mixed).\n"
" :type ids: Sequence[:class:`bpy.types.ID`]\n");
static PyObject *bpy_batch_remove(PyObject * /*self*/, PyObject *args, PyObject *kwds)
{
#if 0 /* If someone knows how to get a proper 'self' in that case... */

View File

@@ -95,7 +95,7 @@ PyDoc_STRVAR(
"additional user defined positional arguments are passed to the message function.\n"
"\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");
" :type message: str | Callable[[Any, ...], str | None]\n");
static PyObject *BPY_rna_operator_poll_message_set(PyObject * /*self*/, PyObject *args)
{

View File

@@ -54,7 +54,7 @@ PyDoc_STRVAR(
"((start_line, start_column), (end_line, end_column))\n"
" The values match Python's slicing logic "
"(negative values count backwards from the end, the end value is not inclusive).\n"
" :type range: Two pairs of ints\n"
" :type range: tuple[tuple[int, int], tuple[int, int]]\n"
" :return: The specified region as a string.\n"
" :rtype: str.\n");
/* Receive a Python Tuple as parameter to represent the region range. */
@@ -124,7 +124,7 @@ PyDoc_STRVAR(
"((start_line, start_column), (end_line, end_column))\n"
" The values match Python's slicing logic "
"(negative values count backwards from the end, the end value is not inclusive).\n"
" :type range: Two pairs of ints\n");
" :type range: tuple[tuple[int, int], tuple[int, int]]\n");
static PyObject *bpy_rna_region_from_string(PyObject *self, PyObject *args, PyObject *kwds)
{
BPy_StructRNA *pyrna = (BPy_StructRNA *)self;

View File

@@ -113,7 +113,7 @@ PyDoc_STRVAR(
pyrna_WindowManager_clipboard_doc,
"Clipboard text storage.\n"
"\n"
":type: string");
":type: str");
static PyObject *pyrna_WindowManager_clipboard_get(PyObject * /*self*/, void * /*flag*/)
{
int text_len = 0;
@@ -158,9 +158,9 @@ PyDoc_STRVAR(
" A function that will be called when the cursor is drawn.\n"
" It gets the specified arguments as input with the mouse position (tuple) as last "
"argument.\n"
" :type callback: function\n"
" :type callback: Callable[[Any, ..., tuple[int, int]], Any]\n"
" :arg args: Arguments that will be passed to the callback.\n"
" :type args: tuple\n"
" :type args: tuple[Any, ...]\n"
" :arg space_type: The space type the callback draws in; for example ``VIEW_3D``. "
"(:class:`bpy.types.Space.type`)\n"
" :type space_type: str\n"
@@ -229,10 +229,10 @@ PyDoc_STRVAR(
"\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"
" It gets the specified arguments as input, it's return value is ignored.\n"
" :type callback: Callable[[Any, ...], Any]\n"
" :arg args: Arguments that will be passed to the callback.\n"
" :type args: tuple\n"
" :type args: tuple[Any, ...]\n"
" :arg region_type: The region type the callback draws in; usually ``WINDOW``. "
"(:class:`bpy.types.Region.type`)\n"
" :type region_type: str\n"

View File

@@ -40,7 +40,7 @@ PyDoc_STRVAR(
" Generate a new empty preview.\n"
"\n"
" :arg name: The name (unique id) identifying the preview.\n"
" :type name: string\n"
" :type name: str\n"
" :return: The Preview matching given name, or a new empty one.\n"
" :rtype: :class:`bpy.types.ImagePreview`\n"
/* This is only true when accessed via 'bpy.utils.previews.ImagePreviewCollection.load',
@@ -69,12 +69,12 @@ PyDoc_STRVAR(
" Generate a new preview from given file path.\n"
"\n"
" :arg name: The name (unique id) identifying the preview.\n"
" :type name: string\n"
" :type name: str\n"
" :arg filepath: The file path to generate the preview from.\n"
" :type filepath: string or bytes\n"
" :type filepath: str | bytes\n"
" :arg filetype: The type of file, needed to generate the preview in [" STR_SOURCE_TYPES
"].\n"
" :type filetype: string\n"
" :type filetype: str\n"
" :arg force_reload: If True, force running thumbnail manager even if preview already "
"exists in cache.\n"
" :type force_reload: bool\n"
@@ -137,7 +137,7 @@ PyDoc_STRVAR(
"\n"
"\n"
" :arg name: The name (unique id) identifying the preview.\n"
" :type name: string\n");
" :type name: str\n");
static PyObject *bpy_utils_previews_release(PyObject * /*self*/, PyObject *args)
{
char *name;

View File

@@ -151,16 +151,16 @@ PyDoc_STRVAR(
" Convert a given input string into a float value.\n"
"\n"
" :arg unit_system: The unit system, from :attr:`bpy.utils.units.systems`.\n"
" :type unit_system: string\n"
" :type unit_system: str\n"
" :arg unit_category: The category of data we are converting (length, area, rotation, "
"etc.),\n"
" from :attr:`bpy.utils.units.categories`.\n"
" :type unit_category: string\n"
" :type unit_category: str\n"
" :arg str_input: The string to convert to a float value.\n"
" :type str_input: string\n"
" :type str_input: str\n"
" :arg str_ref_unit: A reference string from which to extract a default unit, if none is "
"found in ``str_input``.\n"
" :type str_ref_unit: string or None\n"
" :type str_ref_unit: str | None\n"
" :return: The converted/interpreted value.\n"
" :rtype: float\n"
" :raises ValueError: if conversion fails to generate a valid Python float value.\n");
@@ -236,11 +236,11 @@ PyDoc_STRVAR(
" Convert a given input float value into a string with units.\n"
"\n"
" :arg unit_system: The unit system, from :attr:`bpy.utils.units.systems`.\n"
" :type unit_system: string\n"
" :type unit_system: str\n"
" :arg unit_category: The category of data we are converting (length, area, "
"rotation, etc.),\n"
" from :attr:`bpy.utils.units.categories`.\n"
" :type unit_category: string\n"
" :type unit_category: str\n"
" :arg value: The value to convert to a string.\n"
" :type value: float\n"
" :arg precision: Number of digits after the comma.\n"