|
Blender V4.3
|
#include <Python.h>#include "BLI_string.h"#include "BLI_string_utils.hh"#include "BLI_utildefines.h"#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_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_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.
Macros | |
| #define | PY_SSIZE_T_CLEAN |
| #define | DEF_ENUM(id) {STRINGIFY(id), id}, |
| #define | SetFlagItem(x) PyDict_SetItemString(result, STRINGIFY(x), PyBool_FromLong((WM_CAPABILITY_##x) & flag)); |
| #define | PYMODULE_ADD_METHOD(mod, meth) PyModule_AddObject(mod, (meth)->ml_name, (PyObject *)PyCFunction_New(meth, mod)) |
Functions | |
| 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 * | bpy_script_paths (PyObject *) |
| static bool | bpy_blend_foreach_path_cb (BPathForeachPathData *bpath_data, char *, size_t, const char *path_src) |
| 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" " :arg absolute: When true the paths returned are made absolute.\n" " :type absolute: bool\n" " :arg packed: When true skip file paths for packed data.\n" " :type packed: bool\n" " :arg local: When true skip linked library paths.\n" " :type local: bool\n" " :return: path list.\n" " :rtype: list[str]\n") | |
| static PyObject * | bpy_blend_paths (PyObject *, PyObject *args, PyObject *kw) |
| 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" " :arg name: Bone name to flip.\n" " :type name: str\n" " :arg strip_digits: Whether to remove ``.###`` suffix.\n" " :type strip_digits: bool\n" " :return: The flipped name.\n" " :rtype: str\n") | |
| static PyObject * | bpy_flip_name (PyObject *, PyObject *args, PyObject *kw) |
| static PyObject * | bpy_user_resource (PyObject *, PyObject *args, PyObject *kw) |
| PyDoc_STRVAR (bpy_system_resource_doc, ".. function:: system_resource(type, path=\"\")\n" "\n" " Return a system resource path.\n" "\n" " :arg type: string in ['DATAFILES', 'SCRIPTS', 'EXTENSIONS', 'PYTHON'].\n" " :type type: str\n" " :arg path: Optional subdirectory.\n" " :type path: str | bytes\n") | |
| static PyObject * | bpy_system_resource (PyObject *, PyObject *args, PyObject *kw) |
| PyDoc_STRVAR (bpy_resource_path_doc, ".. function:: resource_path(type, major=bpy.app.version[0], minor=bpy.app.version[1])\n" "\n" " Return the base path for storing system files.\n" "\n" " :arg type: string in ['USER', 'LOCAL', 'SYSTEM'].\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: str\n" " :return: the resource path (not necessarily existing).\n" " :rtype: str\n") | |
| static PyObject * | bpy_resource_path (PyObject *, PyObject *args, PyObject *kw) |
| PyDoc_STRVAR (bpy_driver_secure_code_test_doc, ".. function:: _driver_secure_code_test(code)\n" "\n" " Test if the script should be considered trusted.\n" "\n" " :arg code: The code to test.\n" " :type code: code\n" " :arg namespace: The namespace of values which are allowed.\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" " :rtype: bool\n") | |
| static PyObject * | bpy_driver_secure_code_test (PyObject *, PyObject *args, PyObject *kw) |
| PyDoc_STRVAR (bpy_escape_identifier_doc, ".. function:: escape_identifier(string)\n" "\n" " Simple string escaping function used for animation paths.\n" "\n" " :arg string: text\n" " :type string: str\n" " :return: The escaped string.\n" " :rtype: str\n") | |
| static PyObject * | bpy_escape_identifier (PyObject *, PyObject *value) |
| 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" " :arg string: text\n" " :type string: str\n" " :return: The un-escaped string.\n" " :rtype: str\n") | |
| static PyObject * | bpy_unescape_identifier (PyObject *, PyObject *value) |
| 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 * | bpy_context_members (PyObject *) |
| 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") | |
| static PyObject * | bpy_rna_enum_items_static (PyObject *) |
| 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 * | bpy_ghost_backend (PyObject *) |
| 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 * | bpy_wm_capabilities (PyObject *self) |
| static PyObject * | bpy_import_test (const char *modname) |
| void | BPy_init_modules (bContext *C) |
Variables | |
| PyObject * | bpy_package_py = nullptr |
| const char * | buttons_context_dir [] |
| const char * | clip_context_dir [] |
| const char * | file_context_dir [] |
| const char * | image_context_dir [] |
| const char * | node_context_dir [] |
| const char * | screen_context_dir [] |
| const char * | sequencer_context_dir [] |
| const char * | text_context_dir [] |
| const char * | view3d_context_dir [] |
| static PyMethodDef | bpy_methods [] |
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.
| #define PYMODULE_ADD_METHOD | ( | mod, | |
| meth ) PyModule_AddObject(mod, (meth)->ml_name, (PyObject *)PyCFunction_New(meth, mod)) |
Referenced by BPy_init_modules().
| #define SetFlagItem | ( | x | ) | PyDict_SetItemString(result, STRINGIFY(x), PyBool_FromLong((WM_CAPABILITY_##x) & flag)); |
Referenced by bpy_wm_capabilities().
|
static |
Definition at line 90 of file bpy.cc.
References PyC_UnicodeFromBytes(), and BPathForeachPathData::user_data.
Referenced by bpy_blend_paths().
|
static |
Definition at line 115 of file bpy.cc.
References absolute(), BKE_BPATH_FOREACH_PATH_ABSOLUTE, BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_SKIP_LINKED, BKE_BPATH_FOREACH_PATH_SKIP_PACKED, BPathForeachPathData::bmain, bpy_blend_foreach_path_cb(), flag, G_MAIN, PY_ARG_PARSER_HEAD_COMPAT, and PyC_ParseBool().
|
static |
Definition at line 509 of file bpy.cc.
References ARRAY_SIZE, BLI_assert, buttons_context_dir, clip_context_dir, file_context_dir, image_context_dir, members, node_context_dir, result, screen_context_dir, sequencer_context_dir, text_context_dir, and view3d_context_dir.
|
static |
Definition at line 379 of file bpy.cc.
References BPY_driver_secure_bytecode_test(), PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseBool(), and verbose.
|
static |
Definition at line 421 of file bpy.cc.
References BLI_str_escape().
|
static |
Definition at line 184 of file bpy.cc.
References BLI_string_flip_side_name(), PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseBool(), and result.
|
static |
Definition at line 591 of file bpy.cc.
References WM_ghost_backend().
|
static |
Definition at line 694 of file bpy.cc.
References GPU_bgl_end(), and mod().
Referenced by BPy_init_modules().
| void BPy_init_modules | ( | bContext * | C | ) |
Creates the bpy module and adds it to sys.modules for importing.
Definition at line 711 of file bpy.cc.
References BKE_appdir_folder_id(), BLENDER_SYSTEM_SCRIPTS, BLI_assert, BPY_app_struct(), BPY_cli_command_register_def, BPY_cli_command_unregister_def, bpy_context_module, bpy_import_test(), BPY_library_load_type_ready(), bpy_methods, BPY_msgbus_module(), BPY_operator_module(), bpy_package_py, BPY_rna_data_context_type_ready(), BPY_rna_gizmo_module(), BPY_rna_module(), BPY_rna_props(), BPY_rna_types(), BPY_rna_types_extend_capi(), BPY_rna_types_finalize_external_types(), BPY_utils_previews_module(), BPY_utils_units(), Freestyle_Init(), IDProp_Init_Types(), IDPropertyUIData_Init_Types(), meth_bpy_owner_id_get, meth_bpy_owner_id_set, meth_bpy_register_class, meth_bpy_unregister_class, mod(), printf, PyC_UnicodeFromStdStr(), PYMODULE_ADD_METHOD, pyrna_struct_CreatePyObject(), and RNA_pointer_create().
Referenced by BPY_python_start().
|
static |
Definition at line 328 of file bpy.cc.
References BKE_appdir_resource_path_id_with_version(), BLENDER_RESOURCE_PATH_LOCAL, BLENDER_RESOURCE_PATH_SYSTEM, BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION, PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseStringEnum(), and PyC_UnicodeFromStdStr().
|
static |
Definition at line 557 of file bpy.cc.
References ARRAY_SIZE, ptr, pyrna_struct_CreatePyObject(), result, RNA_enum_items_count(), and RNA_pointer_create().
|
static |
Definition at line 73 of file bpy.cc.
References BKE_appdir_folder_id(), BLENDER_SYSTEM_SCRIPTS, BLENDER_USER_SCRIPTS, BLI_assert, PyC_UnicodeFromStdStr(), and ret.
|
static |
Definition at line 273 of file bpy.cc.
References BKE_appdir_folder_id(), BLENDER_SYSTEM_DATAFILES, BLENDER_SYSTEM_EXTENSIONS, BLENDER_SYSTEM_PYTHON, BLENDER_SYSTEM_SCRIPTS, PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseStringEnum(), PyC_ParseUnicodeAsBytesAndSize(), PyC_UnicodeFromStdStr(), PyC_UnicodeAsBytesAndSize_Data::value, and PyC_UnicodeAsBytesAndSize_Data::value_coerce.
|
static |
Definition at line 461 of file bpy.cc.
References BLI_str_unescape().
|
static |
Definition at line 220 of file bpy.cc.
References BKE_appdir_folder_id_user_notest(), BLENDER_USER_CONFIG, BLENDER_USER_DATAFILES, BLENDER_USER_EXTENSIONS, BLENDER_USER_SCRIPTS, PY_ARG_PARSER_HEAD_COMPAT, PyC_ParseStringEnum(), PyC_ParseUnicodeAsBytesAndSize(), PyC_UnicodeFromStdStr(), PyC_UnicodeAsBytesAndSize_Data::value, and PyC_UnicodeAsBytesAndSize_Data::value_coerce.
|
static |
Definition at line 610 of file bpy.cc.
References flag, result, self, SetFlagItem, and WM_capabilities_flag().
| 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" " :arg absolute: When true the paths returned are made absolute.\n" " :type absolute: bool\n" " :arg packed: When true skip file paths for packed data.\n" " :type packed: bool\n" " :arg local: When true skip linked library paths.\n" " :type local: bool\n" " :return: path list.\n" " :rtype: list\n" | [str] ) |
| 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]\n" | [str, tuple[str] ) |
doc/python_api/sphinx_doc_gen.py. | PyDoc_STRVAR | ( | bpy_driver_secure_code_test_doc | , |
| ".. function:: _driver_secure_code_test(code)\n" "\n" " Test if the script should be considered trusted.\n" "\n" " :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" " :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" " :rtype: bool\n" | [str, Any] ) |
| PyDoc_STRVAR | ( | bpy_escape_identifier_doc | , |
| ".. function:: escape_identifier(string)\n" "\n" " Simple string escaping function used for animation paths.\n" "\n" " :arg string: text\n" " :type string: str\n" " :return: The escaped string.\n" " :rtype: str\n" | ) |
| 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" " :arg name:Bone name to flip.\n" " :type name:str\n" " :arg strip_digits:Whether to remove ``.###`` suffix.\n" " :type strip_digits:bool\n" " :return:The flipped name.\n" " :rtype:str\n" | ) |
| PyDoc_STRVAR | ( | bpy_ghost_backend_doc | , |
| ".. function:: _ghost_backend()\n" "\n" " :return: An identifier for the GHOST back-end.\n" " :rtype: str\n" | ) |
| PyDoc_STRVAR | ( | bpy_resource_path_doc | , |
| ".. function:: resource_path(type, major=bpy.app.version[0], minor=bpy.app.version[1])\n" "\n" " Return the base path for storing system files.\n" "\n" " :arg type: string in .\n" " :type type: str\n" " :arg major: major | version[ 'USER', 'LOCAL', 'SYSTEM'], | ||
| defaults to current.\n" " :type major:int\n" " :arg minor:minor | version, | ||
| defaults to current.\n" " :type minor:str\n" " :return:the resource path(not necessarily existing).\n" " :rtype:str\n" | ) |
| 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]\n" | [str, tuple[:class:`bpy.types.EnumPropertyItem`] ) |
doc/python_api/sphinx_doc_gen.py. | 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\n" | [str, str] ) |
| PyDoc_STRVAR | ( | bpy_system_resource_doc | , |
| ".. function:: system_resource(type, path=\"\")\n" "\n" " Return a system resource path.\n" "\n" " :arg type: string in .\n" " :type type: str\n" " :arg path: Optional subdirectory.\n" " :type path: str | bytes\n" | [ 'DATAFILES', 'SCRIPTS', 'EXTENSIONS', 'PYTHON'] ) |
| 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" " :arg string: text\n" " :type string: str\n" " :return: The un-escaped string.\n" " :rtype: str\n" | ) |
| PyDoc_STRVAR | ( | bpy_wm_capabilities_doc | , |
| ".. function:: _wm_capabilities()\n" "\n" " :return: A dictionary of capabilities (string keys, boolean values).\n" " :rtype: dict\n" | [str, bool] ) |
|
static |
Definition at line 652 of file bpy.cc.
Referenced by BPy_init_modules().
| PyObject* bpy_package_py = nullptr |
Definition at line 62 of file bpy.cc.
Referenced by BPy_init_modules().
| const char* buttons_context_dir[] |
Definition at line 489 of file bpy.cc.
Referenced by bpy_context_members().
| const char* clip_context_dir[] |
Definition at line 490 of file bpy.cc.
Referenced by bpy_context_members().
| const char* file_context_dir[] |
Definition at line 491 of file bpy.cc.
Referenced by bpy_context_members().
| const char* image_context_dir[] |
Definition at line 492 of file bpy.cc.
Referenced by bpy_context_members().
| const char* node_context_dir[] |
Definition at line 493 of file bpy.cc.
Referenced by bpy_context_members(), and blender::ed::space_node::node_context().
| const char* screen_context_dir[] |
Definition at line 494 of file bpy.cc.
Referenced by bpy_context_members().
| const char* sequencer_context_dir[] |
Definition at line 495 of file bpy.cc.
Referenced by bpy_context_members().
| const char* text_context_dir[] |
Definition at line 496 of file bpy.cc.
Referenced by bpy_context_members().
| const char* view3d_context_dir[] |
Definition at line 497 of file bpy.cc.
Referenced by bpy_context_members().