Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_rna.c
| Show First 20 Lines • Show All 8,251 Lines • ▼ Show 20 Lines | #endif | ||||
| PyDict_DelItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna); | PyDict_DelItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna); | ||||
| if (PyErr_Occurred()) | if (PyErr_Occurred()) | ||||
| PyErr_Clear(); //return NULL; | PyErr_Clear(); //return NULL; | ||||
| Py_RETURN_NONE; | Py_RETURN_NONE; | ||||
| } | } | ||||
| /* Access to 'bl_owner' internal global. */ | |||||
| static PyObject *pyrna_bl_origin_get(PyObject *UNUSED(self)) | |||||
| { | |||||
| const char *name = RNA_struct_state_bl_origin_get(); | |||||
| if (name) { | |||||
| return PyUnicode_FromString(name); | |||||
| } | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| static PyObject *pyrna_bl_origin_set(PyObject *UNUSED(self), PyObject *value) | |||||
| { | |||||
| const char *name; | |||||
| if (value == Py_None) { | |||||
| name = NULL; | |||||
| } | |||||
| else if (PyUnicode_Check(value)) { | |||||
| name = _PyUnicode_AsString(value); | |||||
| } | |||||
| else { | |||||
| PyErr_Format(PyExc_ValueError, | |||||
| "bl_origin_set(...): " | |||||
| "expected None or a string, not '%.200s'", Py_TYPE(value)->tp_name); | |||||
| return NULL; | |||||
| } | |||||
| RNA_struct_state_bl_origin_set(name); | |||||
| Py_RETURN_NONE; | |||||
| } | |||||
| PyMethodDef meth_bpy_bl_origin_get = { | |||||
| "_bl_origin_get", (PyCFunction)pyrna_bl_origin_get, METH_NOARGS, NULL, | |||||
| }; | |||||
| PyMethodDef meth_bpy_bl_origin_set = { | |||||
| "_bl_origin_set", (PyCFunction)pyrna_bl_origin_set, METH_O, NULL, | |||||
| }; | |||||
| /* currently this is fairly limited, we would need to make some way to split up | /* currently this is fairly limited, we would need to make some way to split up | ||||
| * pyrna_callback_classmethod_... if we want more than one callback per type */ | * pyrna_callback_classmethod_... if we want more than one callback per type */ | ||||
| typedef struct BPyRNA_CallBack { | typedef struct BPyRNA_CallBack { | ||||
| PyMethodDef py_method; | PyMethodDef py_method; | ||||
| StructRNA *bpy_srna; | StructRNA *bpy_srna; | ||||
| } PyRNA_CallBack; | } PyRNA_CallBack; | ||||
| static struct BPyRNA_CallBack pyrna_cb_methods[] = { | static struct BPyRNA_CallBack pyrna_cb_methods[] = { | ||||
| Show All 27 Lines | |||||