|
Blender V5.3
|
#include <Python.h>#include <frameobject.h>#include "BLI_utildefines.hh"#include "DNA_vec_types.h"#include "py_capi_utils.hh"#include "python_utildefines.hh"#include "MEM_guardedalloc.h"#include "BLI_string_utf8.hh"Go to the source code of this file.
Classes | |
| struct | blender::BPyMemoryViewOwned |
Namespaces | |
| namespace | blender |
| BMesh Iterators. | |
Macros | |
| #define | PY_SSIZE_T_CLEAN |
Functions | |
Fast Python to C Array Conversion for Primitive Types | |
| int | blender::PyC_AsArray_FAST (void *array, const size_t array_item_size, PyObject *value_fast, const Py_ssize_t length, const PyTypeObject *type, const char *error_prefix) |
| int | blender::PyC_AsArray (void *array, const size_t array_item_size, PyObject *value, const Py_ssize_t length, const PyTypeObject *type, const char *error_prefix) |
| static int | blender::PyC_AsArray_Multi_impl (void **array_p, const size_t array_item_size, PyObject *value, const int *dims, const int dims_len, const PyTypeObject *type, const char *error_prefix) |
| static int | blender::PyC_AsArray_Multi_FAST_impl (void **array_p, const size_t array_item_size, PyObject *value_fast, const int *dims, const int dims_len, const PyTypeObject *type, const char *error_prefix) |
| int | blender::PyC_AsArray_Multi_FAST (void *array, const size_t array_item_size, PyObject *value_fast, const int *dims, const int dims_len, const PyTypeObject *type, const char *error_prefix) |
| int | blender::PyC_AsArray_Multi (void *array, const size_t array_item_size, PyObject *value, const int *dims, const int dims_len, const PyTypeObject *type, const char *error_prefix) |
Typed Tuple Packing | |
| |
| PyObject * | blender::PyC_Tuple_PackArray_F32 (const float *array, uint len) |
| PyObject * | blender::PyC_Tuple_PackArray_F64 (const double *array, uint len) |
| PyObject * | blender::PyC_Tuple_PackArray_I32 (const int *array, uint len) |
| PyObject * | blender::PyC_Tuple_PackArray_I32FromBool (const int *array, uint len) |
| PyObject * | blender::PyC_Tuple_PackArray_Bool (const bool *array, uint len) |
| PyObject * | blender::PyC_Tuple_PackArray_String (const char **array, uint len) |
Typed Tuple Packing (Multi-Dimensional) | |
| static PyObject * | blender::PyC_Tuple_PackArray_Multi_F32_impl (const float **array_p, const int dims[], const int dims_len) |
| PyObject * | blender::PyC_Tuple_PackArray_Multi_F32 (const float *array, const int dims[], const int dims_len) |
| static PyObject * | blender::PyC_Tuple_PackArray_Multi_F64_impl (const double **array_p, const int dims[], const int dims_len) |
| PyObject * | blender::PyC_Tuple_PackArray_Multi_F64 (const double *array, const int dims[], const int dims_len) |
| static PyObject * | blender::PyC_Tuple_PackArray_Multi_I32_impl (const int **array_p, const int dims[], const int dims_len) |
| PyObject * | blender::PyC_Tuple_PackArray_Multi_I32 (const int *array, const int dims[], const int dims_len) |
| static PyObject * | blender::PyC_Tuple_PackArray_Multi_Bool_impl (const bool **array_p, const int dims[], const int dims_len) |
| PyObject * | blender::PyC_Tuple_PackArray_Multi_Bool (const bool *array, const int dims[], const int dims_len) |
Tuple/List Filling | |
| void | blender::PyC_Tuple_Fill (PyObject *tuple, PyObject *value) |
| void | blender::PyC_List_Fill (PyObject *list, PyObject *value) |
Bool/Enum Argument Parsing | |
| int | blender::PyC_ParseBool (PyObject *o, void *p) |
| int | blender::PyC_ParseTypeOrNone (PyObject *o, void *p) |
| int | blender::PyC_ParseOptionalInt (PyObject *o, void *p) |
| int | blender::PyC_ParseOptionalDouble (PyObject *o, void *p) |
| int | blender::PyC_ParseOptionalFloat (PyObject *o, void *p) |
| int | blender::PyC_ParseOptionalUInt (PyObject *o, void *p) |
| int | blender::PyC_ParseOptionalBool (PyObject *o, void *p) |
| int | blender::PyC_ParseRectI (PyObject *o, void *p) |
| int | blender::PyC_ParseOptionalRectI (PyObject *o, void *p) |
| int | blender::PyC_ParseStringEnum (PyObject *o, void *p) |
| const char * | blender::PyC_StringEnum_FindIDFromValue (const PyC_StringEnumItems *items, const int value) |
| int | blender::PyC_CheckArgs_DeepCopy (PyObject *args) |
Simple Printing (for debugging) | |
These are useful to run directly from a debugger to be able to inspect the state. | |
| void | blender::PyC_ObSpit (const char *name, PyObject *var) |
| void | blender::PyC_ObSpitStr (char *result, size_t result_maxncpy, PyObject *var) |
| void | blender::PyC_LineSpit () |
| void | blender::PyC_StackSpit () |
Access Current Frame File Name & Line Number | |
| void | blender::PyC_FileAndNum (const char **r_filename, int *r_lineno) |
| void | blender::PyC_FileAndNum_Safe (const char **r_filename, int *r_lineno) |
Frozen Set Creation | |
| PyObject * | blender::PyC_FrozenSetFromStrings (const char **strings) |
Exception Utilities | |
| PyObject * | blender::PyC_Err_Format_Prefix (PyObject *exception_type_prefix, const char *format,...) |
| PyObject * | blender::PyC_Err_SetString_Prefix (PyObject *exception_type_prefix, const char *str) |
| void | blender::PyC_Err_PrintWithFunc (PyObject *py_func) |
Unicode Conversion | |
In some cases we need to coerce strings, avoid doing this inline. | |
| const char * | blender::PyC_UnicodeAsBytesAndSize (PyObject *py_str, Py_ssize_t *r_size, PyObject **r_coerce) |
| const char * | blender::PyC_UnicodeAsBytes (PyObject *py_str, PyObject **r_coerce) |
| PyObject * | blender::PyC_UnicodeFromBytesAndSize (const char *str, Py_ssize_t size) |
| PyObject * | blender::PyC_UnicodeFromBytes (const char *str) |
| PyObject * | blender::PyC_UnicodeFromStdStr (const std::string &str) |
| int | blender::PyC_ParseUnicodeAsBytesAndSize (PyObject *o, void *p) |
| int | blender::PyC_ParseUnicodeAsBytesAndSize_OrNone (PyObject *o, void *p) |
Name Space Creation/Manipulation | |
| PyObject * | blender::PyC_DefaultNameSpace (const char *filename) |
| bool | blender::PyC_NameSpace_ImportArray (PyObject *py_dict, const char *imports[]) |
| PyObject * | blender::PyC_MainModule_Backup () |
| void | blender::PyC_MainModule_Restore (PyObject *main_mod) |
| int | blender::PyC_Module_AddToSysModules (PyObject *sys_modules, PyObject *module) |
| bool | blender::PyC_IsInterpreterActive () |
#Py_SetPythonHome Wrapper | |
| void | blender::PyC_RunQuicky (const char *filepath, int n,...) |
| void * | blender::PyC_RNA_AsPointer (PyObject *value, const char *type_name) |
Flag Set Utilities (#PyC_FlagSet) | |
Convert to/from Python set of strings to an int flag. | |
| PyObject * | blender::PyC_FlagSet_AsString (const PyC_FlagSet *item) |
| int | blender::PyC_FlagSet_ValueFromID_int (const PyC_FlagSet *item, const char *identifier, int *r_value) |
| int | blender::PyC_FlagSet_ValueFromID (const PyC_FlagSet *item, const char *identifier, int *r_value, const char *error_prefix) |
| int | blender::PyC_FlagSet_ToBitfield (const PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix) |
| PyObject * | blender::PyC_FlagSet_FromBitfield (PyC_FlagSet *items, int flag) |
Run String (Evaluate to Primitive Types) | |
| static PyObject * | blender::pyc_run_string_as_py_object (const char *imports[], const char *imports_star[], const char *expr, const char *filename) ATTR_NONNULL(3 |
| bool | blender::PyC_RunString_AsNumber (const char *imports[], const char *expr, const char *filename, double *r_value) |
| bool | blender::PyC_RunString_AsIntPtr (const char *imports[], const char *expr, const char *filename, intptr_t *r_value) |
| bool | blender::PyC_RunString_AsStringAndSize (const char *imports[], const char *expr, const char *filename, char **r_value, size_t *r_value_size) |
| bool | blender::PyC_RunString_AsString (const char *imports[], const char *expr, const char *filename, char **r_value) |
| bool | blender::PyC_RunString_AsStringAndSizeOrNone (const char *imports[], const char *expr, const char *filename, char **r_value, size_t *r_value_size) |
| bool | blender::PyC_RunString_AsStringOrNone (const char *imports[], const char *expr, const char *filename, char **r_value) |
Std Files Flush | |
| void | blender::PyC_StdFilesFlush () |
Int Conversion | |
| |
| static ulong | blender::pyc_Long_AsUnsignedLong (PyObject *value) |
| int | blender::PyC_Long_AsBool (PyObject *value) |
| int8_t | blender::PyC_Long_AsI8 (PyObject *value) |
| int16_t | blender::PyC_Long_AsI16 (PyObject *value) |
| uint8_t | blender::PyC_Long_AsU8 (PyObject *value) |
| uint16_t | blender::PyC_Long_AsU16 (PyObject *value) |
| uint32_t | blender::PyC_Long_AsU32 (PyObject *value) |
| uint64_t | blender::PyC_Long_AsU64 (PyObject *value) |
Py_buffer Utils | |
| char | blender::PyC_StructFmt_type_from_str (const char *typestr) |
| bool | blender::PyC_StructFmt_type_is_float_any (char format) |
| bool | blender::PyC_StructFmt_type_is_int_any (char format) |
| bool | blender::PyC_StructFmt_type_is_byte (char format) |
| bool | blender::PyC_StructFmt_type_is_bool (char format) |
Dict Utilities | |
| bool | blender::PyC_Dict_CheckKeysAreStrings (PyObject *dict) |
Exception Buffer Access | |
| static std::optional< int > | blender::g_system_exit_code |
| std::optional< int > | blender::PyC_ExceptionSystemExitCode () |
| bool | blender::PyC_Err_CaptureSystemExitCode () |
| static void | blender::pyc_exception_buffer_handle_system_exit () |
| PyObject * | blender::PyC_ExceptionBuffer () |
| PyObject * | blender::PyC_ExceptionBuffer_Simple () |
Owned MemoryView | |
A memory view where the memory is owned. NOTE(@ideasman42): Python doesn't provide a convenient zero-copy way for owned memory to be returned from a memoryview. This types only purpose is to expose a memoryview which our own custom free. The type itself is not expected to be exposed to users. So we could switch to an alternative API if it is ever supported. | |
| static PyBufferProcs | blender::bpy_memoryview_buffer_as_buffer |
| static PyTypeObject | blender::BPyMemoryViewOwned_Type |
| static void | blender::bpy_memoryview_buffer_dealloc (BPyMemoryViewOwned *self) |
| static int | blender::bpy_memoryview_buffer_getbuffer (BPyMemoryViewOwned *self, Py_buffer *view, int flags) |
| PyObject * | blender::PyC_MemoryView_FromBufferOwned (const Py_buffer *info) |
Extend upon CPython's API, filling in some gaps, these functions use PyC_ prefix to distinguish them apart from CPython.
Definition in file py_capi_utils.cc.
| #define PY_SSIZE_T_CLEAN |
Definition at line 13 of file py_capi_utils.cc.