40#ifdef USE_PYRNA_INVALIDATE_WEAKREF
47#include "RNA_prototypes.hh"
72#define USE_PEDANTIC_WRITE
74#define USE_STRING_COERCE
83#define USE_POSTPONED_ANNOTATIONS
106#define BPY_DOC_ID_PROP_TYPE_NOTE \
109 " Only the :class:`bpy.types.ID`, :class:`bpy.types.Bone` and\n" \
110 " :class:`bpy.types.PoseBone` classes support custom properties.\n"
123 PyExc_ReferenceError,
"StructRNA of type %.200s has been removed", Py_TYPE(pysrna)->tp_name);
137 if (
self->ptr.type) {
140 PyErr_Format(PyExc_ReferenceError,
141 "PropertyRNA of type %.200s.%.200s has been removed",
142 Py_TYPE(
self)->tp_name,
152#ifdef USE_PYRNA_INVALIDATE_GC
153# define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g) + 1))
156struct gc_generation {
162static void id_release_gc(
struct ID *
id)
166 for (j = 0; j < 3; j++) {
168 PyGC_Head *gen = (PyGC_Head *)(((
char *)_PyGC_generation0) + (
sizeof(gc_generation) * j));
169 PyGC_Head *g = gen->gc.gc_next;
170 while ((g = g->gc.gc_next) != gen) {
171 PyObject *ob = FROM_GC(g);
188#ifdef USE_PYRNA_INVALIDATE_WEAKREF
191struct GHash *id_weakref_pool =
nullptr;
192static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref);
193static PyMethodDef id_free_weakref_cb_def = {
194 "id_free_weakref_cb", (PyCFunction)id_free_weakref_cb, METH_O,
nullptr};
199static void id_weakref_pool_free_value_fn(
void *p)
201 GHash *weakinfo_hash =
static_cast<GHash *
>(p);
206static GHash *id_weakref_pool_get(
ID *
id)
209 if (weakinfo_hash ==
nullptr) {
215 return weakinfo_hash;
222 PyObject *weakref_capsule;
223 PyObject *weakref_cb_py;
227 GHash *weakinfo_hash = id_weakref_pool_get(
id);
229 weakref_capsule = PyCapsule_New(weakinfo_hash,
nullptr,
nullptr);
230 weakref_cb_py = PyCFunction_New(&id_free_weakref_cb_def, weakref_capsule);
231 Py_DECREF(weakref_capsule);
234 weakref = PyWeakref_NewRef((PyObject *)pyrna, weakref_cb_py);
236 Py_DECREF(weakref_cb_py);
246static ID *_id_tmp_ptr;
247static void value_id_set(
void *
id)
249 _id_tmp_ptr = (
ID *)
id;
252static void id_release_weakref_list(
struct ID *
id,
GHash *weakinfo_hash);
253static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref)
256 GHash *weakinfo_hash =
static_cast<GHash *
>(PyCapsule_GetPointer(weakinfo_pair,
nullptr));
263 id_release_weakref_list(_id_tmp_ptr, weakinfo_hash);
271static void id_release_weakref_list(
struct ID *
id,
GHash *weakinfo_hash)
277# ifdef DEBUG_RNA_WEAKREF
278 fprintf(stdout,
"id_release_weakref: '%s', %d items\n", id->name,
BLI_ghash_len(weakinfo_hash));
283 PyObject *item = PyWeakref_GET_OBJECT(weakref);
284 if (item != Py_None) {
286# ifdef DEBUG_RNA_WEAKREF
302static void id_release_weakref(
struct ID *
id)
306 id_release_weakref_list(
id, weakinfo_hash);
314#ifdef USE_PYRNA_INVALIDATE_GC
318#ifdef USE_PYRNA_INVALIDATE_WEAKREF
320 if (id_weakref_pool !=
nullptr) {
321 PyGILState_STATE gilstate = PyGILState_Ensure();
323 id_release_weakref(
id);
325 PyGILState_Release(gilstate);
332#ifdef USE_PEDANTIC_WRITE
339 const short idcode =
GS(id->name);
344 if (key && PyUnicode_Check(key)) {
345 pyname = PyUnicode_AsUTF8(key);
348 pyname =
"<UNKNOWN>";
353 PyErr_Format(PyExc_AttributeError,
354 "Writing to ID classes in this context is not allowed: "
355 "%.200s, %.200s datablock, error setting %.200s.%.200s",
368#ifdef USE_PEDANTIC_WRITE
405 const short order_fallback,
412# define MATHUTILS_CB_SUBTYPE_EUL 0
413# define MATHUTILS_CB_SUBTYPE_VEC 1
414# define MATHUTILS_CB_SUBTYPE_QUAT 2
415# define MATHUTILS_CB_SUBTYPE_COLOR 3
423 return self->prop ? 0 : -1;
432 if (
self->prop ==
nullptr) {
455 if (
self->prop ==
nullptr) {
459# ifdef USE_PEDANTIC_WRITE
466 PyErr_Format(PyExc_AttributeError,
467 "bpy_prop \"%.200s.%.200s\" is read-only",
477 for (i = 0; i <
len; i++) {
492 if (order != eul->
order) {
508 if (
self->prop ==
nullptr) {
522 if (
self->prop ==
nullptr) {
526# ifdef USE_PEDANTIC_WRITE
533 PyErr_Format(PyExc_AttributeError,
534 "bpy_prop \"%.200s.%.200s\" is read-only",
567 if (
self->prop ==
nullptr) {
581 if (
self->prop ==
nullptr) {
585# ifdef USE_PEDANTIC_WRITE
592 PyErr_Format(PyExc_AttributeError,
593 "bpy_prop \"%.200s.%.200s\" is read-only",
617 const short order_fallback,
621 if (*r_prop_eul_order ==
nullptr) {
625 if (*r_prop_eul_order) {
633 return order_fallback;
642#define PROP_ALL_VECTOR_SUBTYPES \
644 case PROP_TRANSLATION: \
645 case PROP_DIRECTION: \
646 case PROP_VELOCITY: \
647 case PROP_ACCELERATION: \
653 PyObject *
ret =
nullptr;
674 goto thick_wrap_slice;
687 if (totdim == 1 || (totdim == 2 && subtype ==
PROP_MATRIX)) {
695 if (
len >= 2 &&
len <= 4) {
789 if (
ret ==
nullptr) {
820 return (((a->ptr.data ==
b->ptr.data) && (a->ptr.type ==
b->ptr.type)) ? 0 : -1);
825 return (((a->prop ==
b->prop) && (a->ptr.data ==
b->ptr.data) && (a->ptr.type ==
b->ptr.type)) ?
844 res = ok ? Py_False : Py_True;
851 res = Py_NotImplemented;
858 return Py_NewRef(res);
875 res = ok ? Py_False : Py_True;
882 res = Py_NotImplemented;
889 return Py_NewRef(res);
897 const char *extra_info =
"";
900 return PyUnicode_FromFormat(
"<bpy_struct, %.200s invalid>", Py_TYPE(
self)->tp_name);
903 ID *
id =
self->ptr.owner_id;
905 extra_info =
", evaluated";
914 ret = PyUnicode_FromFormat(
"<bpy_struct, %.200s(\"%.200s\") at %p%s>",
923 return PyUnicode_FromFormat(
"<bpy_struct, %.200s at %p%s>",
931 ID *
id =
self->ptr.owner_id;
940 tmp_str = PyUnicode_FromString(id->name + 2);
943 ret = PyUnicode_FromFormat(
947 ID *real_id =
nullptr;
956 if (real_id !=
nullptr) {
958 tmp_str = PyUnicode_FromString(real_id->
name + 2);
959 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R].%s",
966 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
974 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
991 const char *type_id =
nullptr;
1002 PyErr_SetString(PyExc_RuntimeError,
"could not use property type, internal error");
1021 type_count[0] =
'\0';
1030 ret = PyUnicode_FromFormat(
"<bpy_%.200s%.200s, %.200s.%.200s(\"%.200s\")>",
1043 return PyUnicode_FromFormat(
1048 return PyUnicode_FromFormat(
"<bpy_%.200s%.200s, %.200s.%.200s>",
1057 ID *
id =
self->ptr.owner_id;
1063 if (
id ==
nullptr) {
1068 tmp_str = PyUnicode_FromString(id->name + 2);
1072 ID *real_id =
nullptr;
1077 if (real_id !=
id) {
1079 tmp_str = PyUnicode_FromString(real_id->
name + 2);
1081 const char *data_delim = ((*path)[0] ==
'[') ?
"" :
".";
1082 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]%s%s",
1090 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
1113 return PyUnicode_FromFormat(
"<%.200s %.200s.%.200s()>",
1114 Py_TYPE(
self)->tp_name,
1121 return _Py_HashPointer(
self->ptr.data);
1128 if (
self->ptr.data ==
nullptr) {
1132 x = _Py_HashPointer(
self->ptr.data);
1137 y = _Py_HashPointer((
void *)(
self->prop));
1148#ifdef USE_PYRNA_STRUCT_REFERENCE
1149static int pyrna_struct_traverse(
BPy_StructRNA *
self, visitproc visit,
void *arg)
1151 Py_VISIT(
self->reference);
1157 Py_CLEAR(
self->reference);
1165#ifdef PYRNA_FREE_SUPPORT
1166 if (
self->freeptr &&
self->ptr.data) {
1168 self->ptr.data =
nullptr;
1173 if (
self->in_weakreflist !=
nullptr) {
1174 PyObject_ClearWeakRefs((PyObject *)
self);
1178#ifdef USE_PYRNA_STRUCT_REFERENCE
1179 if (
self->reference) {
1180 PyObject_GC_UnTrack(
self);
1181 pyrna_struct_clear(
self);
1184 PyTypeObject *base = Py_TYPE(
self)->tp_base;
1186 if (base && PyType_IS_GC(base)) {
1187 PyObject_GC_UnTrack(
self);
1197#ifdef USE_PYRNA_STRUCT_REFERENCE
1200 if (
self->reference) {
1201 PyObject_GC_UnTrack(
self);
1202 Py_CLEAR(
self->reference);
1207 self->reference = reference;
1208 Py_INCREF(reference);
1210 PyObject_GC_Track(
self);
1219 if (
self->in_weakreflist !=
nullptr) {
1220 PyObject_ClearWeakRefs((PyObject *)
self);
1230 if (
self->in_weakreflist !=
nullptr) {
1231 PyObject_ClearWeakRefs((PyObject *)
self);
1262 const char *param = PyUnicode_AsUTF8(item);
1264 if (param ==
nullptr) {
1265 PyErr_Format(PyExc_TypeError,
1266 "%.200s expected a string enum, not %.200s",
1268 Py_TYPE(item)->tp_name);
1274 PyErr_Format(PyExc_TypeError,
1275 "%.200s enum \"%.200s\" not found in (%s)",
1295 if (!PyAnySet_Check(value)) {
1296 PyErr_Format(PyExc_TypeError,
1297 "%.200s, %.200s.%.200s expected a set, not a %.200s",
1301 Py_TYPE(value)->tp_name);
1311 if (PySet_GET_SIZE(value)) {
1312 PyErr_Format(PyExc_TypeError,
1313 "%.200s: empty enum \"%.200s\" could not have any values assigned",
1332 PyObject *item, *
ret =
nullptr;
1337 ret = PySet_New(
nullptr);
1342 for (index = 0; identifier[index]; index++) {
1343 item = PyUnicode_FromString(identifier[index]);
1344 PySet_Add(
ret, item);
1350 const char *identifier;
1352 ret = PyUnicode_FromString(identifier);
1368 "current value '%d' "
1369 "matches no enum in '%s', '%s', '%s'",
1376 char error_str[256];
1379 "RNA Warning: Current value \"%d\" "
1380 "matches no enum in '%s', '%s', '%s'",
1386 PyErr_Warn(PyExc_RuntimeWarning, error_str);
1394 ret = PyUnicode_FromString(
"");
1396 PyErr_Format(PyExc_AttributeError,
"RNA Error: Current value \"%d\" matches no enum", val);
1432#ifdef USE_STRING_COERCE
1435 ret = PyBytes_FromStringAndSize(buf, buf_len);
1441 ret = PyUnicode_FromStringAndSize(buf, buf_len);
1445 ret = PyBytes_FromStringAndSize(buf, buf_len);
1448 ret = PyUnicode_FromStringAndSize(buf, buf_len);
1451 if (buf_fixed != buf) {
1476 PyErr_Format(PyExc_TypeError,
1477 "bpy_struct internal error: unknown type '%d' (pyrna_prop_to_py)",
1488 const bool all_args,
1489 const char *error_prefix)
1493 const char *arg_name =
nullptr;
1496 totkw = kw ? PyDict_Size(kw) : 0;
1501 if (
STREQ(arg_name,
"rna_type")) {
1505 if (kw ==
nullptr) {
1507 PyExc_TypeError,
"%.200s: no keywords, expected \"%.200s\"", error_prefix, arg_name);
1512 item = PyDict_GetItemString(kw, arg_name);
1514 if (item ==
nullptr) {
1516 PyErr_Format(PyExc_TypeError,
1517 "%.200s: keyword \"%.200s\" missing",
1519 arg_name ? arg_name :
"<UNKNOWN>");
1534 if (error_val == 0 && totkw > 0) {
1535 PyObject *key, *value;
1538 while (PyDict_Next(kw, &
pos, &key, &value)) {
1539 arg_name = PyUnicode_AsUTF8(key);
1546 PyErr_Format(PyExc_TypeError,
1547 "%.200s: keyword \"%.200s\" unrecognized",
1549 arg_name ? arg_name :
"<UNKNOWN>");
1560 pyfunc->
func = func;
1561 return (PyObject *)pyfunc;
1587 param = PyObject_IsTrue(value);
1590 param = PyC_Long_AsI32(value);
1598 PyErr_Format(PyExc_TypeError,
1599 "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s",
1603 Py_TYPE(value)->tp_name);
1608 *((
bool *)data) = param;
1618 const long param = PyLong_AsLongAndOverflow(value, &overflow);
1619 if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
1620 PyErr_Format(PyExc_ValueError,
1621 "%.200s %.200s.%.200s value not in 'int' range "
1628 if (param == -1 && PyErr_Occurred()) {
1629 PyErr_Format(PyExc_TypeError,
1630 "%.200s %.200s.%.200s expected an int type, not %.200s",
1634 Py_TYPE(value)->tp_name);
1638 int param_i =
int(param);
1641 *((
int *)data) = param_i;
1650 const float param = PyFloat_AsDouble(value);
1651 if (PyErr_Occurred()) {
1652 PyErr_Format(PyExc_TypeError,
1653 "%.200s %.200s.%.200s expected a float type, not %.200s",
1657 Py_TYPE(value)->tp_name);
1663 *((
float *)data) = param;
1675 if (value == Py_None) {
1682 *((
char **)data) = (
char *)
nullptr;
1690 PyErr_Format(PyExc_TypeError,
1691 "%.200s %.200s.%.200s doesn't support None from string types",
1702 param = PyBytes_AsString(value);
1704 if (param ==
nullptr) {
1705 if (PyBytes_Check(value)) {
1710 "%.200s %.200s.%.200s error assigning bytes",
1716 PyErr_Format(PyExc_TypeError,
1717 "%.200s %.200s.%.200s expected a bytes type, not %.200s",
1721 Py_TYPE(value)->tp_name);
1732 *((
char **)data) = (
char *)param;
1741#ifdef USE_STRING_COERCE
1742 PyObject *value_coerce =
nullptr;
1748 param = PyUnicode_AsUTF8(value);
1751 param = PyUnicode_AsUTF8(value);
1754 if (param ==
nullptr) {
1755 if (PyUnicode_Check(value)) {
1760 "%.200s %.200s.%.200s error assigning string",
1766 PyErr_Format(PyExc_TypeError,
1767 "%.200s %.200s.%.200s expected a string type, not %.200s",
1771 Py_TYPE(value)->tp_name);
1785 *((
char **)data) = (
char *)param;
1792#ifdef USE_STRING_COERCE
1793 Py_XDECREF(value_coerce);
1816 *((
int *)data) = val;
1825 PyObject *value_new =
nullptr;
1847 if (
ELEM(base_type, &RNA_Operator, &RNA_Gizmo)) {
1855 if (PyDict_Check(value)) {
1857 if (base_type == &RNA_OperatorProperties) {
1861 if (base_type == &RNA_GizmoProperties) {
1876 PyErr_Format(PyExc_TypeError,
1877 "%.200s %.200s.%.200s collection has no type, "
1878 "can't be used as a %.200s type",
1888 if (value == Py_None) {
1890 PyErr_Format(PyExc_TypeError,
1891 "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type",
1896 Py_XDECREF(value_new);
1903 PyErr_Format(PyExc_TypeError,
1904 "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
1909 Py_TYPE(value)->tp_name);
1910 Py_XDECREF(value_new);
1916 if (value_owner_id !=
nullptr) {
1918 PyErr_Format(PyExc_TypeError,
1919 "%.200s %.200s.%.200s ID type does not support assignment to itself",
1923 Py_XDECREF(value_new);
1929 if (
ptr->
type != &RNA_Function) {
1930 PyErr_Format(PyExc_TypeError,
1931 "%.200s %.200s.%.200s ID type assignment is temporary, can't assign",
1935 Py_XDECREF(value_new);
1942 bool raise_error =
false;
1947 if (param ==
nullptr) {
1962 if (param ==
nullptr) {
1963 *((
void **)data) =
nullptr;
1973 else if (param ==
nullptr) {
1974 *((
void **)data) =
nullptr;
1977 *((
void **)data) = param->
ptr.
data;
1992 Py_XDECREF(value_new);
2007 PyErr_Format(PyExc_TypeError,
2008 "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
2015 Py_XDECREF(value_new);
2019 Py_XDECREF(value_new);
2024 Py_ssize_t seq_len, i;
2032 if (!PySequence_Check(value)) {
2035 "%.200s %.200s.%.200s expected a sequence for an RNA collection, not %.200s",
2039 Py_TYPE(value)->tp_name);
2043 seq_len = PySequence_Size(value);
2044 for (i = 0; i < seq_len; i++) {
2045 item = PySequence_GetItem(value, i);
2047 if (item ==
nullptr) {
2050 "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection",
2059 if (PyDict_Check(item) == 0) {
2060 PyErr_Format(PyExc_TypeError,
2061 "%.200s %.200s.%.200s expected a each sequence "
2062 "member to be a dict for an RNA collection, not %.200s",
2066 Py_TYPE(item)->tp_name);
2079 &itemptr, item,
true,
"Converting a Python list to an RNA collection") == -1)
2082 const char *msg_char = PyUnicode_AsUTF8(msg);
2085 PyErr_Format(PyExc_TypeError,
2086 "%.200s %.200s.%.200s error converting a member of a collection "
2087 "from a dicts into an RNA collection, failed with: %s",
2103 PyErr_Format(PyExc_AttributeError,
2104 "%.200s %.200s.%.200s unknown property type (pyrna_py_to_prop)",
2137 &
self->ptr,
self->prop,
self->arraydim,
self->arrayoffset, index, value,
"") == -1)
2159 int param = PyC_Long_AsI32(value);
2160 if (param == -1 && PyErr_Occurred()) {
2161 PyErr_SetString(PyExc_TypeError,
"expected an int type");
2171 float param = PyFloat_AsDouble(value);
2172 if (PyErr_Occurred()) {
2173 PyErr_SetString(PyExc_TypeError,
"expected a float type");
2183 PyErr_SetString(PyExc_AttributeError,
"not an array type");
2235#define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \
2237 keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \
2238 if (keynum_abs < 0) { \
2239 PyErr_Format(PyExc_IndexError, "bpy_prop_collection[%d]: out of range.", keynum); \
2250 if (value != Py_None) {
2256 PyErr_Format(PyExc_TypeError,
2257 "'%.200s' object is not subscriptable (only iteration is supported)",
2258 Py_TYPE(value)->tp_name);
2266 const char *error_prefix)
2268 PyErr_Format(PyExc_TypeError,
2269 "%.200s: %.200s.%.200s does not support string lookups",
2276 const char *error_prefix)
2290 Py_ssize_t keynum_abs = keynum;
2303 const int key =
int(keynum_abs);
2304 PyObject *result =
nullptr;
2328 if (keynum_abs >=
len) {
2329 PyErr_Format(PyExc_IndexError,
2330 "bpy_prop_collection[index]: "
2331 "index %d out of range, size %d",
2336 PyErr_Format(PyExc_RuntimeError,
2337 "bpy_prop_collection[index]: internal error, "
2338 "valid index %d given in %d sized collection, but value not found",
2351 Py_ssize_t keynum_abs = keynum;
2360 if (keynum_abs >=
len) {
2361 PyErr_Format(PyExc_IndexError,
2362 "bpy_prop_collection[index] = value: "
2363 "index %d out of range, size %d",
2368 PyErr_Format(PyExc_IndexError,
2369 "bpy_prop_collection[index] = value: "
2370 "index %d failed assignment (unknown reason)",
2391 if (keynum >= 0 && keynum <
len) {
2395 PyErr_Format(PyExc_IndexError,
"bpy_prop_array[index]: index %d out of range", keynum);
2412 const int key_len = strlen(keyname);
2415 PyObject *result =
nullptr;
2426 &iter.
ptr, nameprop, name,
sizeof(name), &name_len);
2427 if ((key_len == name_len) &&
STREQ(name_ptr, keyname)) {
2430 if (name != name_ptr) {
2454 PyErr_Format(PyExc_KeyError,
"bpy_prop_collection[key]: key \"%.200s\" not found", keyname);
2472 const char *err_prefix,
2473 const short err_not_found,
2476 const char *keyname;
2479 if (PyTuple_GET_SIZE(key) != 2) {
2480 PyErr_Format(PyExc_KeyError,
2481 "%s: tuple key must be a pair, not size %d",
2483 PyTuple_GET_SIZE(key));
2486 if (
self->ptr.type != &RNA_BlendData) {
2487 PyErr_Format(PyExc_KeyError,
2488 "%s: is only valid for bpy.data collections, not %.200s",
2493 if ((keyname = PyUnicode_AsUTF8(PyTuple_GET_ITEM(key, 0))) ==
nullptr) {
2494 PyErr_Format(PyExc_KeyError,
2495 "%s: id must be a string, not %.200s",
2497 Py_TYPE(PyTuple_GET_ITEM(key, 0))->tp_name);
2501 PyObject *keylib = PyTuple_GET_ITEM(key, 1);
2505 if (keylib == Py_None) {
2508 else if (PyUnicode_Check(keylib)) {
2510 const char *keylib_str = PyUnicode_AsUTF8(keylib);
2513 if (
lib ==
nullptr) {
2514 if (err_not_found) {
2515 PyErr_Format(PyExc_KeyError,
2516 "%s: lib filepath '%.1024s' "
2517 "does not reference a valid library",
2527 PyErr_Format(PyExc_KeyError,
2528 "%s: lib must be a string or None, not %.200s",
2530 Py_TYPE(keylib)->tp_name);
2538 ID *
id =
static_cast<ID *
>(itemptr.data);
2539 if (id->lib ==
lib &&
STREQLEN(keyname, id->name + 2,
sizeof(id->name) - 2)) {
2550 if ((found ==
false) && err_not_found) {
2552 PyErr_SetString(PyExc_KeyError,
"bpy_prop_collection[key, lib]: not found");
2561 const char *err_prefix,
2562 const bool err_not_found)
2566 self, key, err_prefix, err_not_found, &
ptr);
2568 if (contains == 1) {
2587 list = PyList_New(0);
2596 PyList_APPEND(list, item);
2599 if (
count == stop) {
2627 tuple = PyTuple_New(stop - start);
2642 values =
static_cast<float *
>(PyMem_MALLOC(
sizeof(
float) * length));
2645 values = values_stack;
2650 PyTuple_SET_ITEM(tuple,
count - start, PyFloat_FromDouble(values[
count]));
2653 if (values != values_stack) {
2662 values =
static_cast<bool *
>(PyMem_MALLOC(
sizeof(
bool) * length));
2665 values = values_stack;
2670 PyTuple_SET_ITEM(tuple,
count - start, PyBool_FromLong(values[
count]));
2673 if (values != values_stack) {
2682 values =
static_cast<int *
>(PyMem_MALLOC(
sizeof(
int) * length));
2685 values = values_stack;
2690 PyTuple_SET_ITEM(tuple,
count - start, PyLong_FromLong(values[
count]));
2693 if (values != values_stack) {
2701 PyErr_SetString(PyExc_TypeError,
"not an array type");
2714 if (PyUnicode_Check(key)) {
2717 if (PyIndex_Check(key)) {
2718 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2719 if (i == -1 && PyErr_Occurred()) {
2725 if (PySlice_Check(key)) {
2726 PySliceObject *key_slice = (PySliceObject *)key;
2727 Py_ssize_t step = 1;
2729 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2733 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection[slice]: slice steps not supported");
2736 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2740 Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
2743 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
2746 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
2750 if (start < 0 || stop < 0) {
2763 if (stop - start <= 0) {
2764 return PyList_New(0);
2769 if (PyTuple_Check(key)) {
2772 self, key,
"bpy_prop_collection[id, lib]",
true);
2775 PyErr_Format(PyExc_TypeError,
2776 "bpy_prop_collection[key]: invalid key, "
2777 "must be a string or an int, not %.200s",
2778 Py_TYPE(key)->tp_name);
2788 if (value == Py_None) {
2790 PyErr_Format(PyExc_TypeError,
2791 "bpy_prop_collection[key] = value: invalid, "
2792 "this collection doesn't support None assignment");
2799 PyErr_Format(PyExc_TypeError,
2800 "bpy_prop_collection[key] = value: invalid, "
2801 "expected a StructRNA type or None, not a %.200s",
2802 Py_TYPE(value)->tp_name);
2808 PyErr_Format(PyExc_TypeError,
2809 "bpy_prop_collection[key] = value: invalid, "
2810 "expected a '%.200s' type or None, not a '%.200s'",
2819 PyErr_Format(PyExc_TypeError,
2820 "bpy_prop_collection[key] = value: internal error, "
2821 "failed to get the collection type");
2834 if (value ==
nullptr) {
2835 PyErr_SetString(PyExc_TypeError,
"del bpy_prop_collection[key]: not supported");
2843 if (PyUnicode_Check(key)) {
2848 if (PyIndex_Check(key)) {
2849 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2850 if (i == -1 && PyErr_Occurred()) {
2857 else if (PySlice_Check(key)) {
2858 PySliceObject *key_slice = (PySliceObject *)key;
2859 Py_ssize_t step = 1;
2861 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2864 else if (step != 1) {
2865 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection[slice]: slice steps not supported");
2868 else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2872 Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
2875 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
2878 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
2882 if (start < 0 || stop < 0) {
2895 if (stop - start <= 0) {
2896 return PyList_New(0);
2905 PyErr_Format(PyExc_TypeError,
2906 "bpy_prop_collection[key]: invalid key, "
2907 "must be an int, not %.200s",
2908 Py_TYPE(key)->tp_name);
2917 if (PyUnicode_Check(key)) {
2918 return pyrna_prop_array_subscript_str(
self, PyUnicode_AsUTF8(key));
2922 if (PyIndex_Check(key)) {
2923 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2924 if (i == -1 && PyErr_Occurred()) {
2929 if (PySlice_Check(key)) {
2930 Py_ssize_t step = 1;
2931 PySliceObject *key_slice = (PySliceObject *)key;
2933 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2937 PyErr_SetString(PyExc_TypeError,
"bpy_prop_array[slice]: slice steps not supported");
2940 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2948 Py_ssize_t start, stop, slicelength;
2950 if (PySlice_GetIndicesEx(key,
len, &start, &stop, &step, &slicelength) < 0) {
2954 if (slicelength <= 0) {
2955 return PyTuple_New(0);
2961 PyErr_SetString(PyExc_AttributeError,
"bpy_prop_array[key]: invalid key, key must be an int");
2971 PyObject *value_fast;
2972 if (!(value_fast = PySequence_Fast(value,
2973 "bpy_prop_array[slice] = value: "
2974 "element in assignment is not a sequence type")))
2978 if (PySequence_Fast_GET_SIZE(value_fast) != length) {
2979 Py_DECREF(value_fast);
2980 PyErr_SetString(PyExc_ValueError,
2981 "bpy_prop_array[slice] = value: "
2982 "re-sizing bpy_struct element in arrays isn't supported");
2991 PyObject **value_items,
float *value,
int totdim,
const int dimsize[],
const float range[2])
2993 const int length = dimsize[0];
2997 for (i = 0; i !=
length; i++) {
2999 if (
UNLIKELY(subvalue ==
nullptr)) {
3004 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1], range);
3006 Py_DECREF(subvalue);
3012 const float min = range[0], max = range[1];
3014 for (i = 0; i !=
length; i++) {
3015 float v = PyFloat_AsDouble(value_items[i]);
3023 PyObject **value_items,
int *value,
int totdim,
const int dimsize[],
const int range[2])
3025 const int length = dimsize[0];
3029 for (i = 0; i !=
length; i++) {
3031 if (
UNLIKELY(subvalue ==
nullptr)) {
3036 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1], range);
3038 Py_DECREF(subvalue);
3044 const int min = range[0], max = range[1];
3046 for (i = 0; i !=
length; i++) {
3047 int v = PyLong_AsLong(value_items[i]);
3057 const int dimsize[])
3059 const int length = dimsize[0];
3063 for (i = 0; i !=
length; i++) {
3065 if (
UNLIKELY(subvalue ==
nullptr)) {
3070 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1]);
3072 Py_DECREF(subvalue);
3079 for (i = 0; i !=
length; i++) {
3080 const int v = PyLong_AsLong(value_items[i]);
3094 PyObject *value_orig)
3098 void *values_alloc =
nullptr;
3101 if (value_orig ==
nullptr) {
3104 "bpy_prop_array[slice] = value: deleting with list types is not supported by bpy_struct");
3108 if (!(value = PySequence_Fast(
3109 value_orig,
"bpy_prop_array[slice] = value: assignment is not a sequence type")))
3114 if (PySequence_Fast_GET_SIZE(value) != stop - start) {
3116 PyErr_SetString(PyExc_TypeError,
3117 "bpy_prop_array[slice] = value: re-sizing bpy_struct arrays isn't supported");
3129 for (
int i = arraydim + 1; i < totdim; i++) {
3134 PyObject **value_items = PySequence_Fast_ITEMS(value);
3138 float *values =
static_cast<float *
>(
3140 (values_alloc = PyMem_MALLOC(
sizeof(*values) * length_flat)) :
3142 if (start != 0 || stop != length) {
3150 dimsize[arraydim] = stop - start;
3152 &values[arrayoffset + (start * span)],
3157 if (PyErr_Occurred()) {
3167 int *values =
static_cast<int *
>(
3169 (values_alloc = PyMem_MALLOC(
sizeof(*values) * length_flat)) :
3171 if (start != 0 || stop != length) {
3179 dimsize[arraydim] = stop - start;
3181 &values[arrayoffset + (start * span)],
3186 if (PyErr_Occurred()) {
3196 bool *values =
static_cast<bool *
>(
3198 (values_alloc = PyMem_MALLOC(
sizeof(
bool) * length_flat)) :
3201 if (start != 0 || stop != length) {
3206 dimsize[arraydim] = stop - start;
3208 &values[arrayoffset + (start * span)],
3210 &dimsize[arraydim]);
3212 if (PyErr_Occurred()) {
3221 PyErr_SetString(PyExc_TypeError,
"not an array type");
3229 PyMem_FREE(values_alloc);
3247 if (keynum >= 0 && keynum <
len) {
3251 PyErr_SetString(PyExc_IndexError,
"bpy_prop_array[index] = value: index out of range");
3265 PyErr_Format(PyExc_AttributeError,
3266 "bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only",
3272 else if (PyIndex_Check(key)) {
3273 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
3274 if (i == -1 && PyErr_Occurred()) {
3281 else if (PySlice_Check(key)) {
3283 Py_ssize_t start, stop, step, slicelength;
3285 if (PySlice_GetIndicesEx(key,
len, &start, &stop, &step, &slicelength) < 0) {
3288 else if (slicelength <= 0) {
3291 else if (step == 1) {
3296 PyErr_SetString(PyExc_TypeError,
"slice steps not supported with RNA");
3301 PyErr_SetString(PyExc_AttributeError,
"invalid key, key must be an int");
3388 if (PyTuple_Check(key)) {
3391 self, key,
"(id, lib) in bpy_prop_collection",
false,
nullptr);
3395 const char *keyname = PyUnicode_AsUTF8(key);
3397 if (keyname ==
nullptr) {
3398 PyErr_SetString(PyExc_TypeError,
3399 "bpy_prop_collection.__contains__: expected a string or a tuple of strings");
3407 self,
"bpy_prop_collection.__contains__") == -1)
3417 const char *name = PyUnicode_AsUTF8(value);
3422 PyErr_SetString(PyExc_TypeError,
"bpy_struct.__contains__: expected a string");
3427 PyErr_SetString(PyExc_TypeError,
"bpy_struct: this type doesn't support IDProperties");
3486 const char *name = PyUnicode_AsUTF8(key);
3491 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
3495 if (name ==
nullptr) {
3496 PyErr_SetString(PyExc_TypeError,
3497 "bpy_struct[key]: only strings are allowed as keys of ID properties");
3503 if (group ==
nullptr) {
3504 PyErr_Format(PyExc_KeyError,
"bpy_struct[key]: key \"%s\" not found", name);
3510 if (idprop ==
nullptr) {
3511 PyErr_Format(PyExc_KeyError,
"bpy_struct[key]: key \"%s\" not found", name);
3524#ifdef USE_PEDANTIC_WRITE
3530 if (group ==
nullptr) {
3531 PyErr_SetString(PyExc_TypeError,
3532 "bpy_struct[key] = val: id properties not supported for this type");
3544 "bpy_struct[key] = val: datablock id properties not supported for this type");
3561 pyrna_struct_keys_doc,
3562 ".. method:: keys()\n"
3564 " Returns the keys of this objects custom properties (matches Python's\n"
3565 " dictionary function of the same name).\n"
3567 " :return: custom property keys.\n"
3568 " :rtype: :class:`idprop.types.IDPropertyGroupViewKeys`\n"
3575 PyErr_SetString(PyExc_TypeError,
"bpy_struct.keys(): this type doesn't support IDProperties");
3586 pyrna_struct_items_doc,
3587 ".. method:: items()\n"
3589 " Returns the items of this objects custom properties (matches Python's\n"
3590 " dictionary function of the same name).\n"
3592 " :return: custom property key, value pairs.\n"
3593 " :rtype: :class:`idprop.types.IDPropertyGroupViewItems`\n"
3600 PyErr_SetString(PyExc_TypeError,
"bpy_struct.items(): this type doesn't support IDProperties");
3611 pyrna_struct_values_doc,
3612 ".. method:: values()\n"
3614 " Returns the values of this objects custom properties (matches Python's\n"
3615 " dictionary function of the same name).\n"
3617 " :return: custom property values.\n"
3618 " :rtype: :class:`idprop.types.IDPropertyGroupViewValues`\n"
3625 PyErr_SetString(PyExc_TypeError,
3626 "bpy_struct.values(): this type doesn't support IDProperties");
3637 pyrna_struct_is_property_set_doc,
3638 ".. method:: is_property_set(property, ghost=True)\n"
3640 " Check if a property is set, use for testing operator properties.\n"
3642 " :arg ghost: Used for operators that re-run with previous settings.\n"
3643 " In this case the property is not marked as set,\n"
3644 " yet the value from the previous execution is used.\n"
3646 " In rare cases you may want to set this option to false.\n"
3648 " :type ghost: bool\n"
3649 " :return: True when the property has been set.\n"
3655 bool use_ghost =
true;
3659 static const char *_keywords[] = {
"",
"ghost",
nullptr};
3660 static _PyArg_Parser _parser = {
3669 if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &name,
PyC_ParseBool, &use_ghost)) {
3674 PyErr_Format(PyExc_TypeError,
3675 "%.200s.is_property_set(\"%.200s\") not found",
3686 pyrna_struct_property_unset_doc,
3687 ".. method:: property_unset(property)\n"
3689 " Unset a property, will use default value afterward.\n");
3697 if (!PyArg_ParseTuple(args,
"s:property_unset", &name)) {
3702 PyErr_Format(PyExc_TypeError,
3703 "%.200s.property_unset(\"%.200s\") not found",
3716 pyrna_struct_is_property_hidden_doc,
3717 ".. method:: is_property_hidden(property)\n"
3719 " Check if a property is hidden.\n"
3721 " :return: True when the property is hidden.\n"
3730 if (!PyArg_ParseTuple(args,
"s:is_property_hidden", &name)) {
3735 PyErr_Format(PyExc_TypeError,
3736 "%.200s.is_property_hidden(\"%.200s\") not found",
3747 pyrna_struct_is_property_readonly_doc,
3748 ".. method:: is_property_readonly(property)\n"
3750 " Check if a property is readonly.\n"
3752 " :return: True when the property is readonly (not writable).\n"
3761 if (!PyArg_ParseTuple(args,
"s:is_property_readonly", &name)) {
3766 PyErr_Format(PyExc_TypeError,
3767 "%.200s.is_property_readonly(\"%.200s\") not found",
3778 pyrna_struct_is_property_overridable_library_doc,
3779 ".. method:: is_property_overridable_library(property)\n"
3781 " Check if a property is overridable.\n"
3783 " :return: True when the property is overridable.\n"
3792 if (!PyArg_ParseTuple(args,
"s:is_property_overridable_library", &name)) {
3797 PyErr_Format(PyExc_TypeError,
3798 "%.200s.is_property_overridable_library(\"%.200s\") not found",
3809 pyrna_struct_property_overridable_library_set_doc,
3810 ".. method:: property_overridable_library_set(property, overridable)\n"
3812 " Define a property as overridable or not (only for custom properties!).\n"
3814 " :return: True when the overridable status of the property was successfully set.\n"
3824 if (!PyArg_ParseTuple(args,
"sp:property_overridable_library_set", &name, &is_overridable)) {
3829 PyErr_Format(PyExc_TypeError,
3830 "%.200s.property_overridable_library_set(\"%.200s\") not found",
3836 return PyBool_FromLong(
3842 pyrna_struct_path_resolve_doc,
3843 ".. method:: path_resolve(path, coerce=True)\n"
3845 " Returns the property from the path, raise an exception when not found.\n"
3847 " :arg path: path which this property resolves.\n"
3848 " :type path: str\n"
3849 " :arg coerce: optional argument, when True, the property will be converted\n"
3850 " into its Python representation.\n"
3851 " :type coerce: bool\n");
3855 PyObject *coerce = Py_True;
3862 if (!PyArg_ParseTuple(args,
"s|O!:path_resolve", &path, &PyBool_Type, &coerce)) {
3870 PyErr_Format(PyExc_IndexError,
3871 "%.200s.path_resolve(\"%.200s\") index out of range",
3880 if (coerce == Py_False) {
3890 PyErr_Format(PyExc_ValueError,
3891 "%.200s.path_resolve(\"%.200s\") could not be resolved",
3899 pyrna_struct_path_from_id_doc,
3900 ".. method:: path_from_id(property=\"\")\n"
3902 " Returns the data path from the ID to this object (string).\n"
3904 " :arg property: Optional property name which can be used if the path is\n"
3905 " to a property of this object.\n"
3906 " :type property: str\n"
3907 " :return: The path from :class:`bpy.types.bpy_struct.id_data`\n"
3908 " to this struct and property (when given).\n"
3912 const char *name =
nullptr;
3918 if (!PyArg_ParseTuple(args,
"|s:path_from_id", &name)) {
3922 std::optional<std::string> path;
3925 if (prop ==
nullptr) {
3926 PyErr_Format(PyExc_AttributeError,
3927 "%.200s.path_from_id(\"%.200s\") not found",
3941 PyErr_Format(PyExc_ValueError,
3942 "%.200s.path_from_id(\"%s\") found, but does not support path creation",
3947 PyErr_Format(PyExc_ValueError,
3948 "%.200s.path_from_id() does not support path creation for this type",
3954 ret = PyUnicode_FromString(path->c_str());
3961 pyrna_prop_path_from_id_doc,
3962 ".. method:: path_from_id()\n"
3964 " Returns the data path from the ID to this property (string).\n"
3966 " :return: The path from :class:`bpy.types.bpy_struct.id_data` to this property.\n"
3976 PyErr_Format(PyExc_ValueError,
3977 "%.200s.%.200s.path_from_id() does not support path creation for this type",
3983 ret = PyUnicode_FromString(path->c_str());
3990 pyrna_prop_as_bytes_doc,
3991 ".. method:: as_bytes()\n"
3993 " Returns this string property as a byte rather than a Python string.\n"
3995 " :return: The string as bytes.\n"
3996 " :rtype: bytes\n");
4001 PyErr_Format(PyExc_TypeError,
4002 "%.200s.%.200s.as_bytes() must be a string",
4009 char buf_fixed[256], *buf;
4013 &
self->ptr,
self->prop, buf_fixed,
sizeof(buf_fixed), &buf_len);
4015 ret = PyBytes_FromStringAndSize(buf, buf_len);
4017 if (buf_fixed != buf) {
4026 pyrna_prop_update_doc,
4027 ".. method:: update()\n"
4029 " Execute the properties update callback.\n"
4032 " This is called when assigning a property,\n"
4033 " however in rare cases it's useful to call explicitly.\n");
4042 pyrna_struct_type_recast_doc,
4043 ".. method:: type_recast()\n"
4045 " Return a new instance, this is needed because types\n"
4046 " such as textures can be changed at runtime.\n"
4048 " :return: a new instance of this object with the type initialized again.\n"
4049 " :rtype: :class:`bpy.types.bpy_struct`\n");
4064 PyObject *ret_test =
nullptr;
4065 PyObject *subclasses = (PyObject *)((PyTypeObject *)cls)->tp_subclasses;
4070 PyObject *key =
nullptr;
4072 PyObject *value =
nullptr;
4073 while (PyDict_Next(subclasses, &
pos, &key, &value)) {
4075 PyObject *subcls = PyWeakref_GET_OBJECT(value);
4076 if (subcls != Py_None) {
4098 pyrna_struct_bl_rna_get_subclass_py_doc,
4099 ".. classmethod:: bl_rna_get_subclass_py(id, default=None)\n"
4101 " :arg id: The RNA type identifier.\n"
4103 " :return: The class or default when not found.\n"
4108 PyObject *ret_default = Py_None;
4110 if (!PyArg_ParseTuple(args,
"s|O:bl_rna_get_subclass_py", &
id, &ret_default)) {
4114 if (
ret ==
nullptr) {
4117 return Py_NewRef(
ret);
4122 pyrna_struct_bl_rna_get_subclass_doc,
4123 ".. classmethod:: bl_rna_get_subclass(id, default=None)\n"
4125 " :arg id: The RNA type identifier.\n"
4127 " :return: The RNA type or default when not found.\n"
4128 " :rtype: :class:`bpy.types.Struct` subclass\n");
4132 PyObject *ret_default = Py_None;
4134 if (!PyArg_ParseTuple(args,
"s|O:bl_rna_get_subclass", &
id, &ret_default)) {
4140 if (py_srna ==
nullptr) {
4141 PyErr_SetString(PyExc_ValueError,
"Not a registered class");
4146 if (srna_base == &RNA_Node) {
4163 return Py_NewRef(ret_default);
4170 list_tmp = PyDict_Keys(dict);
4171 PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
4172 Py_DECREF(list_tmp);
4178 PyObject **dict_ptr;
4180 dict_ptr = _PyObject_GetDictPtr((PyObject *)
self);
4182 if (dict_ptr && (dict = *dict_ptr)) {
4186 dict = ((PyTypeObject *)Py_TYPE(
self))->tp_dict;
4199 dict = ((PyTypeObject *)cls)->tp_dict;
4222 PyList_APPEND(list, PyUnicode_FromString(idname));
4232 char name[256], *name_ptr;
4245 PyList_APPEND(list, PyUnicode_FromStringAndSize(name_ptr, name_len));
4247 if (name != name_ptr) {
4264 ret = PyList_New(0);
4272 if (
self->ptr.type == &RNA_Context) {
4276 PyList_APPEND(
ret, PyUnicode_FromString(
static_cast<const char *
>(link->data)));
4286 PyObject *set = PySet_New(
ret);
4289 ret = PySequence_List(set);
4298 pyrna_struct_id_properties_ensure_doc,
4299 ".. method:: id_properties_ensure()\n"
4301 " :return: the parent group for an RNA struct's custom IDProperties.\n"
4302 " :rtype: :class:`idprop.types.IDPropertyGroup`\n");
4308 PyErr_SetString(PyExc_TypeError,
"This type doesn't support IDProperties");
4316 if (idprops ==
nullptr) {
4321 group->owner_id =
self->ptr.owner_id;
4322 group->prop = idprops;
4323 group->parent =
nullptr;
4324 return (PyObject *)group;
4329 pyrna_struct_id_properties_ui_doc,
4330 ".. method:: id_properties_ui(key)\n"
4332 " :return: Return an object used to manage an IDProperty's UI data.\n"
4333 " :arg key: String name of the property.\n"
4334 " :rtype: :class:`bpy.types.IDPropertyUIManager`\n");
4340 PyErr_SetString(PyExc_TypeError,
"This type doesn't support IDProperties");
4345 if (!PyArg_ParseTuple(args,
"s:ui_data", &key)) {
4353 if (parent_group ==
nullptr) {
4358 if (property ==
nullptr) {
4359 PyErr_SetString(PyExc_KeyError,
"Property not found in IDProperty group");
4364 PyErr_Format(PyExc_TypeError,
"IDProperty \"%s\" does not support UI data", property->name);
4371 return (PyObject *)ui_manager;
4376 pyrna_struct_id_properties_clear_doc,
4377 ".. method:: id_properties_clear()\n"
4379 " :return: Remove the parent group for an RNA struct's custom IDProperties.\n");
4385 PyErr_SetString(PyExc_TypeError,
"This type doesn't support IDProperties");
4402 const char *name = PyUnicode_AsUTF8(pyname);
4410 if (name ==
nullptr) {
4411 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: __getattr__ must be a string");
4421 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: no __getitem__ support for this type");
4425 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4435 else if (
self->ptr.type == &RNA_Context) {
4438 PyErr_Format(PyExc_AttributeError,
4439 "bpy_struct: Context is 'nullptr', can't get \"%.200s\" from context",
4456 CTX_data_get(C, name, &newptr, &newlb, &newprop, &newindex, &newstr, &newtype));
4466 if (newptr.
data ==
nullptr) {
4480 ret = PyUnicode_FromStringAndSize(newstr.
data(), newstr.
size());
4485 ret = PyList_New(0);
4492 if (newprop !=
nullptr) {
4497 std::optional<std::string> path_str;
4510 ret = PyTuple_New(3);
4513 PyUnicode_FromString(path_str->c_str()),
4514 PyLong_FromLong(newindex));
4531 PyErr_Format(PyExc_AttributeError,
4532 "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
4545 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4551 PyErr_Format(PyExc_AttributeError,
"bpy_struct: attribute \"%.200s\" not found", name);
4561 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4568static int pyrna_struct_pydict_contains(PyObject *
self, PyObject *pyname)
4570 PyObject *dict = *(_PyObject_GetDictPtr((PyObject *)
self));
4575 return PyDict_Contains(dict, pyname);
4582static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr)
4584 PyObject *
ret = PyType_Type.tp_getattro(cls, attr);
4596 if ((
ret ==
nullptr) ) {
4606 if (
ret ==
nullptr) {
4607 PyErr_Format(PyExc_AttributeError,
4608 "StructRNA.__getattr__: attribute \"%.200s\" not found",
4609 PyUnicode_AsUTF8(attr));
4622 const char *attr_str = PyUnicode_AsUTF8(attr);
4627 PyErr_Format(PyExc_AttributeError,
4628 "pyrna_struct_meta_idprop_setattro() "
4629 "can't set in readonly state '%.200s.%S'",
4630 ((PyTypeObject *)cls)->tp_name,
4635 if (srna ==
nullptr) {
4638 if (value && is_deferred_prop) {
4639 PyErr_Format(PyExc_AttributeError,
4640 "pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'",
4641 ((PyTypeObject *)cls)->tp_name);
4647 return PyType_Type.tp_setattro(cls, attr, value);
4652 if (is_deferred_prop) {
4673 PyExc_TypeError,
"struct_meta_idprop.detattr(): '%s' not a dynamic property", attr_str);
4679 return PyType_Type.tp_setattro(cls, attr, value);
4684 const char *name = PyUnicode_AsUTF8(pyname);
4689#ifdef USE_PEDANTIC_WRITE
4695 if (name ==
nullptr) {
4696 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: __setattr__ must be a string");
4701 PyErr_Format(PyExc_AttributeError,
4702 "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only",
4708 else if (
self->ptr.type == &RNA_Context) {
4713 PyErr_Format(PyExc_AttributeError,
4714 "bpy_struct: Context is 'nullptr', can't set \"%.200s\" from context",
4727 CTX_data_get(C, name, &newptr, &newlb, &newprop, &newindex, &newstr, &newtype));
4731 PyExc_AttributeError,
"bpy_struct: Context property \"%.200s\" is read-only", name);
4738 if (value ==
nullptr) {
4739 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: del not supported");
4745 return PyObject_GenericSetAttr((PyObject *)
self, pyname, value);
4755 ret = PyList_New(0);
4772 return PyObject_GenericGetAttr((PyObject *)
self, pyname);
4777 const char *name = PyUnicode_AsUTF8(pyname);
4779 if (name ==
nullptr) {
4780 PyErr_SetString(PyExc_AttributeError,
"bpy_prop_collection: __getattr__ must be a string");
4783 if (name[0] !=
'_') {
4798 Py_DECREF(self_collection);
4806 return PyObject_GenericGetAttr((PyObject *)
self, pyname);
4813 PyObject *
ret = _PyObject_GenericGetAttrWithDict((PyObject *)
self, pyname,
nullptr, 1);
4816 if ((
ret ==
nullptr) && (name[0] !=
'_')) {
4821 ret = _PyObject_GenericGetAttrWithDict(cls, pyname,
nullptr, 1);
4824 if (
ret !=
nullptr) {
4825 if (Py_TYPE(
ret) == &PyMethodDescr_Type) {
4826 PyMethodDef *m = ((PyMethodDescrObject *)
ret)->d_method;
4828 if (m->ml_flags & METH_STATIC) {
4833 ret = PyCMethod_New(m, (PyObject *)
self,
nullptr,
nullptr);
4840 if (
ret ==
nullptr) {
4842 PyExc_AttributeError,
"bpy_prop_collection: attribute \"%.200s\" not found", name);
4853 const char *name = PyUnicode_AsUTF8(pyname);
4857#ifdef USE_PEDANTIC_WRITE
4863 if (name ==
nullptr) {
4864 PyErr_SetString(PyExc_AttributeError,
"bpy_prop: __setattr__ must be a string");
4867 if (value ==
nullptr) {
4868 PyErr_SetString(PyExc_AttributeError,
"bpy_prop: del not supported");
4875 &r_ptr, prop,
nullptr, value,
"BPy_PropertyRNA - Attribute (setattr):");
4879 PyErr_Format(PyExc_AttributeError,
"bpy_prop_collection: attribute \"%.200s\" not found", name);
4890#ifdef USE_PEDANTIC_WRITE
4898 PyErr_SetString(PyExc_TypeError,
4899 "bpy_prop_collection.add(): not supported for this collection");
4908 const int key = PyLong_AsLong(value);
4910#ifdef USE_PEDANTIC_WRITE
4916 if (key == -1 && PyErr_Occurred()) {
4917 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection.remove(): expected one int argument");
4922 PyErr_SetString(PyExc_TypeError,
4923 "bpy_prop_collection.remove() not supported for this collection");
4932#ifdef USE_PEDANTIC_WRITE
4945 int key = 0,
pos = 0;
4947#ifdef USE_PEDANTIC_WRITE
4953 if (!PyArg_ParseTuple(args,
"ii", &key, &
pos)) {
4954 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection.move(): expected two ints as arguments");
4959 PyErr_SetString(PyExc_TypeError,
4960 "bpy_prop_collection.move() not supported for this collection");
4969 pyrna_struct_get_id_data_doc,
4970 "The :class:`bpy.types.ID` object this datablock is from or None, (not available for "
4975 if (
self->ptr.owner_id) {
4985 pyrna_struct_get_data_doc,
4986 "The data this property is using, *type* :class:`bpy.types.bpy_struct`");
4994 pyrna_struct_get_rna_type_doc,
4995 "The property type for introspection");
5010 pyrna_struct_get_id_data_doc,
5016 pyrna_struct_get_rna_type_doc,
5018 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
5025 pyrna_struct_get_id_data_doc,
5027 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
5034 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
5039 pyrna_prop_collection_keys_doc,
5040 ".. method:: keys()\n"
5042 " Return the identifiers of collection members\n"
5043 " (matching Python's dict.keys() functionality).\n"
5045 " :return: the identifiers for each member of this collection.\n"
5046 " :rtype: list[str]\n");
5049 PyObject *
ret = PyList_New(0);
5050 char name[256], *name_ptr;
5057 PyList_APPEND(
ret, PyUnicode_FromStringAndSize(name_ptr, name_len));
5059 if (name != name_ptr) {
5071 pyrna_prop_collection_items_doc,
5072 ".. method:: items()\n"
5074 " Return the identifiers of collection members\n"
5075 " (matching Python's dict.items() functionality).\n"
5077 " :return: (key, value) pairs for each member of this collection.\n"
5078 " :rtype: list[tuple[str, :class:`bpy.types.bpy_struct`]]\n");
5081 PyObject *
ret = PyList_New(0);
5083 char name[256], *name_ptr;
5090 item = PyTuple_New(2);
5093 PyTuple_SET_ITEM(item, 0, PyUnicode_FromStringAndSize(name_ptr, name_len));
5094 if (name != name_ptr) {
5100 PyTuple_SET_ITEM(item, 0, PyLong_FromLong(i));
5104 PyList_APPEND(
ret, item);
5116 pyrna_prop_collection_values_doc,
5117 ".. method:: values()\n"
5119 " Return the values of collection\n"
5120 " (matching Python's dict.values() functionality).\n"
5122 " :return: The members of this collection.\n"
5123 " :rtype: list[:class:`bpy.types.bpy_struct`]\n");
5132 pyrna_struct_get_doc,
5133 ".. method:: get(key, default=None)\n"
5135 " Returns the value of the custom property assigned to key or default\n"
5136 " when not found (matches Python's dictionary function of the same name).\n"
5138 " :arg key: The key associated with the custom property.\n"
5140 " :arg default: Optional argument for the value to return if\n"
5141 " *key* is not found.\n"
5142 " :type default: Any\n"
5149 PyObject *def = Py_None;
5153 if (!PyArg_ParseTuple(args,
"s|O:get", &key, &def)) {
5159 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
5172 return Py_NewRef(def);
5177 pyrna_struct_pop_doc,
5178 ".. method:: pop(key, default=None)\n"
5180 " Remove and return the value of the custom property assigned to key or default\n"
5181 " when not found (matches Python's dictionary function of the same name).\n"
5183 " :arg key: The key associated with the custom property.\n"
5185 " :arg default: Optional argument for the value to return if\n"
5186 " *key* is not found.\n"
5187 " :type default: Any\n"
5194 PyObject *def =
nullptr;
5198 if (!PyArg_ParseTuple(args,
"s|O:get", &key, &def)) {
5204 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
5224 if (def ==
nullptr) {
5225 PyErr_SetString(PyExc_KeyError,
"key not found");
5228 return Py_NewRef(def);
5233 pyrna_struct_as_pointer_doc,
5234 ".. method:: as_pointer()\n"
5236 " Returns the memory address which holds a pointer to Blender's internal data\n"
5238 " :return: int (memory address).\n"
5241 " .. note:: This is intended only for advanced script writers who need to\n"
5242 " pass blender data to their own C/Python modules.\n");
5245 return PyLong_FromVoidPtr(
self->ptr.data);
5250 pyrna_prop_collection_get_doc,
5251 ".. method:: get(key, default=None)\n"
5253 " Returns the value of the item assigned to key or default when not found\n"
5254 " (matches Python's dictionary function of the same name).\n"
5256 " :arg key: The identifier for the collection member.\n"
5258 " :arg default: Optional argument for the value to return if\n"
5259 " *key* is not found.\n"
5260 " :type default: Any\n");
5266 PyObject *def = Py_None;
5270 if (!PyArg_ParseTuple(args,
"O|O:get", &key_ob, &def)) {
5274 if (PyUnicode_Check(key_ob)) {
5275 const char *key = PyUnicode_AsUTF8(key_ob);
5281 "bpy_prop_collection.get") == -1)
5286 else if (PyTuple_Check(key_ob)) {
5288 self, key_ob,
"bpy_prop_collection.get((id, lib))",
false);
5294 PyErr_Format(PyExc_KeyError,
5295 "bpy_prop_collection.get(key, ...): key must be a string or tuple, not %.200s",
5296 Py_TYPE(key_ob)->tp_name);
5299 return Py_NewRef(def);
5304 pyrna_prop_collection_find_doc,
5305 ".. method:: find(key)\n"
5307 " Returns the index of a key in a collection or -1 when not found\n"
5308 " (matches Python's string find function of the same name).\n"
5310 " :arg key: The identifier for the collection member.\n"
5312 " :return: index of the key.\n"
5316 Py_ssize_t key_len_ssize;
5317 const char *key = PyUnicode_AsUTF8AndSize(key_ob, &key_len_ssize);
5318 const int key_len =
int(key_len_ssize);
5320 char name[256], *name_ptr;
5331 if ((key_len == name_len) && memcmp(name_ptr, key, key_len) == 0) {
5336 if (name != name_ptr) {
5345 return PyLong_FromLong(index);
5353 bool *r_attr_signed,
5357 bool attr_ok =
true;
5360 *r_attr_signed =
false;
5374 *r_is_empty =
false;
5385 const char *function_name,
5388 const char **r_attr,
5394 bool *r_attr_signed)
5396 *r_size = *r_attr_tot = 0;
5397 *r_attr_signed =
false;
5400 if (!PyArg_ParseTuple(args,
"sO:foreach_get/set", r_attr, r_seq)) {
5404 if (!PySequence_Check(*r_seq) && PyObject_CheckBuffer(*r_seq)) {
5405 PyErr_Format(PyExc_TypeError,
5406 "%s(..) expected second argument to be a sequence or buffer, not a %.200s",
5408 Py_TYPE(*r_seq)->tp_name);
5413 *r_tot = PySequence_Size(*r_seq);
5426 if (array_tot == 0) {
5427 PyErr_Format(PyExc_TypeError,
5428 "%s(..) sequence length mismatch given %d, needed 0",
5435 bool is_empty =
false;
5437 PyErr_Format(PyExc_AttributeError,
5438 "%s(..) '%.200s.%200s[...]' elements have no attribute '%.200s'",
5447 PyErr_Format(PyExc_TypeError,
5448 "%s(..) sequence length mismatch given %d, needed 0",
5461 if ((*r_attr_tot) < 1) {
5465 const int target_tot = array_tot * (*r_attr_tot);
5468 if (target_tot != (*r_tot)) {
5469 PyErr_Format(PyExc_TypeError,
5470 "%s(..) sequence length mismatch given %d, needed %d",
5482 if (*r_size == 0 && *r_attr_tot != 0) {
5484 PyExc_AttributeError,
"%s(..): attribute does not support foreach method", function_name);
5497 return (f ==
'b') ?
true :
false;
5500 return (f ==
'B') ?
true :
false;
5504 return (f ==
'B') ?
true :
false;
5507 return (f ==
'h') ?
true :
false;
5510 return (f ==
'H') ?
true :
false;
5513 return (f ==
'H') ?
true :
false;
5516 return (f ==
'i') ?
true :
false;
5519 return (f ==
'I') ?
true :
false;
5522 return (f ==
'?') ?
true :
false;
5524 return (f ==
'f') ?
true :
false;
5526 return (f ==
'd') ?
true :
false;
5529 return (f ==
'q') ?
true :
false;
5532 return (f ==
'Q') ?
true :
false;
5535 return (f ==
'Q') ?
true :
false;
5545 PyObject *item =
nullptr;
5547 bool buffer_is_compat;
5548 void *
array =
nullptr;
5560 set ?
"foreach_set" :
"foreach_get",
5567 &attr_signed) == -1)
5577 buffer_is_compat =
false;
5578 if (PyObject_CheckBuffer(seq)) {
5580 if (PyObject_GetBuffer(seq, &buf, PyBUF_ND | PyBUF_FORMAT) == -1) {
5590 if (buffer_is_compat) {
5592 nullptr, &
self->ptr,
self->prop, attr, buf.buf, raw_type, tot);
5595 PyBuffer_Release(&buf);
5600 if (!buffer_is_compat) {
5601 array = PyMem_Malloc(size * tot);
5603 for (; i < tot; i++) {
5604 item = PySequence_GetItem(seq, i);
5622 ((
int *)
array)[i] =
int(PyC_Long_AsI32(item));
5628 ((
float *)
array)[i] =
float(PyFloat_AsDouble(item));
5631 ((
double *)
array)[i] =
double(PyFloat_AsDouble(item));
5649 nullptr, &
self->ptr,
self->prop, attr,
array, raw_type, tot);
5653 buffer_is_compat =
false;
5654 if (PyObject_CheckBuffer(seq)) {
5656 if (PyObject_GetBuffer(seq, &buf, PyBUF_ND | PyBUF_FORMAT) == -1) {
5666 if (buffer_is_compat) {
5668 nullptr, &
self->ptr,
self->prop, attr, buf.buf, raw_type, tot);
5671 PyBuffer_Release(&buf);
5676 if (!buffer_is_compat) {
5677 array = PyMem_Malloc(size * tot);
5680 nullptr, &
self->ptr,
self->prop, attr,
array, raw_type, tot);
5687 for (; i < tot; i++) {
5691 item = PyLong_FromLong(
long(((
char *)
array)[i]));
5694 item = PyLong_FromLong(
long(((
int8_t *)
array)[i]));
5700 item = PyLong_FromLong(
long(((
short *)
array)[i]));
5706 item = PyLong_FromLong(
long(((
int *)
array)[i]));
5709 item = PyFloat_FromDouble(
double(((
float *)
array)[i]));
5712 item = PyFloat_FromDouble(
double(((
double *)
array)[i]));
5715 item = PyBool_FromLong(
long(((
bool *)
array)[i]));
5731 PySequence_SetItem(seq, i, item);
5741 if (PyErr_Occurred()) {
5744 PyErr_SetString(PyExc_TypeError,
"couldn't access the py sequence");
5748 PyErr_SetString(PyExc_RuntimeError,
"internal error setting the array");
5760 pyrna_prop_collection_foreach_get_doc,
5761 ".. method:: foreach_get(attr, seq)\n"
5763 " This is a function to give fast access to attributes within a collection.\n");
5773 pyrna_prop_collection_foreach_set_doc,
5774 ".. method:: foreach_set(attr, seq)\n"
5776 " This is a function to give fast access to attributes within a collection.\n");
5788 PyObject *item =
nullptr;
5789 Py_ssize_t i, seq_size,
size;
5790 void *
array =
nullptr;
5797 PyErr_Format(PyExc_TypeError,
"foreach_get/set available only for int and float");
5801 if (!PyArg_ParseTuple(args,
"O:foreach_get/set", &seq)) {
5805 if (!PySequence_Check(seq) && PyObject_CheckBuffer(seq)) {
5808 "foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
5809 Py_TYPE(seq)->tp_name);
5816 seq_size = PySequence_Size(seq);
5818 if (size != seq_size) {
5819 PyErr_Format(PyExc_TypeError,
"expected sequence size %d, got %d", size, seq_size);
5824 if (PyObject_GetBuffer(seq, &buf, PyBUF_ND | PyBUF_FORMAT) == -1) {
5827 switch (prop_type) {
5829 array = PyMem_Malloc(
sizeof(
int) * size);
5831 for (i = 0; i <
size; i++) {
5832 item = PySequence_GetItem(seq, i);
5833 ((
int *)
array)[i] =
int(PyLong_AsLong(item));
5842 for (i = 0; i <
size; i++) {
5843 item = PyLong_FromLong(
long(((
int *)
array)[i]));
5844 PySequence_SetItem(seq, i, item);
5851 array = PyMem_Malloc(
sizeof(
float) * size);
5853 for (i = 0; i <
size; i++) {
5854 item = PySequence_GetItem(seq, i);
5855 ((
float *)
array)[i] =
float(PyFloat_AsDouble(item));
5864 for (i = 0; i <
size; i++) {
5865 item = PyFloat_FromDouble(
double(((
float *)
array)[i]));
5866 PySequence_SetItem(seq, i, item);
5883 if (PyErr_Occurred()) {
5886 PyErr_SetString(PyExc_TypeError,
"couldn't access the py sequence");
5891 const char f = buf.format ? buf.format[0] : 0;
5892 if ((prop_type ==
PROP_INT && (buf.itemsize !=
sizeof(
int) || !
ELEM(f,
'l',
'i'))) ||
5893 (prop_type ==
PROP_FLOAT && (buf.itemsize !=
sizeof(
float) || f !=
'f')))
5895 PyBuffer_Release(&buf);
5896 PyErr_Format(PyExc_TypeError,
"incorrect sequence item type: %s", buf.format);
5900 switch (prop_type) {
5912 &
self->ptr,
self->prop,
static_cast<const float *
>(buf.buf));
5928 PyBuffer_Release(&buf);
5936 pyrna_prop_array_foreach_get_doc,
5937 ".. method:: foreach_get(seq)\n"
5939 " This is a function to give fast access to array data.\n");
5949 pyrna_prop_array_foreach_set_doc,
5950 ".. method:: foreach_set(seq)\n"
5952 " This is a function to give fast access to array data.\n");
5966 PyObject *iter =
nullptr;
5977 iter = PyObject_GetIter(
ret);
5986#ifndef USE_PYRNA_ITER
5991 PyObject *iter =
nullptr;
5997 iter = PyObject_GetIter(
ret);
6005#if (defined(__GNUC__) && !defined(__clang__))
6006# pragma GCC diagnostic push
6007# pragma GCC diagnostic ignored "-Wcast-function-type"
6017 {
"get", (PyCFunction)
pyrna_struct_get, METH_VARARGS, pyrna_struct_get_doc},
6018 {
"pop", (PyCFunction)
pyrna_struct_pop, METH_VARARGS, pyrna_struct_pop_doc},
6025 METH_VARARGS | METH_KEYWORDS,
6029 METH_VARARGS | METH_KEYWORDS,
6042 METH_VARARGS | METH_KEYWORDS,
6043 pyrna_struct_is_property_set_doc},
6047 pyrna_struct_property_unset_doc},
6048 {
"is_property_hidden",
6051 pyrna_struct_is_property_hidden_doc},
6052 {
"is_property_readonly",
6055 pyrna_struct_is_property_readonly_doc},
6056 {
"is_property_overridable_library",
6059 pyrna_struct_is_property_overridable_library_doc},
6060 {
"property_overridable_library_set",
6063 pyrna_struct_property_overridable_library_set_doc},
6067 pyrna_struct_path_resolve_doc},
6071 pyrna_struct_path_from_id_doc},
6075 pyrna_struct_type_recast_doc},
6076 {
"bl_rna_get_subclass_py",
6078 METH_VARARGS | METH_CLASS,
6079 pyrna_struct_bl_rna_get_subclass_py_doc},
6080 {
"bl_rna_get_subclass",
6082 METH_VARARGS | METH_CLASS,
6083 pyrna_struct_bl_rna_get_subclass_doc},
6085 {
"id_properties_ensure",
6088 pyrna_struct_id_properties_ensure_doc},
6089 {
"id_properties_clear",
6092 pyrna_struct_id_properties_clear_doc},
6093 {
"id_properties_ui",
6096 pyrna_struct_id_properties_ui_doc},
6101 {
"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS,
nullptr},
6102 {
"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS,
nullptr},
6106 METH_VARARGS | METH_CLASS,
6110 METH_VARARGS | METH_CLASS,
6113 {
nullptr,
nullptr, 0,
nullptr},
6120 pyrna_prop_path_from_id_doc},
6124 {
nullptr,
nullptr, 0,
nullptr},
6131 pyrna_prop_array_foreach_get_doc},
6135 pyrna_prop_array_foreach_set_doc},
6137 {
nullptr,
nullptr, 0,
nullptr},
6144 pyrna_prop_collection_foreach_get_doc},
6148 pyrna_prop_collection_foreach_set_doc},
6154 pyrna_prop_collection_items_doc},
6158 pyrna_prop_collection_values_doc},
6162 {
nullptr,
nullptr, 0,
nullptr},
6170 {
nullptr,
nullptr, 0,
nullptr},
6173#if (defined(__GNUC__) && !defined(__clang__))
6174# pragma GCC diagnostic pop
6183 if (PyTuple_GET_SIZE(args) == 1) {
6185 if (Py_TYPE(base) == type) {
6187 return (PyObject *)base;
6206#ifdef USE_PYRNA_STRUCT_REFERENCE
6209 PyObject_GC_UnTrack(
ret);
6213 return (PyObject *)
ret;
6217 PyErr_Format(PyExc_TypeError,
6218 "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct",
6223 PyErr_Format(PyExc_TypeError,
"bpy_struct.__new__(type): expected a single argument");
6235 if (!PyArg_ParseTuple(args,
"O!:bpy_prop.__new__", &
pyrna_prop_Type, &base)) {
6239 if (type == Py_TYPE(base)) {
6240 return Py_NewRef(base);
6246 return (PyObject *)
ret;
6249 PyErr_Format(PyExc_TypeError,
6250 "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop",
6268 data = data_alloc->
array;
6281 for (a = 0; a <
len; a++) {
6282 PyTuple_SET_ITEM(
ret, a, PyBool_FromLong(((
bool *)data)[a]));
6287 for (a = 0; a <
len; a++) {
6288 PyTuple_SET_ITEM(
ret, a, PyLong_FromLong(((
int *)data)[a]));
6302 else if (
len == 9) {
6310 for (a = 0; a <
len; a++) {
6311 PyTuple_SET_ITEM(
ret, a, PyFloat_FromDouble(((
float *)data)[a]));
6318 PyExc_TypeError,
"RNA Error: unknown array type \"%d\" (pyrna_param_to_py)", type);
6327 ret = PyBool_FromLong(*(
bool *)data);
6330 ret = PyLong_FromLong(*(
int *)data);
6333 ret = PyFloat_FromDouble(*(
float *)data);
6336 const char *data_ch;
6342 data_ch =
static_cast<const char *
>(data_alloc->
array);
6344 BLI_assert((data_ch ==
nullptr) || strlen(data_ch) == data_ch_len);
6348 data_ch_len = data_ch ? strlen(data_ch) : 0;
6351 if (
UNLIKELY(data_ch ==
nullptr)) {
6356#ifdef USE_STRING_COERCE
6358 ret = PyBytes_FromStringAndSize(data_ch, data_ch_len);
6364 ret = PyUnicode_FromStringAndSize(data_ch, data_ch_len);
6368 ret = PyBytes_FromString(buf);
6371 ret = PyUnicode_FromString(data_ch);
6413 ret = PyList_New(0);
6420 PyErr_Format(PyExc_TypeError,
"RNA Error: unknown type \"%d\" (pyrna_param_to_py)", type);
6437 const Py_ssize_t key_lookup_len = strlen(key_lookup);
6438 PyObject *key =
nullptr;
6440 PyObject *value =
nullptr;
6442 while (PyDict_Next(dict, &
pos, &key, &value)) {
6443 if (PyUnicode_Check(key)) {
6444 Py_ssize_t key_buf_len;
6445 const char *key_buf = PyUnicode_AsUTF8AndSize(key, &key_buf_len);
6446 if ((key_lookup_len == key_buf_len) && (memcmp(key_lookup, key_buf, key_lookup_len) == 0)) {
6460 const int parm_index,
6462 const size_t error_size)
6466 if (parm_index == -1) {
6469 "%.200s.%.200s(): error with keyword argument \"%.200s\" - ",
6477 "%.200s.%.200s(): error with argument %d, \"%.200s\" - ",
6494 PyObject *
ret, *item;
6495 int i, pyargs_len, pykw_len, parms_len, ret_len, flag_parameter, err = 0, kw_tot = 0;
6499 void *retdata_single =
nullptr;
6505#ifdef DEBUG_STRING_FREE
6506 PyObject *string_free_ls = PyList_New(0);
6512 if (self_ptr ==
nullptr) {
6513 PyErr_SetString(PyExc_RuntimeError,
6514 "RNA functions internal RNA pointer is nullptr, this is a bug. aborting");
6518 if (self_func ==
nullptr) {
6521 "%.200s.<unknown>(): RNA function internal function is nullptr, this is a bug. aborting",
6532 printf(
"pyrna_func_call > %.200s.%.200s : %.200s:%d\n",
6545 pyargs_len = PyTuple_GET_SIZE(args);
6546 pykw_len = kw ? PyDict_Size(kw) : 0;
6553 if (pyargs_len + pykw_len > parms_len) {
6555 PyErr_Format(PyExc_TypeError,
6556 "%.200s.%.200s(): takes at most %d arguments, got %d",
6560 pyargs_len + pykw_len);
6572 if (pret_single ==
nullptr) {
6574 retdata_single = iter.
data;
6582 if (i < pyargs_len) {
6585 PyErr_Format(PyExc_TypeError,
6586 "%.200s.%.200s(): required parameter \"%.200s\" to be a keyword argument!",
6594 item = PyTuple_GET_ITEM(args, i);
6597 else if (kw !=
nullptr) {
6610 if (item ==
nullptr) {
6612 PyErr_Format(PyExc_TypeError,
6613 "%.200s.%.200s(): required parameter \"%.200s\" not specified",
6624#ifdef DEBUG_STRING_FREE
6626 if (PyUnicode_Check(item)) {
6627 PyList_APPEND(string_free_ls, PyUnicode_FromString(PyUnicode_AsUTF8(item)));
6634 char error_prefix[512];
6658 if (err == 0 && kw && (pykw_len > kw_tot)) {
6659 PyObject *key, *value;
6665 const char *arg_name, *bad_args_str, *good_args_str;
6666 bool found =
false, first =
true;
6668 while (PyDict_Next(kw, &
pos, &key, &value)) {
6670 arg_name = PyUnicode_AsUTF8(key);
6673 if (arg_name ==
nullptr)
6690 if (found ==
false) {
6717 "%.200s.%.200s(): was called with invalid keyword argument(s) (%s), expected (%s)",
6746 ret = PyTuple_New(ret_len);
6766 if (
ret ==
nullptr) {
6773#ifdef DEBUG_STRING_FREE
6775 if (PyList_GET_SIZE(string_free_ls)) {
6776 printf(
"%.200s.%.200s(): has %d strings\n",
6779 int(PyList_GET_SIZE(string_free_ls)));
6782 Py_DECREF(string_free_ls);
6783# undef DEBUG_STRING_FREE
6807 ret = PyUnicode_FromFormat(
"%.200s.%.200s(%.200s)\n%s",
6817 PyVarObject_HEAD_INIT(
nullptr, 0)
6818 "bpy_struct_meta_idprop",
6821 sizeof(PyHeapTypeObject),
6838 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6849#if defined(_MSC_VER)
6877 PyVarObject_HEAD_INIT(
nullptr, 0)
6896 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
6897#ifdef USE_PYRNA_STRUCT_REFERENCE
6898 | Py_TPFLAGS_HAVE_GC
6902#ifdef USE_PYRNA_STRUCT_REFERENCE
6903 (traverseproc)pyrna_struct_traverse,
6904 (inquiry)pyrna_struct_clear,
6944 PyVarObject_HEAD_INIT(
nullptr, 0)
6963 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
7000 PyVarObject_HEAD_INIT(
nullptr, 0)
7019 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
7056 PyVarObject_HEAD_INIT(
nullptr, 0)
7057 "bpy_prop_collection",
7075 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
7113 PyVarObject_HEAD_INIT(
nullptr, 0)
7114 "bpy_prop_collection_idprop",
7132 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
7171 PyVarObject_HEAD_INIT(
nullptr, 0)
7226#ifdef USE_PYRNA_ITER
7239 PyVarObject_HEAD_INIT(
nullptr, 0)
7240 "bpy_prop_collection_iter",
7255 PyObject_GenericGetAttr,
7300 self->in_weakreflist =
nullptr;
7305 return (PyObject *)
self;
7315 if (
self->iter.valid ==
false) {
7316 PyErr_SetNone(PyExc_StopIteration);
7322# ifdef USE_PYRNA_STRUCT_REFERENCE
7324 if ((PyObject *)pyrna != Py_None) {
7329 pyrna_struct_reference_set(pyrna, (PyObject *)
self);
7336 return (PyObject *)pyrna;
7342 if (
self->in_weakreflist !=
nullptr) {
7343 PyObject_ClearWeakRefs((PyObject *)
self);
7357 Py_INCREF(newclass);
7361 Py_DECREF(oldclass);
7392 const PointerRNA func_ptr = {
nullptr, srna,
nullptr};
7419 PyObject *py_base =
nullptr;
7424 if (base && base != srna) {
7430 if (py_base ==
nullptr) {
7447 PyObject *bpy_types = PyImport_ImportModuleLevel(
"bpy_types",
nullptr,
nullptr,
nullptr, 0);
7449 if (bpy_types ==
nullptr) {
7456 Py_DECREF(bpy_types);
7468 PyObject *tp_bases = ((PyTypeObject *)newclass)->tp_bases;
7469 PyObject *tp_slots = PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict,
7472 if (tp_slots ==
nullptr) {
7474 BPY_LOG_RNA,
"expected class '%s' to have __slots__ defined, see bpy_types.py", idname);
7477 else if (PyTuple_GET_SIZE(tp_bases)) {
7478 PyObject *base = PyTuple_GET_ITEM(tp_bases, 0);
7480 if (base_compare != base) {
7481 char pyob_info[256];
7484 "incorrect subclassing of SRNA '%s', expected '%s', see bpy_types.py",
7500 PyObject *newclass =
nullptr;
7503 if (srna ==
nullptr) {
7507 Py_INCREF(newclass);
7511 Py_INCREF(newclass);
7526 PyObject *metaclass;
7533 descr =
"(no docs)";
7543 metaclass = (PyObject *)&PyType_Type;
7548 newclass = PyObject_CallFunction(
7549 metaclass,
"s(O) {sss()}", idname, py_base,
"__module__",
"bpy.types",
"__slots__");
7553 PyObject *args, *item, *value;
7556 args = PyTuple_New(3);
7559 PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(idname));
7562 PyTuple_SET_ITEM(args, 1, item = PyTuple_New(1));
7563 PyTuple_SET_ITEM(item, 0, Py_NewRef(py_base));
7566 PyTuple_SET_ITEM(args, 2, item = PyDict_New());
7573 newclass = PyObject_CallObject(metaclass, args);
7608 if (
ptr->
type == &RNA_Struct) {
7634#ifdef USE_PYRNA_STRUCT_REFERENCE
7637 if (pyrna !=
nullptr) {
7638 PyObject_GC_UnTrack(pyrna);
7645#ifdef USE_PYRNA_STRUCT_REFERENCE
7651#ifdef USE_PYRNA_STRUCT_REFERENCE
7654 PyObject_GC_UnTrack(pyrna);
7658 if (pyrna !=
nullptr) {
7659 pyrna->in_weakreflist =
nullptr;
7664 if (pyrna ==
nullptr) {
7665 PyErr_SetString(PyExc_MemoryError,
"couldn't create bpy_struct object");
7676#ifdef PYRNA_FREE_SUPPORT
7677 pyrna->freeptr =
false;
7680#ifdef USE_PYRNA_STRUCT_REFERENCE
7681 pyrna->reference =
nullptr;
7686#ifdef USE_PYRNA_INVALIDATE_WEAKREF
7691 return (PyObject *)pyrna;
7707 if (instance && *instance) {
7713 return (PyObject *)pyrna;
7718 *instance =
nullptr;
7728 return (PyObject *)pyrna;
7733 if (
ptr->
type == &RNA_PrimitiveString) {
7737 if (
ptr->
type == &RNA_PrimitiveInt) {
7739 return PyLong_FromLong(data->value);
7741 if (
ptr->
type == &RNA_PrimitiveFloat) {
7743 return PyFloat_FromDouble(data->value);
7745 if (
ptr->
type == &RNA_PrimitiveBoolean) {
7747 return PyBool_FromLong(data->value);
7773 pyrna->in_weakreflist =
nullptr;
7785 if (pyrna ==
nullptr) {
7786 PyErr_SetString(PyExc_MemoryError,
"couldn't create BPy_rna object");
7793#ifdef USE_PYRNA_INVALIDATE_WEAKREF
7799 return (PyObject *)pyrna;
7836#if defined(_MSC_VER)
7869#ifdef USE_PYRNA_ITER
7875#ifdef USE_PYRNA_INVALIDATE_WEAKREF
7883#ifdef USE_PYRNA_INVALIDATE_WEAKREF
7888 const int id_weakref_pool_len =
BLI_ghash_len(id_weakref_pool);
7889 if (id_weakref_pool_len != 0) {
7890 printf(
"Found %d unreleased ID's\n", id_weakref_pool_len);
7894 printf(
"ID: %s\n", id->name);
7897 BLI_ghash_free(id_weakref_pool,
nullptr, id_weakref_pool_free_value_fn);
7898 id_weakref_pool =
nullptr;
7913 return (PyObject *)pyrna;
7930PyObject *BPY_rna_doc()
7962 const char *name = PyUnicode_AsUTF8(pyname);
7964 if (name ==
nullptr) {
7965 PyErr_SetString(PyExc_AttributeError,
"bpy.types: __getattr__ must be a string");
7970 if (
ret ==
nullptr) {
7971 PyErr_Format(PyExc_RuntimeError,
7972 "bpy.types.%.200s subtype could not be generated, this is a bug!",
7973 PyUnicode_AsUTF8(pyname));
7978 PyErr_Format(PyExc_AttributeError,
7979 "bpy.types.%.200s RNA_Struct does not exist",
7980 PyUnicode_AsUTF8(pyname));
7984 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
7993 PyObject *
ret = PyList_New(0);
8002 PyObject *submodule_dict = PyModule_GetDict(
self);
8003 PyObject *key, *value;
8005 while (PyDict_Next(submodule_dict, &
pos, &key, &value)) {
8006 PyList_Append(
ret, key);
8011#if (defined(__GNUC__) && !defined(__clang__))
8012# pragma GCC diagnostic push
8013# pragma GCC diagnostic ignored "-Wcast-function-type"
8019 {
nullptr,
nullptr, 0,
nullptr},
8022#if (defined(__GNUC__) && !defined(__clang__))
8023# pragma GCC diagnostic pop
8028 bpy_types_module_doc,
8029 "Access to internal Blender types");
8031 PyModuleDef_HEAD_INIT,
8033 bpy_types_module_doc,
8046 PyModule_GetState(submodule));
8053 static PyTypeObject *pyrna_types[] = {
8062 PyObject *submodule_dict = PyModule_GetDict(submodule);
8063 for (
int i = 0; i <
ARRAY_SIZE(pyrna_types); i += 1) {
8064 PyDict_SetItemString(submodule_dict, pyrna_types[i]->tp_name, (PyObject *)pyrna_types[i]);
8084 PyModule_GetState(submodule));
8086 PyObject *arg_key, *arg_value;
8087 Py_ssize_t arg_pos = 0;
8088 while (PyDict_Next(
bpy_types_dict, &arg_pos, &arg_key, &arg_value)) {
8089 const char *key_str = PyUnicode_AsUTF8(arg_key);
8090 if (key_str[0] ==
'_') {
8096 "Members of bpy_types.py which are not StructRNA sub-classes must use a \"_\" prefix!");
8111 if (
STREQ(key_str,
"USDHook")) {
8116 BPY_LOG_RNA,
"bpy_types.py defines \"%.200s\" which is not a known RNA type!", key_str);
8130 if (PyType_Check(
self)) {
8133 Py_XINCREF(py_srna);
8139 if (py_srna ==
nullptr) {
8144 if (py_srna ==
nullptr) {
8145 PyErr_Format(PyExc_RuntimeError,
8146 "%.200s, missing bl_rna attribute from '%.200s' instance (may not be registered)",
8148 Py_TYPE(
self)->tp_name);
8153 PyErr_Format(PyExc_TypeError,
8154 "%.200s, bl_rna attribute wrong type '%.200s' on '%.200s'' instance",
8156 Py_TYPE(py_srna)->tp_name,
8157 Py_TYPE(
self)->tp_name);
8162 if (py_srna->
ptr.
type != &RNA_Struct) {
8163 PyErr_Format(PyExc_TypeError,
8164 "%.200s, bl_rna attribute not a RNA_Struct, on '%.200s'' instance",
8166 Py_TYPE(
self)->tp_name);
8181 PyErr_Format(PyExc_TypeError,
8182 "Expected a \"bpy.types.%.200s\" not a \"%.200s\"",
8184 Py_TYPE(py_obj)->tp_name);
8188 return &bpy_srna->
ptr;
8193 if (py_obj == Py_None) {
8204 if (srna_parse->
ptr ==
nullptr) {
8215 if (srna_parse->
ptr ==
nullptr) {
8225 if (
self ==
nullptr) {
8228 if (PyCapsule_CheckExact(
self)) {
8229 return static_cast<StructRNA *
>(PyCapsule_GetPointer(
self,
nullptr));
8231 if (PyType_Check(
self) == 0) {
8249 PyObject *py_func =
static_cast<PyObject *
>(((
BPy_PropDeferred *)item)->fn);
8251 PyObject *py_srna_cobject, *py_ret;
8255 PyMethodDef *py_func_method_def = ((PyCFunctionObject *)py_func)->m_ml;
8256 const char *func_name = py_func_method_def->ml_name;
8258 PyObject *args_fake;
8259 const char *key_str = PyUnicode_AsUTF8(key);
8261 if (*key_str ==
'_') {
8262 PyErr_Format(PyExc_ValueError,
8263 "bpy_struct \"%.200s\" registration error: "
8264 "'%.200s' %.200s could not register because it starts with an '_'",
8270 py_srna_cobject = PyCapsule_New(srna,
nullptr,
nullptr);
8275 args_fake = PyTuple_New(1);
8276 PyTuple_SET_ITEM(args_fake, 0, py_srna_cobject);
8278 PyObject *type = PyDict_GetItemString(py_kw,
"type");
8282 PyCFunctionWithKeywords py_func_ref = *(
8283 PyCFunctionWithKeywords)(
void *)PyCFunction_GET_FUNCTION(py_func);
8287 PyErr_Format(PyExc_ValueError,
8288 "bpy_struct \"%.200s\" registration error: "
8289 "'%.200s' %.200s could not register because "
8290 "this type doesn't support data-block properties",
8300 py_ret = PyObject_Call(py_func, args_fake, py_kw);
8304 Py_DECREF(args_fake);
8311 Py_DECREF(args_fake);
8313 PyErr_Format(PyExc_ValueError,
8314 "bpy_struct \"%.200s\" registration error: "
8315 "'%.200s' %.200s could not register (see previous error)",
8330 PyObject *annotations_dict =
nullptr;
8334 PyObject *typing_mod = PyImport_ImportModuleLevel(
"typing",
nullptr,
nullptr,
nullptr, 0);
8335 if (typing_mod !=
nullptr) {
8336 PyObject *get_type_hints_fn = PyObject_GetAttrString(typing_mod,
"get_type_hints");
8337 if (get_type_hints_fn !=
nullptr) {
8338 PyObject *args = PyTuple_New(1);
8340 PyTuple_SET_ITEM(args, 0, (PyObject *)py_class);
8341 Py_INCREF(py_class);
8343 annotations_dict = PyObject_CallObject(get_type_hints_fn, args);
8346 Py_DECREF(get_type_hints_fn);
8348 Py_DECREF(typing_mod);
8353 if (annotations_dict !=
nullptr) {
8354 if (PyDict_CheckExact(annotations_dict)) {
8355 PyObject *item, *key;
8358 while (PyDict_Next(annotations_dict, &
pos, &key, &item)) {
8367 PyErr_Format(PyExc_TypeError,
8368 "typing.get_type_hints returned: %.200s, expected dict\n",
8369 Py_TYPE(annotations_dict)->tp_name);
8373 Py_DECREF(annotations_dict);
8377 fprintf(stderr,
"typing.get_type_hints failed with: %.200s\n", py_class->tp_name);
8386 PyObject *annotations_dict;
8387 PyObject *item, *key;
8394 PyDict_CheckExact(annotations_dict))
8396 while (PyDict_Next(annotations_dict, &
pos, &key, &item)) {
8410 const int len = PyTuple_GET_SIZE(py_class->tp_bases);
8414 for (i = 0; i <
len; i++) {
8415 PyTypeObject *py_superclass = (PyTypeObject *)PyTuple_GET_ITEM(py_class->tp_bases, i);
8426 if (py_superclass != &PyBaseObject_Type &&
8427 !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&
pyrna_struct_Type))
8450#ifdef USE_POSTPONED_ANNOTATIONS
8451 const bool use_postponed_annotations =
true;
8453 const bool use_postponed_annotations =
false;
8456 if (use_postponed_annotations) {
8470 int count = is_staticmethod ? 0 : 1;
8471 bool done_min_count =
false;
8481 done_min_count =
true;
8487 if (!done_min_count && min_count) {
8496 bool *have_function)
8501 PyObject *py_class = (PyObject *)py_data;
8504 int i, arg_count, func_arg_count, func_arg_min_count = 0;
8505 const char *py_class_name = ((PyTypeObject *)py_class)->tp_name;
8514 if (!PyObject_IsSubclass(py_class, base_class)) {
8515 PyErr_Format(PyExc_TypeError,
8516 "expected %.200s subclass of class \"%.200s\"",
8534 have_function[i] = (item !=
nullptr);
8537 if (item ==
nullptr) {
8539 PyErr_Format(PyExc_AttributeError,
8540 "expected %.200s, %.200s class to have an \"%.200s\" attribute",
8558 PyObject *item_orig = item;
8560 if (is_staticmethod) {
8561 if (PyMethod_Check(item) == 0) {
8562 PyErr_Format(PyExc_TypeError,
8563 "expected %.200s, %.200s class \"%.200s\" "
8564 "attribute to be a static/class method, not a %.200s",
8568 Py_TYPE(item)->tp_name);
8569 Py_DECREF(item_orig);
8572 item = ((PyMethodObject *)item)->im_func;
8575 if (PyFunction_Check(item) == 0) {
8576 PyErr_Format(PyExc_TypeError,
8577 "expected %.200s, %.200s class \"%.200s\" "
8578 "attribute to be a function, not a %.200s",
8582 Py_TYPE(item)->tp_name);
8583 Py_DECREF(item_orig);
8590 if (func_arg_count >= 0) {
8591 arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
8596 if (is_staticmethod) {
8598 func_arg_min_count++;
8601 if (arg_count < func_arg_min_count || arg_count > func_arg_count) {
8602 if (func_arg_min_count != func_arg_count) {
8605 "expected %.200s, %.200s class \"%.200s\" function to have between %d and %d "
8617 "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d",
8624 Py_DECREF(item_orig);
8628 Py_DECREF(item_orig);
8634 const char *identifier;
8644 item = PyObject_GetAttrString(py_class, identifier);
8646 if (item ==
nullptr) {
8650#define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
8651 else if (STREQ(identifier, rna_attr)) { \
8652 if ((item = PyObject_GetAttr(py_class, py_attr))) { \
8653 if (item != Py_None) { \
8654 if (pyrna_py_to_prop(dummy_ptr, prop, nullptr, item, "validating class:") != 0) { \
8671#undef BPY_REPLACEMENT_STRING
8674 PyErr_Format(PyExc_AttributeError,
8675 "expected %.200s, %.200s class to have an \"%.200s\" attribute",
8685 if (
pyrna_py_to_prop(dummy_ptr, prop,
nullptr, item,
"validating class:") != 0) {
8705 PyObject *
ret =
nullptr, *py_srna =
nullptr, *py_class_instance =
nullptr, *parmitem;
8706 PyTypeObject *py_class;
8710 int err = 0, i, ret_len = 0, arg_count;
8716 void *retdata_single =
nullptr;
8718 PyGILState_STATE gilstate;
8720#ifdef USE_PEDANTIC_WRITE
8730 if (py_class ==
nullptr) {
8732 "unable to get Python class for RNA struct '%.200s'",
8749 if (!(is_staticmethod || is_classmethod)) {
8756 py_class_instance =
static_cast<PyObject *
>(*instance);
8757 Py_INCREF(py_class_instance);
8763 if (py_class_instance ==
nullptr) {
8767 if (py_class_instance) {
8770 else if (py_srna ==
nullptr) {
8771 py_class_instance =
nullptr;
8773 else if (py_srna == Py_None) {
8775 py_class_instance =
nullptr;
8784 if (py_class->tp_init) {
8785# ifdef USE_PEDANTIC_WRITE
8792 args = PyTuple_New(0);
8793 if (py_class->tp_init(py_srna, args,
nullptr) < 0) {
8799# ifdef USE_PEDANTIC_WRITE
8803 py_class_instance = py_srna;
8812 py_class_instance = py_srna;
8813 Py_INCREF(py_class_instance);
8820 args = PyTuple_New(1);
8821 PyTuple_SET_ITEM(args, 0, py_srna);
8822 py_class_instance = PyObject_Call(py_class, args,
nullptr);
8829 if (py_class_instance ==
nullptr) {
8836 if (err != -1 && (is_staticmethod || is_classmethod || py_class_instance)) {
8839 const bool item_type_valid = (item !=
nullptr) &&
8840 (is_staticmethod ? PyMethod_Check(item) : PyFunction_Check(item));
8841 if (item_type_valid) {
8844 if (is_staticmethod) {
8846 ((PyCodeObject *)PyFunction_GET_CODE(((PyMethodObject *)item)->im_func))->co_argcount -
8850 arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
8856 args = PyTuple_New(arg_count);
8858 if (is_staticmethod) {
8861 else if (is_classmethod) {
8862 PyTuple_SET_ITEM(args, 0, (PyObject *)py_class);
8866 PyTuple_SET_ITEM(args, 0, py_class_instance);
8879 if (pret_single ==
nullptr) {
8881 retdata_single = iter.
data;
8887 if (i < arg_count) {
8889 PyTuple_SET_ITEM(args, i, parmitem);
8894#ifdef USE_PEDANTIC_WRITE
8901 ret = PyObject_Call(item, args,
nullptr);
8905#ifdef USE_PEDANTIC_WRITE
8916 PyErr_Format(PyExc_TypeError,
8917 "could not find function %.200s in %.200s to execute callback",
8926 PyErr_Format(PyExc_RuntimeError,
8927 "could not create instance of %.200s to call callback function %.200s",
8934 if (
ret ==
nullptr) {
8938 if (ret_len == 0 &&
ret != Py_None) {
8939 PyErr_Format(PyExc_RuntimeError,
8940 "expected class %.200s, function %.200s to return None, not %.200s",
8943 Py_TYPE(
ret)->tp_name);
8946 else if (ret_len == 1) {
8955 "class %.200s, function %.200s: incompatible return value ",
8960 else if (ret_len > 1) {
8962 if (PyTuple_Check(
ret) == 0) {
8965 "expected class %.200s, function %.200s to return a tuple of size %d, not %.200s",
8969 Py_TYPE(
ret)->tp_name);
8972 else if (PyTuple_GET_SIZE(
ret) != ret_len) {
8973 PyErr_Format(PyExc_RuntimeError,
8974 "class %.200s, function %.200s to returned %d items, expected %d",
8977 PyTuple_GET_SIZE(
ret),
8992 &funcptr, parm, iter.
data, PyTuple_GET_ITEM(
ret, i++),
"calling class function:");
9008 if ((!is_staticmethod) && (!is_classmethod) && (
ptr->
data) &&
9036 PyObject *
self = (PyObject *)pyob_ptr;
9037 PyGILState_STATE gilstate;
9039 gilstate = PyGILState_Ensure();
9054 if (
self->ob_refcnt > 1) {
9059 Py_DECREF((PyObject *)pyob_ptr);
9061 PyGILState_Release(gilstate);
9071 PyGILState_STATE gilstate;
9075 gilstate = PyGILState_Ensure();
9083 if (item ==
nullptr) {
9084 if (PyErr_Occurred()) {
9095 PyGILState_Release(gilstate);
9134 pyrna_register_class_doc,
9135 ".. function:: register_class(cls)\n"
9137 " Register a subclass of a Blender type class.\n"
9139 " :arg cls: Blender type class in:\n"
9140 " :class:`bpy.types.Panel`, :class:`bpy.types.UIList`,\n"
9141 " :class:`bpy.types.Menu`, :class:`bpy.types.Header`,\n"
9142 " :class:`bpy.types.Operator`, :class:`bpy.types.KeyingSetInfo`,\n"
9143 " :class:`bpy.types.RenderEngine`, :class:`bpy.types.AssetShelf`,\n"
9144 " :class:`bpy.types.FileHandler`\n"
9145 " :type cls: type\n"
9146 " :raises ValueError:\n"
9147 " if the class is not a subclass of a registerable blender class.\n"
9151 " If the class has a *register* class method it will be called\n"
9152 " before registration.\n");
9162 const char *identifier;
9163 PyObject *py_cls_meth;
9164 const char *error_prefix =
"register_class(...):";
9166 if (!PyType_Check(py_class)) {
9167 PyErr_Format(PyExc_ValueError,
9168 "register_class(...): "
9169 "expected a class argument, not '%.200s'",
9170 Py_TYPE(py_class)->tp_name);
9175 PyErr_Format(PyExc_ValueError,
9176 "register_class(...): "
9177 "already registered as a subclass '%.200s'",
9178 ((PyTypeObject *)py_class)->tp_name);
9183 PyErr_Format(PyExc_RuntimeError,
9184 "register_class(...): "
9185 "can't run in readonly state '%.200s'",
9186 ((PyTypeObject *)py_class)->tp_name);
9192 if (srna ==
nullptr) {
9199 PyErr_Format(PyExc_ValueError,
9200 "register_class(...): %.200s's parent class %.200s is already registered, this "
9202 ((PyTypeObject *)py_class)->tp_name,
9212 PyErr_Format(PyExc_ValueError,
9213 "register_class(...): expected a subclass of a registerable "
9214 "RNA type (%.200s does not support registration)",
9225 identifier = ((PyTypeObject *)py_class)->tp_name;
9250 if (srna_new ==
nullptr) {
9262 Py_DECREF(py_class);
9278 PyObject *
ret = PyObject_CallObject(py_cls_meth,
nullptr);
9279 Py_DECREF(py_cls_meth);
9298 const char **r_prop_identifier)
9322 pyrna_unregister_class_doc,
9323 ".. function:: unregister_class(cls)\n"
9325 " Unload the Python class from blender.\n"
9327 " :arg cls: Blender type class, \n"
9328 " see :mod:`bpy.utils.register_class` for classes which can \n"
9330 " :type cls: type\n"
9334 " If the class has an *unregister* class method it will be called\n"
9335 " before unregistering.\n");
9340 pyrna_unregister_class_doc,
9347 PyObject *py_cls_meth;
9349 if (!PyType_Check(py_class)) {
9350 PyErr_Format(PyExc_ValueError,
9351 "register_class(...): "
9352 "expected a class argument, not '%.200s'",
9353 Py_TYPE(py_class)->tp_name);
9359 PWM_cursor_wait(
false);
9360 PyErr_SetString(PyExc_ValueError,
"unregister_class(): not a registered as a subclass");
9366 PyErr_Format(PyExc_RuntimeError,
9367 "unregister_class(...): "
9368 "can't run in readonly state '%.200s'",
9369 ((PyTypeObject *)py_class)->tp_name);
9374 if (srna ==
nullptr) {
9384 "unregister_class(...): "
9385 "expected a Type subclassed from a registerable RNA type (no unregister supported)");
9393 PyObject *
ret = PyObject_CallObject(py_cls_meth,
nullptr);
9394 Py_DECREF(py_cls_meth);
9413 const char *prop_identifier =
nullptr;
9420 srna_iter =
static_cast<StructRNA *
>(itemptr.data);
9427 if (prop_identifier) {
9428 PyErr_Format(PyExc_RuntimeError,
9429 "unregister_class(...): can't unregister %s because %s.%s pointer property is "
9458 PyObject *dict = type->tp_dict;
9459 if (method !=
nullptr) {
9460 for (; method->ml_name !=
nullptr; method++) {
9461 PyObject *py_method;
9463 if (method->ml_flags & METH_CLASS) {
9464 PyObject *cfunc = PyCFunction_New(method, (PyObject *)type);
9465 py_method = PyClassMethod_New(cfunc);
9468 else if (method->ml_flags & METH_STATIC) {
9469 py_method = PyCFunction_New(method,
nullptr);
9472 py_method = PyDescr_NewMethod(type, method);
9475 const int err = PyDict_SetItemString(dict, method->ml_name, py_method);
9476 Py_DECREF(py_method);
9482 if (getset !=
nullptr) {
9483 for (; getset->name !=
nullptr; getset++) {
9484 PyObject *descr = PyDescr_NewGetSet(type, getset);
9486 BLI_assert(PyDict_GetItem(dict, PyDescr_NAME(descr)) ==
nullptr);
9487 PyDict_SetItem(dict, PyDescr_NAME(descr), descr);
9500 return PyUnicode_FromString(name);
9508 if (value == Py_None) {
9511 else if (PyUnicode_Check(value)) {
9512 name = PyUnicode_AsUTF8(value);
9515 PyErr_Format(PyExc_ValueError,
9517 "expected None or a string, not '%.200s'",
9518 Py_TYPE(value)->tp_name);
9525#if (defined(__GNUC__) && !defined(__clang__))
9526# pragma GCC diagnostic push
9527# pragma GCC diagnostic ignored "-Wcast-function-type"
9543#if (defined(__GNUC__) && !defined(__clang__))
9544# pragma GCC diagnostic pop
ReportList * CTX_wm_reports(const bContext *C)
ListBase CTX_data_dir_get(const bContext *C)
int CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, blender::Vector< PointerRNA > *r_lb, PropertyRNA **r_prop, int *r_index, blender::StringRef *r_str, short *r_type)
@ CTX_RESULT_MEMBER_NOT_FOUND
Main * CTX_data_main(const bContext *C)
@ CTX_DATA_TYPE_COLLECTION
wmWindowManager * CTX_wm_manager(const bContext *C)
void IDP_FreeFromGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
bool IDP_ui_data_supported(const IDProperty *prop)
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_FreeProperty(IDProperty *prop)
const char * BKE_idtype_idcode_to_name(short idcode)
const char * BKE_idtype_idcode_to_name_plural(short idcode)
void BKE_reports_free(ReportList *reports)
void BKE_report_print_level_set(ReportList *reports, eReportType level)
void BKE_reports_init(ReportList *reports, int flag)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
A dynamically sized string ADT.
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format,...) ATTR_PRINTF_FORMAT(2
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
void BLI_ghashIterator_step(GHashIterator *ghi)
#define GHASH_ITER(gh_iter_, ghash_)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
void BLI_kdtree_nd_ free(KDTree *tree)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
#define STRNCPY(dst, src)
#define SNPRINTF(dst, format,...)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void BLI_str_tolower_ascii(char *str, size_t len) ATTR_NONNULL(1)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STREQLEN(a, b, n)
#define UNUSED_VARS_NDEBUG(...)
struct CLG_LogRef * BPY_LOG_RNA
typedef double(DMatrix)[4][4]
#define CLOG_ERROR(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
#define CLOG_INFO(clg_ref, level,...)
ID * DEG_get_original_id(ID *id)
Read Guarded memory(de)allocation.
#define RNA_STRUCT_BEGIN(sptr, prop)
#define RNA_POINTER_INVALIDATE(ptr)
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *identifier)
#define RNA_ENUM_BITFLAG_SIZE
bool(*)(Main *bmain, StructRNA *type) StructUnregisterFunc
StructRNA *(*)(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) StructRegisterFunc
constexpr PointerRNA PointerRNA_NULL
ATTR_WARN_UNUSED_RESULT const BMVert * v
void BPy_reports_write_stdout(const ReportList *reports, const char *header)
short BPy_reports_to_error(ReportList *reports, PyObject *exception, const bool clear)
bool BPy_errors_to_report(ReportList *reports)
void bpy_context_clear(struct bContext *C, const PyGILState_STATE *gilstate)
void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate)
struct bContext * BPY_context_get(void)
PyObject * bpy_intern_str_bpy_types
PyObject * bpy_intern_str___name__
PyObject * bpy_intern_str_register
PyObject * bpy_intern_str_bl_rna
PyObject * bpy_intern_str___module__
PyObject * bpy_intern_str___doc__
PyObject * bpy_intern_str_attr
PyObject * bpy_intern_str___annotations__
PyObject * bpy_intern_str_unregister
PyObject * bpy_intern_str___slots__
PyObject * bpy_intern_str_properties
PyObject * BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
PyObject * BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
#define BPy_PropDeferred_CheckTypeExact(v)
#define PYRNA_STACK_ARRAY
static PyModuleDef bpy_types_module_def
static PyTypeObject pyrna_prop_collection_iter_Type
static PyObject * pyrna_struct_is_property_overridable_library(BPy_StructRNA *self, PyObject *args)
const PointerRNA * pyrna_struct_as_ptr(PyObject *py_obj, const StructRNA *srna)
static PyObject * pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py_ssize_t start, Py_ssize_t stop)
static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
static PyObject * pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args)
PyDoc_STRVAR(pyrna_struct_keys_doc, ".. method:: keys()\n" "\n" " Returns the keys of this objects custom properties (matches Python's\n" " dictionary function of the same name).\n" "\n" " :return: custom property keys.\n" " :rtype: :class:`idprop.types.IDPropertyGroupViewKeys`\n" "\n" BPY_DOC_ID_PROP_TYPE_NOTE)
static void pyrna_struct_dealloc(BPy_StructRNA *self)
PyTypeObject pyrna_struct_meta_idprop_Type
PyTypeObject pyrna_prop_Type
static PyObject * pyrna_register_class(PyObject *self, PyObject *py_class)
static PyObject * pyrna_bl_owner_id_get(PyObject *)
void pyrna_invalidate(BPy_DummyPointerRNA *self)
static PyObject * pyrna_struct_dir(BPy_StructRNA *self)
StructRNA * pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix)
static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
static PyObject * pyrna_prop_array_repr(BPy_PropertyArrayRNA *self)
static int pyrna_prop_array_contains(BPy_PropertyRNA *self, PyObject *value)
static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, PyObject *value)
static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self)
static PointerRNA * rna_module_ptr
static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *key, PyObject *value)
#define BPY_REPLACEMENT_STRING(rna_attr, py_attr)
static PyObject * pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject *key)
static PyObject * pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject *key)
static PyObject * pyrna_struct_type_recast(BPy_StructRNA *self)
static int rna_function_arg_count(FunctionRNA *func, int *min_count)
PyMethodDef meth_bpy_owner_id_set
bool pyrna_id_CheckPyObject(PyObject *obj)
static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject *py_class)
static PyObject * pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA *self)
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self)
static PyObject * pyrna_srna_Subtype(StructRNA *srna)
static PyObject * pyrna_prop_array_foreach_set(BPy_PropertyArrayRNA *self, PyObject *args)
static PyObject * pyrna_struct_get_id_data(BPy_DummyPointerRNA *self, void *)
static PyObject * pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
PyObject * BPY_rna_module()
static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
#define MATHUTILS_CB_SUBTYPE_COLOR
static int prop_subscript_ass_array_slice__int_recursive(PyObject **value_items, int *value, int totdim, const int dimsize[], const int range[2])
static PyObject * pyrna_struct_property_unset(BPy_StructRNA *self, PyObject *args)
static bool rna_disallow_writes
#define PROP_ALL_VECTOR_SUBTYPES
static PyObject * pyrna_struct_id_properties_ensure(BPy_StructRNA *self)
static const char * pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
static PyObject * pyrna_srna_PyBase(StructRNA *srna)
static long pyrna_prop_hash(BPy_PropertyRNA *self)
static PyObject * pyrna_struct_get_data(BPy_DummyPointerRNA *self, void *)
static PyMethodDef pyrna_struct_methods[]
static PyObject * pyrna_struct_as_pointer(BPy_StructRNA *self)
void BPY_id_release(ID *id)
static PyMethodDef pyrna_prop_collection_idprop_methods[]
static PyObject * pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject *pyname)
PyObject * pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
static PyObject * pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int index)
static PyObject * pyrna_struct_id_properties_clear(BPy_StructRNA *self)
static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum, PyObject *value)
static PyObject * pyrna_struct_items(BPy_StructRNA *self)
static PyObject * pyrna_bl_owner_id_set(PyObject *, PyObject *value)
void pyrna_struct_type_extend_capi(StructRNA *srna, PyMethodDef *method, PyGetSetDef *getset)
static PyObject * pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
static PyMappingMethods pyrna_struct_as_mapping
static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item)
static PyObject * pyrna_prop_dir(BPy_PropertyRNA *self)
static void pyrna_dir_members_py__add_keys(PyObject *list, PyObject *dict)
static PyTypeObject pyrna_prop_collection_idprop_Type
static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
static void pyrna_prop_dealloc(BPy_PropertyRNA *self)
static PyObject * pyrna_struct_property_overridable_library_set(BPy_StructRNA *self, PyObject *args)
#define BPY_DOC_ID_PROP_TYPE_NOTE
static PyObject * pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, Py_ssize_t start, Py_ssize_t stop, Py_ssize_t length)
static PyMappingMethods pyrna_prop_array_as_mapping
static void pyrna_dir_members_py(PyObject *list, PyObject *self)
PyMethodDef meth_bpy_owner_id_get
static PyObject * pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, const char *keyname)
static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *key, PyObject *value)
static PyObject * pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *prop, int *r_value, const char *error_prefix)
static PyObject * pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
static PyObject * pyrna_prop_as_bytes(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_collection_iter(BPy_PropertyRNA *self)
static PyObject * pyrna_struct_id_properties_ui(BPy_StructRNA *self, PyObject *args)
static int pyrna_prop_collection_string_subscript_supported_or_error(BPy_PropertyRNA *self, const char *error_prefix)
static PyObject * pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
static int bpy_class_validate_recursive(PointerRNA *dummy_ptr, StructRNA *srna, void *py_data, bool *have_function)
static PyObject * pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObject *args)
static PyObject * pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, Py_ssize_t keynum)
static PyObject * pyrna_prop_update(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_path_from_id(BPy_PropertyRNA *self)
void pyrna_struct_validity_exception_only(const BPy_StructRNA *pysrna)
static PyNumberMethods pyrna_prop_collection_as_number
static PyObject * pyrna_struct_get_rna_type(BPy_PropertyRNA *self, void *)
static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int start, int stop, int length, PyObject *value_orig)
static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
static PyObject * pyrna_prop_collection_values(BPy_PropertyRNA *self)
static PyObject * pyrna_srna_ExternalType(StructRNA *srna)
void BPY_rna_types_finalize_external_types(PyObject *submodule)
static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *value)
static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyObject *value)
int pyrna_struct_as_ptr_or_null_parse(PyObject *o, void *p)
int pyrna_struct_as_ptr_parse(PyObject *o, void *p)
static PyObject * pyrna_unregister_class(PyObject *self, PyObject *py_class)
static int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject *value)
static uchar mathutils_rna_array_cb_index
static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int, int index)
static PyObject * small_dict_get_item_string(PyObject *dict, const char *key_lookup)
StructRNA * srna_from_self(PyObject *self, const char *error_prefix)
static PySequenceMethods pyrna_struct_as_sequence
static PyObject * pyrna_func_doc_get(BPy_FunctionRNA *self, void *closure)
static int pyrna_prop_array_bool(BPy_PropertyRNA *self)
#define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err)
PyObject * pyrna_id_CreatePyObject(ID *id)
static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
int pyrna_struct_validity_check(const BPy_StructRNA *pysrna)
static int pyrna_prop_collection_subscript_is_valid_or_error(const PyObject *value)
static PyObject * pyrna_prop_array_foreach_get(BPy_PropertyArrayRNA *self, PyObject *args)
int pyrna_prop_validity_check(const BPy_PropertyRNA *self)
static int mathutils_rna_generic_check(BaseMathObject *bmo)
static PyObject * pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
int pyrna_struct_validity_check_only(const BPy_StructRNA *pysrna)
static PyObject * pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *args)
static PyObject * pyrna_struct_is_property_readonly(BPy_StructRNA *self, PyObject *args)
static PyObject * pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *self, PyObject *key, const char *err_prefix, const bool err_not_found)
const PointerRNA * pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA *srna)
static void pyrna_prop_collection_iter_dealloc(BPy_PropertyCollectionIterRNA *self)
static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
static PyObject * pyrna_prop_array_getattro(BPy_PropertyRNA *self, PyObject *pyname)
PyTypeObject pyrna_prop_array_Type
static void pyrna_func_error_prefix(BPy_FunctionRNA *self, PropertyRNA *parm, const int parm_index, char *error, const size_t error_size)
static int prop_subscript_ass_array_slice__bool_recursive(PyObject **value_items, bool *value, int totdim, const int dimsize[])
static PyNumberMethods pyrna_prop_array_as_number
static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t keynum, PyObject *value)
static PyObject * foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
static PySequenceMethods pyrna_prop_collection_as_sequence
static PyObject * pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
static Py_hash_t pyrna_struct_hash(BPy_StructRNA *self)
static PyObject * pyrna_struct_bl_rna_find_subclass_recursive(PyObject *cls, const char *id)
static PyGetSetDef pyrna_prop_getseters[]
PyTypeObject pyrna_struct_Type
static PyObject * pyrna_prop_collection_idprop_clear(BPy_PropertyRNA *self)
static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
static PyObject * pyrna_struct_pop(BPy_StructRNA *self, PyObject *args)
static PyObject * pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject *kw)
static PyObject * prop_subscript_ass_array_slice__as_seq_fast(PyObject *value, int length)
static void bpy_class_free(void *pyob_ptr)
static uchar mathutils_rna_matrix_cb_index
static PySequenceMethods pyrna_prop_array_as_sequence
static PyObject * pyrna_struct_Subtype(PointerRNA *ptr)
static bool foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, const char *format)
static PyMethodDef pyrna_prop_methods[]
static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRNA *srna, const char **r_prop_identifier)
static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
PyTypeObject pyrna_func_Type
static PyObject * pyrna_struct_str(BPy_StructRNA *self)
int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class)
static PyGetSetDef pyrna_struct_getseters[]
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const bool all_args, const char *error_prefix)
static PyObject * pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
static PyMethodDef pyrna_prop_collection_methods[]
static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args, const char *function_name, const char **r_attr, PyObject **r_seq, int *r_tot, size_t *r_size, RawPropertyType *r_raw_type, int *r_attr_tot, bool *r_attr_signed)
static PyObject * pyrna_func_to_py(const PointerRNA *ptr, FunctionRNA *func)
static PyObject * pyrna_struct_CreatePyObject_from_type(const PointerRNA *ptr, PyTypeObject *tp, void **instance)
static Mathutils_Callback mathutils_rna_array_cb
static void pyrna_prop_collection_string_subscript_unsupported_error(BPy_PropertyRNA *self, const char *error_prefix)
static PyObject * pyrna_struct_values(BPy_StructRNA *self)
static PyObject * pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
static PyObject * pyrna_struct_bl_rna_get_subclass_py(PyObject *cls, PyObject *args)
PyObject * BPY_rna_types()
static bool foreach_attr_type(BPy_PropertyRNA *self, const char *attr, RawPropertyType *r_raw_type, int *r_attr_tot, bool *r_attr_signed, bool *r_is_empty)
PyMethodDef meth_bpy_unregister_class
static short pyrna_rotation_euler_order_get(PointerRNA *ptr, const short order_fallback, PropertyRNA **r_prop_eul_order)
static PyObject * bpy_types_dict
static int prop_subscript_ass_array_slice__float_recursive(PyObject **value_items, float *value, int totdim, const int dimsize[], const float range[2])
PyObject * pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
static void pyrna_prop_array_dealloc(BPy_PropertyRNA *self)
void pyrna_write_set(bool val)
static PyObject * pyrna_prop_repr_ex(BPy_PropertyRNA *self, const int index_dim, const int index)
static PyObject * pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
PyMethodDef meth_bpy_register_class
static int bpy_class_validate(PointerRNA *dummy_ptr, void *py_data, bool *have_function)
static PyObject * pyrna_struct_repr(BPy_StructRNA *self)
#define MATHUTILS_CB_SUBTYPE_VEC
static int pyrna_deferred_register_class_from_type_hints(StructRNA *srna, PyTypeObject *py_class)
static PyObject * pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key_ob)
static int mathutils_rna_matrix_set(BaseMathObject *bmo, int)
static PyObject * pyrna_prop_collection_keys(BPy_PropertyRNA *self)
#define MATHUTILS_CB_SUBTYPE_EUL
static PyObject * pyrna_prop_repr(BPy_PropertyRNA *self)
static PyGetSetDef pyrna_func_getseters[]
void BPY_update_rna_module()
static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pyname, PyObject *value)
static PyObject * pyrna_struct_bl_rna_get_subclass(PyObject *cls, PyObject *args)
static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObject *value, int *r_value, const char *error_prefix)
static PyObject * pyrna_func_repr(BPy_FunctionRNA *self)
static PyMappingMethods pyrna_prop_collection_as_mapping
bool pyrna_id_FromPyObject(PyObject *obj, ID **id)
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
static PyMethodDef bpy_types_module_methods[]
static PyObject * bpy_types_module_getattro(PyObject *self, PyObject *pyname)
static PyObject * pyrna_prop_str(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_collection_items(BPy_PropertyRNA *self)
static PyObject * pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self, PyObject *args, const bool do_set)
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int)
static PyObject * bpy_types_module_dir(PyObject *self)
static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int, int index)
static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *)
static PyObject * pyrna_struct_keys(BPy_StructRNA *self)
static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyObject *key, const char *err_prefix, const short err_not_found, PointerRNA *r_ptr)
static PyObject * pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
#define MATHUTILS_CB_SUBTYPE_QUAT
static PyObject * pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
static PyObject * pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObject *args)
static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *)
static PyMethodDef pyrna_prop_array_methods[]
BPy_StructRNA * bpy_context_module
PyObject * pyrna_struct_CreatePyObject_with_primitive_support(PointerRNA *ptr)
static PyObject * pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyObject *value)
static PyObject * pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key)
static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObject *value)
static PyObject * pyrna_prop_collection_iter_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
static StructRNA * srna_from_ptr(PointerRNA *ptr)
static bool rna_id_write_error(PointerRNA *ptr, PyObject *key)
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix)
PyTypeObject pyrna_prop_collection_Type
static PyObject * pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *args, PyObject *kw)
static Mathutils_Callback mathutils_rna_matrix_cb
int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix)
PyObject * pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
#define PYRNA_STRUCT_IS_VALID(pysrna)
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
#define BPy_StructRNA_CheckExact(v)
#define PYRNA_STRUCT_CHECK_OBJ(obj)
int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix)
#define PYRNA_STRUCT_CHECK_INT(obj)
#define PYRNA_STRUCT_CHECK_OBJ_UNLESS(obj, unless)
#define PYRNA_PROP_CHECK_OBJ(obj)
#define PYRNA_PROP_CHECK_INT(obj)
#define BPy_PropertyRNA_CheckExact(v)
#define BPy_StructRNA_Check(v)
#define BPy_PropertyRNA_Check(v)
PyObject * pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
PyObject * pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop)
char pyrna_struct_driver_add_doc[]
char pyrna_struct_keyframe_insert_doc[]
PyObject * pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
PyObject * pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
PyObject * pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
char pyrna_struct_driver_remove_doc[]
char pyrna_struct_keyframe_delete_doc[]
PyObject * pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
PyObject * pyrna_callback_classmethod_remove(PyObject *, PyObject *args)
PyObject * pyrna_callback_classmethod_add(PyObject *, PyObject *args)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
constexpr bool is_empty() const
constexpr int64_t size() const
constexpr const char * data() const
void append(const T &value)
local_group_size(16, 16) .push_constant(Type b
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
PyObject * BPy_Wrap_GetKeys_View_WithID(ID *id, IDProperty *prop)
int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
PyObject * BPy_Wrap_GetItems_View_WithID(ID *id, IDProperty *prop)
PyTypeObject BPy_IDGroup_Type
PyObject * BPy_IDGroup_MapDataToPy(IDProperty *prop)
PyObject * BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent)
PyObject * BPy_Wrap_GetValues_View_WithID(ID *id, IDProperty *prop)
PyTypeObject BPy_IDPropertyUIManager_Type
void MEM_freeN(void *vmemh)
uchar Mathutils_RegisterCallback(Mathutils_Callback *cb)
int(* BaseMathGetFunc)(BaseMathObject *, int)
int(* BaseMathGetIndexFunc)(BaseMathObject *, int, int)
int(* BaseMathSetIndexFunc)(BaseMathObject *, int, int)
int(* BaseMathSetFunc)(BaseMathObject *, int)
int(* BaseMathCheckFunc)(BaseMathObject *)
PyObject * Color_CreatePyObject(const float col[3], PyTypeObject *base_type)
PyObject * Color_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
PyObject * Euler_CreatePyObject(const float eul[3], const short order, PyTypeObject *base_type)
PyObject * Euler_CreatePyObject_cb(PyObject *cb_user, const short order, uchar cb_type, uchar cb_subtype)
PyObject * Matrix_CreatePyObject_cb(PyObject *cb_user, const ushort col_num, const ushort row_num, uchar cb_type, uchar cb_subtype)
PyObject * Matrix_CreatePyObject(const float *mat, const ushort col_num, const ushort row_num, PyTypeObject *base_type)
PyObject * Quaternion_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
PyObject * Quaternion_CreatePyObject(const float quat[4], PyTypeObject *base_type)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int vec_num, uchar cb_type, uchar cb_subtype)
static void error(const char *str)
const char * node_type_find_alias(const char *idname)
bNodeType * node_type_find(const char *idname)
int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
char * pyrna_enum_repr(const EnumPropertyItem *item)
int16_t PyC_Long_AsI16(PyObject *value)
uint8_t PyC_Long_AsU8(PyObject *value)
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format,...)
void PyC_ObSpit(const char *name, PyObject *var)
int8_t PyC_Long_AsI8(PyObject *value)
PyObject * PyC_UnicodeFromBytesAndSize(const char *str, Py_ssize_t size)
PyObject * PyC_UnicodeFromBytes(const char *str)
uint64_t PyC_Long_AsU64(PyObject *value)
void PyC_ObSpitStr(char *result, size_t result_maxncpy, PyObject *var)
PyObject * PyC_ExceptionBuffer()
int PyC_Long_AsBool(PyObject *value)
void PyC_FileAndNum(const char **r_filename, int *r_lineno)
uint16_t PyC_Long_AsU16(PyObject *value)
int PyC_ParseBool(PyObject *o, void *p)
const char * PyC_UnicodeAsBytes(PyObject *py_str, PyObject **r_coerce)
header-only compatibility defines.
#define PY_ARG_PARSER_HEAD_COMPAT()
#define PyTuple_SET_ITEMS(op_arg,...)
StructUnregisterFunc RNA_struct_unregister(StructRNA *type)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_collection_lookup_int_has_fn(PropertyRNA *prop)
bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value)
StructRegisterFunc RNA_struct_register(StructRNA *type)
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **r_identifier)
void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
const StructRNA * RNA_struct_base_child_of(const StructRNA *type, const StructRNA *parent_type)
bool RNA_property_update_check(PropertyRNA *prop)
bool RNA_property_array_check(PropertyRNA *prop)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
const char * RNA_function_identifier(FunctionRNA *func)
void RNA_parameter_list_end(ParameterIterator *)
void RNA_struct_state_owner_set(const char *name)
void RNA_struct_py_type_set(StructRNA *srna, void *py_type)
IDProperty ** RNA_struct_idprops_p(PointerRNA *ptr)
int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **r_identifier)
bool RNA_struct_is_ID(const StructRNA *type)
const ListBase * RNA_struct_type_properties(StructRNA *srna)
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
const ListBase * RNA_struct_type_functions(StructRNA *srna)
bool RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr)
bool RNA_property_collection_is_empty(PointerRNA *ptr, PropertyRNA *prop)
int RNA_function_defined(FunctionRNA *func)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
char * RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
void RNA_property_collection_skip(CollectionPropertyIterator *iter, int num)
bool RNA_property_collection_lookup_string_has_nameprop(PropertyRNA *prop)
int RNA_property_collection_raw_get(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *array, RawPropertyType type, int len)
bool RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, bool use_ghost)
bool RNA_property_collection_lookup_string_supported(PropertyRNA *prop)
void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter)
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax)
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
PropertyType RNA_property_type(PropertyRNA *prop)
char * RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen, int *r_len)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
void ** RNA_struct_instance(PointerRNA *ptr)
void RNA_parameter_list_free(ParameterList *parms)
IDProperty * RNA_struct_idprops(PointerRNA *ptr, bool create)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
size_t RNA_raw_type_sizeof(RawPropertyType type)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
const char * RNA_struct_identifier(const StructRNA *type)
bool RNA_struct_idprops_contains_datablock(const StructRNA *type)
void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
bool RNA_enum_id_from_value(const EnumPropertyItem *item, int value, const char **r_identifier)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_collection_next(CollectionPropertyIterator *iter)
void RNA_parameter_list_next(ParameterIterator *iter)
const char * RNA_function_ui_description(FunctionRNA *func)
int RNA_property_array_dimension(const PointerRNA *ptr, PropertyRNA *prop, int length[])
PropertyRNA * RNA_struct_type_find_property_no_base(StructRNA *srna, const char *identifier)
int RNA_function_flag(FunctionRNA *func)
std::string RNA_function_as_string_keywords(bContext *C, FunctionRNA *func, const bool as_function, const bool all_args, const int max_prop_length)
int RNA_property_flag(PropertyRNA *prop)
RawPropertyType RNA_property_raw_type(PropertyRNA *prop)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
bool RNA_property_builtin(PropertyRNA *prop)
const char * RNA_struct_ui_description(const StructRNA *type)
int RNA_parameter_list_arg_count(const ParameterList *parms)
bool RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
bool RNA_struct_idprops_register_check(const StructRNA *type)
void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
StructRNA * RNA_struct_base(StructRNA *type)
FunctionRNA * RNA_struct_find_function(StructRNA *srna, const char *identifier)
bool RNA_property_is_idprop(const PropertyRNA *prop)
int RNA_property_string_maxlength(PropertyRNA *prop)
const char * RNA_struct_state_owner_get()
bool RNA_struct_idprops_datablock_allowed(const StructRNA *type)
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_pointer_recast(PointerRNA *ptr)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
PropertyRNA * RNA_struct_name_property(const StructRNA *type)
void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos)
PropertySubType RNA_property_subtype(PropertyRNA *prop)
PointerRNA RNA_main_pointer_create(Main *main)
void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax)
int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
bool RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr)
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *, FunctionRNA *func)
void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
void RNA_property_collection_end(CollectionPropertyIterator *iter)
bool RNA_property_collection_lookup_string_has_fn(PropertyRNA *prop)
bool RNA_struct_idprops_check(StructRNA *srna)
PointerRNA RNA_blender_rna_pointer_create()
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter)
PropertyRNA * RNA_struct_iterator_property(StructRNA *type)
void RNA_property_enum_items_ex(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const bool use_static, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
int RNA_parameter_flag(PropertyRNA *prop)
void * RNA_struct_py_type_get(StructRNA *srna)
bool RNA_property_editable_flag(const PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_collection_raw_set(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *array, RawPropertyType type, int len)
const char * RNA_property_identifier(const PropertyRNA *prop)
const ListBase * RNA_function_defined_parameters(FunctionRNA *func)
int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dim)
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
PointerRNA RNA_id_pointer_create(ID *id)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
bool RNA_property_overridable_library_set(PointerRNA *, PropertyRNA *prop, const bool is_overridable)
bool RNA_property_overridable_get(const PointerRNA *ptr, PropertyRNA *prop)
std::optional< std::string > RNA_path_from_ID_to_struct(const PointerRNA *ptr)
std::optional< std::string > RNA_path_from_real_ID_to_struct(Main *bmain, const PointerRNA *ptr, ID **r_real)
std::optional< std::string > RNA_path_from_real_ID_to_property_index(Main *bmain, const PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index, ID **r_real_id)
bool RNA_path_resolve_full_maybe_null(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
std::string RNA_path_from_ptr_to_property_index(const PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index)
const EnumPropertyItem rna_enum_property_type_items[]
const EnumPropertyItem rna_enum_dummy_NULL_items[]
unsigned __int64 uint64_t
PyObject_HEAD PointerRNA ptr
PyObject_HEAD PointerRNA ptr
PyObject_VAR_HEAD IDProperty * property
PyObject_HEAD PointerRNA ptr
PyObject_HEAD PointerRNA ptr
blender::Vector< PointerRNA > items
struct ReportList * reports
static DynamicLibrary lib