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,254 Lines • ▼ Show 20 Lines | if (C == NULL) { | ||||
| name); | name); | ||||
| ret = NULL; | ret = NULL; | ||||
| } | } | ||||
| else { | else { | ||||
| PointerRNA newptr; | PointerRNA newptr; | ||||
| ListBase newlb; | ListBase newlb; | ||||
| short newtype; | short newtype; | ||||
| const int done = CTX_data_get(C, name, &newptr, &newlb, &newtype); | const eContextResult done = CTX_data_get(C, name, &newptr, &newlb, &newtype); | ||||
| if (done == 1) { /* Found. */ | if (done == CTX_RESULT_OK) { | ||||
| switch (newtype) { | switch (newtype) { | ||||
| case CTX_DATA_TYPE_POINTER: | case CTX_DATA_TYPE_POINTER: | ||||
| if (newptr.data == NULL) { | if (newptr.data == NULL) { | ||||
| ret = Py_None; | ret = Py_None; | ||||
| Py_INCREF(ret); | Py_INCREF(ret); | ||||
| } | } | ||||
| else { | else { | ||||
| ret = pyrna_struct_CreatePyObject(&newptr); | ret = pyrna_struct_CreatePyObject(&newptr); | ||||
| Show All 16 Lines | else { | ||||
| PyErr_Format(PyExc_AttributeError, | PyErr_Format(PyExc_AttributeError, | ||||
| "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context", | "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context", | ||||
| newtype, | newtype, | ||||
| name); | name); | ||||
| ret = NULL; | ret = NULL; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| else if (done == -1) { /* Found, but not set. */ | else if (done == CTX_RESULT_MEMBER_NOT_FOUND) { | ||||
| ret = Py_None; | ret = Py_None; | ||||
| Py_INCREF(ret); | Py_INCREF(ret); | ||||
| } | } | ||||
| else { /* Not found in the context. */ | else { /* Not found in the context. */ | ||||
| /* Lookup the subclass. raise an error if it's not found. */ | /* Lookup the subclass. raise an error if it's not found. */ | ||||
| ret = PyObject_GenericGetAttr((PyObject *)self, pyname); | ret = PyObject_GenericGetAttr((PyObject *)self, pyname); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | if (C == NULL) { | ||||
| name); | name); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| PointerRNA newptr; | PointerRNA newptr; | ||||
| ListBase newlb; | ListBase newlb; | ||||
| short newtype; | short newtype; | ||||
| const int done = CTX_data_get(C, name, &newptr, &newlb, &newtype); | const eContextResult done = CTX_data_get(C, name, &newptr, &newlb, &newtype); | ||||
| if (done == 1) { | if (done == CTX_RESULT_OK) { | ||||
| PyErr_Format( | PyErr_Format( | ||||
| PyExc_AttributeError, "bpy_struct: Context property \"%.200s\" is read-only", name); | PyExc_AttributeError, "bpy_struct: Context property \"%.200s\" is read-only", name); | ||||
| BLI_freelistN(&newlb); | BLI_freelistN(&newlb); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| BLI_freelistN(&newlb); | BLI_freelistN(&newlb); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 4,598 Lines • Show Last 20 Lines | |||||