forked from bartvdbraak/blender
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.
This commit is contained in:
parent
89dea61c17
commit
371a7b477d
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user