Blender V4.3
bpy_rna.hh File Reference

Go to the source code of this file.

Classes

struct  BPy_DummyPointerRNA
 
struct  BPy_StructRNA
 
struct  BPy_PropertyRNA
 
struct  BPy_PropertyArrayRNA
 
struct  BPy_PropertyCollectionIterRNA
 
struct  BPy_FunctionRNA
 
struct  BPy_StructRNA_Parse
 

Macros

#define USE_PYRNA_ITER
 
#define BPy_StructRNA_Check(v)   (PyObject_TypeCheck(v, &pyrna_struct_Type))
 
#define BPy_StructRNA_CheckExact(v)   (Py_TYPE(v) == &pyrna_struct_Type)
 
#define BPy_PropertyRNA_Check(v)   (PyObject_TypeCheck(v, &pyrna_prop_Type))
 
#define BPy_PropertyRNA_CheckExact(v)   (Py_TYPE(v) == &pyrna_prop_Type)
 
#define PYRNA_STRUCT_CHECK_OBJ(obj)
 
#define PYRNA_STRUCT_CHECK_INT(obj)
 
#define PYRNA_PROP_CHECK_OBJ(obj)
 
#define PYRNA_PROP_CHECK_INT(obj)
 
#define PYRNA_STRUCT_CHECK_OBJ_UNLESS(obj, unless)
 
#define PYRNA_STRUCT_IS_VALID(pysrna)   (LIKELY(((BPy_StructRNA *)(pysrna))->ptr.type != NULL))
 
#define PYRNA_PROP_IS_VALID(pysrna)   (LIKELY(((BPy_PropertyRNA *)(pysrna))->ptr.type != NULL))
 

Functions

StructRNAsrna_from_self (PyObject *self, const char *error_prefix)
 
StructRNApyrna_struct_as_srna (PyObject *self, bool parent, const char *error_prefix)
 
void BPY_rna_init (void)
 
void BPY_rna_exit (void)
 
PyObject * BPY_rna_module (void)
 
void BPY_update_rna_module (void)
 
PyObject * BPY_rna_types (void)
 
void BPY_rna_types_finalize_external_types (PyObject *submodule)
 
PyObject * pyrna_struct_CreatePyObject_with_primitive_support (PointerRNA *ptr)
 
PyObject * pyrna_struct_CreatePyObject (PointerRNA *ptr)
 
PyObject * pyrna_prop_CreatePyObject (PointerRNA *ptr, PropertyRNA *prop)
 
PyObject * pyrna_id_CreatePyObject (ID *id)
 
bool pyrna_id_FromPyObject (PyObject *obj, ID **id)
 
bool pyrna_id_CheckPyObject (PyObject *obj)
 
int pyrna_pydict_to_props (PointerRNA *ptr, PyObject *kw, bool all_args, const char *error_prefix)
 
PyObject * pyrna_prop_to_py (PointerRNA *ptr, PropertyRNA *prop)
 
int pyrna_deferred_register_class (StructRNA *srna, PyTypeObject *py_class)
 
const PointerRNApyrna_struct_as_ptr (PyObject *py_obj, const StructRNA *srna)
 
const PointerRNApyrna_struct_as_ptr_or_null (PyObject *py_obj, const StructRNA *srna)
 
int pyrna_struct_as_ptr_parse (PyObject *o, void *p)
 
int pyrna_struct_as_ptr_or_null_parse (PyObject *o, void *p)
 
void pyrna_struct_type_extend_capi (StructRNA *srna, PyMethodDef *method, PyGetSetDef *getset)
 
void pyrna_alloc_types (void)
 
void pyrna_free_types (void)
 
int pyrna_py_to_array (PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix)
 
int pyrna_py_to_array_index (PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix)
 
PyObject * pyrna_array_index (PointerRNA *ptr, PropertyRNA *prop, int index)
 
PyObject * pyrna_py_from_array (PointerRNA *ptr, PropertyRNA *prop)
 
