Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_rna.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 4,068 Lines • ▼ Show 20 Lines | if (BPy_PropertyRNA_Check(self)) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr) | static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr) | ||||
| { | { | ||||
| const char *idname; | const char *idname; | ||||
| /* For looping over attrs and funcs. */ | /* For looping over attributes and functions. */ | ||||
| PointerRNA tptr; | PointerRNA tptr; | ||||
| PropertyRNA *iterprop; | PropertyRNA *iterprop; | ||||
| { | { | ||||
| RNA_pointer_create(NULL, &RNA_Struct, ptr->type, &tptr); | RNA_pointer_create(NULL, &RNA_Struct, ptr->type, &tptr); | ||||
| iterprop = RNA_struct_find_property(&tptr, "functions"); | iterprop = RNA_struct_find_property(&tptr, "functions"); | ||||
| RNA_PROP_BEGIN (&tptr, itemptr, iterprop) { | RNA_PROP_BEGIN (&tptr, itemptr, iterprop) { | ||||
| ▲ Show 20 Lines • Show All 1,846 Lines • ▼ Show 20 Lines | if (flag & PROP_DYNAMIC) { | ||||
| ParameterDynAlloc *data_alloc = data; | ParameterDynAlloc *data_alloc = data; | ||||
| len = data_alloc->array_tot; | len = data_alloc->array_tot; | ||||
| data = data_alloc->array; | data = data_alloc->array; | ||||
| } | } | ||||
| else { | else { | ||||
| len = RNA_property_array_length(ptr, prop); | len = RNA_property_array_length(ptr, prop); | ||||
| } | } | ||||
| /* Resolve the array from a new pytype. */ | /* Resolve the array from a new Python type. */ | ||||
| /* TODO(Kazanbas): make multi-dimensional sequences here. */ | /* TODO(Kazanbas): make multi-dimensional sequences here. */ | ||||
| switch (type) { | switch (type) { | ||||
| case PROP_BOOLEAN: | case PROP_BOOLEAN: | ||||
| ret = PyTuple_New(len); | ret = PyTuple_New(len); | ||||
| for (a = 0; a < len; a++) { | for (a = 0; a < len; a++) { | ||||
| PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((bool *)data)[a])); | PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((bool *)data)[a])); | ||||
| ▲ Show 20 Lines • Show All 2,781 Lines • ▼ Show 20 Lines | if (ret_len == 0 && ret != Py_None) { | ||||
| RNA_struct_identifier(ptr->type), | RNA_struct_identifier(ptr->type), | ||||
| RNA_function_identifier(func), | RNA_function_identifier(func), | ||||
| Py_TYPE(ret)->tp_name); | Py_TYPE(ret)->tp_name); | ||||
| err = -1; | err = -1; | ||||
| } | } | ||||
| else if (ret_len == 1) { | else if (ret_len == 1) { | ||||
| err = pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, ""); | err = pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, ""); | ||||
| /* when calling operator funcs only gives Function.result with | /* When calling operator functions only gives `Function.result` with no line number | ||||
| * no line number since the func has finished calling on error, | * since the function has finished calling on error, re-raise the exception with more | ||||
| * re-raise the exception with more info since it would be slow to | * information since it would be slow to create prefix on every call | ||||
| * create prefix on every call (when there are no errors) */ | * (when there are no errors). */ | ||||
| if (err == -1) { | if (err == -1) { | ||||
| PyC_Err_Format_Prefix(PyExc_RuntimeError, | PyC_Err_Format_Prefix(PyExc_RuntimeError, | ||||
| "class %.200s, function %.200s: incompatible return value ", | "class %.200s, function %.200s: incompatible return value ", | ||||
| RNA_struct_identifier(ptr->type), | RNA_struct_identifier(ptr->type), | ||||
| RNA_function_identifier(func)); | RNA_function_identifier(func)); | ||||
| } | } | ||||
| } | } | ||||
| else if (ret_len > 1) { | else if (ret_len > 1) { | ||||
| ▲ Show 20 Lines • Show All 563 Lines • Show Last 20 Lines | |||||