Blender V5.3
bpy.cc File Reference
#include <Python.h>
#include <optional>
#include "BLI_string.hh"
#include "BLI_string_utils.hh"
#include "BLI_utildefines.hh"
#include "BKE_appdir.hh"
#include "BKE_blender_version.h"
#include "BKE_bpath.hh"
#include "BKE_global.hh"
#include "RNA_access.hh"
#include "RNA_enum_types.hh"
#include "RNA_prototypes.hh"
#include "GPU_state.hh"
#include "WM_api.hh"
#include "bpy.hh"
#include "bpy_app.hh"
#include "bpy_cli_command.hh"
#include "bpy_driver.hh"
#include "bpy_geometry_set.hh"
#include "bpy_inline_shader_nodes.hh"
#include "bpy_library.hh"
#include "bpy_operator.hh"
#include "bpy_props.hh"
#include "bpy_rna.hh"
#include "bpy_rna_data.hh"
#include "bpy_rna_gizmo.hh"
#include "bpy_rna_id_collection.hh"
#include "bpy_rna_types_capi.hh"
#include "bpy_utils_previews.hh"
#include "bpy_utils_units.hh"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_compat.hh"
#include "../generic/python_utildefines.hh"
#include "../generic/idprop_py_api.hh"
#include "../generic/idprop_py_ui_api.hh"
#include "bpy_msgbus.hh"
#include "RNA_enum_items.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define PY_SSIZE_T_CLEAN
#define DEF_ENUM(id)
#define SetFlagItem(x)
#define PYMODULE_ADD_METHOD(mod, meth)

Functions

 blender::PyDoc_STRVAR (bpy_script_paths_doc, ".. function:: script_paths()\n" "\n" " Return 2 paths to blender scripts directories.\n" "\n" " :return: (system, user) strings will be empty when not found.\n" " :rtype: tuple[str, str]\n")
static PyObject * blender::bpy_script_paths (PyObject *)
static bool blender::bpy_blend_foreach_path_cb (BPathForeachPathData *bpath_data, char *, size_t, const char *path_src)
 blender::PyDoc_STRVAR (bpy_blend_paths_doc, ".. function:: blend_paths(*, absolute=False, packed=False, local=False)\n" "\n" " Returns a list of paths to external files referenced by the loaded .blend file.\n" "\n" " :param absolute: When true the paths returned are made absolute.\n" " :type absolute: bool\n" " :param packed: When true include file paths for packed data.\n" " :type packed: bool\n" " :param local: When true skip linked library paths.\n" " :type local: bool\n" " :return: path list.\n" " :rtype: list[str]\n")
static PyObject * blender::bpy_blend_paths (PyObject *, PyObject *args, PyObject *kw)
 blender::PyDoc_STRVAR (bpy_flip_name_doc, ".. function:: flip_name(name, *, strip_digits=False)\n" "\n" " Flip a name between left/right sides, useful for \n" " mirroring bone names.\n" "\n" " :param name: Bone name to flip.\n" " :type name: str\n" " :param strip_digits: Whether to remove ``.###`` suffix.\n" " :type strip_digits: bool\n" " :return: The flipped name.\n" " :rtype: str\n")
static PyObject * blender::bpy_flip_name (PyObject *, PyObject *args, PyObject *kw)
static PyObject * blender::bpy_user_resource (PyObject *, PyObject *args, PyObject *kw)
 blender::PyDoc_STRVAR (bpy_system_resource_doc, ".. function:: system_resource(type, *, path=\"\")\n" "\n" " Return a system resource path.\n" "\n" " :param type: string in ['DATAFILES', 'SCRIPTS', 'EXTENSIONS', 'PYTHON'].\n" " :type type: str\n" " :param path: Optional subdirectory.\n" " :type path: str | bytes\n")
static PyObject * blender::bpy_system_resource (PyObject *, PyObject *args, PyObject *kw)
 blender::PyDoc_STRVAR (bpy_resource_path_doc, ".. function:: resource_path(type, *, major=None, minor=None)\n" "\n" " Return the base path for storing system files.\n" "\n" " :param type: The resource type.\n" " :type type: Literal['USER', 'LOCAL', 'SYSTEM', 'SYSTEM_LIBS']\n" " :param major: Major version. None (the default) uses ``bpy.app.version[0]``.\n" " :type major: int | None\n" " :param minor: Minor version. None (the default) uses ``bpy.app.version[1]``.\n" " :type minor: int | None\n" " :return: the resource path (not necessarily existing).\n" " :rtype: str\n" "\n" " .. note::\n" "\n" " ``SYSTEM_LIBS`` mirrors ``SYSTEM`` " "but resolves to the directory for architecture-dependent libraries " "(typically under ``/usr/lib/...`` rather than ``/usr/share/...``). " "It is an empty string on builds without a separate library directory, " "such as portable builds and the Python module.\n")
