Blender  V2.93
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
 

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, const bool parent, const char *error_prefix)
 
void BPY_rna_init (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, const bool all_args, const char *error_prefix)
 
PyObject * pyrna_prop_to_py (PointerRNA *ptr, PropertyRNA *prop)
 
uintpyrna_set_to_enum_bitmap (const struct EnumPropertyItem *items, PyObject *value, int type_size, bool type_convert_sign, int bitmap_size, const char *error_prefix)
 
PyObject * pyrna_enum_bitfield_to_py (const struct EnumPropertyItem *items, int value)
 
int pyrna_set_to_enum_bitfield (const struct EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
 
int pyrna_enum_value_from_id (const EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix)
 
int pyrna_deferred_register_class (struct StructRNA *srna, PyTypeObject *py_class)
 
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 82 of file bpy_rna.h.

◆ BPy_PropertyRNA_CheckExact

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

Definition at line 83 of file bpy_rna.h.

◆ BPy_StructRNA_Check

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

Definition at line 80 of file bpy_rna.h.

◆ BPy_StructRNA_CheckExact

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

Definition at line 81 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:121

Definition at line 101 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 96 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 108 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:111

Definition at line 90 of file bpy_rna.h.

◆ PYRNA_STRUCT_CHECK_OBJ

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

Definition at line 85 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 107 of file bpy_rna.h.

◆ USE_PYRNA_ITER

#define USE_PYRNA_ITER

Definition at line 63 of file bpy_rna.h.

Function Documentation

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

References NULL, BPy_TypesModule_State::prop, 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_enum_bitfield_to_py()

PyObject* pyrna_enum_bitfield_to_py ( const struct EnumPropertyItem items,
int  value 
)

◆ pyrna_enum_value_from_id()

int pyrna_enum_value_from_id ( const EnumPropertyItem item,
const char *  identifier,
int *  r_value,
const char *  error_prefix 
)

◆ pyrna_free_types()

void pyrna_free_types ( void  )

◆ pyrna_id_CheckPyObject()

bool pyrna_id_CheckPyObject ( PyObject *  obj)

Definition at line 7633 of file bpy_rna.c.

Referenced by pyrna_id_FromPyObject().

◆ pyrna_id_CreatePyObject()

PyObject* pyrna_id_CreatePyObject ( struct ID id)

Definition at line 7611 of file bpy_rna.c.

◆ pyrna_id_FromPyObject()

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

Definition at line 7622 of file bpy_rna.c.

◆ pyrna_invalidate()

void pyrna_invalidate ( BPy_DummyPointerRNA self)

Definition at line 133 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 121 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 979 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,
const bool  all_args,
const char *  error_prefix 
)

This function is used by operators and converting dicts into collections. It takes keyword args and fills them with property values.

Definition at line 1622 of file bpy_rna.c.

References NULL, pos, ptr, pyrna_py_to_prop(), RNA_property_identifier(), RNA_STRUCT_BEGIN, RNA_STRUCT_END, RNA_struct_find_property(), and STREQ.

Referenced by pyop_as_string(), pyop_call(), and pyrna_py_to_prop().

◆ pyrna_set_to_enum_bitfield()

int pyrna_set_to_enum_bitfield ( const struct EnumPropertyItem items,
PyObject *  value,
int *  r_value,
const char *  error_prefix 
)

◆ pyrna_set_to_enum_bitmap()

uint* pyrna_set_to_enum_bitmap ( const struct EnumPropertyItem items,
PyObject *  value,
int  type_size,
bool  type_convert_sign,
int  bitmap_size,
const char *  error_prefix 
)

◆ pyrna_struct_as_srna()

StructRNA* pyrna_struct_as_srna ( PyObject *  self,
const 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 *  method,
struct PyGetSetDef *  getset 
)

Extend RNA types with C/API methods, properties.

Definition at line 9121 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 111 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 9194 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 9200 of file bpy_rna.c.

Referenced by BPy_init_modules().

◆ meth_bpy_register_class

PyMethodDef meth_bpy_register_class
extern

Definition at line 8827 of file bpy_rna.c.

Referenced by BPy_init_modules().

◆ meth_bpy_unregister_class

PyMethodDef meth_bpy_unregister_class
extern

Definition at line 9001 of file bpy_rna.c.

Referenced by BPy_init_modules().

◆ pyrna_func_Type

PyTypeObject pyrna_func_Type
extern

Definition at line 6972 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 6717 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 6633 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 6456 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