PyObject * pyrna_py_from_array_index (BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
 
PyObject * pyrna_math_object_from_array (PointerRNA *ptr, PropertyRNA *prop)
 
int pyrna_array_contains_py (PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
 
bool pyrna_write_check (void)
 
void pyrna_write_set (bool val)
 
void pyrna_invalidate (BPy_DummyPointerRNA *self)
 
int pyrna_struct_validity_check_only (const BPy_StructRNA *pysrna)
 
void pyrna_struct_validity_exception_only (const BPy_StructRNA *pysrna)
 
int pyrna_struct_validity_check (const BPy_StructRNA *pysrna)
 
int pyrna_prop_validity_check (const BPy_PropertyRNA *self)
 

Variables

PyTypeObject pyrna_struct_meta_idprop_Type
 
PyTypeObject pyrna_struct_Type
 
PyTypeObject pyrna_prop_Type
 
PyTypeObject pyrna_prop_array_Type
 
PyTypeObject pyrna_prop_collection_Type
 
PyTypeObject pyrna_func_Type
 
PyMethodDef meth_bpy_register_class
 
PyMethodDef meth_bpy_unregister_class
 
PyMethodDef meth_bpy_owner_id_set
 
PyMethodDef meth_bpy_owner_id_get
 
BPy_StructRNAbpy_context_module
 

Macro Definition Documentation

◆ BPy_PropertyRNA_Check

#define BPy_PropertyRNA_Check ( v)    (PyObject_TypeCheck(v, &pyrna_prop_Type))

◆ BPy_PropertyRNA_CheckExact

#define BPy_PropertyRNA_CheckExact ( v)    (Py_TYPE(v) == &pyrna_prop_Type)

Definition at line 72 of file bpy_rna.hh.

Referenced by pyrna_prop_dir().

◆ BPy_StructRNA_Check

◆ BPy_StructRNA_CheckExact

#define BPy_StructRNA_CheckExact ( v)    (Py_TYPE(v) == &pyrna_struct_Type)

Definition at line 70 of file bpy_rna.hh.

Referenced by pyrna_struct_dir().

◆ PYRNA_PROP_CHECK_INT

◆ PYRNA_PROP_CHECK_OBJ

◆ PYRNA_PROP_IS_VALID

#define PYRNA_PROP_IS_VALID ( pysrna)    (LIKELY(((BPy_PropertyRNA *)(pysrna))->ptr.type != NULL))

Definition at line 107 of file bpy_rna.hh.

◆ PYRNA_STRUCT_CHECK_INT

#define PYRNA_STRUCT_CHECK_INT ( obj)
Value:
return -1; \
} \
(void)0
int pyrna_struct_validity_check(const BPy_StructRNA *pysrna)
Definition bpy_rna.cc:126

Definition at line 79 of file bpy_rna.hh.

Referenced by py_msgbus_rna_key_from_py(), pyrna_struct_ass_subscript(), pyrna_struct_contains(), and pyrna_struct_setattro().

◆ PYRNA_STRUCT_CHECK_OBJ

◆ PYRNA_STRUCT_CHECK_OBJ_UNLESS

#define PYRNA_STRUCT_CHECK_OBJ_UNLESS ( obj,
unless )
Value:
{ \
const BPy_StructRNA *_obj = obj; \
if (UNLIKELY(pyrna_struct_validity_check_only(_obj) == -1) && !(unless)) { \
pyrna_struct_validity_exception_only(_obj); \
return NULL; \
} \
} \
(void)0
int pyrna_struct_validity_check_only(const BPy_StructRNA *pysrna)
Definition bpy_rna.cc:112

Definition at line 96 of file bpy_rna.hh.

Referenced by pyrna_struct_getattro().

◆ PYRNA_STRUCT_IS_VALID

#define PYRNA_STRUCT_IS_VALID ( pysrna)    (LIKELY(((BPy_StructRNA *)(pysrna))->ptr.type != NULL))

Definition at line 106 of file bpy_rna.hh.

