diff options
author | Martin Poirier <theeth@yahoo.com> | 2011-04-02 18:58:58 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2011-04-02 18:58:58 +0400 |
commit | 371a7b477d0b40da8859cf25691c53371365f8e5 (patch) | |
tree | db75db6fa75a6eb51707bb32938c87302ca232db | |
parent | 89dea61c174e0dbb871385a2e9bf3eab5a4d4df3 (diff) |
Fix register method order. Was broken when Campbell moved it to the C implementation.
register has to be called AFTER the type is registered while unregister has to be called BEFORE it's unregistered.
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 29f05369f44..add088d181a 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6189,22 +6189,6 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class return NULL; } - /* call classed register function () */ - py_cls_meth= PyObject_GetAttrString(py_class, "register"); - if(py_cls_meth == NULL) { - PyErr_Clear(); - } - else { - PyObject *ret= PyObject_CallObject(py_cls_meth, NULL); - if(ret) { - Py_DECREF(ret); - } - else { - return NULL; - } - } - - /* get the context, so register callback can do necessary refreshes */ C= BPy_GetContext(); @@ -6238,6 +6222,21 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class if(pyrna_deferred_register_class(srna_new, py_class)!=0) return NULL; + /* call classed register method () */ + py_cls_meth= PyObject_GetAttrString(py_class, "register"); + if(py_cls_meth == NULL) { + PyErr_Clear(); + } + else { + PyObject *ret= PyObject_CallObject(py_cls_meth, NULL); + if(ret) { + Py_DECREF(ret); + } + else { + return NULL; + } + } + Py_RETURN_NONE; } @@ -6299,7 +6298,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla return NULL; } - /* call classed register function */ + /* call classed unregister method */ py_cls_meth= PyObject_GetAttrString(py_class, "unregister"); if(py_cls_meth == NULL) { PyErr_Clear(); |