Blender
V3.3
|
#include <Python.h>
#include "BLI_string.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BKE_appdir.h"
#include "BKE_blender_version.h"
#include "BKE_bpath.h"
#include "BKE_global.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "RNA_prototypes.h"
#include "RNA_types.h"
#include "GPU_state.h"
#include "bpy.h"
#include "bpy_app.h"
#include "bpy_capi_utils.h"
#include "bpy_driver.h"
#include "bpy_library.h"
#include "bpy_operator.h"
#include "bpy_props.h"
#include "bpy_rna.h"
#include "bpy_rna_data.h"
#include "bpy_rna_gizmo.h"
#include "bpy_rna_id_collection.h"
#include "bpy_rna_types_capi.h"
#include "bpy_utils_previews.h"
#include "bpy_utils_units.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "../generic/idprop_py_api.h"
#include "../generic/idprop_py_ui_api.h"
#include "bpy_msgbus.h"
#include "RNA_enum_items.h"
Go to the source code of this file.
Macros | |
#define | PY_SSIZE_T_CLEAN |
#define | DEF_ENUM(id) {STRINGIFY(id), id}, |
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 of strings\n") | |
static PyObject * | bpy_script_paths (PyObject *UNUSED(self)) |
static bool | bpy_blend_foreach_path_cb (BPathForeachPathData *bpath_data, char *UNUSED(path_dst), 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: boolean\n" " :arg packed: When true skip file paths for packed data.\n" " :type packed: boolean\n" " :arg local: When true skip linked library paths.\n" " :type local: boolean\n" " :return: path list.\n" " :rtype: list of strings\n") | |
static PyObject * | bpy_blend_paths (PyObject *UNUSED(self), 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: string\n" " :arg strip_digits: Whether to remove ``.###`` suffix.\n" " :type strip_digits: bool\n" " :return: The flipped name.\n" " :rtype: string\n") | |
static PyObject * | bpy_flip_name (PyObject *UNUSED(self), PyObject *args, PyObject *kw) |
static PyObject * | bpy_user_resource (PyObject *UNUSED(self), 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', 'PYTHON'].\n" " :type type: string\n" " :arg path: Optional subdirectory.\n" " :type path: string\n") | |
static PyObject * | bpy_system_resource (PyObject *UNUSED(self), 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: string\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" " :return: the resource path (not necessarily existing).\n" " :rtype: string\n") | |
static PyObject * | bpy_resource_path (PyObject *UNUSED(self), 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\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 *UNUSED(self), 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: string\n" " :return: The escaped string.\n" " :rtype: string\n") | |
static PyObject * | bpy_escape_identifier (PyObject *UNUSED(self), 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 `escape_identifier`.\n" "\n" " :arg string: text\n" " :type string: string\n" " :return: The un-escaped string.\n" " :rtype: string\n") | |
static PyObject * | bpy_unescape_identifier (PyObject *UNUSED(self), 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\n") | |
static PyObject * | bpy_context_members (PyObject *UNUSED(self)) |
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") | |
static PyObject * | bpy_rna_enum_items_static (PyObject *UNUSED(self)) |
static PyObject * | bpy_import_test (const char *modname) |
void | BPy_init_modules (struct bContext *C) |
Variables | |
PyObject * | bpy_package_py = NULL |
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.c.
|
static |
Definition at line 86 of file bpy.c.
References PyC_UnicodeFromByte(), and BPathForeachPathData::user_data.
Referenced by bpy_blend_paths().
|
static |
Definition at line 108 of file bpy.c.
References absolute(), BKE_BPATH_FOREACH_PATH_ABSOLUTE, BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_SKIP_LINKED, BKE_BPATH_FOREACH_PATH_SKIP_PACKED, bpy_blend_foreach_path_cb(), G_MAIN, NULL, and PyC_ParseBool().
|
static |
Definition at line 457 of file bpy.c.
References ARRAY_SIZE, BLI_assert, buttons_context_dir, clip_context_dir, file_context_dir, image_context_dir, node_context_dir, result, screen_context_dir, sequencer_context_dir, text_context_dir, and view3d_context_dir.
|
static |
Definition at line 344 of file bpy.c.
References BPY_driver_secure_bytecode_test(), NULL, PyC_ParseBool(), and verbose.
|
static |
Definition at line 382 of file bpy.c.
References BLI_str_escape(), NULL, and size().
|
static |
Definition at line 173 of file bpy.c.
References BLI_string_flip_side_name(), NULL, PyC_ParseBool(), result, and size().
|
static |
Definition at line 572 of file bpy.c.
References GPU_bgl_end(), mod(), and NULL.
Referenced by BPy_init_modules().
Creates the bpy module and adds it to sys.modules
for importing.
Definition at line 589 of file bpy.c.
References BKE_appdir_folder_id(), BLENDER_SYSTEM_SCRIPTS, BLI_assert, BPY_app_struct(), 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_utils_previews_module(), BPY_utils_units(), C, 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(), NULL, pyrna_struct_CreatePyObject(), and RNA_pointer_create().
Referenced by BPY_python_start().
|
static |
Definition at line 297 of file bpy.c.
References BKE_appdir_folder_id_version(), BLENDER_RESOURCE_PATH_LOCAL, BLENDER_RESOURCE_PATH_SYSTEM, BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION, NULL, PyC_ParseStringEnum(), PyC_UnicodeFromByte(), and type.
|
static |
Definition at line 513 of file bpy.c.
References ARRAY_SIZE, id, NULL, ptr, pyrna_struct_CreatePyObject(), result, RNA_enum_items_count(), and RNA_pointer_create().
|
static |
Definition at line 68 of file bpy.c.
References BKE_appdir_folder_id(), BLENDER_SYSTEM_SCRIPTS, BLENDER_USER_SCRIPTS, BLI_assert, NULL, PyC_UnicodeFromByte(), and ret.
|
static |
Definition at line 251 of file bpy.c.
References BKE_appdir_folder_id(), BLENDER_SYSTEM_DATAFILES, BLENDER_SYSTEM_PYTHON, BLENDER_SYSTEM_SCRIPTS, NULL, PyC_ParseStringEnum(), PyC_UnicodeFromByte(), and type.
|
static |
Definition at line 420 of file bpy.c.
References BLI_str_unescape(), NULL, and size().
|
static |
Definition at line 207 of file bpy.c.
References BKE_appdir_folder_id_user_notest(), BLENDER_USER_AUTOSAVE, BLENDER_USER_CONFIG, BLENDER_USER_DATAFILES, BLENDER_USER_SCRIPTS, NULL, PyC_ParseStringEnum(), PyC_UnicodeFromByte(), and type.
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: boolean\n" " :arg packed: When true skip file paths for packed data.\n" " :type packed: boolean\n" " :arg local: When true skip linked library paths.\n" " :type local: boolean\n" " :return: path list.\n" " :rtype: list of strings\n" | |||
) |
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" | |||
) |
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" | |||
) |
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: string\n" " :return: The escaped string.\n" " :rtype: string\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:string\n" " :arg strip_digits:Whether to remove ``.###`` suffix.\n" " :type strip_digits:bool\n" " :return:The flipped name.\n" " :rtype:string\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: string\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:string\n" " :return:the resource path(not necessarily existing).\n" " :rtype:string\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 " ":class:`bpy.types.EnumPropertyItem`.\n" " :rtype:dict of \n" | |||
) |
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 of strings\n" | |||
) |
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: string\n" " :arg path: Optional subdirectory.\n" " :type path: string\n" | [ 'DATAFILES', 'SCRIPTS', '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 `escape_identifier`.\n" "\n" " :arg string: text\n" " :type string: string\n" " :return: The un-escaped string.\n" " :rtype: string\n" | |||
) |
|
static |
Definition at line 539 of file bpy.c.
Referenced by BPy_init_modules().
PyObject* bpy_package_py = NULL |
Definition at line 59 of file bpy.c.
Referenced by BPy_init_modules().