Referenced by pyrna_struct_repr(), and pyrna_struct_str().

◆ USE_PYRNA_ITER

#define USE_PYRNA_ITER

Definition at line 52 of file bpy_rna.hh.

Function Documentation

◆ BPY_rna_exit()

void BPY_rna_exit ( void )

Definition at line 7881 of file bpy_rna.cc.

References BLI_ghash_free(), BLI_ghash_len(), BLI_ghashIterator_getKey(), GHASH_ITER, and printf.

Referenced by BPY_python_end().

◆ BPY_rna_init()

◆ BPY_rna_module()

PyObject * BPY_rna_module ( void )

◆ BPY_rna_types()

◆ BPY_rna_types_finalize_external_types()

void BPY_rna_types_finalize_external_types ( PyObject * submodule)

◆ BPY_update_rna_module()

void BPY_update_rna_module ( void )

Definition at line 7916 of file bpy_rna.cc.

References PointerRNA::data, G_MAIN, RNA_main_pointer_create(), and rna_module_ptr.

Referenced by BPY_driver_exec(), and BPY_modules_update().

◆ pyrna_alloc_types()

void pyrna_alloc_types ( void )

◆ pyrna_array_contains_py()

◆ pyrna_array_index()

◆ pyrna_deferred_register_class()

◆ pyrna_free_types()

◆ pyrna_id_CheckPyObject()

bool pyrna_id_CheckPyObject ( PyObject * obj)

Definition at line 7823 of file bpy_rna.cc.

Referenced by pyrna_id_FromPyObject().

◆ pyrna_id_CreatePyObject()

PyObject * pyrna_id_CreatePyObject ( ID * id)

Definition at line 7802 of file bpy_rna.cc.

◆ pyrna_id_FromPyObject()

bool pyrna_id_FromPyObject ( PyObject * obj,
ID ** id )

Definition at line 7812 of file bpy_rna.cc.

◆ pyrna_invalidate()

void pyrna_invalidate ( BPy_DummyPointerRNA * self)

Definition at line 147 of file bpy_rna.cc.

References RNA_POINTER_INVALIDATE, and self.

Referenced by BPY_DECREF_RNA_INVALIDATE().

◆ pyrna_math_object_from_array()

◆ pyrna_prop_CreatePyObject()

◆ pyrna_prop_to_py()

◆ pyrna_prop_validity_check()

int pyrna_prop_validity_check ( const BPy_PropertyRNA * self)

Definition at line 135 of file bpy_rna.cc.

References RNA_property_identifier(), and self.

◆ pyrna_py_from_array()

PyObject * pyrna_py_from_array ( PointerRNA * ptr,
PropertyRNA * prop )

Definition at line 986 of file bpy_rna_array.cc.

References ptr, pyrna_math_object_from_array(), pyrna_prop_CreatePyObject(), and ret.

Referenced by pyrna_prop_to_py().

◆ pyrna_py_from_array_index()

◆ pyrna_py_to_array()

◆ pyrna_py_to_array_index()

int pyrna_py_to_array_index ( PointerRNA * ptr,
PropertyRNA * prop,
int arraydim,
int arrayoffset,
int index,
PyObject * py,
const char * error_prefix )

◆ pyrna_pydict_to_props()

int pyrna_pydict_to_props ( PointerRNA * ptr,
PyObject * kw,
bool all_args,
const char * error_prefix )

◆ pyrna_struct_as_ptr()

◆ pyrna_struct_as_ptr_or_null()

const PointerRNA * pyrna_struct_as_ptr_or_null ( PyObject * py_obj,
const StructRNA * srna )

◆ pyrna_struct_as_ptr_or_null_parse()

int pyrna_struct_as_ptr_or_null_parse ( PyObject * o,
void * p )

A version of pyrna_struct_as_ptr_parse that maps Python's None to PointerRNA_NULL.

Definition at line 8210 of file bpy_rna.cc.

References BLI_assert, BPy_StructRNA_Parse::ptr, pyrna_struct_as_ptr_or_null(), and BPy_StructRNA_Parse::type.

