51 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
75 #include "../generic/idprop_py_api.h"
76 #include "../generic/py_capi_utils.h"
77 #include "../generic/python_utildefines.h"
79 #define USE_PEDANTIC_WRITE
81 #define USE_STRING_COERCE
90 #define USE_POSTPONED_ANNOTATIONS
105 #define BPY_DOC_ID_PROP_TYPE_NOTE \
108 " Only the :class:`bpy.types.ID`, :class:`bpy.types.Bone` and\n" \
109 " :class:`bpy.types.PoseBone` classes support custom properties.\n"
117 PyExc_ReferenceError,
"StructRNA of type %.200s has been removed", Py_TYPE(pysrna)->tp_name);
123 if (
self->ptr.type) {
126 PyErr_Format(PyExc_ReferenceError,
127 "PropertyRNA of type %.200s.%.200s has been removed",
128 Py_TYPE(
self)->tp_name,
138 #ifdef USE_PYRNA_INVALIDATE_GC
139 # define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g) + 1))
142 struct gc_generation {
148 static void id_release_gc(
struct ID *
id)
152 for (j = 0; j < 3; j++) {
154 PyGC_Head *gen = (PyGC_Head *)(((
char *)_PyGC_generation0) + (
sizeof(gc_generation) * j));
155 PyGC_Head *g = gen->gc.gc_next;
156 while ((g = g->gc.gc_next) != gen) {
157 PyObject *ob = FROM_GC(g);
173 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
177 static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref);
178 static PyMethodDef id_free_weakref_cb_def = {
179 "id_free_weakref_cb", (PyCFunction)id_free_weakref_cb, METH_O,
NULL};
182 static GHash *id_weakref_pool_get(
ID *
id)
186 if (id_weakref_pool) {
192 weakinfo_hash =
NULL;
195 if (weakinfo_hash ==
NULL) {
201 return weakinfo_hash;
208 PyObject *weakref_capsule;
209 PyObject *weakref_cb_py;
213 GHash *weakinfo_hash = id_weakref_pool_get(
id);
215 weakref_capsule = PyCapsule_New(weakinfo_hash,
NULL,
NULL);
216 weakref_cb_py = PyCFunction_New(&id_free_weakref_cb_def, weakref_capsule);
217 Py_DECREF(weakref_capsule);
220 weakref = PyWeakref_NewRef((PyObject *)pyrna, weakref_cb_py);
222 Py_DECREF(weakref_cb_py);
232 static ID *_id_tmp_ptr;
233 static void value_id_set(
void *
id)
235 _id_tmp_ptr = (
ID *)
id;
238 static void id_release_weakref_list(
struct ID *
id,
GHash *weakinfo_hash);
239 static PyObject *id_free_weakref_cb(PyObject *weakinfo_pair, PyObject *weakref)
242 GHash *weakinfo_hash = PyCapsule_GetPointer(weakinfo_pair,
NULL);
249 id_release_weakref_list(_id_tmp_ptr, weakinfo_hash);
257 static void id_release_weakref_list(
struct ID *
id,
GHash *weakinfo_hash)
263 # ifdef DEBUG_RNA_WEAKREF
264 fprintf(stdout,
"id_release_weakref: '%s', %d items\n",
id->
name,
BLI_ghash_len(weakinfo_hash));
269 PyObject *item = PyWeakref_GET_OBJECT(weakref);
270 if (item != Py_None) {
272 # ifdef DEBUG_RNA_WEAKREF
289 id_weakref_pool =
NULL;
290 # ifdef DEBUG_RNA_WEAKREF
291 printf(
"id_release_weakref freeing pool\n");
296 static void id_release_weakref(
struct ID *
id)
300 id_release_weakref_list(
id, weakinfo_hash);
308 #ifdef USE_PYRNA_INVALIDATE_GC
312 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
313 if (id_weakref_pool) {
314 PyGILState_STATE gilstate = PyGILState_Ensure();
316 id_release_weakref(
id);
318 PyGILState_Release(gilstate);
325 #ifdef USE_PEDANTIC_WRITE
337 if (key && PyUnicode_Check(key)) {
338 pyname = PyUnicode_AsUTF8(key);
341 pyname =
"<UNKNOWN>";
346 PyErr_Format(PyExc_AttributeError,
347 "Writing to ID classes in this context is not allowed: "
348 "%.200s, %.200s datablock, error setting %.200s.%.200s",
361 #ifdef USE_PEDANTIC_WRITE
389 # include "../mathutils/mathutils.h"
398 const short order_fallback,
405 # define MATHUTILS_CB_SUBTYPE_EUL 0
406 # define MATHUTILS_CB_SUBTYPE_VEC 1
407 # define MATHUTILS_CB_SUBTYPE_QUAT 2
408 # define MATHUTILS_CB_SUBTYPE_COLOR 3
416 return self->prop ? 0 : -1;
452 # ifdef USE_PEDANTIC_WRITE
459 PyErr_Format(PyExc_AttributeError,
460 "bpy_prop \"%.200s.%.200s\" is read-only",
468 if (
min != -FLT_MAX ||
max != FLT_MAX) {
470 for (i = 0; i <
len; i++) {
519 # ifdef USE_PEDANTIC_WRITE
526 PyErr_Format(PyExc_AttributeError,
527 "bpy_prop \"%.200s.%.200s\" is read-only",
578 # ifdef USE_PEDANTIC_WRITE
585 PyErr_Format(PyExc_AttributeError,
586 "bpy_prop \"%.200s.%.200s\" is read-only",
610 const short order_fallback,
614 if (*r_prop_eul_order ==
NULL) {
618 if (*r_prop_eul_order) {
626 return order_fallback;
635 #define PROP_ALL_VECTOR_SUBTYPES \
637 case PROP_TRANSLATION: \
638 case PROP_DIRECTION: \
639 case PROP_VELOCITY: \
640 case PROP_ACCELERATION: \
667 goto thick_wrap_slice;
680 if (totdim == 1 || (totdim == 2 && subtype ==
PROP_MATRIX)) {
688 if (
len >= 2 &&
len <= 4) {
805 const char *identifier,
807 const char *error_prefix)
812 PyExc_ValueError,
"%s: '%.200s' not found in (%s)", error_prefix, identifier, enum_str);
833 return (((
a->ptr.data == b->
ptr.
data) && (
a->ptr.type == b->
ptr.
type)) ? 0 : -1);
857 res = ok ? Py_False : Py_True;
864 res = Py_NotImplemented;
871 return Py_INCREF_RET(res);
888 res = ok ? Py_False : Py_True;
895 res = Py_NotImplemented;
902 return Py_INCREF_RET(res);
910 const char *extra_info =
"";
913 return PyUnicode_FromFormat(
"<bpy_struct, %.200s invalid>", Py_TYPE(
self)->tp_name);
916 ID *
id =
self->ptr.owner_id;
918 extra_info =
", evaluated";
927 ret = PyUnicode_FromFormat(
"<bpy_struct, %.200s(\"%.200s\") at %p%s>",
936 return PyUnicode_FromFormat(
"<bpy_struct, %.200s at %p%s>",
944 ID *
id =
self->ptr.owner_id;
953 tmp_str = PyUnicode_FromString(
id->
name + 2);
956 ret = PyUnicode_FromFormat(
969 if (real_id !=
NULL) {
971 tmp_str = PyUnicode_FromString(real_id->
name + 2);
972 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R].%s",
979 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
988 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
1005 const char *type_id =
NULL;
1006 char type_fmt[64] =
"";
1015 PyErr_SetString(PyExc_RuntimeError,
"could not use property type, internal error");
1023 while ((*
c++ = tolower(*type_id++))) {
1034 sprintf(--
c,
"[%d]",
len);
1043 ret = PyUnicode_FromFormat(
"<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
1055 return PyUnicode_FromFormat(
1060 return PyUnicode_FromFormat(
"<bpy_%.200s, %.200s.%.200s>",
1068 ID *
id =
self->ptr.owner_id;
1080 tmp_str = PyUnicode_FromString(
id->
name + 2);
1089 if (real_id !=
id) {
1091 tmp_str = PyUnicode_FromString(real_id->
name + 2);
1093 const char *data_delim = (path[0] ==
'[') ?
"" :
".";
1094 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]%s%s",
1104 ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]...%s",
1127 return PyUnicode_FromFormat(
"<%.200s %.200s.%.200s()>",
1128 Py_TYPE(
self)->tp_name,
1135 return _Py_HashPointer(
self->ptr.data);
1146 x = _Py_HashPointer(
self->ptr.data);
1151 y = _Py_HashPointer((
void *)(
self->prop));
1162 #ifdef USE_PYRNA_STRUCT_REFERENCE
1163 static int pyrna_struct_traverse(
BPy_StructRNA *
self, visitproc visit,
void *arg)
1165 Py_VISIT(
self->reference);
1171 Py_CLEAR(
self->reference);
1179 #ifdef PYRNA_FREE_SUPPORT
1180 if (
self->freeptr &&
self->ptr.data) {
1182 self->ptr.data =
NULL;
1187 if (
self->in_weakreflist !=
NULL) {
1188 PyObject_ClearWeakRefs((PyObject *)
self);
1192 #ifdef USE_PYRNA_STRUCT_REFERENCE
1193 if (
self->reference) {
1194 PyObject_GC_UnTrack(
self);
1195 pyrna_struct_clear(
self);
1200 Py_TYPE(
self)->tp_free(
self);
1203 #ifdef USE_PYRNA_STRUCT_REFERENCE
1204 static void pyrna_struct_reference_set(
BPy_StructRNA *
self, PyObject *reference)
1206 if (
self->reference) {
1207 PyObject_GC_UnTrack(
self);
1208 Py_CLEAR(
self->reference);
1213 self->reference = reference;
1214 Py_INCREF(reference);
1215 PyObject_GC_Track(
self);
1224 if (
self->in_weakreflist !=
NULL) {
1225 PyObject_ClearWeakRefs((PyObject *)
self);
1229 Py_TYPE(
self)->tp_free(
self);
1235 if (
self->in_weakreflist !=
NULL) {
1236 PyObject_ClearWeakRefs((PyObject *)
self);
1240 Py_TYPE(
self)->tp_free(
self);
1267 const char *param = PyUnicode_AsUTF8(item);
1269 if (param ==
NULL) {
1270 PyErr_Format(PyExc_TypeError,
1271 "%.200s expected a string enum, not %.200s",
1273 Py_TYPE(item)->tp_name);
1279 PyErr_Format(PyExc_TypeError,
1280 "%.200s enum \"%.200s\" not found in (%s)",
1302 bool type_convert_sign,
1304 const char *error_prefix)
1308 Py_ssize_t
hash = 0;
1313 while (_PySet_NextEntry(value, &
pos, &key, &
hash)) {
1314 const char *param = PyUnicode_AsUTF8(key);
1315 if (param ==
NULL) {
1316 PyErr_Format(PyExc_TypeError,
1317 "%.200s expected a string, not %.200s",
1319 Py_TYPE(key)->tp_name);
1330 if (type_convert_sign) {
1331 if (type_size == 2) {
1333 signed short as_signed;
1336 ret_convert.as_signed = (
signed short)
ret;
1337 index = (int)ret_convert.as_unsigned;
1339 else if (type_size == 1) {
1341 signed char as_signed;
1344 ret_convert.as_signed = (
signed char)
ret;
1345 index = (int)ret_convert.as_unsigned;
1366 const char *error_prefix)
1373 Py_ssize_t
hash = 0;
1378 while (_PySet_NextEntry(value, &
pos, &key, &
hash)) {
1379 const char *param = PyUnicode_AsUTF8(key);
1381 if (param ==
NULL) {
1382 PyErr_Format(PyExc_TypeError,
1383 "%.200s expected a string, not %.200s",
1385 Py_TYPE(key)->tp_name);
1409 if (!PyAnySet_Check(value)) {
1410 PyErr_Format(PyExc_TypeError,
1411 "%.200s, %.200s.%.200s expected a set, not a %.200s",
1415 Py_TYPE(value)->tp_name);
1425 if (PySet_GET_SIZE(value)) {
1426 PyErr_Format(PyExc_TypeError,
1427 "%.200s: empty enum \"%.200s\" could not have any values assigned",
1446 PyObject *
ret = PySet_New(
NULL);
1452 for (index = 0; identifier[index]; index++) {
1453 item = PyUnicode_FromString(identifier[index]);
1454 PySet_Add(
ret, item);
1474 for (index = 0; identifier[index]; index++) {
1475 item = PyUnicode_FromString(identifier[index]);
1476 PySet_Add(
ret, item);
1482 const char *identifier;
1484 ret = PyUnicode_FromString(identifier);
1500 "current value '%d' "
1501 "matches no enum in '%s', '%s', '%s'",
1508 char error_str[256];
1511 "RNA Warning: Current value \"%d\" "
1512 "matches no enum in '%s', '%s', '%s'",
1518 PyErr_Warn(PyExc_RuntimeWarning, error_str);
1526 ret = PyUnicode_FromString(
"");
1528 PyErr_Format(PyExc_AttributeError,
"RNA Error: Current value \"%d\" matches no enum", val);
1564 #ifdef USE_STRING_COERCE
1567 ret = PyBytes_FromStringAndSize(buf, buf_len);
1573 ret = PyUnicode_FromStringAndSize(buf, buf_len);
1577 ret = PyBytes_FromStringAndSize(buf, buf_len);
1580 ret = PyUnicode_FromStringAndSize(buf, buf_len);
1583 if (buf_fixed != buf) {
1608 PyErr_Format(PyExc_TypeError,
1609 "bpy_struct internal error: unknown type '%d' (pyrna_prop_to_py)",
1624 const bool all_args,
1625 const char *error_prefix)
1629 const char *arg_name =
NULL;
1632 totkw = kw ? PyDict_Size(kw) : 0;
1637 if (
STREQ(arg_name,
"rna_type")) {
1642 PyErr_Format(PyExc_TypeError,
1643 "%.200s: no keywords, expected \"%.200s\"",
1645 arg_name ? arg_name :
"<UNKNOWN>");
1650 item = PyDict_GetItemString(kw, arg_name);
1654 PyErr_Format(PyExc_TypeError,
1655 "%.200s: keyword \"%.200s\" missing",
1657 arg_name ? arg_name :
"<UNKNOWN>");
1672 if (error_val == 0 && totkw > 0) {
1673 PyObject *key, *value;
1676 while (PyDict_Next(kw, &
pos, &key, &value)) {
1677 arg_name = PyUnicode_AsUTF8(key);
1684 PyErr_Format(PyExc_TypeError,
1685 "%.200s: keyword \"%.200s\" unrecognized",
1687 arg_name ? arg_name :
"<UNKNOWN>");
1698 pyfunc->
func = func;
1699 return (PyObject *)pyfunc;
1725 param = PyObject_IsTrue(value);
1728 param = PyC_Long_AsI32(value);
1736 PyErr_Format(PyExc_TypeError,
1737 "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s",
1741 Py_TYPE(value)->tp_name);
1746 *((
bool *)
data) = param;
1756 const long param = PyLong_AsLongAndOverflow(value, &overflow);
1757 if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
1758 PyErr_Format(PyExc_ValueError,
1759 "%.200s %.200s.%.200s value not in 'int' range "
1766 if (param == -1 && PyErr_Occurred()) {
1767 PyErr_Format(PyExc_TypeError,
1768 "%.200s %.200s.%.200s expected an int type, not %.200s",
1772 Py_TYPE(value)->tp_name);
1776 int param_i = (int)param;
1779 *((
int *)
data) = param_i;
1788 const float param = PyFloat_AsDouble(value);
1789 if (PyErr_Occurred()) {
1790 PyErr_Format(PyExc_TypeError,
1791 "%.200s %.200s.%.200s expected a float type, not %.200s",
1795 Py_TYPE(value)->tp_name);
1801 *((
float *)
data) = param;
1813 if (value == Py_None) {
1829 "%.200s %.200s.%.200s doesn't support None from string types",
1840 param = PyBytes_AsString(value);
1842 if (param ==
NULL) {
1843 if (PyBytes_Check(value)) {
1848 "%.200s %.200s.%.200s error assigning bytes",
1854 PyErr_Format(PyExc_TypeError,
1855 "%.200s %.200s.%.200s expected a bytes type, not %.200s",
1859 Py_TYPE(value)->tp_name);
1870 *((
char **)
data) = (
char *)param;
1879 #ifdef USE_STRING_COERCE
1880 PyObject *value_coerce =
NULL;
1886 param = PyUnicode_AsUTF8(value);
1889 param = PyUnicode_AsUTF8(value);
1892 if (param ==
NULL) {
1893 if (PyUnicode_Check(value)) {
1898 "%.200s %.200s.%.200s error assigning string",
1904 PyErr_Format(PyExc_TypeError,
1905 "%.200s %.200s.%.200s expected a string type, not %.200s",
1909 Py_TYPE(value)->tp_name);
1923 *((
char **)
data) = (
char *)param;
1930 #ifdef USE_STRING_COERCE
1931 Py_XDECREF(value_coerce);
1954 *((
int *)
data) = val;
1963 PyObject *value_new =
NULL;
1993 if (PyDict_Check(value)) {
2014 PyErr_Format(PyExc_TypeError,
2015 "%.200s %.200s.%.200s collection has no type, "
2016 "can't be used as a %.200s type",
2026 if (value == Py_None) {
2028 PyErr_Format(PyExc_TypeError,
2029 "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type",
2034 Py_XDECREF(value_new);
2041 PyErr_Format(PyExc_TypeError,
2042 "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
2047 Py_TYPE(value)->tp_name);
2048 Py_XDECREF(value_new);
2054 if (value_owner_id !=
NULL) {
2056 PyErr_Format(PyExc_TypeError,
2057 "%.200s %.200s.%.200s ID type does not support assignment to itself",
2061 Py_XDECREF(value_new);
2068 PyErr_Format(PyExc_TypeError,
2069 "%.200s %.200s.%.200s ID type assignment is temporary, can't assign",
2073 Py_XDECREF(value_new);
2080 bool raise_error =
false;
2085 if (param ==
NULL) {
2100 if (param ==
NULL) {
2111 else if (param ==
NULL) {
2130 Py_XDECREF(value_new);
2146 PyErr_Format(PyExc_TypeError,
2147 "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
2154 Py_XDECREF(value_new);
2158 Py_XDECREF(value_new);
2163 Py_ssize_t seq_len, i;
2172 if (!PySequence_Check(value)) {
2175 "%.200s %.200s.%.200s expected a sequence for an RNA collection, not %.200s",
2179 Py_TYPE(value)->tp_name);
2183 seq_len = PySequence_Size(value);
2184 for (i = 0; i < seq_len; i++) {
2185 item = PySequence_GetItem(value, i);
2190 "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection",
2199 if (PyDict_Check(item) == 0) {
2200 PyErr_Format(PyExc_TypeError,
2201 "%.200s %.200s.%.200s expected a each sequence "
2202 "member to be a dict for an RNA collection, not %.200s",
2206 Py_TYPE(item)->tp_name);
2213 link->
ptr = itemptr;
2221 &itemptr, item,
true,
"Converting a Python list to an RNA collection") == -1) {
2223 const char *msg_char = PyUnicode_AsUTF8(msg);
2225 PyErr_Format(PyExc_TypeError,
2226 "%.200s %.200s.%.200s error converting a member of a collection "
2227 "from a dicts into an RNA collection, failed with: %s",
2243 PyErr_Format(PyExc_AttributeError,
2244 "%.200s %.200s.%.200s unknown property type (pyrna_py_to_prop)",
2277 &
self->ptr,
self->prop,
self->arraydim,
self->arrayoffset, index, value,
"") == -1) {
2298 int param = PyC_Long_AsI32(value);
2299 if (param == -1 && PyErr_Occurred()) {
2300 PyErr_SetString(PyExc_TypeError,
"expected an int type");
2310 float param = PyFloat_AsDouble(value);
2311 if (PyErr_Occurred()) {
2312 PyErr_SetString(PyExc_TypeError,
"expected a float type");
2322 PyErr_SetString(PyExc_AttributeError,
"not an array type");
2381 #define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \
2383 keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \
2384 if (keynum_abs < 0) { \
2385 PyErr_Format(PyExc_IndexError, "bpy_prop_collection[%d]: out of range.", keynum); \
2395 Py_ssize_t keynum_abs = keynum;
2406 if (keynum_abs >=
len) {
2407 PyErr_Format(PyExc_IndexError,
2408 "bpy_prop_collection[index]: "
2409 "index %d out of range, size %d",
2414 PyErr_Format(PyExc_RuntimeError,
2415 "bpy_prop_collection[index]: internal error, "
2416 "valid index %d given in %d sized collection, but value not found",
2429 Py_ssize_t keynum_abs = keynum;
2438 if (keynum_abs >=
len) {
2439 PyErr_Format(PyExc_IndexError,
2440 "bpy_prop_collection[index] = value: "
2441 "index %d out of range, size %d",
2447 PyErr_Format(PyExc_IndexError,
2448 "bpy_prop_collection[index] = value: "
2449 "failed assignment (unknown reason)",
2470 if (keynum >= 0 && keynum <
len) {
2474 PyErr_Format(PyExc_IndexError,
"bpy_prop_array[index]: index %d out of range", keynum);
2488 PyErr_Format(PyExc_KeyError,
"bpy_prop_collection[key]: key \"%.200s\" not found", keyname);
2506 const char *err_prefix,
2507 const short err_not_found,
2510 const char *keyname;
2513 if (PyTuple_GET_SIZE(key) != 2) {
2514 PyErr_Format(PyExc_KeyError,
2515 "%s: tuple key must be a pair, not size %d",
2517 PyTuple_GET_SIZE(key));
2521 PyErr_Format(PyExc_KeyError,
2522 "%s: is only valid for bpy.data collections, not %.200s",
2527 if ((keyname = PyUnicode_AsUTF8(PyTuple_GET_ITEM(key, 0))) ==
NULL) {
2528 PyErr_Format(PyExc_KeyError,
2529 "%s: id must be a string, not %.200s",
2531 Py_TYPE(PyTuple_GET_ITEM(key, 0))->tp_name);
2535 PyObject *keylib = PyTuple_GET_ITEM(key, 1);
2539 if (keylib == Py_None) {
2542 else if (PyUnicode_Check(keylib)) {
2543 Main *bmain =
self->ptr.data;
2544 const char *keylib_str = PyUnicode_AsUTF8(keylib);
2547 if (err_not_found) {
2548 PyErr_Format(PyExc_KeyError,
2549 "%s: lib filepath '%.1024s' "
2550 "does not reference a valid library",
2560 PyErr_Format(PyExc_KeyError,
2561 "%s: lib must be a string or None, not %.200s",
2563 Py_TYPE(keylib)->tp_name);
2571 ID *
id = itemptr.data;
2583 if ((found ==
false) && err_not_found) {
2585 PyErr_SetString(PyExc_KeyError,
"bpy_prop_collection[key, lib]: not found");
2594 const char *err_prefix,
2595 const bool err_not_found)
2599 self, key, err_prefix, err_not_found, &
ptr);
2601 if (contains == 1) {
2620 list = PyList_New(0);
2629 PyList_APPEND(list, item);
2632 if (
count == stop) {
2660 tuple = PyTuple_New(stop - start);
2675 values = PyMem_MALLOC(
sizeof(
float) *
length);
2678 values = values_stack;
2683 PyTuple_SET_ITEM(tuple,
count - start, PyFloat_FromDouble(values[
count]));
2686 if (values != values_stack) {
2695 values = PyMem_MALLOC(
sizeof(
bool) *
length);
2698 values = values_stack;
2703 PyTuple_SET_ITEM(tuple,
count - start, PyBool_FromLong(values[
count]));
2706 if (values != values_stack) {
2715 values = PyMem_MALLOC(
sizeof(
int) *
length);
2718 values = values_stack;
2723 PyTuple_SET_ITEM(tuple,
count - start, PyLong_FromLong(values[
count]));
2726 if (values != values_stack) {
2734 PyErr_SetString(PyExc_TypeError,
"not an array type");
2747 if (PyUnicode_Check(key)) {
2750 if (PyIndex_Check(key)) {
2751 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2752 if (i == -1 && PyErr_Occurred()) {
2758 if (PySlice_Check(key)) {
2759 PySliceObject *key_slice = (PySliceObject *)key;
2760 Py_ssize_t step = 1;
2762 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2766 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection[slice]: slice steps not supported");
2769 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2773 Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
2776 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
2779 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
2783 if (start < 0 || stop < 0) {
2796 if (stop - start <= 0) {
2797 return PyList_New(0);
2802 if (PyTuple_Check(key)) {
2805 self, key,
"bpy_prop_collection[id, lib]",
true);
2808 PyErr_Format(PyExc_TypeError,
2809 "bpy_prop_collection[key]: invalid key, "
2810 "must be a string or an int, not %.200s",
2811 Py_TYPE(key)->tp_name);
2821 if (value == Py_None) {
2823 PyErr_Format(PyExc_TypeError,
2824 "bpy_prop_collection[key] = value: invalid, "
2825 "this collection doesn't support None assignment");
2832 PyErr_Format(PyExc_TypeError,
2833 "bpy_prop_collection[key] = value: invalid, "
2834 "expected a StructRNA type or None, not a %.200s",
2835 Py_TYPE(value)->tp_name);
2841 PyErr_Format(PyExc_TypeError,
2842 "bpy_prop_collection[key] = value: invalid, "
2843 "expected a '%.200s' type or None, not a '%.200s'",
2852 PyErr_Format(PyExc_TypeError,
2853 "bpy_prop_collection[key] = value: internal error, "
2854 "failed to get the collection type");
2867 if (value ==
NULL) {
2868 PyErr_SetString(PyExc_TypeError,
"del bpy_prop_collection[key]: not supported");
2876 if (PyUnicode_Check(key)) {
2881 if (PyIndex_Check(key)) {
2882 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2883 if (i == -1 && PyErr_Occurred()) {
2890 else if (PySlice_Check(key)) {
2891 PySliceObject *key_slice = (PySliceObject *)key;
2892 Py_ssize_t step = 1;
2894 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2897 else if (step != 1) {
2898 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection[slice]: slice steps not supported");
2901 else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2905 Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
2908 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
2911 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
2915 if (start < 0 || stop < 0) {
2928 if (stop - start <= 0) {
2929 return PyList_New(0);
2938 PyErr_Format(PyExc_TypeError,
2939 "bpy_prop_collection[key]: invalid key, "
2940 "must be a string or an int, not %.200s",
2941 Py_TYPE(key)->tp_name);
2950 if (PyUnicode_Check(key)) {
2951 return pyrna_prop_array_subscript_str(
self, PyUnicode_AsUTF8(key));
2955 if (PyIndex_Check(key)) {
2956 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
2957 if (i == -1 && PyErr_Occurred()) {
2962 if (PySlice_Check(key)) {
2963 Py_ssize_t step = 1;
2964 PySliceObject *key_slice = (PySliceObject *)key;
2966 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
2970 PyErr_SetString(PyExc_TypeError,
"bpy_prop_array[slice]: slice steps not supported");
2973 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
2981 Py_ssize_t start, stop, slicelength;
2983 if (PySlice_GetIndicesEx(key,
len, &start, &stop, &step, &slicelength) < 0) {
2987 if (slicelength <= 0) {
2988 return PyTuple_New(0);
2994 PyErr_SetString(PyExc_AttributeError,
"bpy_prop_array[key]: invalid key, key must be an int");
3004 PyObject *value_fast;
3005 if (!(value_fast = PySequence_Fast(value,
3006 "bpy_prop_array[slice] = value: "
3007 "element in assignment is not a sequence type"))) {
3010 if (PySequence_Fast_GET_SIZE(value_fast) !=
length) {
3011 Py_DECREF(value_fast);
3012 PyErr_SetString(PyExc_ValueError,
3013 "bpy_prop_array[slice] = value: "
3014 "re-sizing bpy_struct element in arrays isn't supported");
3023 PyObject **value_items,
float *value,
int totdim,
const int dimsize[],
const float range[2])
3025 const int length = dimsize[0];
3029 for (i = 0; i !=
length; i++) {
3036 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1], range);
3038 Py_DECREF(subvalue);
3044 const float min = range[0],
max = range[1];
3046 for (i = 0; i !=
length; i++) {
3047 float v = PyFloat_AsDouble(value_items[i]);
3055 PyObject **value_items,
int *value,
int totdim,
const int dimsize[],
const int range[2])
3057 const int length = dimsize[0];
3061 for (i = 0; i !=
length; i++) {
3068 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1], range);
3070 Py_DECREF(subvalue);
3076 const int min = range[0],
max = range[1];
3078 for (i = 0; i !=
length; i++) {
3079 int v = PyLong_AsLong(value_items[i]);
3089 const int dimsize[])
3091 const int length = dimsize[0];
3095 for (i = 0; i !=
length; i++) {
3102 PySequence_Fast_ITEMS(subvalue), &value[index], totdim - 1, &dimsize[1]);
3104 Py_DECREF(subvalue);
3111 for (i = 0; i !=
length; i++) {
3112 const int v = PyLong_AsLong(value_items[i]);
3126 PyObject *value_orig)
3130 PyObject **value_items;
3131 void *values_alloc =
NULL;
3134 if (value_orig ==
NULL) {
3137 "bpy_prop_array[slice] = value: deleting with list types is not supported by bpy_struct");
3141 if (!(value = PySequence_Fast(
3142 value_orig,
"bpy_prop_array[slice] = value: assignment is not a sequence type"))) {
3146 if (PySequence_Fast_GET_SIZE(value) != stop - start) {
3148 PyErr_SetString(PyExc_TypeError,
3149 "bpy_prop_array[slice] = value: re-sizing bpy_struct arrays isn't supported");
3161 for (
int i = arraydim + 1; i < totdim; i++) {
3166 value_items = PySequence_Fast_ITEMS(value);
3171 (values_alloc = PyMem_MALLOC(
sizeof(*values) * length_flat)) :
3173 if (start != 0 || stop !=
length) {
3181 dimsize[arraydim] = stop - start;
3183 &values[arrayoffset + (start * span)],
3188 if (PyErr_Occurred()) {
3199 (values_alloc = PyMem_MALLOC(
sizeof(*values) * length_flat)) :
3201 if (start != 0 || stop !=
length) {
3209 dimsize[arraydim] = stop - start;
3211 &values[arrayoffset + (start * span)],
3216 if (PyErr_Occurred()) {
3227 (values_alloc = PyMem_MALLOC(
sizeof(
bool) * length_flat)) :
3230 if (start != 0 || stop !=
length) {
3235 dimsize[arraydim] = stop - start;
3237 &values[arrayoffset + (start * span)],
3239 &dimsize[arraydim]);
3241 if (PyErr_Occurred()) {
3250 PyErr_SetString(PyExc_TypeError,
"not an array type");
3258 PyMem_FREE(values_alloc);
3278 if (keynum >= 0 && keynum <
len) {
3282 PyErr_SetString(PyExc_IndexError,
"bpy_prop_array[index] = value: index out of range");
3296 PyErr_Format(PyExc_AttributeError,
3297 "bpy_prop_collection: attribute \"%.200s\" from \"%.200s\" is read-only",
3303 else if (PyIndex_Check(key)) {
3304 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
3305 if (i == -1 && PyErr_Occurred()) {
3312 else if (PySlice_Check(key)) {
3314 Py_ssize_t start, stop, step, slicelength;
3316 if (PySlice_GetIndicesEx(key,
len, &start, &stop, &step, &slicelength) < 0) {
3319 else if (slicelength <= 0) {
3322 else if (step == 1) {
3327 PyErr_SetString(PyExc_TypeError,
"slice steps not supported with RNA");
3332 PyErr_SetString(PyExc_AttributeError,
"invalid key, key must be an int");
3393 if (PyTuple_Check(key)) {
3396 self, key,
"(id, lib) in bpy_prop_collection",
false,
NULL);
3400 const char *keyname = PyUnicode_AsUTF8(key);
3402 if (keyname ==
NULL) {
3403 PyErr_SetString(PyExc_TypeError,
3404 "bpy_prop_collection.__contains__: expected a string or a tuple of strings");
3418 const char *name = PyUnicode_AsUTF8(value);
3423 PyErr_SetString(PyExc_TypeError,
"bpy_struct.__contains__: expected a string");
3428 PyErr_SetString(PyExc_TypeError,
"bpy_struct: this type doesn't support IDProperties");
3488 const char *name = PyUnicode_AsUTF8(key);
3493 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
3498 PyErr_SetString(PyExc_TypeError,
3499 "bpy_struct[key]: only strings are allowed as keys of ID properties");
3505 if (group ==
NULL) {
3506 PyErr_Format(PyExc_KeyError,
"bpy_struct[key]: key \"%s\" not found", name);
3512 if (idprop ==
NULL) {
3513 PyErr_Format(PyExc_KeyError,
"bpy_struct[key]: key \"%s\" not found", name);
3528 #ifdef USE_PEDANTIC_WRITE
3534 if (group ==
NULL) {
3535 PyErr_SetString(PyExc_TypeError,
3536 "bpy_struct[key] = val: id properties not supported for this type");
3547 "bpy_struct[key] = val: datablock id properties not supported for this type");
3563 ".. method:: keys()\n"
3565 " Returns the keys of this objects custom properties (matches Python's\n"
3566 " dictionary function of the same name).\n"
3568 " :return: custom property keys.\n"
3569 " :rtype: list of strings\n"
3576 PyErr_SetString(PyExc_TypeError,
"bpy_struct.keys(): this type doesn't support IDProperties");
3582 if (group ==
NULL) {
3583 return PyList_New(0);
3590 ".. method:: items()\n"
3592 " Returns the items of this objects custom properties (matches Python's\n"
3593 " dictionary function of the same name).\n"
3595 " :return: custom property key, value pairs.\n"
3596 " :rtype: list of key, value tuples\n"
3603 PyErr_SetString(PyExc_TypeError,
"bpy_struct.items(): this type doesn't support IDProperties");
3609 if (group ==
NULL) {
3610 return PyList_New(0);
3617 ".. method:: values()\n"
3619 " Returns the values of this objects custom properties (matches Python's\n"
3620 " dictionary function of the same name).\n"
3622 " :return: custom property values.\n"
3630 PyErr_SetString(PyExc_TypeError,
3631 "bpy_struct.values(): this type doesn't support IDProperties");
3637 if (group ==
NULL) {
3638 return PyList_New(0);
3645 ".. method:: is_property_set(property, ghost=True)\n"
3647 " Check if a property is set, use for testing operator properties.\n"
3649 " :arg ghost: Used for operators that re-run with previous settings.\n"
3650 " In this case the property is not marked as set,\n"
3651 " yet the value from the previous execution is used.\n"
3653 " In rare cases you may want to set this option to false.\n"
3655 " :type ghost: boolean\n"
3656 " :return: True when the property has been set.\n"
3657 " :rtype: boolean\n");
3662 bool use_ghost =
true;
3666 static const char *_keywords[] = {
"",
"ghost",
NULL};
3667 static _PyArg_Parser _parser = {
"s|$O&:is_property_set", _keywords, 0};
3668 if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &name,
PyC_ParseBool, &use_ghost)) {
3673 PyErr_Format(PyExc_TypeError,
3674 "%.200s.is_property_set(\"%.200s\") not found",
3684 ".. method:: property_unset(property)\n"
3686 " Unset a property, will use default value afterward.\n");
3694 if (!PyArg_ParseTuple(args,
"s:property_unset", &name)) {
3699 PyErr_Format(PyExc_TypeError,
3700 "%.200s.property_unset(\"%.200s\") not found",
3712 ".. method:: is_property_hidden(property)\n"
3714 " Check if a property is hidden.\n"
3716 " :return: True when the property is hidden.\n"
3717 " :rtype: boolean\n");
3725 if (!PyArg_ParseTuple(args,
"s:is_property_hidden", &name)) {
3730 PyErr_Format(PyExc_TypeError,
3731 "%.200s.is_property_hidden(\"%.200s\") not found",
3741 ".. method:: is_property_readonly(property)\n"
3743 " Check if a property is readonly.\n"
3745 " :return: True when the property is readonly (not writable).\n"
3746 " :rtype: boolean\n");
3754 if (!PyArg_ParseTuple(args,
"s:is_property_readonly", &name)) {
3759 PyErr_Format(PyExc_TypeError,
3760 "%.200s.is_property_readonly(\"%.200s\") not found",
3770 ".. method:: is_property_overridable_library(property)\n"
3772 " Check if a property is overridable.\n"
3774 " :return: True when the property is overridable.\n"
3775 " :rtype: boolean\n");
3783 if (!PyArg_ParseTuple(args,
"s:is_property_overridable_library", &name)) {
3788 PyErr_Format(PyExc_TypeError,
3789 "%.200s.is_property_overridable_library(\"%.200s\") not found",
3799 ".. method:: property_overridable_library_set(property, overridable)\n"
3801 " Define a property as overridable or not (only for custom properties!).\n"
3803 " :return: True when the overridable status of the property was successfully set.\n"
3804 " :rtype: boolean\n");
3813 if (!PyArg_ParseTuple(args,
"sp:property_overridable_library_set", &name, &is_overridable)) {
3818 PyErr_Format(PyExc_TypeError,
3819 "%.200s.property_overridable_library_set(\"%.200s\") not found",
3825 return PyBool_FromLong(
3830 ".. method:: path_resolve(path, coerce=True)\n"
3832 " Returns the property from the path, raise an exception when not found.\n"
3834 " :arg path: path which this property resolves.\n"
3835 " :type path: string\n"
3836 " :arg coerce: optional argument, when True, the property will be converted\n"
3837 " into its Python representation.\n"
3838 " :type coerce: boolean\n");
3842 PyObject *coerce = Py_True;
3849 if (!PyArg_ParseTuple(args,
"s|O!:path_resolve", &path, &PyBool_Type, &coerce)) {
3857 PyErr_Format(PyExc_IndexError,
3858 "%.200s.path_resolve(\"%.200s\") index out of range",
3867 if (coerce == Py_False) {
3877 PyErr_Format(PyExc_ValueError,
3878 "%.200s.path_resolve(\"%.200s\") could not be resolved",
3885 ".. method:: path_from_id(property=\"\")\n"
3887 " Returns the data path from the ID to this object (string).\n"
3889 " :arg property: Optional property name which can be used if the path is\n"
3890 " to a property of this object.\n"
3891 " :type property: string\n"
3892 " :return: The path from :class:`bpy.types.bpy_struct.id_data`\n"
3893 " to this struct and property (when given).\n"
3897 const char *name =
NULL;
3904 if (!PyArg_ParseTuple(args,
"|s:path_from_id", &name)) {
3911 PyErr_Format(PyExc_AttributeError,
3912 "%.200s.path_from_id(\"%.200s\") not found",
3926 PyErr_Format(PyExc_ValueError,
3927 "%.200s.path_from_id(\"%s\") found, but does not support path creation",
3932 PyErr_Format(PyExc_ValueError,
3933 "%.200s.path_from_id() does not support path creation for this type",
3939 ret = PyUnicode_FromString(path);
3946 ".. method:: path_from_id()\n"
3948 " Returns the data path from the ID to this property (string).\n"
3950 " :return: The path from :class:`bpy.types.bpy_struct.id_data` to this property.\n"
3961 PyErr_Format(PyExc_ValueError,
3962 "%.200s.%.200s.path_from_id() does not support path creation for this type",
3968 ret = PyUnicode_FromString(path);
3975 ".. method:: as_bytes()\n"
3977 " Returns this string property as a byte rather than a Python string.\n"
3979 " :return: The string as bytes.\n"
3980 " :rtype: bytes\n");
3985 PyErr_Format(PyExc_TypeError,
3986 "%.200s.%.200s.as_bytes() must be a string",
3993 char buf_fixed[256], *buf;
3997 &
self->ptr,
self->prop, buf_fixed,
sizeof(buf_fixed), &buf_len);
3999 ret = PyBytes_FromStringAndSize(buf, buf_len);
4001 if (buf_fixed != buf) {
4009 ".. method:: update()\n"
4011 " Execute the properties update callback.\n"
4014 " This is called when assigning a property,\n"
4015 " however in rare cases it's useful to call explicitly.\n");
4023 ".. method:: type_recast()\n"
4025 " Return a new instance, this is needed because types\n"
4026 " such as textures can be changed at runtime.\n"
4028 " :return: a new instance of this object with the type initialized again.\n"
4029 " :rtype: subclass of :class:`bpy.types.bpy_struct`\n");
4045 PyObject *ret_test =
NULL;
4046 PyObject *subclasses = ((PyTypeObject *)cls)->tp_subclasses;
4051 PyObject *key =
NULL;
4053 PyObject *value =
NULL;
4054 while (PyDict_Next(subclasses, &
pos, &key, &value)) {
4056 PyObject *subcls = PyWeakref_GET_OBJECT(value);
4057 if (subcls != Py_None) {
4078 ".. classmethod:: bl_rna_get_subclass_py(id, default=None)\n"
4080 " :arg id: The RNA type identifier.\n"
4081 " :type id: string\n"
4082 " :return: The class or default when not found.\n"
4087 PyObject *ret_default = Py_None;
4089 if (!PyArg_ParseTuple(args,
"s|O:bl_rna_get_subclass_py", &
id, &ret_default)) {
4096 return Py_INCREF_RET(
ret);
4100 ".. classmethod:: bl_rna_get_subclass(id, default=None)\n"
4102 " :arg id: The RNA type identifier.\n"
4103 " :type id: string\n"
4104 " :return: The RNA type or default when not found.\n"
4105 " :rtype: :class:`bpy.types.Struct` subclass\n");
4109 PyObject *ret_default = Py_None;
4111 if (!PyArg_ParseTuple(args,
"s|O:bl_rna_get_subclass", &
id, &ret_default)) {
4117 if (py_srna ==
NULL) {
4118 PyErr_SetString(PyExc_ValueError,
"Not a registered class");
4138 return Py_INCREF_RET(ret_default);
4145 list_tmp = PyDict_Keys(dict);
4146 PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
4147 Py_DECREF(list_tmp);
4153 PyObject **dict_ptr;
4155 dict_ptr = _PyObject_GetDictPtr((PyObject *)
self);
4157 if (dict_ptr && (dict = *dict_ptr)) {
4161 dict = ((PyTypeObject *)Py_TYPE(
self))->tp_dict;
4174 dict = ((PyTypeObject *)cls)->tp_dict;
4198 PyList_APPEND(list, PyUnicode_FromString(idname));
4208 char name[256], *nameptr;
4221 PyList_APPEND(list, PyUnicode_FromStringAndSize(nameptr, namelen));
4223 if (name != nameptr) {
4240 ret = PyList_New(0);
4252 for (link = lb.
first; link; link = link->
next) {
4253 PyList_APPEND(
ret, PyUnicode_FromString(link->
data));
4263 PyObject *set = PySet_New(
ret);
4266 ret = PySequence_List(set);
4276 const char *name = PyUnicode_AsUTF8(pyname);
4284 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: __getattr__ must be a string");
4291 if (
STR_ELEM(name,
"__getitem__",
"__setitem__") &&
4293 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: no __getitem__ support for this type");
4297 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4310 PyErr_Format(PyExc_AttributeError,
4311 "bpy_struct: Context is 'NULL', can't get \"%.200s\" from context",
4336 ret = PyList_New(0);
4338 for (link = newlb.
first; link; link = link->
next) {
4347 PyErr_Format(PyExc_AttributeError,
4348 "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
4361 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4369 PyErr_Format(PyExc_AttributeError,
"bpy_struct: attribute \"%.200s\" not found", name);
4379 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4386 static int pyrna_struct_pydict_contains(PyObject *
self, PyObject *pyname)
4388 PyObject *dict = *(_PyObject_GetDictPtr((PyObject *)
self));
4393 return PyDict_Contains(dict, pyname);
4400 static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr)
4402 PyObject *
ret = PyType_Type.tp_getattro(cls, attr);
4436 const char *attr_str = PyUnicode_AsUTF8(attr);
4440 PyErr_Format(PyExc_AttributeError,
4441 "pyrna_struct_meta_idprop_setattro() "
4442 "can't set in readonly state '%.200s.%S'",
4443 ((PyTypeObject *)cls)->tp_name,
4451 if (value && is_deferred_prop) {
4452 PyErr_Format(PyExc_AttributeError,
4453 "pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'",
4454 ((PyTypeObject *)cls)->tp_name);
4460 return PyType_Type.tp_setattro(cls, attr, value);
4465 if (is_deferred_prop) {
4486 PyExc_TypeError,
"struct_meta_idprop.detattr(): '%s' not a dynamic property", attr_str);
4492 return PyType_Type.tp_setattro(cls, attr, value);
4497 const char *name = PyUnicode_AsUTF8(pyname);
4502 #ifdef USE_PEDANTIC_WRITE
4509 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: __setattr__ must be a string");
4514 PyErr_Format(PyExc_AttributeError,
4515 "bpy_struct: attribute \"%.200s\" from \"%.200s\" is read-only",
4526 PyErr_Format(PyExc_AttributeError,
4527 "bpy_struct: Context is 'NULL', can't set \"%.200s\" from context",
4540 PyExc_AttributeError,
"bpy_struct: Context property \"%.200s\" is read-only", name);
4550 if (value ==
NULL) {
4551 PyErr_SetString(PyExc_AttributeError,
"bpy_struct: del not supported");
4557 return PyObject_GenericSetAttr((PyObject *)
self, pyname, value);
4567 ret = PyList_New(0);
4584 return PyObject_GenericGetAttr((PyObject *)
self, pyname);
4589 const char *name = PyUnicode_AsUTF8(pyname);
4592 PyErr_SetString(PyExc_AttributeError,
"bpy_prop_collection: __getattr__ must be a string");
4595 if (name[0] !=
'_') {
4610 Py_DECREF(self_collection);
4618 return PyObject_GenericGetAttr((PyObject *)
self, pyname);
4625 PyObject *
ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
4627 if (
ret ==
NULL && name[0] !=
'_') {
4633 PyObject *error_type, *error_value, *error_traceback;
4634 PyErr_Fetch(&error_type, &error_value, &error_traceback);
4638 ret = PyObject_GenericGetAttr(cls, pyname);
4643 PyErr_Restore(error_type, error_value, error_traceback);
4646 if (Py_TYPE(
ret) == &PyMethodDescr_Type) {
4647 PyMethodDef *m = ((PyMethodDescrObject *)
ret)->d_method;
4649 if (m->ml_flags & METH_STATIC) {
4654 ret = PyCMethod_New(m, (PyObject *)
self,
NULL,
NULL);
4669 const char *name = PyUnicode_AsUTF8(pyname);
4673 #ifdef USE_PEDANTIC_WRITE
4680 PyErr_SetString(PyExc_AttributeError,
"bpy_prop: __setattr__ must be a string");
4683 if (value ==
NULL) {
4684 PyErr_SetString(PyExc_AttributeError,
"bpy_prop: del not supported");
4694 PyErr_Format(PyExc_AttributeError,
"bpy_prop_collection: attribute \"%.200s\" not found", name);
4705 #ifdef USE_PEDANTIC_WRITE
4713 PyErr_SetString(PyExc_TypeError,
4714 "bpy_prop_collection.add(): not supported for this collection");
4723 const int key = PyLong_AsLong(value);
4725 #ifdef USE_PEDANTIC_WRITE
4731 if (key == -1 && PyErr_Occurred()) {
4732 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection.remove(): expected one int argument");
4737 PyErr_SetString(PyExc_TypeError,
4738 "bpy_prop_collection.remove() not supported for this collection");
4747 #ifdef USE_PEDANTIC_WRITE
4760 int key = 0,
pos = 0;
4762 #ifdef USE_PEDANTIC_WRITE
4768 if (!PyArg_ParseTuple(args,
"ii", &key, &
pos)) {
4769 PyErr_SetString(PyExc_TypeError,
"bpy_prop_collection.move(): expected two ints as arguments");
4774 PyErr_SetString(PyExc_TypeError,
4775 "bpy_prop_collection.move() not supported for this collection");
4783 "The :class:`bpy.types.ID` object this datablock is from or None, (not available for "
4788 if (
self->ptr.owner_id) {
4798 "The data this property is using, *type* :class:`bpy.types.bpy_struct`");
4804 PyDoc_STRVAR(pyrna_struct_get_rna_type_doc,
"The property type for introspection");
4820 pyrna_struct_get_id_data_doc,
4826 pyrna_struct_get_rna_type_doc,
4835 pyrna_struct_get_id_data_doc,
4848 ".. method:: keys()\n"
4850 " Return the identifiers of collection members\n"
4851 " (matching Python's dict.keys() functionality).\n"
4853 " :return: the identifiers for each member of this collection.\n"
4854 " :rtype: list of strings\n");
4857 PyObject *
ret = PyList_New(0);
4858 char name[256], *nameptr;
4865 PyList_APPEND(
ret, PyUnicode_FromStringAndSize(nameptr, namelen));
4867 if (name != nameptr) {
4878 ".. method:: items()\n"
4880 " Return the identifiers of collection members\n"
4881 " (matching Python's dict.items() functionality).\n"
4883 " :return: (key, value) pairs for each member of this collection.\n"
4884 " :rtype: list of tuples\n");
4887 PyObject *
ret = PyList_New(0);
4889 char name[256], *nameptr;
4896 item = PyTuple_New(2);
4899 PyTuple_SET_ITEM(item, 0, PyUnicode_FromStringAndSize(nameptr, namelen));
4900 if (name != nameptr) {
4906 PyTuple_SET_ITEM(item, 0, PyLong_FromLong(i));
4910 PyList_APPEND(
ret, item);
4921 ".. method:: values()\n"
4923 " Return the values of collection\n"
4924 " (matching Python's dict.values() functionality).\n"
4926 " :return: the members of this collection.\n"
4935 ".. method:: get(key, default=None)\n"
4937 " Returns the value of the custom property assigned to key or default\n"
4938 " when not found (matches Python's dictionary function of the same name).\n"
4940 " :arg key: The key associated with the custom property.\n"
4941 " :type key: string\n"
4942 " :arg default: Optional argument for the value to return if\n"
4943 " *key* is not found.\n"
4944 " :type default: Undefined\n"
4951 PyObject *def = Py_None;
4955 if (!PyArg_ParseTuple(args,
"s|O:get", &key, &def)) {
4961 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
4974 return Py_INCREF_RET(def);
4978 ".. method:: pop(key, default=None)\n"
4980 " Remove and return the value of the custom property assigned to key or default\n"
4981 " when not found (matches Python's dictionary function of the same name).\n"
4983 " :arg key: The key associated with the custom property.\n"
4984 " :type key: string\n"
4985 " :arg default: Optional argument for the value to return if\n"
4986 " *key* is not found.\n"
4987 " :type default: Undefined\n"
4994 PyObject *def =
NULL;
4998 if (!PyArg_ParseTuple(args,
"s|O:get", &key, &def)) {
5004 PyErr_SetString(PyExc_TypeError,
"this type doesn't support IDProperties");
5025 PyErr_SetString(PyExc_KeyError,
"key not found");
5028 return Py_INCREF_RET(def);
5032 ".. method:: as_pointer()\n"
5034 " Returns the memory address which holds a pointer to Blender's internal data\n"
5036 " :return: int (memory address).\n"
5039 " .. note:: This is intended only for advanced script writers who need to\n"
5040 " pass blender data to their own C/Python modules.\n");
5043 return PyLong_FromVoidPtr(
self->ptr.data);
5047 ".. method:: get(key, default=None)\n"
5049 " Returns the value of the item assigned to key or default when not found\n"
5050 " (matches Python's dictionary function of the same name).\n"
5052 " :arg key: The identifier for the collection member.\n"
5053 " :type key: string\n"
5054 " :arg default: Optional argument for the value to return if\n"
5055 " *key* is not found.\n"
5056 " :type default: Undefined\n");
5062 PyObject *def = Py_None;
5066 if (!PyArg_ParseTuple(args,
"O|O:get", &key_ob, &def)) {
5070 if (PyUnicode_Check(key_ob)) {
5071 const char *key = PyUnicode_AsUTF8(key_ob);
5077 else if (PyTuple_Check(key_ob)) {
5079 self, key_ob,
"bpy_prop_collection.get((id, lib))",
false);
5085 PyErr_Format(PyExc_KeyError,
5086 "bpy_prop_collection.get(key, ...): key must be a string or tuple, not %.200s",
5087 Py_TYPE(key_ob)->tp_name);
5090 return Py_INCREF_RET(def);
5094 ".. method:: find(key)\n"
5096 " Returns the index of a key in a collection or -1 when not found\n"
5097 " (matches Python's string find function of the same name).\n"
5099 " :arg key: The identifier for the collection member.\n"
5100 " :type key: string\n"
5101 " :return: index of the key.\n"
5105 Py_ssize_t key_len_ssize_t;
5106 const char *key = PyUnicode_AsUTF8AndSize(key_ob, &key_len_ssize_t);
5107 const int key_len = (int)key_len_ssize_t;
5109 char name[256], *nameptr;
5120 if ((key_len == namelen) && memcmp(nameptr, key, key_len) == 0) {
5125 if (name != nameptr) {
5134 return PyLong_FromLong(index);
5142 bool *r_attr_signed)
5145 bool attr_ok =
true;
5148 *r_attr_signed =
false;
5173 const char **r_attr,
5179 bool *r_attr_signed)
5186 *r_size = *r_attr_tot = 0;
5187 *r_attr_signed =
false;
5190 if (!PyArg_ParseTuple(args,
"sO:foreach_get/set", r_attr, r_seq)) {
5194 if (!PySequence_Check(*r_seq) && PyObject_CheckBuffer(*r_seq)) {
5197 "foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
5198 Py_TYPE(*r_seq)->tp_name);
5203 *r_tot = PySequence_Size(*r_seq);
5207 PyErr_Format(PyExc_AttributeError,
5208 "foreach_get/set '%.200s.%200s[...]' elements have no attribute '%.200s'",
5218 if ((*r_attr_tot) < 1) {
5229 target_tot = array_tot * (*r_attr_tot);
5232 if (target_tot != (*r_tot)) {
5233 PyErr_Format(PyExc_TypeError,
5234 "foreach_get(attr, sequence) sequence length mismatch given %d, needed %d",
5245 if (*r_size == 0 && *r_attr_tot != 0) {
5246 PyErr_SetString(PyExc_AttributeError,
"attribute does not support foreach method");
5259 return (f ==
'b') ? 1 : 0;
5262 return (f ==
'B') ? 1 : 0;
5266 return (f ==
'h') ? 1 : 0;
5269 return (f ==
'H') ? 1 : 0;
5273 return (f ==
'i') ? 1 : 0;
5276 return (f ==
'I') ? 1 : 0;
5279 return (f ==
'?') ? 1 : 0;
5281 return (f ==
'f') ? 1 : 0;
5283 return (f ==
'd') ? 1 : 0;
5293 PyObject *item =
NULL;
5295 bool buffer_is_compat;
5301 int tot,
size, attr_tot;
5306 self, args, &attr, &seq, &tot, &
size, &raw_type, &attr_tot, &attr_signed) == -1) {
5315 buffer_is_compat =
false;
5316 if (PyObject_CheckBuffer(seq)) {
5318 PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
5324 if (buffer_is_compat) {
5326 NULL, &
self->ptr,
self->prop, attr, buf.buf, raw_type, tot);
5329 PyBuffer_Release(&buf);
5333 if (!buffer_is_compat) {
5336 for (; i < tot; i++) {
5337 item = PySequence_GetItem(seq, i);
5340 ((
char *)
array)[i] = (char)PyLong_AsLong(item);
5343 ((
short *)
array)[i] = (short)PyLong_AsLong(item);
5346 ((
int *)
array)[i] = (int)PyLong_AsLong(item);
5349 ((
bool *)
array)[i] = (int)PyLong_AsLong(item) != 0;
5352 ((
float *)
array)[i] = (
float)PyFloat_AsDouble(item);
5355 ((
double *)
array)[i] = (
double)PyFloat_AsDouble(item);
5371 buffer_is_compat =
false;
5372 if (PyObject_CheckBuffer(seq)) {
5374 PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT);
5380 if (buffer_is_compat) {
5382 NULL, &
self->ptr,
self->prop, attr, buf.buf, raw_type, tot);
5385 PyBuffer_Release(&buf);
5389 if (!buffer_is_compat) {
5400 for (; i < tot; i++) {
5404 item = PyLong_FromLong((
long)((
char *)
array)[i]);
5407 item = PyLong_FromLong((
long)((
short *)
array)[i]);
5410 item = PyLong_FromLong((
long)((
int *)
array)[i]);
5413 item = PyFloat_FromDouble((
double)((
float *)
array)[i]);
5416 item = PyFloat_FromDouble((
double)((
double *)
array)[i]);
5419 item = PyBool_FromLong((
long)((
bool *)
array)[i]);
5429 PySequence_SetItem(seq, i, item);
5439 if (PyErr_Occurred()) {
5442 PyErr_SetString(PyExc_TypeError,
"couldn't access the py sequence");
5446 PyErr_SetString(PyExc_RuntimeError,
"internal error setting the array");
5454 ".. method:: foreach_get(attr, seq)\n"
5456 " This is a function to give fast access to attributes within a collection.\n");
5465 ".. method:: foreach_set(attr, seq)\n"
5467 " This is a function to give fast access to attributes within a collection.\n");
5479 PyObject *item =
NULL;
5480 Py_ssize_t i, seq_size,
size;
5488 PyErr_Format(PyExc_TypeError,
"foreach_get/set available only for int and float");
5492 if (!PyArg_ParseTuple(args,
"O:foreach_get/set", &seq)) {
5496 if (!PySequence_Check(seq) && PyObject_CheckBuffer(seq)) {
5499 "foreach_get/set expected second argument to be a sequence or buffer, not a %.200s",
5500 Py_TYPE(seq)->tp_name);
5505 seq_size = PySequence_Size(seq);
5507 if (
size != seq_size) {
5508 PyErr_Format(PyExc_TypeError,
"expected sequence size %d, got %d",
size, seq_size);
5513 if (PyObject_GetBuffer(seq, &buf, PyBUF_SIMPLE | PyBUF_FORMAT) == -1) {
5516 switch (prop_type) {
5518 array = PyMem_Malloc(
sizeof(
int) *
size);
5520 for (i = 0; i <
size; i++) {
5521 item = PySequence_GetItem(seq, i);
5522 ((
int *)
array)[i] = (int)PyLong_AsLong(item);
5531 for (i = 0; i <
size; i++) {
5532 item = PyLong_FromLong((
long)((
int *)
array)[i]);
5533 PySequence_SetItem(seq, i, item);
5540 array = PyMem_Malloc(
sizeof(
float) *
size);
5542 for (i = 0; i <
size; i++) {
5543 item = PySequence_GetItem(seq, i);
5544 ((
float *)
array)[i] = (
float)PyFloat_AsDouble(item);
5553 for (i = 0; i <
size; i++) {
5554 item = PyFloat_FromDouble((
double)((
float *)
array)[i]);
5555 PySequence_SetItem(seq, i, item);
5572 if (PyErr_Occurred()) {
5575 PyErr_SetString(PyExc_TypeError,
"couldn't access the py sequence");
5580 const char f = buf.format ? buf.format[0] : 0;
5581 if ((prop_type ==
PROP_INT && (buf.itemsize !=
sizeof(
int) || (f !=
'l' && f !=
'i'))) ||
5582 (prop_type ==
PROP_FLOAT && (buf.itemsize !=
sizeof(
float) || f !=
'f'))) {
5583 PyBuffer_Release(&buf);
5584 PyErr_Format(PyExc_TypeError,
"incorrect sequence item type: %s", buf.format);
5588 switch (prop_type) {
5615 PyBuffer_Release(&buf);
5622 ".. method:: foreach_get(seq)\n"
5624 " This is a function to give fast access to array data.\n");
5633 ".. method:: foreach_set(seq)\n"
5635 " This is a function to give fast access to array data.\n");
5649 PyObject *iter =
NULL;
5660 iter = PyObject_GetIter(
ret);
5669 #ifndef USE_PYRNA_ITER
5674 PyObject *iter =
NULL;
5680 iter = PyObject_GetIter(
ret);
5695 {
"get", (PyCFunction)
pyrna_struct_get, METH_VARARGS, pyrna_struct_get_doc},
5696 {
"pop", (PyCFunction)
pyrna_struct_pop, METH_VARARGS, pyrna_struct_pop_doc},
5703 METH_VARARGS | METH_KEYWORDS,
5707 METH_VARARGS | METH_KEYWORDS,
5720 METH_VARARGS | METH_KEYWORDS,
5721 pyrna_struct_is_property_set_doc},
5725 pyrna_struct_property_unset_doc},
5726 {
"is_property_hidden",
5729 pyrna_struct_is_property_hidden_doc},
5730 {
"is_property_readonly",
5733 pyrna_struct_is_property_readonly_doc},
5734 {
"is_property_overridable_library",
5737 pyrna_struct_is_property_overridable_library_doc},
5738 {
"property_overridable_library_set",
5741 pyrna_struct_property_overridable_library_set_doc},
5745 pyrna_struct_path_resolve_doc},
5749 pyrna_struct_path_from_id_doc},
5753 pyrna_struct_type_recast_doc},
5754 {
"bl_rna_get_subclass_py",
5756 METH_VARARGS | METH_CLASS,
5757 pyrna_struct_bl_rna_get_subclass_py_doc},
5758 {
"bl_rna_get_subclass",
5760 METH_VARARGS | METH_CLASS,
5761 pyrna_struct_bl_rna_get_subclass_doc},
5767 {
"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS,
NULL},
5768 {
"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS,
NULL},
5773 METH_VARARGS | METH_CLASS,
5783 pyrna_prop_path_from_id_doc},
5794 pyrna_prop_array_foreach_get_doc},
5798 pyrna_prop_array_foreach_set_doc},
5807 pyrna_prop_collection_foreach_get_doc},
5811 pyrna_prop_collection_foreach_set_doc},
5817 pyrna_prop_collection_items_doc},
5821 pyrna_prop_collection_values_doc},
5840 if (PyTuple_GET_SIZE(args) == 1) {
5842 if (Py_TYPE(base) ==
type) {
5844 return (PyObject *)base;
5863 #ifdef USE_PYRNA_STRUCT_REFERENCE
5866 PyObject_GC_UnTrack(
ret);
5870 return (PyObject *)
ret;
5874 PyErr_Format(PyExc_TypeError,
5875 "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct",
5880 PyErr_Format(PyExc_TypeError,
"bpy_struct.__new__(type): expected a single argument");
5890 if (!PyArg_ParseTuple(args,
"O!:bpy_prop.__new__", &
pyrna_prop_Type, &base)) {
5894 if (
type == Py_TYPE(base)) {
5895 return Py_INCREF_RET((PyObject *)base);
5901 return (PyObject *)
ret;
5904 PyErr_Format(PyExc_TypeError,
5905 "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop",
5936 for (
a = 0;
a <
len;
a++) {
5937 PyTuple_SET_ITEM(
ret,
a, PyBool_FromLong(((
bool *)
data)[
a]));
5942 for (
a = 0;
a <
len;
a++) {
5943 PyTuple_SET_ITEM(
ret,
a, PyLong_FromLong(((
int *)
data)[
a]));
5948 #ifdef USE_MATHUTILS
5957 else if (
len == 9) {
5965 for (
a = 0;
a <
len;
a++) {
5966 PyTuple_SET_ITEM(
ret,
a, PyFloat_FromDouble(((
float *)
data)[
a]));
5973 PyExc_TypeError,
"RNA Error: unknown array type \"%d\" (pyrna_param_to_py)",
type);
5982 ret = PyBool_FromLong(*(
bool *)
data);
5985 ret = PyLong_FromLong(*(
int *)
data);
5988 ret = PyFloat_FromDouble(*(
float *)
data);
5991 const char *data_ch;
5992 PyObject *value_coerce =
NULL;
5996 data_ch = (
char *)
data;
5999 data_ch = *(
char **)
data;
6002 #ifdef USE_STRING_COERCE
6004 ret = PyBytes_FromString(data_ch);
6010 ret = PyUnicode_FromString(data_ch);
6014 ret = PyBytes_FromString(buf);
6017 ret = PyUnicode_FromString(data_ch);
6021 #ifdef USE_STRING_COERCE
6022 Py_XDECREF(value_coerce);
6065 ret = PyList_New(0);
6067 for (link = lb->
first; link; link = link->
next) {
6074 PyErr_Format(PyExc_TypeError,
"RNA Error: unknown type \"%d\" (pyrna_param_to_py)",
type);
6090 PyObject *key =
NULL;
6092 PyObject *value =
NULL;
6094 while (PyDict_Next(dict, &
pos, &key, &value)) {
6095 if (PyUnicode_Check(key)) {
6096 if (
STREQ(key_lookup, PyUnicode_AsUTF8(key))) {
6115 PyObject *
ret, *item;
6116 int i, pyargs_len, pykw_len, parms_len, ret_len, flag_parameter,
err = 0, kw_tot = 0;
6120 void *retdata_single =
NULL;
6126 #ifdef DEBUG_STRING_FREE
6127 PyObject *string_free_ls = PyList_New(0);
6133 if (self_ptr ==
NULL) {
6134 PyErr_SetString(PyExc_RuntimeError,
6135 "RNA functions internal RNA pointer is NULL, this is a bug. aborting");
6139 if (self_func ==
NULL) {
6142 "%.200s.<unknown>(): RNA function internal function is NULL, this is a bug. aborting",
6153 printf(
"pyrna_func_call > %.200s.%.200s : %.200s:%d\n",
6166 pyargs_len = PyTuple_GET_SIZE(args);
6167 pykw_len = kw ? PyDict_Size(kw) : 0;
6174 if (pyargs_len + pykw_len > parms_len) {
6176 PyErr_Format(PyExc_TypeError,
6177 "%.200s.%.200s(): takes at most %d arguments, got %d",
6181 pyargs_len + pykw_len);
6193 if (pret_single ==
NULL) {
6195 retdata_single = iter.
data;
6203 if (i < pyargs_len) {
6206 PyErr_Format(PyExc_TypeError,
6207 "%.200s.%.200s(): required parameter \"%.200s\" to be a keyword argument!",
6215 item = PyTuple_GET_ITEM(args, i);
6218 else if (kw !=
NULL) {
6235 PyErr_Format(PyExc_TypeError,
6236 "%.200s.%.200s(): required parameter \"%.200s\" not specified",
6247 #ifdef DEBUG_STRING_FREE
6249 if (PyUnicode_Check(item)) {
6250 PyList_APPEND(string_free_ls, PyUnicode_FromString(PyUnicode_AsUTF8(item)));
6259 char error_prefix[512];
6262 if (kw_arg ==
true) {
6264 sizeof(error_prefix),
6265 "%.200s.%.200s(): error with keyword argument \"%.200s\" - ",
6272 sizeof(error_prefix),
6273 "%.200s.%.200s(): error with argument %d, \"%.200s\" - ",
6294 if (
err == 0 && kw && (pykw_len > kw_tot)) {
6295 PyObject *key, *value;
6301 const char *arg_name, *bad_args_str, *good_args_str;
6302 bool found =
false, first =
true;
6304 while (PyDict_Next(kw, &
pos, &key, &value)) {
6306 arg_name = PyUnicode_AsUTF8(key);
6309 if (arg_name ==
NULL) {
6325 if (found ==
false) {
6352 "%.200s.%.200s(): was called with invalid keyword argument(s) (%s), expected (%s)",
6381 ret = PyTuple_New(ret_len);
6408 #ifdef DEBUG_STRING_FREE
6410 if (PyList_GET_SIZE(string_free_ls)) {
6411 printf(
"%.200s.%.200s(): has %d strings\n",
6414 (
int)PyList_GET_SIZE(string_free_ls));
6417 Py_DECREF(string_free_ls);
6418 # undef DEBUG_STRING_FREE
6443 ret = PyUnicode_FromFormat(
"%.200s.%.200s(%.200s)\n%s",
6457 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_struct_meta_idprop",
6460 sizeof(PyHeapTypeObject),
6488 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6514 #if defined(_MSC_VER)
6541 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_struct",
6571 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE
6572 #ifdef USE_PYRNA_STRUCT_REFERENCE
6573 | Py_TPFLAGS_HAVE_GC
6580 #ifdef USE_PYRNA_STRUCT_REFERENCE
6581 (traverseproc)pyrna_struct_traverse,
6584 (inquiry)pyrna_struct_clear,
6634 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop",
6666 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6718 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_array",
6750 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6801 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_collection",
6834 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6887 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_collection_idprop",
6920 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6973 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_func",
7056 #ifdef USE_PYRNA_ITER
7069 PyVarObject_HEAD_INIT(
NULL, 0)
"bpy_prop_collection_iter",
7095 PyObject_GenericGetAttr,
7117 # ifdef USE_WEAKREFS
7157 # ifdef USE_WEAKREFS
7158 self->in_weakreflist =
NULL;
7163 return (PyObject *)
self;
7173 if (
self->iter.valid ==
false) {
7174 PyErr_SetNone(PyExc_StopIteration);
7180 # ifdef USE_PYRNA_STRUCT_REFERENCE
7182 if ((PyObject *)pyrna != Py_None) {
7187 pyrna_struct_reference_set(pyrna, (PyObject *)
self);
7194 return (PyObject *)pyrna;
7199 # ifdef USE_WEAKREFS
7200 if (
self->in_weakreflist !=
NULL) {
7201 PyObject_ClearWeakRefs((PyObject *)
self);
7218 Py_INCREF(newclass);
7247 for (link = lb->
first; link; link = link->
next) {
7272 PyObject *py_base =
NULL;
7277 if (base && base != srna) {
7283 if (py_base ==
NULL) {
7300 PyObject *bpy_types = PyImport_ImportModuleLevel(
"bpy_types",
NULL,
NULL,
NULL, 0);
7302 if (bpy_types ==
NULL) {
7309 Py_DECREF(bpy_types);
7321 PyObject *tp_bases = ((PyTypeObject *)newclass)->tp_bases;
7322 PyObject *tp_slots = PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict,
7325 if (tp_slots ==
NULL) {
7327 BPY_LOG_RNA,
"expected class '%s' to have __slots__ defined, see bpy_types.py", idname);
7330 else if (PyTuple_GET_SIZE(tp_bases)) {
7331 PyObject *base = PyTuple_GET_ITEM(tp_bases, 0);
7333 if (base_compare != base) {
7334 char pyob_info[256];
7337 "incorrect subclassing of SRNA '%s', expected '%s', see bpy_types.py",
7353 PyObject *newclass =
NULL;
7360 Py_INCREF(newclass);
7364 Py_INCREF(newclass);
7379 PyObject *metaclass;
7392 metaclass = (PyObject *)&PyType_Type;
7397 newclass = PyObject_CallFunction(
7398 metaclass,
"s(O) {sss()}", idname, py_base,
"__module__",
"bpy.types",
"__slots__");
7402 PyObject *args, *item, *value;
7405 args = PyTuple_New(3);
7408 PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(idname));
7411 PyTuple_SET_ITEM(args, 1, item = PyTuple_New(1));
7412 PyTuple_SET_ITEM(item, 0, Py_INCREF_RET(py_base));
7415 PyTuple_SET_ITEM(args, 2, item = PyDict_New());
7422 newclass = PyObject_CallObject(metaclass, args);
7481 if (instance && *instance) {
7487 return (PyObject *)pyrna;
7504 #ifdef USE_PYRNA_STRUCT_REFERENCE
7507 if (pyrna !=
NULL) {
7508 PyObject_GC_UnTrack(pyrna);
7516 #ifdef USE_PYRNA_STRUCT_REFERENCE
7523 if (pyrna !=
NULL) {
7524 pyrna->in_weakreflist =
NULL;
7530 if (pyrna ==
NULL) {
7531 PyErr_SetString(PyExc_MemoryError,
"couldn't create bpy_struct object");
7542 #ifdef PYRNA_FREE_SUPPORT
7543 pyrna->freeptr =
false;
7546 #ifdef USE_PYRNA_STRUCT_REFERENCE
7547 pyrna->reference =
NULL;
7552 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
7557 return (PyObject *)pyrna;
7581 pyrna->in_weakreflist =
NULL;
7593 if (pyrna ==
NULL) {
7594 PyErr_SetString(PyExc_MemoryError,
"couldn't create BPy_rna object");
7601 #ifdef USE_PYRNA_INVALIDATE_WEAKREF
7607 return (PyObject *)pyrna;
7640 #ifdef USE_MATHUTILS
7646 #if defined(_MSC_VER)
7679 #ifdef USE_PYRNA_ITER
7698 return (PyObject *)pyrna;
7715 PyObject *BPY_rna_doc(
void)
7748 const char *name = PyUnicode_AsUTF8(pyname);
7751 PyErr_SetString(PyExc_AttributeError,
"bpy.types: __getattr__ must be a string");
7757 PyErr_Format(PyExc_RuntimeError,
7758 "bpy.types.%.200s subtype could not be generated, this is a bug!",
7759 PyUnicode_AsUTF8(pyname));
7764 PyErr_Format(PyExc_AttributeError,
7765 "bpy.types.%.200s RNA_Struct does not exist",
7766 PyUnicode_AsUTF8(pyname));
7770 ret = PyObject_GenericGetAttr((PyObject *)
self, pyname);
7779 PyObject *
ret = PyList_New(0);
7788 PyObject *submodule_dict = PyModule_GetDict(
self);
7789 PyObject *key, *value;
7791 while (PyDict_Next(submodule_dict, &
pos, &key, &value)) {
7792 PyList_Append(
ret, key);
7805 PyModuleDef_HEAD_INIT,
7807 bpy_types_module_doc,
7829 static PyTypeObject *pyrna_types[] = {
7838 PyObject *submodule_dict = PyModule_GetDict(submodule);
7839 for (
int i = 0; i <
ARRAY_SIZE(pyrna_types); i += 1) {
7840 PyDict_SetItemString(submodule_dict, pyrna_types[i]->tp_name, (PyObject *)pyrna_types[i]);
7855 if (PyType_Check(
self)) {
7856 py_srna = (
BPy_StructRNA *)PyDict_GetItem(((PyTypeObject *)
self)->tp_dict,
7858 Py_XINCREF(py_srna);
7864 if (py_srna ==
NULL) {
7869 if (py_srna ==
NULL) {
7870 PyErr_Format(PyExc_RuntimeError,
7871 "%.200s, missing bl_rna attribute from '%.200s' instance (may not be registered)",
7873 Py_TYPE(
self)->tp_name);
7878 PyErr_Format(PyExc_TypeError,
7879 "%.200s, bl_rna attribute wrong type '%.200s' on '%.200s'' instance",
7881 Py_TYPE(py_srna)->tp_name,
7882 Py_TYPE(
self)->tp_name);
7888 PyErr_Format(PyExc_TypeError,
7889 "%.200s, bl_rna attribute not a RNA_Struct, on '%.200s'' instance",
7891 Py_TYPE(
self)->tp_name);
7912 if (PyCapsule_CheckExact(
self)) {
7913 return PyCapsule_GetPointer(
self,
NULL);
7915 if (PyType_Check(
self) == 0) {
7922 PyObject *error_type, *error_value, *error_traceback;
7925 PyErr_Fetch(&error_type, &error_value, &error_traceback);
7930 if (!PyErr_Occurred()) {
7931 PyErr_Restore(error_type, error_value, error_traceback);
7948 PyObject *py_srna_cobject, *py_ret;
7950 PyObject *args_fake;
7952 if (*PyUnicode_AsUTF8(key) ==
'_') {
7953 PyErr_Format(PyExc_ValueError,
7954 "bpy_struct \"%.200s\" registration error: "
7955 "%.200s could not register because the property starts with an '_'\n",
7957 PyUnicode_AsUTF8(key));
7960 py_srna_cobject = PyCapsule_New(srna,
NULL,
NULL);
7965 args_fake = PyTuple_New(1);
7966 PyTuple_SET_ITEM(args_fake, 0, py_srna_cobject);
7968 PyObject *
type = PyDict_GetItemString(py_kw,
"type");
7975 PyErr_Format(PyExc_ValueError,
7976 "bpy_struct \"%.200s\" doesn't support datablock properties\n",
7982 py_ret = PyObject_Call(py_func, args_fake, py_kw);
7986 Py_DECREF(args_fake);
7993 Py_DECREF(args_fake);
7996 PyErr_Format(PyExc_ValueError,
7997 "bpy_struct \"%.200s\" registration error: "
7998 "%.200s could not register\n",
8000 PyUnicode_AsUTF8(key));
8012 PyObject *annotations_dict =
NULL;
8016 PyObject *typing_mod = PyImport_ImportModuleLevel(
"typing",
NULL,
NULL,
NULL, 0);
8017 if (typing_mod !=
NULL) {
8018 PyObject *get_type_hints_fn = PyObject_GetAttrString(typing_mod,
"get_type_hints");
8019 if (get_type_hints_fn !=
NULL) {
8020 PyObject *args = PyTuple_New(1);
8022 PyTuple_SET_ITEM(args, 0, (PyObject *)py_class);
8023 Py_INCREF(py_class);
8025 annotations_dict = PyObject_CallObject(get_type_hints_fn, args);
8028 Py_DECREF(get_type_hints_fn);
8030 Py_DECREF(typing_mod);
8035 if (annotations_dict !=
NULL) {
8036 if (PyDict_CheckExact(annotations_dict)) {
8037 PyObject *item, *key;
8040 while (PyDict_Next(annotations_dict, &
pos, &key, &item)) {
8049 PyErr_Format(PyExc_TypeError,
8050 "typing.get_type_hints returned: %.200s, expected dict\n",
8051 Py_TYPE(annotations_dict)->tp_name);
8055 Py_DECREF(annotations_dict);
8059 fprintf(stderr,
"typing.get_type_hints failed with: %.200s\n", py_class->tp_name);
8068 PyObject *annotations_dict;
8069 PyObject *item, *key;
8076 PyDict_CheckExact(annotations_dict)) {
8077 while (PyDict_Next(annotations_dict, &
pos, &key, &item)) {
8091 const int len = PyTuple_GET_SIZE(py_class->tp_bases);
8095 for (i = 0; i <
len; i++) {
8096 PyTypeObject *py_superclass = (PyTypeObject *)PyTuple_GET_ITEM(py_class->tp_bases, i);
8107 if (py_superclass != &PyBaseObject_Type &&
8108 !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&
pyrna_struct_Type)) {
8130 #ifdef USE_POSTPONED_ANNOTATIONS
8131 const bool use_postponed_annotations =
true;
8133 const bool use_postponed_annotations =
false;
8136 if (use_postponed_annotations) {
8151 int count = is_staticmethod ? 0 : 1;
8152 bool done_min_count =
false;
8154 for (link = lb->
first; link; link = link->
next) {
8162 done_min_count =
true;
8168 if (!done_min_count && min_count) {
8183 PyObject *py_class = (PyObject *)py_data;
8186 int i, arg_count, func_arg_count, func_arg_min_count = 0;
8187 const char *py_class_name = ((PyTypeObject *)py_class)->tp_name;
8196 if (!PyObject_IsSubclass(py_class, base_class)) {
8197 PyErr_Format(PyExc_TypeError,
8198 "expected %.200s subclass of class \"%.200s\"",
8208 for (link = lb->
first; link; link = link->
next) {
8216 have_function[i] = (item !=
NULL);
8221 PyErr_Format(PyExc_AttributeError,
8222 "expected %.200s, %.200s class to have an \"%.200s\" attribute",
8240 PyObject *item_orig = item;
8242 if (is_staticmethod) {
8243 if (PyMethod_Check(item) == 0) {
8244 PyErr_Format(PyExc_TypeError,
8245 "expected %.200s, %.200s class \"%.200s\" "
8246 "attribute to be a static/class method, not a %.200s",
8250 Py_TYPE(item)->tp_name);
8251 Py_DECREF(item_orig);
8254 item = ((PyMethodObject *)item)->im_func;
8257 if (PyFunction_Check(item) == 0) {
8258 PyErr_Format(PyExc_TypeError,
8259 "expected %.200s, %.200s class \"%.200s\" "
8260 "attribute to be a function, not a %.200s",
8264 Py_TYPE(item)->tp_name);
8265 Py_DECREF(item_orig);
8272 if (func_arg_count >= 0) {
8273 arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
8278 if (is_staticmethod) {
8280 func_arg_min_count++;
8283 if (arg_count < func_arg_min_count || arg_count > func_arg_count) {
8284 if (func_arg_min_count != func_arg_count) {
8287 "expected %.200s, %.200s class \"%.200s\" function to have between %d and %d "
8299 "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d",
8306 Py_DECREF(item_orig);
8310 Py_DECREF(item_orig);
8315 for (link = lb->
first; link; link = link->
next) {
8316 const char *identifier;
8326 item = PyObject_GetAttrString(py_class, identifier);
8332 #define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
8333 else if (STREQ(identifier, rna_attr)) \
8335 if ((item = PyObject_GetAttr(py_class, py_attr))) { \
8336 if (item != Py_None) { \
8337 if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { \
8354 #undef BPY_REPLACEMENT_STRING
8357 PyErr_Format(PyExc_AttributeError,
8358 "expected %.200s, %.200s class to have an \"%.200s\" attribute",
8388 PyObject *
ret =
NULL, *py_srna =
NULL, *py_class_instance =
NULL, *parmitem;
8389 PyTypeObject *py_class;
8393 int err = 0, i, ret_len = 0, arg_count;
8399 void *retdata_single =
NULL;
8401 PyGILState_STATE gilstate;
8403 #ifdef USE_PEDANTIC_WRITE
8413 if (py_class ==
NULL) {
8415 "unable to get Python class for RNA struct '%.200s'",
8432 if (!(is_staticmethod || is_classmethod)) {
8439 py_class_instance = *instance;
8440 Py_INCREF(py_class_instance);
8446 if (py_class_instance ==
NULL) {
8450 if (py_class_instance) {
8453 else if (py_srna ==
NULL) {
8454 py_class_instance =
NULL;
8456 else if (py_srna == Py_None) {
8458 py_class_instance =
NULL;
8467 if (py_class->tp_init) {
8468 # ifdef USE_PEDANTIC_WRITE
8475 args = PyTuple_New(0);
8476 if (py_class->tp_init(py_srna, args,
NULL) < 0) {
8482 # ifdef USE_PEDANTIC_WRITE
8486 py_class_instance = py_srna;
8495 py_class_instance = py_srna;
8496 Py_INCREF(py_class_instance);
8503 args = PyTuple_New(1);
8504 PyTuple_SET_ITEM(args, 0, py_srna);
8505 py_class_instance = PyObject_Call(py_class, args,
NULL);
8512 if (py_class_instance ==
NULL) {
8519 if (
err != -1 && (is_staticmethod || is_classmethod || py_class_instance)) {
8525 if (is_staticmethod) {
8527 ((PyCodeObject *)PyFunction_GET_CODE(((PyMethodObject *)item)->im_func))->co_argcount -
8531 arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
8537 args = PyTuple_New(arg_count);
8539 if (is_staticmethod) {
8542 else if (is_classmethod) {
8543 PyTuple_SET_ITEM(args, 0, (PyObject *)py_class);
8547 PyTuple_SET_ITEM(args, 0, py_class_instance);
8560 if (pret_single ==
NULL) {
8562 retdata_single = iter.
data;
8568 if (i < arg_count) {
8570 PyTuple_SET_ITEM(args, i, parmitem);
8575 #ifdef USE_PEDANTIC_WRITE
8580 ret = PyObject_Call(item, args,
NULL);
8584 #ifdef USE_PEDANTIC_WRITE
8595 PyErr_Format(PyExc_TypeError,
8596 "could not find function %.200s in %.200s to execute callback",
8605 PyErr_Format(PyExc_RuntimeError,
8606 "could not create instance of %.200s to call callback function %.200s",
8617 if (ret_len == 0 &&
ret != Py_None) {
8618 PyErr_Format(PyExc_RuntimeError,
8619 "expected class %.200s, function %.200s to return None, not %.200s",
8622 Py_TYPE(
ret)->tp_name);
8625 else if (ret_len == 1) {
8634 "class %.200s, function %.200s: incompatible return value ",
8639 else if (ret_len > 1) {
8641 if (PyTuple_Check(
ret) == 0) {
8644 "expected class %.200s, function %.200s to return a tuple of size %d, not %.200s",
8648 Py_TYPE(
ret)->tp_name);
8651 else if (PyTuple_GET_SIZE(
ret) != ret_len) {
8652 PyErr_Format(PyExc_RuntimeError,
8653 "class %.200s, function %.200s to returned %d items, expected %d",
8656 PyTuple_GET_SIZE(
ret),
8671 &funcptr, parm, iter.
data, PyTuple_GET_ITEM(
ret, i++),
"calling class function:");
8687 if ((!is_staticmethod) && (!is_classmethod) && (
ptr->
data) &&
8712 PyObject *
self = (PyObject *)pyob_ptr;
8713 PyGILState_STATE gilstate;
8715 gilstate = PyGILState_Ensure();
8722 if (PyErr_Occurred()) {
8728 if (
self->ob_refcnt > 1) {
8729 PyC_ObSpit(
"zombie class - reference should be 1",
self);
8733 Py_DECREF((PyObject *)pyob_ptr);
8735 PyGILState_Release(gilstate);
8746 PyGILState_STATE gilstate;
8751 gilstate = PyGILState_Ensure();
8760 if (PyErr_Occurred()) {
8771 PyGILState_Release(gilstate);
8810 ".. method:: register_class(cls)\n"
8812 " Register a subclass of a Blender type class.\n"
8814 " :arg cls: Blender type class in:\n"
8815 " :class:`bpy.types.Panel`, :class:`bpy.types.UIList`,\n"
8816 " :class:`bpy.types.Menu`, :class:`bpy.types.Header`,\n"
8817 " :class:`bpy.types.Operator`, :class:`bpy.types.KeyingSetInfo`,\n"
8818 " :class:`bpy.types.RenderEngine`\n"
8819 " :type cls: class\n"
8820 " :raises ValueError:\n"
8821 " if the class is not a subclass of a registerable blender class.\n"
8825 " If the class has a *register* class method it will be called\n"
8826 " before registration.\n");
8836 const char *identifier;
8837 PyObject *py_cls_meth;
8838 const char *error_prefix =
"register_class(...):";
8840 if (!PyType_Check(py_class)) {
8841 PyErr_Format(PyExc_ValueError,
8842 "register_class(...): "
8843 "expected a class argument, not '%.200s'",
8844 Py_TYPE(py_class)->tp_name);
8849 PyErr_Format(PyExc_ValueError,
8850 "register_class(...): "
8851 "already registered as a subclass '%.200s'",
8852 ((PyTypeObject *)py_class)->tp_name);
8857 PyErr_Format(PyExc_RuntimeError,
8858 "register_class(...): "
8859 "can't run in readonly state '%.200s'",
8860 ((PyTypeObject *)py_class)->tp_name);
8873 PyErr_Format(PyExc_ValueError,
8874 "register_class(...): %.200s's parent class %.200s is already registered, this "
8876 ((PyTypeObject *)py_class)->tp_name,
8886 PyErr_Format(PyExc_ValueError,
8887 "register_class(...): expected a subclass of a registerable "
8888 "RNA type (%.200s does not support registration)",
8899 identifier = ((PyTypeObject *)py_class)->tp_name;
8922 if (srna_new ==
NULL) {
8934 Py_DECREF(py_class);
8950 PyObject *
ret = PyObject_CallObject(py_cls_meth,
NULL);
8951 Py_DECREF(py_cls_meth);
8970 const char **r_prop_identifier)
8978 for (link = lb->
first; link; link = link->
next) {
8995 ".. method:: unregister_class(cls)\n"
8997 " Unload the Python class from blender.\n"
8999 " If the class has an *unregister* class method it will be called\n"
9000 " before unregistering.\n");
9005 pyrna_unregister_class_doc,
9012 PyObject *py_cls_meth;
9014 if (!PyType_Check(py_class)) {
9015 PyErr_Format(PyExc_ValueError,
9016 "register_class(...): "
9017 "expected a class argument, not '%.200s'",
9018 Py_TYPE(py_class)->tp_name);
9024 PWM_cursor_wait(
false);
9025 PyErr_SetString(PyExc_ValueError,
"unregister_class(): not a registered as a subclass");
9031 PyErr_Format(PyExc_RuntimeError,
9032 "unregister_class(...): "
9033 "can't run in readonly state '%.200s'",
9034 ((PyTypeObject *)py_class)->tp_name);
9049 "unregister_class(...): "
9050 "expected a Type subclassed from a registerable RNA type (no unregister supported)");
9058 PyObject *
ret = PyObject_CallObject(py_cls_meth,
NULL);
9059 Py_DECREF(py_cls_meth);
9079 const char *prop_identifier =
NULL;
9086 srna_iter = itemptr.data;
9093 if (prop_identifier) {
9094 PyErr_Format(PyExc_RuntimeError,
9095 "unregister_class(...): can't unregister %s because %s.%s pointer property is "
9111 if (PyErr_Occurred()) {
9122 struct PyMethodDef *method,
9123 struct PyGetSetDef *getset)
9127 PyObject *dict =
type->tp_dict;
9128 if (method !=
NULL) {
9129 for (; method->ml_name !=
NULL; method++) {
9130 PyObject *py_method;
9132 if (method->ml_flags & METH_CLASS) {
9133 PyObject *cfunc = PyCFunction_New(method, (PyObject *)
type);
9134 py_method = PyClassMethod_New(cfunc);
9137 else if (method->ml_flags & METH_STATIC) {
9138 py_method = PyCFunction_New(method,
NULL);
9141 py_method = PyDescr_NewMethod(
type, method);
9144 const int err = PyDict_SetItemString(dict, method->ml_name, py_method);
9145 Py_DECREF(py_method);
9151 if (getset !=
NULL) {
9152 for (; getset->name !=
NULL; getset++) {
9153 PyObject *descr = PyDescr_NewGetSet(
type, getset);
9156 PyDict_SetItem(dict, PyDescr_NAME(descr), descr);
9169 return PyUnicode_FromString(name);
9177 if (value == Py_None) {
9180 else if (PyUnicode_Check(value)) {
9181 name = PyUnicode_AsUTF8(value);
9184 PyErr_Format(PyExc_ValueError,
9186 "expected None or a string, not '%.200s'",
9187 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)
struct ReportList * CTX_wm_reports(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
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_plural(const short idcode)
const char * BKE_idtype_idcode_to_name(const 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_BITMAP_ENABLE(_bitmap, _index)
#define BLI_BITMAP_NEW(_tot, _alloc_string)
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format,...) ATTR_PRINTF_FORMAT(2
char * BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
void BLI_ghashIterator_step(GHashIterator *ghi)
BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(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)
void * BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_kdtree_nd_() free(KDTree *tree)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
#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 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 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 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 RGB to Bright Vector Camera CLAMP
#define RNA_STRUCT_BEGIN(sptr, prop)
#define RNA_POINTER_INVALIDATE(ptr)
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
StructRNA RNA_GizmoProperties
StructRNA RNA_OperatorProperties
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
char * BPy_enum_as_string(const EnumPropertyItem *item)
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))
PyObject * pyrna_enum_bitfield_to_py(const EnumPropertyItem *items, int value)
static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
PyObject * pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
int pyrna_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value, const char *error_prefix)
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)
int pyrna_set_to_enum_bitfield(const EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
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_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 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)
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 PyObject * pyrna_prop_repr(BPy_PropertyRNA *self)
static PyObject * pyrna_prop_as_bytes(BPy_PropertyRNA *self)
static int mathutils_rna_generic_check(BaseMathObject *bmo)
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 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_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)
BLI_bitmap * pyrna_set_to_enum_bitmap(const EnumPropertyItem *items, PyObject *value, int type_size, bool type_convert_sign, int bitmap_size, const char *error_prefix)
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: list of strings\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)
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
PyObject * BPy_IDGroup_MapDataToPy(IDProperty *prop)
PyObject * BPy_Wrap_GetItems(ID *id, IDProperty *prop)
PyObject * BPy_Wrap_GetValues(ID *id, IDProperty *prop)
PyObject * BPy_Wrap_GetKeys(IDProperty *prop)
PyObject * BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent)
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_cb(PyObject *cb_user, const ushort num_col, const ushort num_row, uchar cb_type, uchar cb_subtype)
PyObject * Matrix_CreatePyObject(const float *mat, const ushort num_col, const ushort num_row, PyTypeObject *base_type)
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 size, PyTypeObject *base_type)
PyObject * Vector_CreatePyObject_cb(PyObject *cb_user, int size, uchar cb_type, uchar cb_subtype)
static void error(const char *str)
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)
PyObject * PyC_UnicodeFromByte(const char *str)
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_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)
int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item, const int value, const char **r_identifier)
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)
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)
bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
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_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
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)
int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[])
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)
int RNA_parameter_list_arg_count(ParameterList *parms)
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)
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)
char * RNA_path_from_ID_to_property(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)
char * RNA_path_from_real_ID_to_struct(Main *bmain, PointerRNA *ptr, struct ID **r_real)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
void RNA_parameter_list_end(ParameterIterator *UNUSED(iter))
int RNA_function_flag(FunctionRNA *func)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
char * RNA_path_from_real_ID_to_property_index(Main *bmain, PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index, ID **r_real_id)
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)
bool RNA_struct_idprops_register_check(const StructRNA *type)
void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
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_struct_idprops_check(StructRNA *srna)
bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop_orig)
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)
char * RNA_path_from_ID_to_struct(PointerRNA *ptr)
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)
const EnumPropertyItem rna_enum_property_type_items[]
const EnumPropertyItem DummyRNA_NULL_items[]
PyObject_HEAD PointerRNA ptr
PyObject_HEAD PointerRNA ptr
PyObject_HEAD PointerRNA ptr
PyObject_HEAD PointerRNA ptr
struct CollectionPointerLink * first
struct CollectionPointerLink * next
struct ReportList * reports