Blender  V3.3
Classes | Macros | Functions | Variables
bpy_rna.h 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_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)
 
PyObject * pyrna_struct_CreatePyObject (PointerRNA *ptr)
 
PyObject * pyrna_prop_CreatePyObject (PointerRNA *ptr, PropertyRNA *prop)
 
PyObject * pyrna_id_CreatePyObject (struct ID *id)
 
bool pyrna_id_FromPyObject (PyObject *obj, struct 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 (struct 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 (struct StructRNA *srna, struct PyMethodDef *py_method, struct PyGetSetDef *py_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 (BPy_StructRNA *pysrna)
 
int pyrna_prop_validity_check (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))

Definition at line 68 of file bpy_rna.h.

◆ BPy_PropertyRNA_CheckExact

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

Definition at line 69 of file bpy_rna.h.

◆ BPy_StructRNA_Check

#define BPy_StructRNA_Check (   v)    (PyObject_TypeCheck(v, &pyrna_struct_Type))

Definition at line 66 of file bpy_rna.h.

◆ BPy_StructRNA_CheckExact

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

Definition at line 67 of file bpy_rna.h.

◆ PYRNA_PROP_CHECK_INT

#define PYRNA_PROP_CHECK_INT (   obj)
Value:
if (UNLIKELY(pyrna_prop_validity_check(obj) == -1)) { \
return -1; \
} \
(void)0
#define UNLIKELY(x)
int pyrna_prop_validity_check(BPy_PropertyRNA *self)
Definition: bpy_rna.c:111
SyclQueue void void size_t num_bytes void

Definition at line 87 of file bpy_rna.h.

◆ PYRNA_PROP_CHECK_OBJ

#define PYRNA_PROP_CHECK_OBJ (   obj)
Value:
if (UNLIKELY(pyrna_prop_validity_check(obj) == -1)) { \
return NULL; \
} \
(void)0

Definition at line 82 of file bpy_rna.h.

◆ PYRNA_PROP_IS_VALID

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

Definition at line 94 of file bpy_rna.h.

◆ PYRNA_STRUCT_CHECK_INT

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

Definition at line 76 of file bpy_rna.h.

◆ PYRNA_STRUCT_CHECK_OBJ

#define PYRNA_STRUCT_CHECK_OBJ (   obj)
Value:
return NULL; \
} \
(void)0

Definition at line 71 of file bpy_rna.h.

◆ PYRNA_STRUCT_IS_VALID

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

Definition at line 93 of file bpy_rna.h.

◆ USE_PYRNA_ITER

#define USE_PYRNA_ITER

Definition at line 49 of file bpy_rna.h.

Function Documentation

◆ BPY_rna_exit()

void BPY_rna_exit ( void  )

Definition at line 7726 of file bpy_rna.c.

References BLI_ghash_free(), BLI_ghash_len(), BLI_ghashIterator_getKey(), GHASH_ITER, id, ID::name, and NULL.

Referenced by BPY_python_end().

◆ BPY_rna_init()

void BPY_rna_init ( void  )

◆ BPY_rna_module()

PyObject* BPY_rna_module ( void  )

◆ BPY_rna_types()

PyObject* BPY_rna_types ( void  )

◆ BPY_update_rna_module()

void BPY_update_rna_module ( void  )

Definition at line 7762 of file bpy_rna.c.

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  )
Note
This isn't essential to run on startup, since subtypes will lazy initialize. But keep running in debug mode so we get immediate notification of bad class hierarchy or any errors in "bpy_types.py" at load time, so errors don't go unnoticed.

Definition at line 8853 of file bpy_rna.c.

References NULL, ptr, pyrna_struct_Subtype(), RNA_blender_rna_pointer_create(), RNA_PROP_BEGIN, RNA_PROP_END, and RNA_struct_find_property().

Referenced by BPY_python_start().

◆ pyrna_array_contains_py()

int pyrna_array_contains_py ( PointerRNA ptr,
PropertyRNA prop,
PyObject *  value 
)

◆ pyrna_array_index()

PyObject* pyrna_array_index ( PointerRNA ptr,
PropertyRNA prop,
int  index 
)

◆ pyrna_deferred_register_class()

int pyrna_deferred_register_class ( struct StructRNA srna,
PyTypeObject *  py_class 
)

◆ pyrna_free_types()

void pyrna_free_types ( void  )

◆ pyrna_id_CheckPyObject()

bool pyrna_id_CheckPyObject ( PyObject *  obj)

Definition at line 7668 of file bpy_rna.c.

Referenced by pyrna_id_FromPyObject().

◆ pyrna_id_CreatePyObject()

PyObject* pyrna_id_CreatePyObject ( struct ID id)

