Blender  V2.93
Functions | Variables
bpy.c File Reference
#include <Python.h>
#include "BLI_string.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_types.h"
#include "GPU_state.h"
#include "bpy.h"
#include "bpy_app.h"
#include "bpy_capi_utils.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 "bpy_msgbus.h"

Go to the source code of this file.

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_paths_visit_cb (void *userdata, 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)
 
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_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)
 
static PyObject * bpy_import_test (const char *modname)
 
void BPy_init_modules (struct bContext *C)
 

Variables

PyObject * bpy_package_py = NULL
 
static PyMethodDef meth_bpy_script_paths
 
static PyMethodDef meth_bpy_blend_paths
 
static PyMethodDef meth_bpy_user_resource
 
static PyMethodDef meth_bpy_system_resource
 
static PyMethodDef meth_bpy_resource_path
 
static PyMethodDef meth_bpy_escape_identifier
 
static PyMethodDef meth_bpy_unescape_identifier
 

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.c.

Function Documentation

◆ bpy_blend_paths()

static PyObject* bpy_blend_paths ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ bpy_blend_paths_visit_cb()

static bool bpy_blend_paths_visit_cb ( void *  userdata,
char *  UNUSEDpath_dst,
const char *  path_src 
)
static

Definition at line 92 of file bpy.c.

References PyC_UnicodeFromByte().

Referenced by bpy_blend_paths().

◆ bpy_escape_identifier()

static PyObject* bpy_escape_identifier ( PyObject *  UNUSEDself,
PyObject *  value 
)
static

Definition at line 262 of file bpy.c.

References BLI_str_escape(), NULL, and size().

◆ bpy_import_test()

static PyObject* bpy_import_test ( const char *  modname)
static

Definition at line 371 of file bpy.c.

References GPU_bgl_end(), mod(), and NULL.

Referenced by BPy_init_modules().

◆ BPy_init_modules()

void BPy_init_modules ( struct bContext C)

◆ bpy_resource_path()

static PyObject* bpy_resource_path ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ bpy_script_paths()

static PyObject* bpy_script_paths ( PyObject *  UNUSEDself)
static

◆ bpy_system_resource()

static PyObject* bpy_system_resource ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ bpy_unescape_identifier()

static PyObject* bpy_unescape_identifier ( PyObject *  UNUSEDself,
PyObject *  value 
)
static

Definition at line 300 of file bpy.c.

References BLI_str_unescape(), NULL, and size().

◆ bpy_user_resource()

static PyObject* bpy_user_resource ( PyObject *  UNUSEDself,
PyObject *  args,
PyObject *  kw 
)
static

◆ PyDoc_STRVAR() [1/6]

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() [2/6]

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() [3/6]

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() [4/6]

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() [5/6]

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() [6/6]

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"   
)

Variable Documentation

◆ bpy_package_py

PyObject* bpy_package_py = NULL

Definition at line 65 of file bpy.c.

Referenced by BPy_init_modules().

◆ meth_bpy_blend_paths

PyMethodDef meth_bpy_blend_paths
static
Initial value:
= {
"blend_paths",
(PyCFunction)bpy_blend_paths,
METH_VARARGS | METH_KEYWORDS,
bpy_blend_paths_doc,
}
static PyObject * bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
Definition: bpy.c:111

Definition at line 334 of file bpy.c.

Referenced by BPy_init_modules().

◆ meth_bpy_escape_identifier

PyMethodDef meth_bpy_escape_identifier
static
Initial value:
= {
"escape_identifier",
(PyCFunction)bpy_escape_identifier,
METH_O,
bpy_escape_identifier_doc,
}
static PyObject * bpy_escape_identifier(PyObject *UNUSED(self), PyObject *value)
Definition: bpy.c:262

Definition at line 358 of file bpy.c.

Referenced by BPy_init_modules().

◆ meth_bpy_resource_path

PyMethodDef meth_bpy_resource_path
static
Initial value:
= {
"resource_path",
(PyCFunction)bpy_resource_path,
METH_VARARGS | METH_KEYWORDS,
bpy_resource_path_doc,
}
static PyObject * bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
Definition: bpy.c:228

Definition at line 352 of file bpy.c.

Referenced by BPy_init_modules().

◆ meth_bpy_script_paths

PyMethodDef meth_bpy_script_paths
static
Initial value:
= {
"script_paths",
(PyCFunction)bpy_script_paths,
METH_NOARGS,
bpy_script_paths_doc,
}
static PyObject * bpy_script_paths(PyObject *UNUSED(self))
Definition: bpy.c:74

Definition at line 328 of file bpy.c.

Referenced by BPy_init_modules().

◆ meth_bpy_system_resource

PyMethodDef meth_bpy_system_resource
static
Initial value:
= {
"system_resource",
(PyCFunction)bpy_system_resource,
METH_VARARGS | METH_KEYWORDS,
bpy_system_resource_doc,
}
static PyObject * bpy_system_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
Definition: bpy.c:189

Definition at line 346 of file bpy.c.

Referenced by BPy_init_modules().

◆ meth_bpy_unescape_identifier

PyMethodDef meth_bpy_unescape_identifier
static
Initial value:
= {
"unescape_identifier",
METH_O,
bpy_unescape_identifier_doc,
}
static PyObject * bpy_unescape_identifier(PyObject *UNUSED(self), PyObject *value)
Definition: bpy.c:300

Definition at line 364 of file bpy.c.

Referenced by BPy_init_modules().

◆ meth_bpy_user_resource

PyMethodDef meth_bpy_user_resource
static
Initial value:
= {
"user_resource",
(PyCFunction)bpy_user_resource,
METH_VARARGS | METH_KEYWORDS,
}
static PyObject * bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
Definition: bpy.c:152

Definition at line 340 of file bpy.c.

Referenced by BPy_init_modules().