static PyObject * blender::bpy_resource_path (PyObject *, PyObject *args, PyObject *kw)
 blender::PyDoc_STRVAR (bpy_driver_secure_code_test_doc, ".. function:: _driver_secure_code_test(code, *, namespace=None, verbose=False)\n" "\n" " Test if the script should be considered trusted.\n" "\n" " :param code: The code to test.\n" " :type code: code\n" " :param namespace: The namespace of values which are allowed.\n" " :type namespace: dict[str, Any] | None\n" " :param verbose: Print the reason for considering insecure to the ``stderr``.\n" " :type verbose: bool\n" " :return: True when the script is considered trusted.\n" " :rtype: bool\n")
static PyObject * blender::bpy_driver_secure_code_test (PyObject *, PyObject *args, PyObject *kw)
 blender::PyDoc_STRVAR (bpy_escape_identifier_doc, ".. function:: escape_identifier(string)\n" "\n" " Simple string escaping function used for animation paths.\n" "\n" " :param string: text\n" " :type string: str\n" " :return: The escaped string.\n" " :rtype: str\n")
static PyObject * blender::bpy_escape_identifier (PyObject *, PyObject *value)
 blender::PyDoc_STRVAR (bpy_unescape_identifier_doc, ".. function:: unescape_identifier(string)\n" "\n" " Simple string un-escape function used for animation paths.\n" " This performs the reverse of :func:`escape_identifier`.\n" "\n" " :param string: text\n" " :type string: str\n" " :return: The un-escaped string.\n" " :rtype: str\n")
static PyObject * blender::bpy_unescape_identifier (PyObject *, PyObject *value)
 blender::PyDoc_STRVAR (bpy_context_members_doc, ".. 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[str, tuple[str]]\n")
static PyObject * blender::bpy_context_members (PyObject *)
 blender::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 enum items.\n" " :rtype: dict[str, tuple[:class:`bpy.types.EnumPropertyItem`]]\n")
 blender::PyDoc_STRVAR (bpy_ghost_backend_doc, ".. function:: _ghost_backend()\n" "\n" " :return: An identifier for the GHOST back-end.\n" " :rtype: str\n")
static PyObject * blender::bpy_ghost_backend (PyObject *)
 blender::PyDoc_STRVAR (bpy_wm_capabilities_doc, ".. function:: _wm_capabilities()\n" "\n" " :return: A dictionary of capabilities (string keys, boolean values).\n" " :rtype: dict[str, bool]\n")
static PyObject * blender::bpy_wm_capabilities (PyObject *self)
static PyObject * blender::bpy_import_test (const char *modname)
void blender::BPy_init_modules (bContext *C)

Variables

PyObject * blender::bpy_package_py = nullptr
const char * blender::sequencer_context_dir []
static PyMethodDef blender::bpy_methods []

Detailed Description

This file defines the '_bpy' module which is used by python's 'bpy' package to access C defined builtin functions. A script writer should never directly access this module.

Definition in file bpy.cc.

Macro Definition Documentation

◆ DEF_ENUM

#define DEF_ENUM ( id)
Value:
{STRINGIFY(id), id},
#define STRINGIFY(x)

◆ PY_SSIZE_T_CLEAN

#define PY_SSIZE_T_CLEAN

Definition at line 14 of file bpy.cc.

◆ PYMODULE_ADD_METHOD

#define PYMODULE_ADD_METHOD ( mod,
meth )
Value:
PyModule_AddObject(mod, (meth)->ml_name, (PyObject *)PyCFunction_New(meth, mod))
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET

Referenced by blender::BPy_init_modules().

◆ SetFlagItem

#define SetFlagItem ( x)
Value:
PyDict_SetItemString(result, STRINGIFY(x), ((WM_CAPABILITY_##x) & flag) ? Py_True : Py_False);

Referenced by blender::bpy_wm_capabilities().