Definition at line 7646 of file bpy_rna.c.

◆ pyrna_id_FromPyObject()

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

Definition at line 7657 of file bpy_rna.c.

◆ pyrna_invalidate()

void pyrna_invalidate ( BPy_DummyPointerRNA self)

Definition at line 123 of file bpy_rna.c.

References RNA_POINTER_INVALIDATE, and self.

Referenced by BPY_DECREF_RNA_INVALIDATE().

◆ pyrna_math_object_from_array()

PyObject* pyrna_math_object_from_array ( PointerRNA ptr,
PropertyRNA prop 
)

◆ pyrna_prop_CreatePyObject()

PyObject* pyrna_prop_CreatePyObject ( PointerRNA ptr,
PropertyRNA prop 
)

◆ pyrna_prop_to_py()

PyObject* pyrna_prop_to_py ( PointerRNA ptr,
PropertyRNA prop 
)

◆ pyrna_prop_validity_check()

int pyrna_prop_validity_check ( BPy_PropertyRNA self)

Definition at line 111 of file bpy_rna.c.

References RNA_property_identifier(), and self.

◆ pyrna_py_from_array()

PyObject* pyrna_py_from_array ( PointerRNA ptr,
PropertyRNA prop 
)

Definition at line 965 of file bpy_rna_array.c.

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

Referenced by pyrna_prop_to_py().

◆ pyrna_py_from_array_index()

PyObject* pyrna_py_from_array_index ( BPy_PropertyArrayRNA self,
PointerRNA ptr,
PropertyRNA prop,
int  index 
)

◆ pyrna_py_to_array()

int pyrna_py_to_array ( PointerRNA ptr,
PropertyRNA prop,
char *  param_data,
PyObject *  py,
const char *  error_prefix 
)

◆ 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()

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

◆ pyrna_struct_as_ptr_or_null()

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

Definition at line 7974 of file bpy_rna.c.

References PointerRNA_NULL, and pyrna_struct_as_ptr().

Referenced by pyrna_struct_as_ptr_or_null_parse().

◆ 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 7993 of file bpy_rna.c.

References BLI_assert, NULL, 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 7982 of file bpy_rna.c.

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

◆ pyrna_struct_as_srna()

StructRNA* pyrna_struct_as_srna ( PyObject *  self,
bool  parent,
const char *  error_prefix 
)

◆ pyrna_struct_CreatePyObject()

PyObject* pyrna_struct_CreatePyObject ( PointerRNA ptr)

◆ pyrna_struct_type_extend_capi()

void pyrna_struct_type_extend_capi ( struct StructRNA srna,
struct PyMethodDef *  py_method,
struct PyGetSetDef *  py_getset 
)

Definition at line 9228 of file bpy_rna.c.

References BLI_assert, err, NULL, pyrna_srna_Subtype(), type, and UNUSED_VARS_NDEBUG.

Referenced by BPY_rna_types_extend_capi().

◆ pyrna_struct_validity_check()

int pyrna_struct_validity_check ( BPy_StructRNA pysrna)

Definition at line 101 of file bpy_rna.c.

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

Referenced by pyrna_py_to_prop().

◆ pyrna_write_check()

bool pyrna_write_check ( void  )

◆ pyrna_write_set()

void pyrna_write_set ( bool  val)

◆ srna_from_self()

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

Variable Documentation

◆ bpy_context_module

BPy_StructRNA* bpy_context_module
extern

◆ meth_bpy_owner_id_get

PyMethodDef meth_bpy_owner_id_get
extern

Definition at line 9301 of file bpy_rna.c.

Referenced by BPy_init_modules().

◆ meth_bpy_owner_id_set

PyMethodDef meth_bpy_owner_id_set
extern

Definition at line 9307 of file bpy_rna.c.

Referenced by BPy_init_modules().

◆ meth_bpy_register_class

PyMethodDef meth_bpy_register_class
extern

Definition at line 8937 of file bpy_rna.c.

Referenced by BPy_init_modules().

◆ meth_bpy_unregister_class

PyMethodDef meth_bpy_unregister_class
extern

Definition at line 9111 of file bpy_rna.c.

Referenced by BPy_init_modules().

◆ pyrna_func_Type

PyTypeObject pyrna_func_Type
extern

Definition at line 7003 of file bpy_rna.c.

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 6748 of file bpy_rna.c.

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

Definition at line 6664 of file bpy_rna.c.

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

◆ pyrna_struct_meta_idprop_Type

PyTypeObject pyrna_struct_meta_idprop_Type
extern

Definition at line 6487 of file bpy_rna.c.

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

◆ pyrna_struct_Type

PyTypeObject pyrna_struct_Type
extern