Referenced by bpy_context_temp_override().

◆ pyrna_struct_as_ptr_parse()

int pyrna_struct_as_ptr_parse ( PyObject * o,
void * p )

Sets BPy_StructRNA_Parse.ptr to the value in the BPy_StructRNA.ptr (from o) or raise an error if the type isn't a BPy_StructRNA.

Use with #PyArg_ParseTuple's O& formatting.

Definition at line 8199 of file bpy_rna.cc.

References BLI_assert, BPy_StructRNA_Parse::ptr, pyrna_struct_as_ptr(), and BPy_StructRNA_Parse::type.

◆ pyrna_struct_as_srna()

◆ pyrna_struct_CreatePyObject()

◆ pyrna_struct_CreatePyObject_with_primitive_support()

PyObject * pyrna_struct_CreatePyObject_with_primitive_support ( PointerRNA * ptr)

◆ pyrna_struct_type_extend_capi()

void pyrna_struct_type_extend_capi ( StructRNA * srna,
PyMethodDef * method,
PyGetSetDef * getset )

Definition at line 9454 of file bpy_rna.cc.

References BLI_assert, pyrna_srna_Subtype(), and UNUSED_VARS_NDEBUG.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_struct_validity_check()

int pyrna_struct_validity_check ( const BPy_StructRNA * pysrna)

◆ pyrna_struct_validity_check_only()

int pyrna_struct_validity_check_only ( const BPy_StructRNA * pysrna)

Definition at line 112 of file bpy_rna.cc.

References BPy_StructRNA::ptr, and PointerRNA::type.

◆ pyrna_struct_validity_exception_only()

void pyrna_struct_validity_exception_only ( const BPy_StructRNA * pysrna)

Definition at line 120 of file bpy_rna.cc.

Referenced by pyrna_struct_validity_check().

◆ pyrna_write_check()

◆ pyrna_write_set()

◆ srna_from_self()

StructRNA * srna_from_self ( PyObject * self,
const char * error_prefix )

Variable Documentation

◆ bpy_context_module

◆ meth_bpy_owner_id_get

PyMethodDef meth_bpy_owner_id_get
extern

Definition at line 9530 of file bpy_rna.cc.

Referenced by BPy_init_modules().

◆ meth_bpy_owner_id_set

PyMethodDef meth_bpy_owner_id_set
extern

Definition at line 9536 of file bpy_rna.cc.

Referenced by BPy_init_modules().

◆ meth_bpy_register_class

PyMethodDef meth_bpy_register_class
extern

Definition at line 9153 of file bpy_rna.cc.

Referenced by BPy_init_modules().

◆ meth_bpy_unregister_class

PyMethodDef meth_bpy_unregister_class
extern

Definition at line 9336 of file bpy_rna.cc.

Referenced by BPy_init_modules().

◆ pyrna_func_Type

PyTypeObject pyrna_func_Type
extern

Definition at line 7170 of file bpy_rna.cc.

Referenced by BPY_rna_init(), BPY_rna_types(), and pyrna_func_to_py().

◆ pyrna_prop_array_Type

PyTypeObject pyrna_prop_array_Type
extern

Definition at line 6999 of file bpy_rna.cc.

Referenced by BPY_rna_init(), BPY_rna_types(), and pyrna_prop_CreatePyObject().

◆ pyrna_prop_collection_Type

PyTypeObject pyrna_prop_collection_Type
extern

◆ pyrna_prop_Type

PyTypeObject pyrna_prop_Type
extern

◆ pyrna_struct_meta_idprop_Type

PyTypeObject pyrna_struct_meta_idprop_Type
extern

Sub-classes of pyrna_struct_Type which support idprop definitions use this as a meta-class.

Note
tp_base member is set to &PyType_Type on initialization.

Definition at line 6816 of file bpy_rna.cc.

Referenced by BPY_rna_init(), BPY_rna_types(), and pyrna_srna_Subtype().

◆ pyrna_struct_Type