20#ifdef WITH_PYTHON_SAFETY
32# define USE_PYRNA_INVALIDATE_WEAKREF
35# define USE_PYRNA_STRUCT_REFERENCE
44#if defined(USE_PYRNA_INVALIDATE_WEAKREF) && !defined(USE_WEAKREFS)
48#if defined(USE_PYRNA_INVALIDATE_GC) && defined(USE_PYRNA_INVALIDATE_WEAKREF)
49# error "Only 1 reference check method at a time!"
76#define BPy_StructRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_struct_Type))
77#define BPy_StructRNA_CheckExact(v) (Py_TYPE(v) == &pyrna_struct_Type)
78#define BPy_PropertyRNA_Check(v) (PyObject_TypeCheck(v, &pyrna_prop_Type))
79#define BPy_PropertyRNA_CheckExact(v) (Py_TYPE(v) == &pyrna_prop_Type)
81#define PYRNA_STRUCT_CHECK_OBJ(obj) \
82 if (pyrna_struct_validity_check(obj) == -1) [[unlikely]] { \
86#define PYRNA_STRUCT_CHECK_INT(obj) \
87 if (pyrna_struct_validity_check(obj) == -1) [[unlikely]] { \
92#define PYRNA_PROP_CHECK_OBJ(obj) \
93 if (pyrna_prop_validity_check(obj) == -1) [[unlikely]] { \
97#define PYRNA_PROP_CHECK_INT(obj) \
98 if (pyrna_prop_validity_check(obj) == -1) [[unlikely]] { \
103#define PYRNA_STRUCT_CHECK_OBJ_UNLESS(obj, unless) \
105 const BPy_StructRNA *_obj = obj; \
106 if (UNLIKELY(pyrna_struct_validity_check_only(_obj) == -1) && !(unless)) { \
107 pyrna_struct_validity_exception_only(_obj); \
113#define PYRNA_STRUCT_IS_VALID(pysrna) (LIKELY(((BPy_StructRNA *)(pysrna))->ptr->has_type()))
114#define PYRNA_PROP_IS_VALID(pysrna) (LIKELY(((BPy_PropertyRNA *)(pysrna))->ptr->has_type()))
121 PyObject *in_weakreflist;
124 std::optional<PointerRNA>
ptr;
130 PyObject *in_weakreflist;
133 std::optional<PointerRNA>
ptr;
135#ifdef USE_PYRNA_STRUCT_REFERENCE
141#ifdef PYRNA_FREE_SUPPORT
150 PyObject *in_weakreflist;
153 std::optional<PointerRNA>
ptr;
163 PyObject *in_weakreflist;
166 std::optional<PointerRNA>
ptr;
181 PyObject *in_weakreflist;
185 std::optional<CollectionPropertyIterator>
iter;
191 PyObject *in_weakreflist;
194 std::optional<PointerRNA>
ptr;
206 const char *error_prefix);
233 const char *error_prefix);
279 const char *error_prefix);
PyTypeObject pyrna_func_Type
bool pyrna_id_CheckPyObject(PyObject *obj)
PyObject * BPY_rna_module()
int pyrna_prop_validity_check(const BPy_PropertyRNA *self)
PyObject * pyrna_id_CreatePyObject(ID *id)
BPy_StructRNA * bpy_context_module
void pyrna_context_clear(bContext *C)
PyMethodDef meth_bpy_owner_id_set
void pyrna_context_init(bContext *C)
int pyrna_struct_validity_check(const BPy_StructRNA *pysrna)
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const bool all_args, const char *error_prefix)
PyTypeObject pyrna_prop_Type
void BPY_rna_types_dict_set(PyObject *dict)
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
PyTypeObject pyrna_struct_meta_idprop_Type
PyMethodDef meth_bpy_unregister_class
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
int pyrna_struct_as_ptr_or_null_parse(PyObject *o, void *p)
void BPY_rna_types_finalize_external_types(PyObject *submodule)
PyObject * pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
PyObject * pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
int pyrna_struct_as_ptr_parse(PyObject *o, void *p)
PyMethodDef meth_bpy_register_class
int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix)
void pyrna_struct_type_extend_capi(StructRNA *srna, PyMethodDef *method, PyGetSetDef *getset)
PyObject * pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
bool pyrna_id_FromPyObject(PyObject *obj, ID **id)
PyObject * pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
PyTypeObject pyrna_prop_collection_Type
PyObject * BPY_rna_types()
PyObject * pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop)
void pyrna_struct_validity_exception_only(const BPy_StructRNA *pysrna)
int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class)
const PointerRNA * pyrna_struct_as_ptr(PyObject *py_obj, const StructRNA *srna)
void pyrna_write_set(bool val)
StructRNA * pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix)
void pyrna_invalidate(BPy_DummyPointerRNA *self)
PyObject * pyrna_struct_CreatePyObject_with_primitive_support(PointerRNA *ptr)
StructRNA * srna_from_self(PyObject *self, const char *error_prefix)
const PointerRNA * pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA *srna)
PyTypeObject pyrna_struct_Type
PyTypeObject pyrna_prop_array_Type
int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix)
PyMethodDef meth_bpy_owner_id_get
int pyrna_struct_validity_check_only(const BPy_StructRNA *pysrna)
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
void BPY_update_rna_module()
PyObject_HEAD std::optional< PointerRNA > ptr
vectorcallfunc vectorcall
PyObject_HEAD std::optional< PointerRNA > ptr
PyObject_HEAD std::optional< PointerRNA > ptr
PyObject_HEAD std::optional< CollectionPropertyIterator > iter
PyObject_HEAD std::optional< PointerRNA > ptr
PyObject_HEAD std::optional< PointerRNA > ptr