diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-24 19:10:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-24 19:10:26 +0300 |
commit | 4dd3e6c36070e64d8b1d784a34d9881ae2c3eed8 (patch) | |
tree | b5797cbc48a2cffad1a50d07945c8e5b31b68e6c /source/blender/python/intern | |
parent | 1d224ad692c8794500f4d6fd5257887db150a635 (diff) |
support for registering operators using the same internal rna api as panels, menus, headers & render engines since there was a fair bit of duplicate functionality.
will remove the old system and update scripts next.
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index b4a2fb36a97..7ccbe1c16a4 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -63,7 +63,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) ot= WM_operatortype_exists(opname); if (ot == NULL) { - PyErr_Format( PyExc_SystemError, "_bpy.ops.call: operator \"%s\"could not be found", opname); + PyErr_Format( PyExc_SystemError, "_bpy.ops.call: operator \"%s\" could not be found", opname); return NULL; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 65d2b687275..d0cc3e95097 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3824,13 +3824,12 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun PyObject *item, *fitem; PyObject *py_arg_count; int i, flag, arg_count, func_arg_count; - const char *identifier; + const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; // __name__ + if (base_class) { if (!PyObject_IsSubclass(py_class, base_class)) { - PyObject *name= PyObject_GetAttrString(base_class, "__name__"); - PyErr_Format( PyExc_TypeError, "expected %.200s subclass of class \"%.200s\"", class_type, name ? _PyUnicode_AsString(name):"<UNKNOWN>"); - Py_XDECREF(name); + PyErr_Format( PyExc_TypeError, "expected %.200s subclass of class \"%.200s\"", class_type, py_class_name); return -1; } } @@ -3852,7 +3851,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun if (item==NULL) { if ((flag & FUNC_REGISTER_OPTIONAL)==0) { - PyErr_Format( PyExc_AttributeError, "expected %.200s class to have an \"%.200s\" attribute", class_type, RNA_function_identifier(func)); + PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, RNA_function_identifier(func)); return -1; } @@ -3867,7 +3866,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun fitem= item; /* py 3.x */ if (PyFunction_Check(fitem)==0) { - PyErr_Format( PyExc_TypeError, "expected %.200s class \"%.200s\" attribute to be a function", class_type, RNA_function_identifier(func)); + PyErr_Format( PyExc_TypeError, "expected %.200s, %.200s class \"%.200s\" attribute to be a function", class_type, py_class_name, RNA_function_identifier(func)); return -1; } @@ -3879,7 +3878,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun Py_DECREF(py_arg_count); if (arg_count != func_arg_count) { - PyErr_Format( PyExc_AttributeError, "expected %.200s class \"%.200s\" function to have %d args", class_type, RNA_function_identifier(func), func_arg_count); + PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class \"%.200s\" function to have %d args", class_type, py_class_name, RNA_function_identifier(func), func_arg_count); return -1; } } @@ -3889,6 +3888,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun /* verify properties */ lb= RNA_struct_defined_properties(srna); for(link=lb->first; link; link=link->next) { + const char *identifier; prop= (PropertyRNA*)link; flag= RNA_property_flag(prop); @@ -3914,7 +3914,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun if (item == NULL && (((flag & PROP_REGISTER_OPTIONAL) != PROP_REGISTER_OPTIONAL))) { - PyErr_Format( PyExc_AttributeError, "expected %.200s class to have an \"%.200s\" attribute", class_type, identifier); + PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class to have an \"%.200s\" attribute", class_type, py_class_name, identifier); return -1; } |