38 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
45 #include "RNA_prototypes.h"
63 #include "../generic/idprop_py_api.h"
64 #include "../generic/idprop_py_ui_api.h"
65 #include "../generic/py_capi_rna.h"
66 #include "../generic/py_capi_utils.h"
67 #include "../generic/python_utildefines.h"
69 #define USE_PEDANTIC_WRITE
71 #define USE_STRING_COERCE
80 #define USE_POSTPONED_ANNOTATIONS
95 #define BPY_DOC_ID_PROP_TYPE_NOTE \
98 " Only the :class:`bpy.types.ID`, :class:`bpy.types.Bone` and\n" \
99 " :class:`bpy.types.PoseBone` classes support custom properties.\n"
107 PyExc_ReferenceError,
"StructRNA of type %.200s has been removed", Py_TYPE(pysrna)->tp_name);
113 if (
self->ptr.type) {
116 PyErr_Format(PyExc_ReferenceError,
117 "PropertyRNA of type %.200s.%.200s has been removed",
118 Py_TYPE(
self)->tp_name,
128 #ifdef USE_PYRNA_INVALIDATE_GC
129 # define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g) + 1))
132 struct gc_generation {
138 static void id_release_gc(
struct ID *
id)
142 for (j = 0; j < 3; j++) {
144 PyGC_Head *gen = (PyGC_Head *)(((
char *)_PyGC_generation0) + (
sizeof(gc_generation) * j));
145 PyGC_Head *
g = gen->gc.gc_next;
146 while ((
g =
g->gc.gc_next) != gen) {
147 PyObject *ob = FROM_GC(
g);
163 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
167 static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref);
168 static PyMethodDef id_free_weakref_cb_def = {
169 "id_free_weakref_cb", (PyCFunction)id_free_weakref_cb, METH_O,
NULL};
174 static void id_weakref_pool_free_value_fn(
void *p)
176 GHash *weakinfo_hash = p;
181 static GHash *id_weakref_pool_get(
ID *
id)
184 if (weakinfo_hash ==
NULL) {
190 return weakinfo_hash;
197 PyObject *weakref_capsule;
198 PyObject *weakref_cb_py;
202 GHash *weakinfo_hash = id_weakref_pool_get(
id);
204 weakref_capsule = PyCapsule_New(weakinfo_hash,
NULL,
NULL);
205 weakref_cb_py = PyCFunction_New(&id_free_weakref_cb_def, weakref_capsule);
206 Py_DECREF(weakref_capsule);
209 weakref = PyWeakref_NewRef((PyObject *)pyrna, weakref_cb_py);
211 Py_DECREF(weakref_cb_py);
221 static ID *_id_tmp_ptr;
222 static void value_id_set(
void *
id)
224 _id_tmp_ptr = (
ID *)
id;
227 static void id_release_weakref_list(
struct ID *
id,
GHash *weakinfo_hash);
228 static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref)
231 GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_pair,
NULL);
238 id_release_weakref_list(_id_tmp_ptr, weakinfo_hash);
246 static void id_release_weakref_list(
struct ID *
id,
GHash *weakinfo_hash)
252 # ifdef DEBUG_RNA_WEAKREF
253 fprintf(stdout,
"id_release_weakref: '%s', %d items\n",
id->
name,
BLI_ghash_len(weakinfo_hash));
258 PyObject *item = PyWeakref_GET_OBJECT(weakref);
259 if (item != Py_None) {
261 # ifdef DEBUG_RNA_WEAKREF
277 static void id_release_weakref(
struct ID *
id)
281 id_release_weakref_list(
id, weakinfo_hash);
289 #ifdef USE_PYRNA_INVALIDATE_GC
293 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
295 if (id_weakref_pool !=
NULL) {
296 PyGILState_STATE gilstate = PyGILState_Ensure();
298 id_release_weakref(
id);
300 PyGILState_Release(gilstate);
307 #ifdef USE_PEDANTIC_WRITE
319 if (key && PyUnicode_Check(key)) {
320 pyname = PyUnicode_AsUTF8(key);
323 pyname =
"<UNKNOWN>";
328 PyErr_Format(PyExc_AttributeError,
329 "Writing to ID classes in this context is not allowed: "
330 "%.200s, %.200s datablock, error setting %.200s.%.200s",
343 #ifdef USE_PEDANTIC_WRITE
371 # include "../mathutils/mathutils.h"
380 const short order_fallback,
387 # define MATHUTILS_CB_SUBTYPE_EUL 0
388 # define MATHUTILS_CB_SUBTYPE_VEC 1
389 # define MATHUTILS_CB_SUBTYPE_QUAT 2
390 # define MATHUTILS_CB_SUBTYPE_COLOR 3
398 return self->prop ? 0 : -1;
434 # ifdef USE_PEDANTIC_WRITE
441 PyErr_Format(PyExc_AttributeError,
442 "bpy_prop \"%.200s.%.200s\" is read-only",
450 if (
min != -FLT_MAX ||
max != FLT_MAX) {
452 for (i = 0; i <
len; i++) {
501 # ifdef USE_PEDANTIC_WRITE
508 PyErr_Format(PyExc_AttributeError,
509 "bpy_prop \"%.200s.%.200s\" is read-only",
560 # ifdef USE_PEDANTIC_WRITE
567 PyErr_Format(PyExc_AttributeError,
568 "bpy_prop \"%.200s.%.200s\" is read-only",
592 const short order_fallback,
596 if (*r_prop_eul_order ==
NULL) {
600 if (*r_prop_eul_order) {
608 return order_fallback;
617 #define PROP_ALL_VECTOR_SUBTYPES \
619 case PROP_TRANSLATION: \
620 case PROP_DIRECTION: \
621 case PROP_VELOCITY: \
622 case PROP_ACCELERATION: \
649 goto thick_wrap_slice;
662 if (totdim == 1 || (totdim == 2 && subtype ==
PROP_MATRIX)) {
670 if (
len >= 2 &&
len <= 4) {
795 return (((
a->ptr.data ==
b->ptr.data) && (
a->ptr.type ==
b->ptr.type)) ? 0 : -1);
800 return (((
a->prop ==
b->prop) && (
a->ptr.data ==
b->ptr.data) && (
a->ptr.type ==
b->ptr.type)) ?
819 res = ok ? Py_False : Py_True;
826 res = Py_NotImplemented;
833 return Py_INCREF_RET(res);
850 res = ok ? Py_False : Py_True;
857 res = Py_NotImplemented;
864 return Py_INCREF_RET(res);
872 const char *extra_info =
"";
875 return PyUnicode_FromFormat(
"<bpy_struct, %.200s invalid>", Py_TYPE(
self)->tp_name);
878 ID *
id =
self->ptr.owner_id;
880 extra_info =
", evaluated";
889 ret = PyUnicode_FromFormat(
"<bpy_struct, %.200s(\"%.200s\") at %p%s>",
898 return PyUnicode_FromFormat(
"<bpy_struct, %.200s at %p%s>",
906 ID *
id =
self->ptr.owner_id;
915 tmp_str = PyUnicode_FromString(
id->
name + 2);
918 ret = PyUnicode_FromFormat(
931 if (real_id !=
NULL) {
933 tmp_str = PyUnicode_FromString(real_id->
name + 2);
934 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R].%s",
941 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
950 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
967 const char *type_id =
NULL;
968 char type_fmt[64] =
"";
977 PyErr_SetString(PyExc_RuntimeError,
"could not use property type, internal error");
985 while ((*
c++ = tolower(*type_id++))) {
996 sprintf(--
c,
"[%d]",
len);
1005 ret = PyUnicode_FromFormat(
"<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
1017 return PyUnicode_FromFormat(
1022 return PyUnicode_FromFormat(
"<bpy_%.200s, %.200s.%.200s>",
1030 ID *
id =
self->ptr.owner_id;
1042 tmp_str = PyUnicode_FromString(
id->
name + 2);
1051 if (real_id !=
id) {
1053 tmp_str = PyUnicode_FromString(real_id->
name + 2);
1055 const char *data_delim = (path[0] ==
'[') ?
"" :
".";
1056 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]%s%s",
1066 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
1089 return PyUnicode_FromFormat(
"<%.200s %.200s.%.200s()>",
1090 Py_TYPE(
self)->tp_name,
1097 return _Py_HashPointer(
self->ptr.data);
1108 x = _Py_HashPointer(
self->ptr.data);
1113 y = _Py_HashPointer((
void *)(
self->prop));
1124 #ifdef USE_PYRNA_STRUCT_REFERENCE
1125 static int pyrna_struct_traverse(
BPy_StructRNA *
self, visitproc visit,
void *arg)
1127 Py_VISIT(
self->reference);
1133 Py_CLEAR(
self->reference);
1141 #ifdef PYRNA_FREE_SUPPORT
1142 if (
self->freeptr &&
self->ptr.data) {
1144 self->ptr.data =
NULL;
1149 if (
self->in_weakreflist !=
NULL) {
1150 PyObject_ClearWeakRefs((PyObject *)
self);
1154 #ifdef USE_PYRNA_STRUCT_REFERENCE
1155 if (
self->reference) {
1156 PyObject_GC_UnTrack(
self);
1157 pyrna_struct_clear(
self);
1162 Py_TYPE(
self)->tp_free(
self);
1165 #ifdef USE_PYRNA_STRUCT_REFERENCE
1166 static void pyrna_struct_reference_set(
BPy_StructRNA *
self, PyObject *reference)
1168 if (
self->reference) {
1169 PyObject_GC_UnTrack(
self);
1170 Py_CLEAR(
self->reference);
1175 self->reference = reference;
1176 Py_INCREF(reference);
1177 PyObject_GC_Track(
self);
1186 if (
self->in_weakreflist !=
NULL) {
1187 PyObject_ClearWeakRefs((PyObject *)
self);
1191 Py_TYPE(
self)->tp_free(
self);
1197 if (
self->in_weakreflist !=
NULL) {
1198 PyObject_ClearWeakRefs((PyObject *)
self);
1202 Py_TYPE(
self)->tp_free(
self);
1229 const char *param = PyUnicode_AsUTF8(item);
1231 if (param ==
NULL) {
1232 PyErr_Format(PyExc_TypeError,
1233 "%.200s expected a string enum, not %.200s",
1235 Py_TYPE(item)->tp_name);
1241 PyErr_Format(PyExc_TypeError,
1242 "%.200s enum \"%.200s\" not found in (%s)",
1262 if (!PyAnySet_Check(value)) {
1263 PyErr_Format(PyExc_TypeError,
1264 "%.200s, %.200s.%.200s expected a set, not a %.200s",
1268 Py_TYPE(value)->tp_name);
1278 if (PySet_GET_SIZE(value)) {
1279 PyErr_Format(PyExc_TypeError,
1280 "%.200s: empty enum \"%.200s\" could not have any values assigned",
1309 for (index = 0; identifier[index]; index++) {
1310 item = PyUnicode_FromString(identifier[index]);
1311 PySet_Add(
ret, item);
1317 const char *identifier;
1319 ret = PyUnicode_FromString(identifier);
1335 "current value '%d' "
1336 "matches no enum in '%s', '%s', '%s'",
1343 char error_str[256];
1346 "RNA Warning: Current value \"%d\" "
1347 "matches no enum in '%s', '%s', '%s'",
1353 PyErr_Warn(PyExc_RuntimeWarning, error_str);
1361 ret = PyUnicode_FromString(
"");
1363 PyErr_Format(PyExc_AttributeError,
"RNA Error: Current value \"%d\" matches no enum", val);
1399 #ifdef USE_STRING_COERCE
1402 ret = PyBytes_FromStringAndSize(buf, buf_len);
1408 ret = PyUnicode_FromStringAndSize(buf, buf_len);
1412 ret = PyBytes_FromStringAndSize(buf, buf_len);
1415 ret = PyUnicode_FromStringAndSize(buf, buf_len);
1418 if (buf_fixed != buf) {
1443 PyErr_Format(PyExc_TypeError,
1444 "bpy_struct internal error: unknown type '%d' (pyrna_prop_to_py)",
1455 const bool all_args,
1456 const char *error_prefix)
1460 const char *arg_name =
NULL;
1463 totkw = kw ? PyDict_Size(kw) : 0;
1468 if (
STREQ(arg_name,
"rna_type")) {
1473 PyErr_Format(PyExc_TypeError,
1474 "%.200s: no keywords, expected \"%.200s\"",
1476 arg_name ? arg_name :
"<UNKNOWN>");
1481 item = PyDict_GetItemString(kw, arg_name);
1485 PyErr_Format(PyExc_TypeError,
1486 "%.200s: keyword \"%.200s\" missing",
1488 arg_name ? arg_name :
"<UNKNOWN>");
1503 if (error_val == 0 && totkw > 0) {
1504 PyObject *key, *value;
1507 while (PyDict_Next(kw, &
pos, &key, &value)) {
1508 arg_name = PyUnicode_AsUTF8(key);
1515 PyErr_Format(PyExc_TypeError,
1516 "%.200s: keyword \"%.200s\" unrecognized",
1518 arg_name ? arg_name :
"<UNKNOWN>");
1529 pyfunc->
func = func;
1530 return (PyObject *)pyfunc;
1556 param = PyObject_IsTrue(value);
1559 param = PyC_Long_AsI32(value);
1567 PyErr_Format(PyExc_TypeError,
1568 "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s",
1572 Py_TYPE(value)->tp_name);
1577 *((
bool *)
data) = param;
1587 const long param = PyLong_AsLongAndOverflow(value, &overflow);
1588 if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
1589 PyErr_Format(PyExc_ValueError,
1590 "%.200s %.200s.%.200s value not in 'int' range "
1597 if (param == -1 && PyErr_Occurred()) {
1598 PyErr_Format(PyExc_TypeError,
1599 "%.200s %.200s.%.200s expected an int type, not %.200s",
1603 Py_TYPE(value)->tp_name);
1607 int param_i = (int)param;
1610 *((
int *)
data) = param_i;
1619 const float param = PyFloat_AsDouble(value);
1620 if (PyErr_Occurred()) {
1621 PyErr_Format(PyExc_TypeError,
1622 "%.200s %.200s.%.200s expected a float type, not %.200s",
1626 Py_TYPE(value)->tp_name);
1632 *((
float *)
data) = param;
1644 if (value == Py_None) {
1660 "%.200s %.200s.%.200s doesn't support None from string types",
1671 param = PyBytes_AsString(value);
1673 if (param ==
NULL) {
1674 if (PyBytes_Check(value)) {
1679 "%.200s %.200s.%.200s error assigning bytes",
1685 PyErr_Format(PyExc_TypeError,
1686 "%.200s %.200s.%.200s expected a bytes type, not %.200s",
1690 Py_TYPE(value)->tp_name);
1701 *((
char **)
data) = (
char *)param;
1710 #ifdef USE_STRING_COERCE
1711 PyObject *value_coerce =
NULL;
1717 param = PyUnicode_AsUTF8(value);
1720 param = PyUnicode_AsUTF8(value);
1723 if (param ==
NULL) {
1724 if (PyUnicode_Check(value)) {
1729 "%.200s %.200s.%.200s error assigning string",
1735 PyErr_Format(PyExc_TypeError,
1736 "%.200s %.200s.%.200s expected a string type, not %.200s",
1740 Py_TYPE(value)->tp_name);
1754 *((
char **)
data) = (
char *)param;
1761 #ifdef USE_STRING_COERCE
1762 Py_XDECREF(value_coerce);
1785 *((
int *)
data) = val;
1794 PyObject *value_new =
NULL;
1816 if (
ELEM(base_type, &RNA_Operator, &RNA_Gizmo)) {
1824 if (PyDict_Check(value)) {
1826 if (base_type == &RNA_OperatorProperties) {
1830 if (base_type == &RNA_GizmoProperties) {
1845 PyErr_Format(PyExc_TypeError,
1846 "%.200s %.200s.%.200s collection has no type, "
1847 "can't be used as a %.200s type",
1857 if (value == Py_None) {
1859 PyErr_Format(PyExc_TypeError,
1860 "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type",
1865 Py_XDECREF(value_new);
1872 PyErr_Format(PyExc_TypeError,
1873 "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
1878 Py_TYPE(value)->tp_name);
1879 Py_XDECREF(value_new);
1885 if (value_owner_id !=
NULL) {
1887 PyErr_Format(PyExc_TypeError,
1888 "%.200s %.200s.%.200s ID type does not support assignment to itself",
1892 Py_XDECREF(value_new);
1898 if (
ptr->
type != &RNA_Function) {
1899 PyErr_Format(PyExc_TypeError,
1900 "%.200s %.200s.%.200s ID type assignment is temporary, can't assign",
1904 Py_XDECREF(value_new);
1911 bool raise_error =
false;
1916 if (param ==
NULL) {
1931 if (param ==
NULL) {
1942 else if (param ==
NULL) {
1961 Py_XDECREF(value_new);
1977 PyErr_Format(PyExc_TypeError,
1978 "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
1985 Py_XDECREF(value_new);
1989 Py_XDECREF(value_new);
1994 Py_ssize_t seq_len, i;
2003 if (!PySequence_Check(value)) {
2006 "%.200s %.200s.%.200s expected a sequence for an RNA collection, not %.200s",
2010 Py_TYPE(value)->tp_name);
2014 seq_len = PySequence_Size(value);
2015 for (i = 0; i < seq_len; i++) {
2016 item = PySequence_GetItem(value, i);
2021 "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection",
2030 if (PyDict_Check(item) == 0) {
2031 PyErr_Format(PyExc_TypeError,
2032 "%.200s %.200s.%.200s expected a each sequence "
2033 "member to be a dict for an RNA collection, not %.200s",
2037 Py_TYPE(item)->tp_name);
2044 link->
ptr = itemptr;
2052 &itemptr, item,
true,
"Converting a Python list to an RNA collection") == -1) {
2054 const char *msg_char = PyUnicode_AsUTF8(msg);
2057 PyErr_Format(PyExc_TypeError,
2058 "%.200s %.200s.%.200s error converting a member of a collection "
2059 "from a dicts into an RNA collection, failed with: %s",
2075 PyErr_Format(PyExc_AttributeError,
2076 "%.200s %.200s.%.200s unknown property type (pyrna_py_to_prop)",
2109 &
self->ptr,
self->prop,
self->arraydim,
self->arrayoffset, index, value,
"") == -1) {
2130 int param = PyC_Long_AsI32(value);
2131 if (param == -1 && PyErr_Occurred()) {
2132 PyErr_SetString(PyExc_TypeError,
"expected an int type");
2142 float param = PyFloat_AsDouble(value);
2143 if (PyErr_Occurred()) {
2144 PyErr_SetString(PyExc_TypeError,
"expected a float type");
2154 PyErr_SetString(PyExc_AttributeError,
"not an array type");
2206 #define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \
2208 keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \
2209 if (keynum_abs < 0) { \
2210 PyErr_Format(PyExc_IndexError, "bpy_prop_collection[%d]: out of range.", keynum); \
2221 if (value != Py_None) {
2227 PyErr_Format(PyExc_TypeError,
2228 "'%.200s' object is not subscriptable (only iteration is supported)",
2229 Py_TYPE(value)->tp_name);
2240 Py_ssize_t keynum_abs = keynum;
2253 const int key = (int)keynum_abs;
2278 if (keynum_abs >=
len) {
2279 PyErr_Format(PyExc_IndexError,
2280 "bpy_prop_collection[index]: "
2281 "index %d out of range, size %d",
2286 PyErr_Format(PyExc_RuntimeError,
2287 "bpy_prop_collection[index]: internal error, "
2288 "valid index %d given in %d sized collection, but value not found",
2301 Py_ssize_t keynum_abs = keynum;
2310 if (keynum_abs >=
len) {
2311 PyErr_Format(PyExc_IndexError,
2312 "bpy_prop_collection[index] = value: "
2313 "index %d out of range, size %d",
2319 PyErr_Format(PyExc_IndexError,
2320 "bpy_prop_collection[index] = value: "
2321 "failed assignment (unknown reason)",
2342 if (keynum >= 0 && keynum <
len) {
2346 PyErr_Format(PyExc_IndexError,
"bpy_prop_array[index]: index %d out of range", keynum);
2363 const int keylen = strlen(keyname);
2373 &iter.
ptr, nameprop, name,
sizeof(name), &namelen);
2374 if ((keylen == namelen) &&
STREQ(nameptr, keyname)) {
2377 if ((
char *)&name != nameptr) {
2397 PyErr_Format(PyExc_KeyError,
"bpy_prop_collection[key]: key \"%.200s\" not found", keyname);
2415 const char *err_prefix,
2416 const short err_not_found,
2419 const char *keyname;
2422 if (PyTuple_GET_SIZE(key) != 2) {
2423 PyErr_Format(PyExc_KeyError,
2424 "%s: tuple key must be a pair, not size %d",
2426 PyTuple_GET_SIZE(key));
2429 if (
self->ptr.type != &RNA_BlendData) {
2430 PyErr_Format(PyExc_KeyError,
2431 "%s: is only valid for bpy.data collections, not %.200s",
2436 if ((keyname = PyUnicode_AsUTF8(PyTuple_GET_ITEM(key, 0))) ==
NULL) {
2437 PyErr_Format(PyExc_KeyError,
2438 "%s: id must be a string, not %.200s",
2440 Py_TYPE(PyTuple_GET_ITEM(key, 0))->tp_name);
2444 PyObject *keylib = PyTuple_GET_ITEM(key, 1);
2448 if (keylib == Py_None) {
2451 else if (PyUnicode_Check(keylib)) {
2452 Main *bmain =
self->ptr.data;
2453 const char *keylib_str = PyUnicode_AsUTF8(keylib);
2456 if (err_not_found) {
2457 PyErr_Format(PyExc_KeyError,
2458 "%s: lib filepath '%.1024s' "
2459 "does not reference a valid library",
2469 PyErr_Format(PyExc_KeyError,
2470 "%s: lib must be a string or None, not %.200s",
2472 Py_TYPE(keylib)->tp_name);
2480 ID *
id = itemptr.data;
2492 if ((found ==
false) && err_not_found) {
2494 PyErr_SetString(PyExc_KeyError,
"bpy_prop_collection[key, lib]: not found");
2503 const char *err_prefix,
2504 const bool err_not_found)
2508 self, key, err_prefix, err_not_found, &
ptr);
2529 list = PyList_New(0);
2538 PyList_APPEND(list, item);
2541 if (
count == stop) {
2569 tuple = PyTuple_New(stop - start);
2584 values = PyMem_MALLOC(
sizeof(
float) *
length);
2587 values = values_stack;
2592 PyTuple_SET_ITEM(tuple,
count - start, PyFloat_FromDouble(values[
count]));
2595 if (values != values_stack) {
2604 values = PyMem_MALLOC(
sizeof(
bool) *
length);
2607 values = values_stack;
2612 PyTuple_SET_ITEM(tuple,
count - start, PyBool_FromLong(values[
count]));
2615 if (values != values_stack) {
2624 values = PyMem_MALLOC(
sizeof(
int) *
length);
2627 values = values_stack;
2632 PyTuple_SET_ITEM(tuple,
count - start, PyLong_FromLong(values[
count]));
2635 if (values != values_stack) {
2643 PyErr_SetString(PyExc_TypeError,
"not an array type");
2656 if (PyUnicode_Check(key)) {
2659 if (PyIndex_Check(key)) {
2660 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2661 if (i == -1 && PyErr_Occurred()) {
2667 if (PySlice_Check(key)) {
2668 PySliceObject *key_slice = (PySliceObject *)key;
2669 Py_ssize_t step = 1;
2671 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2675 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection[slice]: slice steps not supported");
2678 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2682 Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
2685 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
2688 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
2692 if (start < 0 || stop < 0) {
2705 if (stop - start <= 0) {
2706 return PyList_New(0);
2711 if (PyTuple_Check(key)) {
2714 self, key,
"bpy_prop_collection[id, lib]",
true);
2717 PyErr_Format(PyExc_TypeError,
2718 "bpy_prop_collection[key]: invalid key, "
2719 "must be a string or an int, not %.200s",
2720 Py_TYPE(key)->tp_name);
2730 if (value == Py_None) {
2732 PyErr_Format(PyExc_TypeError,
2733 "bpy_prop_collection[key] = value: invalid, "
2734 "this collection doesn't support None assignment");
2741 PyErr_Format(PyExc_TypeError,
2742 "bpy_prop_collection[key] = value: invalid, "
2743 "expected a StructRNA type or None, not a %.200s",
2744 Py_TYPE(value)->tp_name);
2750 PyErr_Format(PyExc_TypeError,
2751 "bpy_prop_collection[key] = value: invalid, "
2752 "expected a '%.200s' type or None, not a '%.200s'",
2761 PyErr_Format(PyExc_TypeError,
2762 "bpy_prop_collection[key] = value: internal error, "
2763 "failed to get the collection type");
2776 if (value ==
NULL) {
2777 PyErr_SetString(PyExc_TypeError,
"del bpy_prop_collection[key]: not supported");
2785 if (PyUnicode_Check(key)) {
2790 if (PyIndex_Check(key)) {
2791 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2792 if (i == -1 && PyErr_Occurred()) {
2799 else if (PySlice_Check(key)) {
2800 PySliceObject *key_slice = (PySliceObject *)key;
2801 Py_ssize_t step = 1;
2803 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2806 else if (step != 1) {
2807 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection[slice]: slice steps not supported");
2810 else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2814 Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
2817 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
2820 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
2824 if (start < 0 || stop < 0) {
2837 if (stop - start <= 0) {
2838 return PyList_New(0);
2847 PyErr_Format(PyExc_TypeError,
2848 "bpy_prop_collection[key]: invalid key, "
2849 "must be a string or an int, not %.200s",
2850 Py_TYPE(key)->tp_name);
2859 if (PyUnicode_Check(key)) {
2860 return pyrna_prop_array_subscript_str(
self, PyUnicode_AsUTF8(key));
2864 if (PyIndex_Check(key)) {
2865 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2866 if (i == -1 && PyErr_Occurred()) {
2871 if (PySlice_Check(key)) {
2872 Py_ssize_t step = 1;
2873 PySliceObject *key_slice = (PySliceObject *)key;
2875 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2879 PyErr_SetString(PyExc_TypeError,
"bpy_prop_array[slice]: slice steps not supported");
2882 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2890 Py_ssize_t start, stop, slicelength;
2892 if (PySlice_GetIndicesEx(key,
len, &start, &stop, &step, &slicelength) < 0) {
2896 if (slicelength <= 0) {
2897 return PyTuple_New(0);
2903 PyErr_SetString(PyExc_AttributeError,
"bpy_prop_array[key]: invalid key, key must be an int");
2913 PyObject *value_fast;
2914 if (!(value_fast = PySequence_Fast(value,
2915 "bpy_prop_array[slice] = value: "
2916 "element in assignment is not a sequence type"))) {
2919 if (PySequence_Fast_GET_SIZE(value_fast) !=
length) {
2920 Py_DECREF(value_fast);
2921 PyErr_SetString(PyExc_ValueError,
2922 "bpy_prop_array[slice] = value: "
2923 "re-sizing bpy_struct element in arrays isn't supported");
2932 PyObject **value_items,
float *value,
int totdim,
const int dimsize[],
const float range[2])
2934 const int length = dimsize[0];
2938 for (i = 0; i !=
length; i++) {
2945 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1], range);
2947 Py_DECREF(subvalue);
2953 const float min = range[0],
max = range[1];
2955 for (i = 0; i !=
length; i++) {
2956 float v = PyFloat_AsDouble(value_items[i]);
2964 PyObject **value_items,
int *value,
int totdim,
const int dimsize[],
const int range[2])
2966 const int length = dimsize[0];
2970 for (i = 0; i !=
length; i++) {
2977 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1], range);
2979 Py_DECREF(subvalue);
2985 const int min = range[0],
max = range[1];
2987 for (i = 0; i !=
length; i++) {
2988 int v = PyLong_AsLong(value_items[i]);
2998 const int dimsize[])
3000 const int length = dimsize[0];
3004 for (i = 0; i !=
length; i++) {
3011 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1]);
3013 Py_DECREF(subvalue);
3020 for (i = 0; i !=
length; i++) {
3021 const int v = PyLong_AsLong(value_items[i]);
3035 PyObject *value_orig)
3039 void *values_alloc =
NULL;
3042 if (value_orig ==
NULL) {
3045 "bpy_prop_array[slice] = value: deleting with list types is not supported by bpy_struct");
3049 if (!(value = PySequence_Fast(
3050 value_orig,
"bpy_prop_array[slice] = value: assignment is not a sequence type"))) {
3054 if (PySequence_Fast_GET_SIZE(value) != stop - start) {
3056 PyErr_SetString(PyExc_TypeError,
3057 "bpy_prop_array[slice] = value: re-sizing bpy_struct arrays isn't supported");
3069 for (
int i = arraydim + 1; i < totdim; i++) {
3074 PyObject **value_items = PySequence_Fast_ITEMS(value);
3079 (values_alloc = PyMem_MALLOC(
sizeof(*values) * length_flat)) :
3081 if (start != 0 || stop !=
length) {
3089 dimsize[arraydim] = stop - start;
3091 &values[arrayoffset + (start * span)],
3096 if (PyErr_Occurred()) {
3107 (values_alloc = PyMem_MALLOC(
sizeof(*values) * length_flat)) :
3109 if (start != 0 || stop !=
length) {
3117 dimsize[arraydim] = stop - start;
3119 &values[arrayoffset + (start * span)],
3124 if (PyErr_Occurred()) {
3135 (values_alloc = PyMem_MALLOC(
sizeof(
bool) * length_flat)) :
3138 if (start != 0 || stop !=
length) {
3143 dimsize[arraydim] = stop - start;
3145 &values[arrayoffset + (start * span)],
3147 &dimsize[arraydim]);
3149 if (PyErr_Occurred()) {
3158 PyErr_SetString(PyExc_TypeError,
"not an array type");
3166 PyMem_FREE(values_alloc);
3184 if (keynum >= 0 && keynum <
len) {
3188 PyErr_SetString(PyExc_IndexError,
"bpy_prop_array[index] = value: index out of range");
3202 PyErr_Format(PyExc_AttributeError,
3203 "bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only",
3209 else if (PyIndex_Check(key)) {
3210 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
3211 if (i == -1 && PyErr_Occurred()) {
3218 else if (PySlice_Check(key)) {
3220 Py_ssize_t start, stop, step, slicelength;
3222 if (PySlice_GetIndicesEx(key,
len, &start, &stop, &step, &slicelength) < 0) {
3225 else if (slicelength <= 0) {
3228 else if (step == 1) {
3233 PyErr_SetString(PyExc_TypeError,
"slice steps not supported with RNA");
3238 PyErr_SetString(PyExc_AttributeError,
"invalid key, key must be an int");
3299 if (PyTuple_Check(key)) {
3302 self, key,
"(id, lib) in bpy_prop_collection",
false,
NULL);
3306 const char *keyname = PyUnicode_AsUTF8(key);
3308 if (keyname ==
NULL) {
3309 PyErr_SetString(PyExc_TypeError,
3310 "bpy_prop_collection.__contains__: expected a string or a tuple of strings");
3323 const char *name = PyUnicode_AsUTF8(value);
3328 PyErr_SetString(PyExc_TypeError,
"bpy_struct.__contains__: expected a string");
3333 PyErr_SetString(PyExc_TypeError,
"bpy_struct: this type doesn't support IDProperties");
3392 const char *name = PyUnicode_AsUTF8(key);
3397 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
3402 PyErr_SetString(PyExc_TypeError,
3403 "bpy_struct[key]: only strings are allowed as keys of ID properties");
3409 if (group ==
NULL) {
3410 PyErr_Format(PyExc_KeyError,
"bpy_struct[key]: key \"%s\" not found", name);
3416 if (idprop ==
NULL) {
3417 PyErr_Format(PyExc_KeyError,
"bpy_struct[key]: key \"%s\" not found", name);
3430 #ifdef USE_PEDANTIC_WRITE
3436 if (group ==
NULL) {
3437 PyErr_SetString(PyExc_TypeError,
3438 "bpy_struct[key] = val: id properties not supported for this type");
3449 "bpy_struct[key] = val: datablock id properties not supported for this type");
3465 ".. method:: keys()\n"
3467 " Returns the keys of this objects custom properties (matches Python's\n"
3468 " dictionary function of the same name).\n"
3470 " :return: custom property keys.\n"
3471 " :rtype: :class:`idprop.type.IDPropertyGroupViewKeys`\n"
3476 PyErr_SetString(PyExc_TypeError,
"bpy_struct.keys(): this type doesn't support IDProperties");
3486 ".. method:: items()\n"
3488 " Returns the items of this objects custom properties (matches Python's\n"
3489 " dictionary function of the same name).\n"
3491 " :return: custom property key, value pairs.\n"
3492 " :rtype: :class:`idprop.type.IDPropertyGroupViewItems`\n"
3497 PyErr_SetString(PyExc_TypeError,
"bpy_struct.items(): this type doesn't support IDProperties");
3507 ".. method:: values()\n"
3509 " Returns the values of this objects custom properties (matches Python's\n"
3510 " dictionary function of the same name).\n"
3512 " :return: custom property values.\n"
3513 " :rtype: :class:`idprop.type.IDPropertyGroupViewValues`\n"
3518 PyErr_SetString(PyExc_TypeError,
3519 "bpy_struct.values(): this type doesn't support IDProperties");
3529 ".. method:: is_property_set(property, ghost=True)\n"
3531 " Check if a property is set, use for testing operator properties.\n"
3533 " :arg ghost: Used for operators that re-run with previous settings.\n"
3534 " In this case the property is not marked as set,\n"
3535 " yet the value from the previous execution is used.\n"
3537 " In rare cases you may want to set this option to false.\n"
3539 " :type ghost: boolean\n"
3540 " :return: True when the property has been set.\n"
3541 " :rtype: boolean\n");
3546 bool use_ghost =
true;
3550 static const char *_keywords[] = {
"",
"ghost",
NULL};
3551 static _PyArg_Parser _parser = {
3559 if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &name,
PyC_ParseBool, &use_ghost)) {
3564 PyErr_Format(PyExc_TypeError,
3565 "%.200s.is_property_set(\"%.200s\") not found",
3575 ".. method:: property_unset(property)\n"
3577 " Unset a property, will use default value afterward.\n");
3585 if (!PyArg_ParseTuple(args,
"s:property_unset", &name)) {
3590 PyErr_Format(PyExc_TypeError,
3591 "%.200s.property_unset(\"%.200s\") not found",
3603 ".. method:: is_property_hidden(property)\n"
3605 " Check if a property is hidden.\n"
3607 " :return: True when the property is hidden.\n"
3608 " :rtype: boolean\n");
3616 if (!PyArg_ParseTuple(args,
"s:is_property_hidden", &name)) {
3621 PyErr_Format(PyExc_TypeError,
3622 "%.200s.is_property_hidden(\"%.200s\") not found",
3632 ".. method:: is_property_readonly(property)\n"
3634 " Check if a property is readonly.\n"
3636 " :return: True when the property is readonly (not writable).\n"
3637 " :rtype: boolean\n");
3645 if (!PyArg_ParseTuple(args,
"s:is_property_readonly", &name)) {
3650 PyErr_Format(PyExc_TypeError,
3651 "%.200s.is_property_readonly(\"%.200s\") not found",
3661 ".. method:: is_property_overridable_library(property)\n"
3663 " Check if a property is overridable.\n"
3665 " :return: True when the property is overridable.\n"
3666 " :rtype: boolean\n");
3674 if (!PyArg_ParseTuple(args,
"s:is_property_overridable_library", &name)) {
3679 PyErr_Format(PyExc_TypeError,
3680 "%.200s.is_property_overridable_library(\"%.200s\") not found",
3690 ".. method:: property_overridable_library_set(property, overridable)\n"
3692 " Define a property as overridable or not (only for custom properties!).\n"
3694 " :return: True when the overridable status of the property was successfully set.\n"
3695 " :rtype: boolean\n");
3704 if (!PyArg_ParseTuple(args,
"sp:property_overridable_library_set", &name, &is_overridable)) {
3709 PyErr_Format(PyExc_TypeError,
3710 "%.200s.property_overridable_library_set(\"%.200s\") not found",
3716 return PyBool_FromLong(
3721 ".. method:: path_resolve(path, coerce=True)\n"
3723 " Returns the property from the path, raise an exception when not found.\n"
3725 " :arg path: path which this property resolves.\n"
3726 " :type path: string\n"
3727 " :arg coerce: optional argument, when True, the property will be converted\n"
3728 " into its Python representation.\n"
3729 " :type coerce: boolean\n");
3733 PyObject *coerce = Py_True;
3740 if (!PyArg_ParseTuple(args,
"s|O!:path_resolve", &path, &PyBool_Type, &coerce)) {
3748 PyErr_Format(PyExc_IndexError,
3749 "%.200s.path_resolve(\"%.200s\") index out of range",
3758 if (coerce == Py_False) {
3768 PyErr_Format(PyExc_ValueError,
3769 "%.200s.path_resolve(\"%.200s\") could not be resolved",
3776 ".. method:: path_from_id(property=\"\")\n"
3778 " Returns the data path from the ID to this object (string).\n"
3780 " :arg property: Optional property name which can be used if the path is\n"
3781 " to a property of this object.\n"
3782 " :type property: string\n"
3783 " :return: The path from :class:`bpy.types.bpy_struct.id_data`\n"
3784 " to this struct and property (when given).\n"
3788 const char *name =
NULL;
3795 if (!PyArg_ParseTuple(args,
"|s:path_from_id", &name)) {
3802 PyErr_Format(PyExc_AttributeError,
3803 "%.200s.path_from_id(\"%.200s\") not found",
3817 PyErr_Format(PyExc_ValueError,
3818 "%.200s.path_from_id(\"%s\") found, but does not support path creation",
3823 PyErr_Format(PyExc_ValueError,
3824 "%.200s.path_from_id() does not support path creation for this type",
3830 ret = PyUnicode_FromString(path);
3837 ".. method:: path_from_id()\n"
3839 " Returns the data path from the ID to this property (string).\n"
3841 " :return: The path from :class:`bpy.types.bpy_struct.id_data` to this property.\n"
3852 PyErr_Format(PyExc_ValueError,
3853 "%.200s.%.200s.path_from_id() does not support path creation for this type",
3859 ret = PyUnicode_FromString(path);
3866 ".. method:: as_bytes()\n"
3868 " Returns this string property as a byte rather than a Python string.\n"
3870 " :return: The string as bytes.\n"
3871 " :rtype: bytes\n");
3876 PyErr_Format(PyExc_TypeError,
3877 "%.200s.%.200s.as_bytes() must be a string",
3884 char buf_fixed[256], *buf;
3888 &
self->ptr,
self->prop, buf_fixed,
sizeof(buf_fixed), &buf_len);
3890 ret = PyBytes_FromStringAndSize(buf, buf_len);
3892 if (buf_fixed != buf) {
3900 ".. method:: update()\n"
3902 " Execute the properties update callback.\n"
3905 " This is called when assigning a property,\n"
3906 " however in rare cases it's useful to call explicitly.\n");
3914 ".. method:: type_recast()\n"
3916 " Return a new instance, this is needed because types\n"
3917 " such as textures can be changed at runtime.\n"
3919 " :return: a new instance of this object with the type initialized again.\n"
3920 " :rtype: subclass of :class:`bpy.types.bpy_struct`\n");
3936 PyObject *ret_test =
NULL;
3937 PyObject *subclasses = ((PyTypeObject *)cls)->tp_subclasses;
3942 PyObject *key =
NULL;
3944 PyObject *value =
NULL;
3945 while (PyDict_Next(subclasses, &
pos, &key, &value)) {
3947 PyObject *subcls = PyWeakref_GET_OBJECT(value);
3948 if (subcls != Py_None) {
3969 ".. classmethod:: bl_rna_get_subclass_py(id, default=None)\n"
3971 " :arg id: The RNA type identifier.\n"
3972 " :type id: string\n"
3973 " :return: The class or default when not found.\n"
3978 PyObject *ret_default = Py_None;
3980 if (!PyArg_ParseTuple(args,
"s|O:bl_rna_get_subclass_py", &
id, &ret_default)) {
3987 return Py_INCREF_RET(
ret);
3991 ".. classmethod:: bl_rna_get_subclass(id, default=None)\n"
3993 " :arg id: The RNA type identifier.\n"
3994 " :type id: string\n"
3995 " :return: The RNA type or default when not found.\n"
3996 " :rtype: :class:`bpy.types.Struct` subclass\n");
4000 PyObject *ret_default = Py_None;
4002 if (!PyArg_ParseTuple(args,
"s|O:bl_rna_get_subclass", &
id, &ret_default)) {
4008 if (py_srna ==
NULL) {
4009 PyErr_SetString(PyExc_ValueError,
"Not a registered class");
4015 if (srna_base == &RNA_Node) {
4029 return Py_INCREF_RET(ret_default);
4036 list_tmp = PyDict_Keys(dict);
4037 PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
4038 Py_DECREF(list_tmp);
4044 PyObject **dict_ptr;
4046 dict_ptr = _PyObject_GetDictPtr((PyObject *)
self);
4048 if (dict_ptr && (dict = *dict_ptr)) {
4052 dict = ((PyTypeObject *)Py_TYPE(
self))->tp_dict;
4065 dict = ((PyTypeObject *)cls)->tp_dict;
4089 PyList_APPEND(list, PyUnicode_FromString(idname));
4099 char name[256], *nameptr;
4112 PyList_APPEND(list, PyUnicode_FromStringAndSize(nameptr, namelen));
4114 if (name != nameptr) {
4131 ret = PyList_New(0);
4139 if (
self->ptr.type == &RNA_Context) {
4143 for (link = lb.
first; link; link = link->
next) {
4144 PyList_APPEND(
ret, PyUnicode_FromString(link->
data));
4154 PyObject *set = PySet_New(
ret);
4157 ret = PySequence_List(set);
4165 ".. method:: id_properties_ensure()\n\n"
4166 " :return: the parent group for an RNA struct's custom IDProperties.\n"
4167 " :rtype: :class:`bpy.types.IDPropertyGroup`\n");
4173 PyErr_SetString(PyExc_TypeError,
"This type doesn't support IDProperties");
4181 if (idprops ==
NULL) {
4186 group->
owner_id =
self->ptr.owner_id;
4187 group->
prop = idprops;
4189 return (PyObject *)group;
4193 ".. method:: id_properties_ui(key)\n"
4195 " :return: Return an object used to manage an IDProperty's UI data.\n"
4196 " :arg key: String name of the property.\n"
4197 " :rtype: :class:`bpy.types.IDPropertyUIManager`\n");
4203 PyErr_SetString(PyExc_TypeError,
"This type doesn't support IDProperties");
4208 if (!PyArg_ParseTuple(args,
"s:ui_data", &key)) {
4216 if (parent_group ==
NULL) {
4221 if (property ==
NULL) {
4222 PyErr_SetString(PyExc_KeyError,
"Property not found in IDProperty group");
4227 PyErr_Format(PyExc_TypeError,
"IDProperty \"%s\" does not support UI data", property->name);
4234 return (PyObject *)ui_manager;
4238 ".. method:: id_properties_clear()\n\n"
4239 " :return: Remove the parent group for an RNA struct's custom IDProperties.\n");
4245 PyErr_SetString(PyExc_TypeError,
"This type doesn't support IDProperties");
4262 const char *name = PyUnicode_AsUTF8(pyname);
4270 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: __getattr__ must be a string");
4277 if (
STR_ELEM(name,
"__getitem__",
"__setitem__") &&
4279 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: no __getitem__ support for this type");
4283 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4293 else if (
self->ptr.type == &RNA_Context) {
4296 PyErr_Format(PyExc_AttributeError,
4297 "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context",
4332 ret = PyList_New(0);
4334 for (link = newlb.
first; link; link = link->
next) {
4343 PyErr_Format(PyExc_AttributeError,
4344 "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
4357 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4365 PyErr_Format(PyExc_AttributeError,
"bpy_struct: attribute \"%.200s\" not found", name);
4375 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4382 static int pyrna_struct_pydict_contains(PyObject *
self, PyObject *pyname)
4384 PyObject *dict = *(_PyObject_GetDictPtr((PyObject *)
self));
4389 return PyDict_Contains(dict, pyname);
4396 static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr)
4398 PyObject *
ret = PyType_Type.tp_getattro(cls, attr);
4432 const char *attr_str = PyUnicode_AsUTF8(attr);
4436 PyErr_Format(PyExc_AttributeError,
4437 "pyrna_struct_meta_idprop_setattro() "
4438 "can't set in readonly state '%.200s.%S'",
4439 ((PyTypeObject *)cls)->tp_name,
4447 if (value && is_deferred_prop) {
4448 PyErr_Format(PyExc_AttributeError,
4449 "pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'",
4450 ((PyTypeObject *)cls)->tp_name);
4456 return PyType_Type.tp_setattro(cls, attr, value);
4461 if (is_deferred_prop) {
4482 PyExc_TypeError,
"struct_meta_idprop.detattr(): '%s' not a dynamic property", attr_str);
4488 return PyType_Type.tp_setattro(cls, attr, value);
4493 const char *name = PyUnicode_AsUTF8(pyname);
4498 #ifdef USE_PEDANTIC_WRITE
4505 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: __setattr__ must be a string");
4510 PyErr_Format(PyExc_AttributeError,
4511 "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only",
4517 else if (
self->ptr.type == &RNA_Context) {
4522 PyErr_Format(PyExc_AttributeError,
4523 "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context",
4536 PyExc_AttributeError,
"bpy_struct: Context property \"%.200s\" is read-only", name);
4546 if (value ==
NULL) {
4547 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: del not supported");
4553 return PyObject_GenericSetAttr((PyObject *)
self, pyname, value);
4563 ret = PyList_New(0);
4580 return PyObject_GenericGetAttr((PyObject *)
self, pyname);
4585 const char *name = PyUnicode_AsUTF8(pyname);
4588 PyErr_SetString(PyExc_AttributeError,
"bpy_prop_collection: __getattr__ must be a string");
4591 if (name[0] !=
'_') {
4606 Py_DECREF(self_collection);
4614 return PyObject_GenericGetAttr((PyObject *)
self, pyname);
4621 PyObject *
ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4623 if (
ret ==
NULL && name[0] !=
'_') {
4629 PyObject *error_type, *error_value, *error_traceback;
4630 PyErr_Fetch(&error_type, &error_value, &error_traceback);
4633 ret = PyObject_GenericGetAttr(cls, pyname);
4638 PyErr_Restore(error_type, error_value, error_traceback);
4641 if (Py_TYPE(
ret) == &PyMethodDescr_Type) {
4642 PyMethodDef *m = ((PyMethodDescrObject *)
ret)->d_method;
4644 if (m->ml_flags & METH_STATIC) {
4649 ret = PyCMethod_New(m, (PyObject *)
self,
NULL,
NULL);
4664 const char *name = PyUnicode_AsUTF8(pyname);
4668 #ifdef USE_PEDANTIC_WRITE
4675 PyErr_SetString(PyExc_AttributeError,
"bpy_prop: __setattr__ must be a string");
4678 if (value ==
NULL) {
4679 PyErr_SetString(PyExc_AttributeError,
"bpy_prop: del not supported");
4689 PyErr_Format(PyExc_AttributeError,
"bpy_prop_collection: attribute \"%.200s\" not found", name);
4700 #ifdef USE_PEDANTIC_WRITE
4708 PyErr_SetString(PyExc_TypeError,
4709 "bpy_prop_collection.add(): not supported for this collection");
4718 const int key = PyLong_AsLong(value);
4720 #ifdef USE_PEDANTIC_WRITE
4726 if (key == -1 && PyErr_Occurred()) {
4727 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection.remove(): expected one int argument");
4732 PyErr_SetString(PyExc_TypeError,
4733 "bpy_prop_collection.remove() not supported for this collection");
4742 #ifdef USE_PEDANTIC_WRITE
4755 int key = 0,
pos = 0;
4757 #ifdef USE_PEDANTIC_WRITE
4763 if (!PyArg_ParseTuple(args,
"ii", &key, &
pos)) {
4764 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection.move(): expected two ints as arguments");
4769 PyErr_SetString(PyExc_TypeError,
4770 "bpy_prop_collection.move() not supported for this collection");
4778 "The :class:`bpy.types.ID` object this datablock is from or None, (not available for "
4783 if (
self->ptr.owner_id) {
4793 "The data this property is using, *type* :class:`bpy.types.bpy_struct`");
4799 PyDoc_STRVAR(pyrna_struct_get_rna_type_doc,
"The property type for introspection");
4815 pyrna_struct_get_id_data_doc,
4821 pyrna_struct_get_rna_type_doc,
4830 pyrna_struct_get_id_data_doc,
4843 ".. method:: keys()\n"
4845 " Return the identifiers of collection members\n"
4846 " (matching Python's dict.keys() functionality).\n"
4848 " :return: the identifiers for each member of this collection.\n"
4849 " :rtype: list of strings\n");
4852 PyObject *
ret = PyList_New(0);
4853 char name[256], *nameptr;
4860 PyList_APPEND(
ret, PyUnicode_FromStringAndSize(nameptr, namelen));
4862 if (name != nameptr) {
4873 ".. method:: items()\n"
4875 " Return the identifiers of collection members\n"
4876 " (matching Python's dict.items() functionality).\n"
4878 " :return: (key, value) pairs for each member of this collection.\n"
4879 " :rtype: list of tuples\n");
4882 PyObject *
ret = PyList_New(0);
4884 char name[256], *nameptr;
4891 item = PyTuple_New(2);
4894 PyTuple_SET_ITEM(item, 0, PyUnicode_FromStringAndSize(nameptr, namelen));
4895 if (name != nameptr) {
4901 PyTuple_SET_ITEM(item, 0, PyLong_FromLong(i));
4905 PyList_APPEND(
ret, item);
4916 ".. method:: values()\n"
4918 " Return the values of collection\n"
4919 " (matching Python's dict.values() functionality).\n"
4921 " :return: the members of this collection.\n"
4930 ".. method:: get(key, default=None)\n"
4932 " Returns the value of the custom property assigned to key or default\n"
4933 " when not found (matches Python's dictionary function of the same name).\n"
4935 " :arg key: The key associated with the custom property.\n"
4936 " :type key: string\n"
4937 " :arg default: Optional argument for the value to return if\n"
4938 " *key* is not found.\n"
4939 " :type default: Undefined\n"
4946 PyObject *def = Py_None;
4950 if (!PyArg_ParseTuple(args,
"s|O:get", &key, &def)) {
4956 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
4969 return Py_INCREF_RET(def);
4973 ".. method:: pop(key, default=None)\n"
4975 " Remove and return the value of the custom property assigned to key or default\n"
4976 " when not found (matches Python's dictionary function of the same name).\n"
4978 " :arg key: The key associated with the custom property.\n"
4979 " :type key: string\n"
4980 " :arg default: Optional argument for the value to return if\n"
4981 " *key* is not found.\n"
4982 " :type default: Undefined\n"
4989 PyObject *def =
NULL;
4993 if (!PyArg_ParseTuple(args,
"s|O:get", &key, &def)) {
4999 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
5020 PyErr_SetString(PyExc_KeyError,
"key not found");
5023 return Py_INCREF_RET(def);
5027 ".. method:: as_pointer()\n"
5029 " Returns the memory address which holds a pointer to Blender's internal data\n"
5031 " :return: int (memory address).\n"
5034 " .. note:: This is intended only for advanced script writers who need to\n"
5035 " pass blender data to their own C/Python modules.\n");
5038 return PyLong_FromVoidPtr(
self->ptr.data);
5042 ".. method:: get(key, default=None)\n"
5044 " Returns the value of the item assigned to key or default when not found\n"
5045 " (matches Python's dictionary function of the same name).\n"
5047 " :arg key: The identifier for the collection member.\n"
5048 " :type key: string\n"
5049 " :arg default: Optional argument for the value to return if\n"
5050 " *key* is not found.\n"
5051 " :type default: Undefined\n");
5057 PyObject *def = Py_None;
5061 if (!PyArg_ParseTuple(args,
"O|O:get", &key_ob, &def)) {
5065 if (PyUnicode_Check(key_ob)) {
5066 const char *key = PyUnicode_AsUTF8(key_ob);
5072 else if (PyTuple_Check(key_ob)) {
5074 self, key_ob,
"bpy_prop_collection.get((id, lib))",
false);
5080 PyErr_Format(PyExc_KeyError,
5081 "bpy_prop_collection.get(key, ...): key must be a string or tuple, not %.200s",
5082 Py_TYPE(key_ob)->tp_name);
5085 return Py_INCREF_RET(def);
5089 ".. method:: find(key)\n"
5091 " Returns the index of a key in a collection or -1 when not found\n"
5092 " (matches Python's string find function of the same name).\n"
5094 " :arg key: The identifier for the collection member.\n"
5095 " :type key: string\n"
5096 " :return: index of the key.\n"
5100 Py_ssize_t key_len_ssize_t;
5101 const char *key = PyUnicode_AsUTF8AndSize(key_ob, &key_len_ssize_t);
5102 const int key_len = (int)key_len_ssize_t;
5104 char name[256], *nameptr;
5115 if ((key_len == namelen) && memcmp(nameptr, key, key_len) == 0) {
5120 if (name != nameptr) {
5129 return PyLong_FromLong(index);
5137 bool *r_attr_signed)
5140 bool attr_ok =
true;
5143 *r_attr_signed =
false;
5168 const char **r_attr,
5174 bool *r_attr_signed)
5181 *r_size = *r_attr_tot = 0;
5182 *r_attr_signed =
false;
5185 if (!PyArg_ParseTuple(args,
"sO:foreach_get/set", r_attr, r_seq)) {
5189 if (!PySequence_Check(*r_seq) && PyObject_CheckBuffer(*r_seq)) {
5192 "foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
5193 Py_TYPE(*r_seq)->tp_name);
5198 *r_tot = PySequence_Size(*r_seq);
5202 PyErr_Format(PyExc_AttributeError,
5203 "foreach_get/set '%.200s.%200s[...]' elements have no attribute '%.200s'",
5213 if ((*r_attr_tot) < 1) {
5224 target_tot = array_tot * (*r_attr_tot);
5227 if (target_tot != (*r_tot)) {
5228 PyErr_Format(PyExc_TypeError,
5229 "foreach_get(attr, sequence) sequence length mismatch given %d, needed %d",
5240 if (*r_size == 0 && *r_attr_tot != 0) {
5241 PyErr_SetString(PyExc_AttributeError,
"attribute does not support foreach method");
5254 return (f ==
'b') ? 1 : 0;
5257 return (f ==
'B') ? 1 : 0;
5261 return (f ==
'h') ? 1 : 0;
5264 return (f ==
'H') ? 1 : 0;
5268 return (f ==
'i') ? 1 : 0;
5271 return (f ==
'I') ? 1 : 0;
5274 return (f ==
'?') ? 1 : 0;
5276 return (f ==
'f') ? 1 : 0;
5278 return (f ==
'd') ? 1 : 0;
5288 PyObject *item =
NULL;
5290 bool buffer_is_compat;
5296 int tot,
size, attr_tot;
5301 self, args, &attr, &seq, &tot, &
size, &raw_type, &attr_tot, &attr_signed) == -1) {
5310 buffer_is_compat =
false;
5311 if (PyObject_CheckBuffer(seq)) {
5313 PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
5319 if (buffer_is_compat) {
5321 NULL, &
self->ptr,
self->prop, attr, buf.buf, raw_type, tot);
5324 PyBuffer_Release(&buf);
5328 if (!buffer_is_compat) {
5331 for (; i < tot; i++) {
5332 item = PySequence_GetItem(seq, i);
5335 ((
char *)
array)[i] = (char)PyLong_AsLong(item);
5338 ((
short *)
array)[i] = (short)PyLong_AsLong(item);
5341 ((
int *)
array)[i] = (int)PyLong_AsLong(item);
5344 ((
bool *)
array)[i] = (int)PyLong_AsLong(item) != 0;
5347 ((
float *)
array)[i] = (
float)PyFloat_AsDouble(item);
5350 ((
double *)
array)[i] = (
double)PyFloat_AsDouble(item);
5366 buffer_is_compat =
false;
5367 if (PyObject_CheckBuffer(seq)) {
5369 PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
5375 if (buffer_is_compat) {
5377 NULL, &
self->ptr,
self->prop, attr, buf.buf, raw_type, tot);
5380 PyBuffer_Release(&buf);
5384 if (!buffer_is_compat) {
5395 for (; i < tot; i++) {
5399 item = PyLong_FromLong((
long)((
char *)
array)[i]);
5402 item = PyLong_FromLong((
long)((
short *)
array)[i]);
5405 item = PyLong_FromLong((
long)((
int *)
array)[i]);
5408 item = PyFloat_FromDouble((
double)((
float *)
array)[i]);
5411 item = PyFloat_FromDouble((
double)((
double *)
array)[i]);
5414 item = PyBool_FromLong((
long)((
bool *)
array)[i]);
5424 PySequence_SetItem(seq, i, item);
5434 if (PyErr_Occurred()) {
5437 PyErr_SetString(PyExc_TypeError,
"couldn't access the py sequence");
5441 PyErr_SetString(PyExc_RuntimeError,
"internal error setting the array");
5449 ".. method:: foreach_get(attr, seq)\n"
5451 " This is a function to give fast access to attributes within a collection.\n");
5460 ".. method:: foreach_set(attr, seq)\n"
5462 " This is a function to give fast access to attributes within a collection.\n");
5474 PyObject *item =
NULL;
5475 Py_ssize_t i, seq_size,
size;
5483 PyErr_Format(PyExc_TypeError,
"foreach_get/set available only for int and float");
5487 if (!PyArg_ParseTuple(args,
"O:foreach_get/set", &seq)) {
5491 if (!PySequence_Check(seq) && PyObject_CheckBuffer(seq)) {
5494 "foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
5495 Py_TYPE(seq)->tp_name);
5500 seq_size = PySequence_Size(seq);
5502 if (
size != seq_size) {
5503 PyErr_Format(PyExc_TypeError,
"expected sequence size %d, got %d",
size, seq_size);
5508 if (PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT) == -1) {
5511 switch (prop_type) {
5513 array = PyMem_Malloc(
sizeof(
int) *
size);
5515 for (i = 0; i <
size; i++) {
5516 item = PySequence_GetItem(seq, i);
5517 ((
int *)
array)[i] = (int)PyLong_AsLong(item);
5526 for (i = 0; i <
size; i++) {
5527 item = PyLong_FromLong((
long)((
int *)
array)[i]);
5528 PySequence_SetItem(seq, i, item);
5535 array = PyMem_Malloc(
sizeof(
float) *
size);
5537 for (i = 0; i <
size; i++) {
5538 item = PySequence_GetItem(seq, i);
5539 ((
float *)
array)[i] = (
float)PyFloat_AsDouble(item);
5548 for (i = 0; i <
size; i++) {
5549 item = PyFloat_FromDouble((
double)((
float *)
array)[i]);
5550 PySequence_SetItem(seq, i, item);
5567 if (PyErr_Occurred()) {
5570 PyErr_SetString(PyExc_TypeError,
"couldn't access the py sequence");
5575 const char f = buf.format ? buf.format[0] : 0;
5576 if ((prop_type ==
PROP_INT && (buf.itemsize !=
sizeof(
int) || (!
ELEM(f,
'l',
'i')))) ||
5577 (prop_type ==
PROP_FLOAT && (buf.itemsize !=
sizeof(
float) || f !=
'f'))) {
5578 PyBuffer_Release(&buf);
5579 PyErr_Format(PyExc_TypeError,
"incorrect sequence item type: %s", buf.format);
5583 switch (prop_type) {
5610 PyBuffer_Release(&buf);
5617 ".. method:: foreach_get(seq)\n"
5619 " This is a function to give fast access to array data.\n");
5628 ".. method:: foreach_set(seq)\n"
5630 " This is a function to give fast access to array data.\n");
5644 PyObject *iter =
NULL;
5655 iter = PyObject_GetIter(
ret);
5664 #ifndef USE_PYRNA_ITER
5669 PyObject *iter =
NULL;
5675 iter = PyObject_GetIter(
ret);
5690 {
"get", (PyCFunction)
pyrna_struct_get, METH_VARARGS, pyrna_struct_get_doc},
5691 {
"pop", (PyCFunction)
pyrna_struct_pop, METH_VARARGS, pyrna_struct_pop_doc},
5698 METH_VARARGS | METH_KEYWORDS,
5702 METH_VARARGS | METH_KEYWORDS,
5715 METH_VARARGS | METH_KEYWORDS,
5716 pyrna_struct_is_property_set_doc},
5720 pyrna_struct_property_unset_doc},
5721 {
"is_property_hidden",
5724 pyrna_struct_is_property_hidden_doc},
5725 {
"is_property_readonly",
5728 pyrna_struct_is_property_readonly_doc},
5729 {
"is_property_overridable_library",
5732 pyrna_struct_is_property_overridable_library_doc},
5733 {
"property_overridable_library_set",
5736 pyrna_struct_property_overridable_library_set_doc},
5740 pyrna_struct_path_resolve_doc},
5744 pyrna_struct_path_from_id_doc},
5748 pyrna_struct_type_recast_doc},
5749 {
"bl_rna_get_subclass_py",
5751 METH_VARARGS | METH_CLASS,
5752 pyrna_struct_bl_rna_get_subclass_py_doc},
5753 {
"bl_rna_get_subclass",
5755 METH_VARARGS | METH_CLASS,
5756 pyrna_struct_bl_rna_get_subclass_doc},
5758 {
"id_properties_ensure",
5761 pyrna_struct_id_properties_ensure_doc},
5762 {
"id_properties_clear",
5765 pyrna_struct_id_properties_clear_doc},
5766 {
"id_properties_ui",
5769 pyrna_struct_id_properties_ui_doc},
5774 {
"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS,
NULL},
5775 {
"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS,
NULL},
5780 METH_VARARGS | METH_CLASS,
5790 pyrna_prop_path_from_id_doc},
5801 pyrna_prop_array_foreach_get_doc},
5805 pyrna_prop_array_foreach_set_doc},
5814 pyrna_prop_collection_foreach_get_doc},
5818 pyrna_prop_collection_foreach_set_doc},
5824 pyrna_prop_collection_items_doc},
5828 pyrna_prop_collection_values_doc},
5849 if (PyTuple_GET_SIZE(args) == 1) {
5851 if (Py_TYPE(base) ==
type) {
5853 return (PyObject *)base;
5872 #ifdef USE_PYRNA_STRUCT_REFERENCE
5875 PyObject_GC_UnTrack(
ret);
5879 return (PyObject *)
ret;
5883 PyErr_Format(PyExc_TypeError,
5884 "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct",
5889 PyErr_Format(PyExc_TypeError,
"bpy_struct.__new__(type): expected a single argument");
5901 if (!PyArg_ParseTuple(args,
"O!:bpy_prop.__new__", &
pyrna_prop_Type, &base)) {
5905 if (
type == Py_TYPE(base)) {
5906 return Py_INCREF_RET((PyObject *)base);
5912 return (PyObject *)
ret;
5915 PyErr_Format(PyExc_TypeError,
5916 "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop",
5947 for (
a = 0;
a <
len;
a++) {
5948 PyTuple_SET_ITEM(
ret,
a, PyBool_FromLong(((
bool *)
data)[
a]));
5953 for (
a = 0;
a <
len;
a++) {
5954 PyTuple_SET_ITEM(
ret,
a, PyLong_FromLong(((
int *)
data)[
a]));
5959 #ifdef USE_MATHUTILS
5968 else if (
len == 9) {
5976 for (
a = 0;
a <
len;
a++) {
5977 PyTuple_SET_ITEM(
ret,
a, PyFloat_FromDouble(((
float *)
data)[
a]));
5984 PyExc_TypeError,
"RNA Error: unknown array type \"%d\" (pyrna_param_to_py)",
type);
5993 ret = PyBool_FromLong(*(
bool *)
data);
5996 ret = PyLong_FromLong(*(
int *)
data);
5999 ret = PyFloat_FromDouble(*(
float *)
data);
6002 const char *data_ch;
6008 data_ch = data_alloc->
array;
6014 data_ch_len = data_ch ? strlen(data_ch) : 0;
6022 #ifdef USE_STRING_COERCE
6024 ret = PyBytes_FromStringAndSize(data_ch, data_ch_len);
6030 ret = PyUnicode_FromStringAndSize(data_ch, data_ch_len);
6034 ret = PyBytes_FromString(buf);
6037 ret = PyUnicode_FromString(data_ch);
6081 ret = PyList_New(0);
6083 for (link = lb->
first; link; link = link->
next) {
6090 PyErr_Format(PyExc_TypeError,
"RNA Error: unknown type \"%d\" (pyrna_param_to_py)",
type);
6106 PyObject *key =
NULL;
6108 PyObject *value =
NULL;
6110 while (PyDict_Next(dict, &
pos, &key, &value)) {
6111 if (PyUnicode_Check(key)) {
6112 if (
STREQ(key_lookup, PyUnicode_AsUTF8(key))) {
6126 const int parm_index,
6128 const size_t error_size)
6132 if (parm_index == -1) {
6135 "%.200s.%.200s(): error with keyword argument \"%.200s\" - ",
6143 "%.200s.%.200s(): error with argument %d, \"%.200s\" - ",
6161 PyObject *
ret, *item;
6162 int i, pyargs_len, pykw_len, parms_len, ret_len, flag_parameter,
err = 0, kw_tot = 0;
6166 void *retdata_single =
NULL;
6172 #ifdef DEBUG_STRING_FREE
6173 PyObject *string_free_ls = PyList_New(0);
6179 if (self_ptr ==
NULL) {
6180 PyErr_SetString(PyExc_RuntimeError,
6181 "RNA functions internal RNA pointer is NULL, this is a bug. aborting");
6185 if (self_func ==
NULL) {
6188 "%.200s.<unknown>(): RNA function internal function is NULL, this is a bug. aborting",
6199 printf(
"pyrna_func_call > %.200s.%.200s : %.200s:%d\n",
6212 pyargs_len = PyTuple_GET_SIZE(args);
6213 pykw_len = kw ? PyDict_Size(kw) : 0;
6220 if (pyargs_len + pykw_len > parms_len) {
6222 PyErr_Format(PyExc_TypeError,
6223 "%.200s.%.200s(): takes at most %d arguments, got %d",
6227 pyargs_len + pykw_len);
6239 if (pret_single ==
NULL) {
6241 retdata_single = iter.
data;
6249 if (i < pyargs_len) {
6252 PyErr_Format(PyExc_TypeError,
6253 "%.200s.%.200s(): required parameter \"%.200s\" to be a keyword argument!",
6261 item = PyTuple_GET_ITEM(args, i);
6264 else if (kw !=
NULL) {
6279 PyErr_Format(PyExc_TypeError,
6280 "%.200s.%.200s(): required parameter \"%.200s\" not specified",
6291 #ifdef DEBUG_STRING_FREE
6293 if (PyUnicode_Check(item)) {
6294 PyList_APPEND(string_free_ls, PyUnicode_FromString(PyUnicode_AsUTF8(item)));
6301 char error_prefix[512];
6325 if (
err == 0 && kw && (pykw_len > kw_tot)) {
6326 PyObject *key, *value;
6332 const char *arg_name, *bad_args_str, *good_args_str;
6333 bool found =
false, first =
true;
6335 while (PyDict_Next(kw, &
pos, &key, &value)) {
6337 arg_name = PyUnicode_AsUTF8(key);
6340 if (arg_name ==
NULL) {
6356 if (found ==
false) {
6383 "%.200s.%.200s(): was called with invalid keyword argument(s) (%s), expected (%s)",
6412 ret = PyTuple_New(ret_len);
6439 #ifdef DEBUG_STRING_FREE
6441 if (PyList_GET_SIZE(string_free_ls)) {
6442 printf(
"%.200s.%.200s(): has %d strings\n",
6445 (
int)PyList_GET_SIZE(string_free_ls));
6448 Py_DECREF(string_free_ls);
6449 # undef DEBUG_STRING_FREE
6474 ret = PyUnicode_FromFormat(
"%.200s.%.200s(%.200s)\n%s",
6488 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_struct_meta_idprop",
6491 sizeof(PyHeapTypeObject),
6519 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6545 #if defined(_MSC_VER)
6572 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_struct",
6602 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
6603 #ifdef USE_PYRNA_STRUCT_REFERENCE
6604 | Py_TPFLAGS_HAVE_GC
6611 #ifdef USE_PYRNA_STRUCT_REFERENCE
6612 (traverseproc)pyrna_struct_traverse,
6615 (inquiry)pyrna_struct_clear,
6665 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop",
6697 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6749 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_array",
6781 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6832 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_collection",
6865 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6918 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_collection_idprop",
6951 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
7004 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_func",
7087 #ifdef USE_PYRNA_ITER
7100 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_collection_iter",
7126 PyObject_GenericGetAttr,
7148 # ifdef USE_WEAKREFS
7188 # ifdef USE_WEAKREFS
7189 self->in_weakreflist =
NULL;
7194 return (PyObject *)
self;
7204 if (
self->iter.valid ==
false) {
7205 PyErr_SetNone(PyExc_StopIteration);
7211 # ifdef USE_PYRNA_STRUCT_REFERENCE
7213 if ((PyObject *)pyrna != Py_None) {
7218 pyrna_struct_reference_set(pyrna, (PyObject *)
self);
7225 return (PyObject *)pyrna;
7230 # ifdef USE_WEAKREFS
7231 if (
self->in_weakreflist !=
NULL) {
7232 PyObject_ClearWeakRefs((PyObject *)
self);
7249 Py_INCREF(newclass);
7278 for (link = lb->
first; link; link = link->
next) {
7303 PyObject *py_base =
NULL;
7308 if (base && base != srna) {
7314 if (py_base ==
NULL) {
7331 PyObject *bpy_types = PyImport_ImportModuleLevel(
"bpy_types",
NULL,
NULL,
NULL, 0);
7333 if (bpy_types ==
NULL) {
7340 Py_DECREF(bpy_types);
7352 PyObject *tp_bases = ((PyTypeObject *)newclass)->tp_bases;
7353 PyObject *tp_slots = PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict,
7356 if (tp_slots ==
NULL) {
7358 BPY_LOG_RNA,
"expected class '%s' to have __slots__ defined, see bpy_types.py", idname);
7361 else if (PyTuple_GET_SIZE(tp_bases)) {
7362 PyObject *base = PyTuple_GET_ITEM(tp_bases, 0);
7364 if (base_compare != base) {
7365 char pyob_info[256];
7368 "incorrect subclassing of SRNA '%s', expected '%s', see bpy_types.py",
7384 PyObject *newclass =
NULL;
7391 Py_INCREF(newclass);
7395 Py_INCREF(newclass);
7410 PyObject *metaclass;
7417 descr =
"(no docs)";
7426 metaclass = (PyObject *)&PyType_Type;
7431 newclass = PyObject_CallFunction(
7432 metaclass,
"s(O) {sss()}", idname, py_base,
"__module__",
"bpy.types",
"__slots__");
7436 PyObject *args, *item, *value;
7439 args = PyTuple_New(3);
7442 PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(idname));
7445 PyTuple_SET_ITEM(args, 1, item = PyTuple_New(1));
7446 PyTuple_SET_ITEM(item, 0, Py_INCREF_RET(py_base));
7449 PyTuple_SET_ITEM(args, 2, item = PyDict_New());
7456 newclass = PyObject_CallObject(metaclass, args);
7491 if (
ptr->
type == &RNA_Struct) {
7523 return (PyObject *)pyrna;
7540 #ifdef USE_PYRNA_STRUCT_REFERENCE
7543 if (pyrna !=
NULL) {
7544 PyObject_GC_UnTrack(pyrna);
7552 #ifdef USE_PYRNA_STRUCT_REFERENCE
7559 if (pyrna !=
NULL) {
7560 pyrna->in_weakreflist =
NULL;
7566 if (pyrna ==
NULL) {
7567 PyErr_SetString(PyExc_MemoryError,
"couldn't create bpy_struct object");
7578 #ifdef PYRNA_FREE_SUPPORT
7579 pyrna->freeptr =
false;
7582 #ifdef USE_PYRNA_STRUCT_REFERENCE
7583 pyrna->reference =
NULL;
7588 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
7593 return (PyObject *)pyrna;
7617 pyrna->in_weakreflist =
NULL;
7629 if (pyrna ==
NULL) {
7630 PyErr_SetString(PyExc_MemoryError,
"couldn't create BPy_rna object");
7637 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
7643 return (PyObject *)pyrna;
7675 #ifdef USE_MATHUTILS
7681 #if defined(_MSC_VER)
7714 #ifdef USE_PYRNA_ITER
7720 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
7728 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
7733 const int id_weakref_pool_len =
BLI_ghash_len(id_weakref_pool);
7734 if (id_weakref_pool_len != 0) {
7735 printf(
"Found %d unreleased ID's\n", id_weakref_pool_len);
7739 printf(
"ID: %s\n",
id->
name);
7743 id_weakref_pool =
NULL;
7759 return (PyObject *)pyrna;
7776 PyObject *BPY_rna_doc(
void)
7809 const char *name = PyUnicode_AsUTF8(pyname);
7812 PyErr_SetString(PyExc_AttributeError,
"bpy.types: __getattr__ must be a string");
7818 PyErr_Format(PyExc_RuntimeError,
7819 "bpy.types.%.200s subtype could not be generated, this is a bug!",
7820 PyUnicode_AsUTF8(pyname));
7825 PyErr_Format(PyExc_AttributeError,
7826 "bpy.types.%.200s RNA_Struct does not exist",
7827 PyUnicode_AsUTF8(pyname));
7831 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
7840 PyObject *
ret = PyList_New(0);
7849 PyObject *submodule_dict = PyModule_GetDict(
self);
7850 PyObject *key, *value;
7852 while (PyDict_Next(submodule_dict, &
pos, &key, &value)) {
7853 PyList_Append(
ret, key);
7866 PyModuleDef_HEAD_INIT,
7868 bpy_types_module_doc,
7887 static PyTypeObject *pyrna_types[] = {
7896 PyObject *submodule_dict = PyModule_GetDict(submodule);
7897 for (
int i = 0; i <
ARRAY_SIZE(pyrna_types); i += 1) {
7898 PyDict_SetItemString(submodule_dict, pyrna_types[i]->tp_name, (PyObject *)pyrna_types[i]);
7913 if (PyType_Check(
self)) {
7914 py_srna = (
BPy_StructRNA *)PyDict_GetItem(((PyTypeObject *)
self)->tp_dict,
7916 Py_XINCREF(py_srna);
7922 if (py_srna ==
NULL) {
7927 if (py_srna ==
NULL) {
7928 PyErr_Format(PyExc_RuntimeError,
7929 "%.200s, missing bl_rna attribute from '%.200s' instance (may not be registered)",
7931 Py_TYPE(
self)->tp_name);
7936 PyErr_Format(PyExc_TypeError,
7937 "%.200s, bl_rna attribute wrong type '%.200s' on '%.200s'' instance",
7939 Py_TYPE(py_srna)->tp_name,
7940 Py_TYPE(
self)->tp_name);
7945 if (py_srna->
ptr.
type != &RNA_Struct) {
7946 PyErr_Format(PyExc_TypeError,
7947 "%.200s, bl_rna attribute not a RNA_Struct, on '%.200s'' instance",
7949 Py_TYPE(
self)->tp_name);
7964 PyErr_Format(PyExc_TypeError,
7965 "Expected a \"bpy.types.%.200s\" not a \"%.200s\"",
7967 Py_TYPE(py_obj)->tp_name);
7971 return &bpy_srna->
ptr;
7976 if (py_obj == Py_None) {
7987 if (srna_parse->
ptr ==
NULL) {
7998 if (srna_parse->
ptr ==
NULL) {
8011 if (PyCapsule_CheckExact(
self)) {
8012 return PyCapsule_GetPointer(
self,
NULL);
8014 if (PyType_Check(
self) == 0) {
8021 PyObject *error_type, *error_value, *error_traceback;
8024 PyErr_Fetch(&error_type, &error_value, &error_traceback);
8027 if (!PyErr_Occurred()) {
8028 PyErr_Restore(error_type, error_value, error_traceback);
8045 PyObject *py_srna_cobject, *py_ret;
8049 PyMethodDef *py_func_method_def = ((PyCFunctionObject *)py_func)->m_ml;
8050 const char *func_name = py_func_method_def->ml_name;
8052 PyObject *args_fake;
8053 const char *key_str = PyUnicode_AsUTF8(key);
8055 if (*key_str ==
'_') {
8056 PyErr_Format(PyExc_ValueError,
8057 "bpy_struct \"%.200s\" registration error: "
8058 "'%.200s' %.200s could not register because it starts with an '_'",
8064 py_srna_cobject = PyCapsule_New(srna,
NULL,
NULL);
8069 args_fake = PyTuple_New(1);
8070 PyTuple_SET_ITEM(args_fake, 0, py_srna_cobject);
8072 PyObject *
type = PyDict_GetItemString(py_kw,
"type");
8079 PyErr_Format(PyExc_ValueError,
8080 "bpy_struct \"%.200s\" registration error: "
8081 "'%.200s' %.200s could not register because "
8082 "this type doesn't support data-block properties",
8090 py_ret = PyObject_Call(py_func, args_fake, py_kw);
8094 Py_DECREF(args_fake);
8101 Py_DECREF(args_fake);
8103 PyErr_Format(PyExc_ValueError,
8104 "bpy_struct \"%.200s\" registration error: "
8105 "'%.200s' %.200s could not register (see previous error)",
8120 PyObject *annotations_dict =
NULL;
8124 PyObject *typing_mod = PyImport_ImportModuleLevel(
"typing",
NULL,
NULL,
NULL, 0);
8125 if (typing_mod !=
NULL) {
8126 PyObject *get_type_hints_fn = PyObject_GetAttrString(typing_mod,
"get_type_hints");
8127 if (get_type_hints_fn !=
NULL) {
8128 PyObject *args = PyTuple_New(1);
8130 PyTuple_SET_ITEM(args, 0, (PyObject *)py_class);
8131 Py_INCREF(py_class);
8133 annotations_dict = PyObject_CallObject(get_type_hints_fn, args);
8136 Py_DECREF(get_type_hints_fn);
8138 Py_DECREF(typing_mod);
8143 if (annotations_dict !=
NULL) {
8144 if (PyDict_CheckExact(annotations_dict)) {
8145 PyObject *item, *key;
8148 while (PyDict_Next(annotations_dict, &
pos, &key, &item)) {
8157 PyErr_Format(PyExc_TypeError,
8158 "typing.get_type_hints returned: %.200s, expected dict\n",
8159 Py_TYPE(annotations_dict)->tp_name);
8163 Py_DECREF(annotations_dict);
8167 fprintf(stderr,
"typing.get_type_hints failed with: %.200s\n", py_class->tp_name);
8176 PyObject *annotations_dict;
8177 PyObject *item, *key;
8184 PyDict_CheckExact(annotations_dict)) {
8185 while (PyDict_Next(annotations_dict, &
pos, &key, &item)) {
8199 const int len = PyTuple_GET_SIZE(py_class->tp_bases);
8203 for (i = 0; i <
len; i++) {
8204 PyTypeObject *py_superclass = (PyTypeObject *)PyTuple_GET_ITEM(py_class->tp_bases, i);
8215 if (py_superclass != &PyBaseObject_Type &&
8216 !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&
pyrna_struct_Type)) {
8238 #ifdef USE_POSTPONED_ANNOTATIONS
8239 const bool use_postponed_annotations =
true;
8241 const bool use_postponed_annotations =
false;
8244 if (use_postponed_annotations) {
8259 int count = is_staticmethod ? 0 : 1;
8260 bool done_min_count =
false;
8262 for (link = lb->
first; link; link = link->
next) {
8270 done_min_count =
true;
8276 if (!done_min_count && min_count) {
8291 PyObject *py_class = (PyObject *)py_data;
8294 int i, arg_count, func_arg_count, func_arg_min_count = 0;
8295 const char *py_class_name = ((PyTypeObject *)py_class)->tp_name;
8304 if (!PyObject_IsSubclass(py_class, base_class)) {
8305 PyErr_Format(PyExc_TypeError,
8306 "expected %.200s subclass of class \"%.200s\"",
8316 for (link = lb->
first; link; link = link->
next) {
8324 have_function[i] = (item !=
NULL);
8329 PyErr_Format(PyExc_AttributeError,
8330 "expected %.200s, %.200s class to have an \"%.200s\" attribute",
8348 PyObject *item_orig = item;
8350 if (is_staticmethod) {
8351 if (PyMethod_Check(item) == 0) {
8352 PyErr_Format(PyExc_TypeError,
8353 "expected %.200s, %.200s class \"%.200s\" "
8354 "attribute to be a static/class method, not a %.200s",
8358 Py_TYPE(item)->tp_name);
8359 Py_DECREF(item_orig);
8362 item = ((PyMethodObject *)item)->im_func;
8365 if (PyFunction_Check(item) == 0) {
8366 PyErr_Format(PyExc_TypeError,
8367 "expected %.200s, %.200s class \"%.200s\" "
8368 "attribute to be a function, not a %.200s",
8372 Py_TYPE(item)->tp_name);
8373 Py_DECREF(item_orig);
8380 if (func_arg_count >= 0) {
8381 arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
8386 if (is_staticmethod) {
8388 func_arg_min_count++;
8391 if (arg_count < func_arg_min_count || arg_count > func_arg_count) {
8392 if (func_arg_min_count != func_arg_count) {
8395 "expected %.200s, %.200s class \"%.200s\" function to have between %d and %d "
8407 "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d",
8414 Py_DECREF(item_orig);
8418 Py_DECREF(item_orig);
8423 for (link = lb->
first; link; link = link->
next) {
8424 const char *identifier;
8434 item = PyObject_GetAttrString(py_class, identifier);
8440 #define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
8441 else if (STREQ(identifier, rna_attr)) \
8443 if ((item = PyObject_GetAttr(py_class, py_attr))) { \
8444 if (item != Py_None) { \
8445 if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { \
8462 #undef BPY_REPLACEMENT_STRING
8465 PyErr_Format(PyExc_AttributeError,
8466 "expected %.200s, %.200s class to have an \"%.200s\" attribute",
8496 PyObject *
ret =
NULL, *py_srna =
NULL, *py_class_instance =
NULL, *parmitem;
8497 PyTypeObject *py_class;
8501 int err = 0, i, ret_len = 0, arg_count;
8507 void *retdata_single =
NULL;
8509 PyGILState_STATE gilstate;
8511 #ifdef USE_PEDANTIC_WRITE
8521 if (py_class ==
NULL) {
8523 "unable to get Python class for RNA struct '%.200s'",
8540 if (!(is_staticmethod || is_classmethod)) {
8548 Py_INCREF(py_class_instance);
8554 if (py_class_instance ==
NULL) {
8558 if (py_class_instance) {
8561 else if (py_srna ==
NULL) {
8562 py_class_instance =
NULL;
8564 else if (py_srna == Py_None) {
8566 py_class_instance =
NULL;
8575 if (py_class->tp_init) {
8576 # ifdef USE_PEDANTIC_WRITE
8583 args = PyTuple_New(0);
8584 if (py_class->tp_init(py_srna, args,
NULL) < 0) {
8590 # ifdef USE_PEDANTIC_WRITE
8594 py_class_instance = py_srna;
8603 py_class_instance = py_srna;
8604 Py_INCREF(py_class_instance);
8611 args = PyTuple_New(1);
8612 PyTuple_SET_ITEM(args, 0, py_srna);
8613 py_class_instance = PyObject_Call(py_class, args,
NULL);
8620 if (py_class_instance ==
NULL) {
8627 if (
err != -1 && (is_staticmethod || is_classmethod || py_class_instance)) {
8633 if (is_staticmethod) {
8635 ((PyCodeObject *)PyFunction_GET_CODE(((PyMethodObject *)item)->im_func))->co_argcount -
8639 arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
8645 args = PyTuple_New(arg_count);
8647 if (is_staticmethod) {
8650 else if (is_classmethod) {
8651 PyTuple_SET_ITEM(args, 0, (PyObject *)py_class);
8655 PyTuple_SET_ITEM(args, 0, py_class_instance);
8668 if (pret_single ==
NULL) {
8670 retdata_single = iter.
data;
8676 if (i < arg_count) {
8678 PyTuple_SET_ITEM(args, i, parmitem);
8683 #ifdef USE_PEDANTIC_WRITE
8690 ret = PyObject_Call(item, args,
NULL);
8694 #ifdef USE_PEDANTIC_WRITE
8705 PyErr_Format(PyExc_TypeError,
8706 "could not find function %.200s in %.200s to execute callback",
8715 PyErr_Format(PyExc_RuntimeError,
8716 "could not create instance of %.200s to call callback function %.200s",
8727 if (ret_len == 0 &&
ret != Py_None) {
8728 PyErr_Format(PyExc_RuntimeError,
8729 "expected class %.200s, function %.200s to return None, not %.200s",
8732 Py_TYPE(
ret)->tp_name);
8735 else if (ret_len == 1) {
8744 "class %.200s, function %.200s: incompatible return value ",
8749 else if (ret_len > 1) {
8751 if (PyTuple_Check(
ret) == 0) {
8754 "expected class %.200s, function %.200s to return a tuple of size %d, not %.200s",
8758 Py_TYPE(
ret)->tp_name);
8761 else if (PyTuple_GET_SIZE(
ret) != ret_len) {
8762 PyErr_Format(PyExc_RuntimeError,
8763 "class %.200s, function %.200s to returned %d items, expected %d",
8766 PyTuple_GET_SIZE(
ret),
8781 &funcptr, parm, iter.
data, PyTuple_GET_ITEM(
ret, i++),
"calling class function:");
8797 if ((!is_staticmethod) && (!is_classmethod) && (
ptr->
data) &&
8822 PyObject *
self = (PyObject *)pyob_ptr;
8823 PyGILState_STATE gilstate;
8825 gilstate = PyGILState_Ensure();
8832 if (PyErr_Occurred()) {
8838 if (
self->ob_refcnt > 1) {
8839 PyC_ObSpit(
"zombie class - reference should be 1",
self);
8843 Py_DECREF((PyObject *)pyob_ptr);
8845 PyGILState_Release(gilstate);
8856 PyGILState_STATE gilstate;
8861 gilstate = PyGILState_Ensure();
8870 if (PyErr_Occurred()) {
8881 PyGILState_Release(gilstate);
8920 ".. function:: register_class(cls)\n"
8922 " Register a subclass of a Blender type class.\n"
8924 " :arg cls: Blender type class in:\n"
8925 " :class:`bpy.types.Panel`, :class:`bpy.types.UIList`,\n"
8926 " :class:`bpy.types.Menu`, :class:`bpy.types.Header`,\n"
8927 " :class:`bpy.types.Operator`, :class:`bpy.types.KeyingSetInfo`,\n"
8928 " :class:`bpy.types.RenderEngine`\n"
8929 " :type cls: class\n"
8930 " :raises ValueError:\n"
8931 " if the class is not a subclass of a registerable blender class.\n"
8935 " If the class has a *register* class method it will be called\n"
8936 " before registration.\n");
8946 const char *identifier;
8947 PyObject *py_cls_meth;
8948 const char *error_prefix =
"register_class(...):";
8950 if (!PyType_Check(py_class)) {
8951 PyErr_Format(PyExc_ValueError,
8952 "register_class(...): "
8953 "expected a class argument, not '%.200s'",
8954 Py_TYPE(py_class)->tp_name);
8959 PyErr_Format(PyExc_ValueError,
8960 "register_class(...): "
8961 "already registered as a subclass '%.200s'",
8962 ((PyTypeObject *)py_class)->tp_name);
8967 PyErr_Format(PyExc_RuntimeError,
8968 "register_class(...): "
8969 "can't run in readonly state '%.200s'",
8970 ((PyTypeObject *)py_class)->tp_name);
8983 PyErr_Format(PyExc_ValueError,
8984 "register_class(...): %.200s's parent class %.200s is already registered, this "
8986 ((PyTypeObject *)py_class)->tp_name,
8996 PyErr_Format(PyExc_ValueError,
8997 "register_class(...): expected a subclass of a registerable "
8998 "RNA type (%.200s does not support registration)",
9009 identifier = ((PyTypeObject *)py_class)->tp_name;
9032 if (srna_new ==
NULL) {
9044 Py_DECREF(py_class);
9060 PyObject *
ret = PyObject_CallObject(py_cls_meth,
NULL);
9061 Py_DECREF(py_cls_meth);
9080 const char **r_prop_identifier)
9088 for (link = lb->
first; link; link = link->
next) {
9105 ".. function:: unregister_class(cls)\n"
9107 " Unload the Python class from blender.\n"
9109 " If the class has an *unregister* class method it will be called\n"
9110 " before unregistering.\n");
9115 pyrna_unregister_class_doc,
9122 PyObject *py_cls_meth;
9124 if (!PyType_Check(py_class)) {
9125 PyErr_Format(PyExc_ValueError,
9126 "register_class(...): "
9127 "expected a class argument, not '%.200s'",
9128 Py_TYPE(py_class)->tp_name);
9134 PWM_cursor_wait(
false);
9135 PyErr_SetString(PyExc_ValueError,
"unregister_class(): not a registered as a subclass");
9141 PyErr_Format(PyExc_RuntimeError,
9142 "unregister_class(...): "
9143 "can't run in readonly state '%.200s'",
9144 ((PyTypeObject *)py_class)->tp_name);
9159 "unregister_class(...): "
9160 "expected a Type subclassed from a registerable RNA type (no unregister supported)");
9168 PyObject *
ret = PyObject_CallObject(py_cls_meth,
NULL);
9169 Py_DECREF(py_cls_meth);
9189 const char *prop_identifier =
NULL;
9196 srna_iter = itemptr.data;
9203 if (prop_identifier) {
9204 PyErr_Format(PyExc_RuntimeError,
9205 "unregister_class(...): can't unregister %s because %s.%s pointer property is "
9221 if (PyErr_Occurred()) {
9229 struct PyMethodDef *method,
9230 struct PyGetSetDef *getset)
9234 PyObject *dict =
type->tp_dict;
9235 if (method !=
NULL) {
9236 for (; method->ml_name !=
NULL; method++) {
9237 PyObject *py_method;
9239 if (method->ml_flags & METH_CLASS) {
9240 PyObject *cfunc = PyCFunction_New(method, (PyObject *)
type);
9241 py_method = PyClassMethod_New(cfunc);
9244 else if (method->ml_flags & METH_STATIC) {
9245 py_method = PyCFunction_New(method,
NULL);
9248 py_method = PyDescr_NewMethod(
type, method);
9251 const int err = PyDict_SetItemString(dict, method->ml_name, py_method);
9252 Py_DECREF(py_method);
9258 if (getset !=
NULL) {
9259 for (; getset->name !=
NULL; getset++) {
9260 PyObject *descr = PyDescr_NewGetSet(
type, getset);
9263 PyDict_SetItem(dict, PyDescr_NAME(descr), descr);
9276 return PyUnicode_FromString(name);
9284 if (value == Py_None) {
9287 else if (PyUnicode_Check(value)) {
9288 name = PyUnicode_AsUTF8(value);
9291 PyErr_Format(PyExc_ValueError,
9293 "expected None or a string, not '%.200s'",
9294 Py_TYPE(value)->tp_name);
typedef float(TangentPoint)[2]
int CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, ListBase *r_lb, short *r_type)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
@ CTX_DATA_TYPE_COLLECTION
ListBase CTX_data_dir_get(const bContext *C)
@ CTX_RESULT_MEMBER_NOT_FOUND
struct ReportList * CTX_wm_reports(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
bool IDP_ui_data_supported(const struct IDProperty *prop)
void IDP_FreeProperty(struct IDProperty *prop)
struct IDProperty * IDP_GetPropertyFromGroup(const struct IDProperty *prop, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_FreeFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL()
const char * BKE_idtype_idcode_to_name(short idcode)
const char * BKE_idtype_idcode_to_name_plural(short idcode)
struct bNodeType * nodeTypeFind(const char *idname)
void BKE_reports_clear(ReportList *reports)
void BKE_reports_init(ReportList *reports, int flag)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
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_)
void * BLI_ghash_lookup(const GHash *gh, const void *key) 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_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
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)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) 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,...)
struct ID * DEG_get_original_id(struct ID *id)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object instance
#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)
struct StructRNA *(* StructRegisterFunc)(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
#define RNA_ENUM_BITFLAG_SIZE
void(* StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type)
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)
struct bContext * BPY_context_get(void)
void bpy_context_clear(struct bContext *C, const PyGILState_STATE *gilstate)
void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate)
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 PyTypeObject pyrna_prop_collection_iter_Type
static PyObject * pyrna_bl_owner_id_get(PyObject *UNUSED(self))
static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
PyObject * pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
static void pyrna_struct_dealloc(BPy_StructRNA *self)
static PyObject * bpy_types_module_dir(PyObject *self)
PyTypeObject pyrna_struct_meta_idprop_Type
static PyObject * pyrna_srna_PyBase(StructRNA *srna)
PyTypeObject pyrna_prop_Type
void pyrna_invalidate(BPy_DummyPointerRNA *self)
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
static PyObject * pyrna_struct_property_overridable_library_set(BPy_StructRNA *self, PyObject *args)
void pyrna_struct_type_extend_capi(struct StructRNA *srna, struct PyMethodDef *method, struct PyGetSetDef *getset)
static PyObject * pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject *key)
static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
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 PyObject * pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *self, PyObject *key, const char *err_prefix, const bool err_not_found)
static PyObject * pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyObject *value)
void pyrna_alloc_types(void)
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)
static PyObject * pyprop_array_foreach_getset(BPy_PropertyArrayRNA *self, PyObject *args, const bool do_set)
#define BPY_REPLACEMENT_STRING(rna_attr, py_attr)
int pyrna_struct_validity_check(BPy_StructRNA *pysrna)
static PyObject * pyrna_struct_bl_rna_get_subclass(PyObject *cls, PyObject *args)
static PyObject * pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int keynum)
static PyObject * pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject *pyname)
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_struct_get_rna_type(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
const PointerRNA * pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA *srna)
bool pyrna_write_check(void)
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 struct PyMethodDef pyrna_prop_collection_idprop_methods[]
static PyObject * prop_subscript_ass_array_slice__as_seq_fast(PyObject *value, int length)
static PyObject * pyrna_srna_ExternalType(StructRNA *srna)
static PyObject * pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, const char *keyname)
static PyObject * pyrna_struct_property_unset(BPy_StructRNA *self, PyObject *args)
static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
static PyObject * pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
static PyObject * pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args)
#define MATHUTILS_CB_SUBTYPE_COLOR
static PyObject * pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
static int prop_subscript_ass_array_slice__int_recursive(PyObject **value_items, int *value, int totdim, const int dimsize[], const int range[2])
static bool rna_disallow_writes
#define PROP_ALL_VECTOR_SUBTYPES
static struct PyMethodDef pyrna_prop_array_methods[]
static PyObject * pyrna_prop_update(BPy_PropertyRNA *self)
static long pyrna_prop_hash(BPy_PropertyRNA *self)
static PyObject * pyrna_struct_bl_rna_find_subclass_recursive(PyObject *cls, const char *id)
static PyObject * pyrna_prop_array_getattro(BPy_PropertyRNA *self, PyObject *pyname)
static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
static const char * pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
static PyObject * pyrna_struct_pop(BPy_StructRNA *self, PyObject *args)
static int pyrna_prop_collection_ass_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum, PyObject *value)
static struct PyModuleDef bpy_types_module_def
static PyObject * pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
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 PyObject * pyrna_struct_type_recast(BPy_StructRNA *self)
static PyObject * pyrna_struct_is_property_overridable_library(BPy_StructRNA *self, PyObject *args)
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 PyObject * pyrna_prop_path_from_id(BPy_PropertyRNA *self)
static void pyrna_prop_dealloc(BPy_PropertyRNA *self)
#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 PyObject * pyrna_prop_repr_ex(BPy_PropertyRNA *self, const int index_dim, const int index)
static PyMappingMethods pyrna_prop_array_as_mapping
static PyObject * pyrna_struct_str(BPy_StructRNA *self)
static void pyrna_dir_members_py(PyObject *list, PyObject *self)
PyMethodDef meth_bpy_owner_id_get
static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *key, PyObject *value)
static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *prop, int *r_value, const char *error_prefix)
static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args, const char **r_attr, PyObject **r_seq, int *r_tot, int *r_size, RawPropertyType *r_raw_type, int *r_attr_tot, bool *r_attr_signed)
static PyObject * pyrna_prop_collection_iter(BPy_PropertyRNA *self)
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
static PyObject * pyrna_struct_id_properties_ui(BPy_StructRNA *self, PyObject *args)
static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
static PyObject * pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
StructRNA * pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix)
static PyNumberMethods pyrna_prop_collection_as_number
static PyObject * pyrna_struct_id_properties_ensure(BPy_StructRNA *self)
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 int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
void pyrna_free_types(void)
void BPY_update_rna_module(void)
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 int pyrna_struct_setattro(BPy_StructRNA *self, PyObject *pyname, PyObject *value)
static bool foreach_attr_type(BPy_PropertyRNA *self, const char *attr, RawPropertyType *r_raw_type, int *r_attr_tot, bool *r_attr_signed)
static PyObject * pyrna_register_class(PyObject *self, PyObject *py_class)
static uchar mathutils_rna_array_cb_index
static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
static PySequenceMethods pyrna_struct_as_sequence
static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
static int pyrna_prop_array_bool(BPy_PropertyRNA *self)
#define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err)
static PyObject * pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key_ob)
PyObject * BPY_rna_module(void)
static PyObject * pyrna_func_doc_get(BPy_FunctionRNA *self, void *closure)
static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
static int pyrna_prop_collection_subscript_is_valid_or_error(const PyObject *value)
static PyObject * pyrna_prop_repr(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_as_bytes(BPy_PropertyRNA *self)
static int mathutils_rna_generic_check(BaseMathObject *bmo)
const PointerRNA * pyrna_struct_as_ptr(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 struct PyMethodDef pyrna_prop_methods[]
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 PyObject * pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObject *args)
static int prop_subscript_ass_array_slice__bool_recursive(PyObject **value_items, bool *value, int totdim, const int dimsize[])
static StructRNA * srna_from_ptr(PointerRNA *ptr)
static PyObject * pyrna_prop_array_repr(BPy_PropertyArrayRNA *self)
static PyNumberMethods pyrna_prop_array_as_number
static PyObject * pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
PyObject * pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
static PyObject * pyrna_struct_id_properties_clear(BPy_StructRNA *self)
static PyObject * pyrna_struct_is_property_readonly(BPy_StructRNA *self, PyObject *args)
static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t keynum, PyObject *value)
static PySequenceMethods pyrna_prop_collection_as_sequence
StructRNA * srna_from_self(PyObject *self, const char *error_prefix)
static Py_hash_t pyrna_struct_hash(BPy_StructRNA *self)
static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, void *py_data, int *have_function)
static PyObject * pyrna_prop_collection_keys(BPy_PropertyRNA *self)
static PyGetSetDef pyrna_prop_getseters[]
static PyObject * pyrna_prop_collection_iter_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
PyTypeObject pyrna_struct_Type
static PyObject * small_dict_get_item_string(PyObject *dict, const char *key_lookup)
static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_function)
static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
static void bpy_class_free(void *pyob_ptr)
static PyObject * pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
static uchar mathutils_rna_matrix_cb_index
static PyObject * pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
static PySequenceMethods pyrna_prop_array_as_sequence
static PyObject * pyrna_prop_array_foreach_get(BPy_PropertyArrayRNA *self, PyObject *args)
static PyObject * pyrna_struct_Subtype(PointerRNA *ptr)
static bool foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, const char *format)
static PyObject * pyrna_prop_collection_idprop_clear(BPy_PropertyRNA *self)
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)
static PyObject * pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *args)
PyTypeObject pyrna_func_Type
static PyObject * pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int index)
static PyObject * pyrna_struct_get_data(BPy_DummyPointerRNA *self)
int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class)
static PyGetSetDef pyrna_struct_getseters[]
static PyObject * pyrna_func_to_py(const PointerRNA *ptr, FunctionRNA *func)
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const bool all_args, const char *error_prefix)
static Mathutils_Callback mathutils_rna_array_cb
static PyObject * pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
static PyObject * pyrna_prop_array_foreach_set(BPy_PropertyArrayRNA *self, PyObject *args)
static PyObject * pyrna_struct_values(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObject *args)
static int pyrna_prop_collection_bool(BPy_PropertyRNA *self)
static PyObject * pyrna_struct_as_pointer(BPy_StructRNA *self)
PyMethodDef meth_bpy_unregister_class
static short pyrna_rotation_euler_order_get(PointerRNA *ptr, const short order_fallback, PropertyRNA **r_prop_eul_order)
static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index)
static PyObject * pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject *kw)
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])
static struct PyMethodDef pyrna_struct_methods[]
static PyObject * pyrna_struct_items(BPy_PropertyRNA *self)
static PyObject * foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
static PyObject * pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject *key)
static void pyrna_prop_array_dealloc(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py_ssize_t start, Py_ssize_t stop)
void pyrna_write_set(bool val)
static PyObject * pyrna_struct_repr(BPy_StructRNA *self)
PyMethodDef meth_bpy_register_class
static PyObject * pyrna_bl_owner_id_set(PyObject *UNUSED(self), PyObject *value)
#define MATHUTILS_CB_SUBTYPE_VEC
static int pyrna_deferred_register_class_from_type_hints(StructRNA *srna, PyTypeObject *py_class)
static PyObject * bpy_types_module_getattro(PyObject *self, PyObject *pyname)
static struct PyMethodDef bpy_types_module_methods[]
int pyrna_prop_validity_check(BPy_PropertyRNA *self)
#define MATHUTILS_CB_SUBTYPE_EUL
static PyObject * pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
static PyObject * pyrna_struct_keys(BPy_PropertyRNA *self)
PyObject * pyrna_id_CreatePyObject(ID *id)
static PyGetSetDef pyrna_func_getseters[]
static int pyrna_prop_collection_setattro(BPy_PropertyRNA *self, PyObject *pyname, PyObject *value)
static int pyrna_prop_to_enum_bitfield(PointerRNA *ptr, PropertyRNA *prop, PyObject *value, int *r_value, const char *error_prefix)
static PyMappingMethods pyrna_prop_collection_as_mapping
bool pyrna_id_FromPyObject(PyObject *obj, ID **id)
void BPY_id_release(struct ID *id)
static PyObject * pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *args, PyObject *kw)
static PyObject * pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
static PyObject * pyrna_struct_bl_rna_get_subclass_py(PyObject *cls, PyObject *args)
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)
#define MATHUTILS_CB_SUBTYPE_QUAT
PyObject * BPY_rna_types(void)
static PyObject * pyrna_prop_str(BPy_PropertyRNA *self)
BPy_StructRNA * bpy_context_module
static PyObject * pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObject *value)
static PyObject * pyrna_struct_subscript(BPy_StructRNA *self, PyObject *key)
static bool rna_id_write_error(PointerRNA *ptr, PyObject *key)
static PyObject * pyrna_prop_collection_items(BPy_PropertyRNA *self)
static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix)
static PyObject * pyrna_unregister_class(PyObject *self, PyObject *py_class)
static struct PyMethodDef pyrna_prop_collection_methods[]
static PyObject * pyrna_struct_dir(BPy_StructRNA *self)
static PyObject * pyrna_func_repr(BPy_FunctionRNA *self)
PyTypeObject pyrna_prop_collection_Type
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.type.IDPropertyGroupViewKeys`\n" "\n" BPY_DOC_ID_PROP_TYPE_NOTE)
static PyObject * pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
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)
#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_PROP_CHECK_OBJ(obj)
PyObject * pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
#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(PointerRNA *ptr, PropertyRNA *prop)
PyObject * pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
PyObject * pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
char pyrna_struct_driver_add_doc[]
char pyrna_struct_keyframe_insert_doc[]
PyObject * pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
char pyrna_struct_driver_remove_doc[]
char pyrna_struct_keyframe_delete_doc[]
PyObject * pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
PyObject * pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
PyObject * pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *args)
PyObject * pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SyclQueue void void size_t num_bytes void
int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
PyObject * BPy_IDGroup_MapDataToPy(IDProperty *prop)
PyObject * BPy_Wrap_GetKeys_View_WithID(ID *id, IDProperty *prop)
PyTypeObject BPy_IDGroup_Type
PyObject * BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent)
PyObject * BPy_Wrap_GetValues_View_WithID(ID *id, IDProperty *prop)
PyObject * BPy_Wrap_GetItems_View_WithID(ID *id, IDProperty *prop)
PyTypeObject BPy_IDPropertyUIManager_Type
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
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_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
PyObject * Color_CreatePyObject(const float col[3], PyTypeObject *base_type)
PyObject * Euler_CreatePyObject_cb(PyObject *cb_user, const short order, uchar cb_type, uchar cb_subtype)
PyObject * Euler_CreatePyObject(const float eul[3], const short order, PyTypeObject *base_type)
PyObject * Matrix_CreatePyObject(const float *mat, const ushort col_num, const ushort row_num, PyTypeObject *base_type)
PyObject * Matrix_CreatePyObject_cb(PyObject *cb_user, const ushort col_num, const ushort row_num, uchar cb_type, uchar cb_subtype)
PyObject * Quaternion_CreatePyObject(const float quat[4], PyTypeObject *base_type)
PyObject * Quaternion_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
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)
bool contains(const void *owner, const blender::bke::AttributeIDRef &attribute_id)
T length(const vec_base< T, Size > &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
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)
const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
void PyC_ObSpit(const char *name, PyObject *var)
PyObject * PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
PyObject * PyC_ExceptionBuffer(void)
int PyC_Long_AsBool(PyObject *value)
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format,...)
void PyC_FileAndNum(const char **r_filename, int *r_lineno)
int PyC_ParseBool(PyObject *o, void *p)
void PyC_ObSpitStr(char *result, size_t result_len, PyObject *var)
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)
const char * RNA_struct_identifier(const StructRNA *type)
bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
const char * RNA_function_identifier(FunctionRNA *func)
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)
IDProperty ** RNA_struct_idprops_p(PointerRNA *ptr)
FunctionRNA * RNA_struct_find_function(StructRNA *srna, const char *identifier)
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)
const struct ListBase * RNA_struct_type_properties(StructRNA *srna)
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
void RNA_struct_state_owner_set(const char *name)
void RNA_struct_py_type_set(StructRNA *srna, void *py_type)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
void ** RNA_struct_instance(PointerRNA *ptr)
bool RNA_struct_is_ID(const StructRNA *type)
const char * RNA_property_identifier(const PropertyRNA *prop)
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
bool RNA_property_collection_is_empty(PointerRNA *ptr, PropertyRNA *prop)
int RNA_function_defined(FunctionRNA *func)
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSED(ptr), FunctionRNA *func)
int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr)
const char * RNA_struct_ui_description(const StructRNA *type)
void RNA_blender_rna_pointer_create(PointerRNA *r_ptr)
char * RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
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)
void RNA_property_collection_skip(CollectionPropertyIterator *iter, int num)
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)
int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter)
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax)
PropertyRNA * RNA_struct_type_find_property_no_base(StructRNA *srna, const char *identifier)
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
PropertyType RNA_property_type(PropertyRNA *prop)
const PointerRNA PointerRNA_NULL
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
void RNA_parameter_list_free(ParameterList *parms)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
char * RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen, int *r_len)
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)
void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
IDProperty * RNA_struct_idprops(PointerRNA *ptr, bool create)
void RNA_property_collection_next(CollectionPropertyIterator *iter)
void RNA_parameter_list_next(ParameterIterator *iter)
bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr)
int RNA_property_array_dimension(const PointerRNA *ptr, PropertyRNA *prop, int length[])
void RNA_parameter_list_end(ParameterIterator *UNUSED(iter))
int RNA_function_flag(FunctionRNA *func)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
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)
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
int RNA_parameter_list_arg_count(const ParameterList *parms)
bool RNA_struct_idprops_register_check(const StructRNA *type)
void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
PropertyRNA * RNA_struct_name_property(const StructRNA *type)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_is_idprop(const PropertyRNA *prop)
int RNA_property_string_maxlength(PropertyRNA *prop)
bool RNA_struct_idprops_datablock_allowed(const StructRNA *type)
const ListBase * RNA_function_defined_parameters(FunctionRNA *func)
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)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
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)
void * RNA_struct_py_type_get(StructRNA *srna)
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)
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)
const ListBase * RNA_struct_type_functions(StructRNA *srna)
bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
const char * RNA_struct_state_owner_get(void)
void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
char * RNA_function_as_string_keywords(bContext *C, FunctionRNA *func, const bool as_function, const bool all_args, const int max_prop_length)
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)
int RNA_raw_type_sizeof(RawPropertyType type)
const char * RNA_function_ui_description(FunctionRNA *func)
int RNA_property_collection_raw_set(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *array, RawPropertyType type, int len)
const StructRNA * RNA_struct_base_child_of(const StructRNA *type, const StructRNA *parent_type)
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)
StructRNA * RNA_struct_base(StructRNA *type)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_overridable_library_set(PointerRNA *UNUSED(ptr), PropertyRNA *prop, const bool is_overridable)
char * RNA_path_from_ID_to_struct(const PointerRNA *ptr)
bool RNA_path_resolve_full_maybe_null(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
char * RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
char * RNA_path_from_real_ID_to_property_index(Main *bmain, const PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index, ID **r_real_id)
char * RNA_path_from_real_ID_to_struct(Main *bmain, const PointerRNA *ptr, struct ID **r_real)
const EnumPropertyItem rna_enum_property_type_items[]
const EnumPropertyItem DummyRNA_NULL_items[]
PyObject_HEAD PointerRNA ptr
PyObject_HEAD PointerRNA ptr
PyObject_VAR_HEAD struct IDProperty * property
PyObject_VAR_HEAD struct ID * owner_id
struct IDProperty * parent
PyObject_HEAD PointerRNA ptr
PyObject_HEAD PointerRNA ptr
struct CollectionPointerLink * first
struct CollectionPointerLink * next
struct ReportList * reports