diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-14 14:21:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-14 14:21:21 +0300 |
commit | 39c04315e2815bbd24c9ba5f7e0aa11736fa1c48 (patch) | |
tree | 6c88f9d9dc4562374df40f080147b3a6144834e6 /source/blender/python | |
parent | b02f78ed02fd0c6fbb8f67bba1c123552052321c (diff) |
change python scripts so modules which register with blender have a register() function rather then making import automatically run the register functions (generally considered bad practice by python people)
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 9a2d6782979..961b7ab3dab 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3881,7 +3881,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, %.200s class \"%.200s\" function to have %d args", class_type, py_class_name, RNA_function_identifier(func), func_arg_count); + PyErr_Format( PyExc_AttributeError, "expected %.200s, %.200s class \"%.200s\" function to have %d args, found %d", class_type, py_class_name, RNA_function_identifier(func), func_arg_count, arg_count); return -1; } } @@ -4165,6 +4165,11 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) PyObject *item; const char *identifier= ""; + if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) { + PyErr_SetString(PyExc_AttributeError, "Alredy registered as a subclass."); + return NULL; + } + srna= pyrna_struct_as_srna(py_class); if(srna==NULL) return NULL; |