F8 reload works again, script errors are printed but dont stop loading every other script

This commit is contained in:
2009-11-13 11:10:29 +00:00
parent b17964af11
commit 5a322bd67c
10 changed files with 82 additions and 64 deletions

View File

@@ -57,13 +57,13 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
// XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it...
bContext *C = BPy_GetContext();
if (!PyArg_ParseTuple(args, "sO|O!i:bpy.__ops__.call", &opname, &context_dict, &PyDict_Type, &kw, &context))
if (!PyArg_ParseTuple(args, "sO|O!i:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context))
return NULL;
ot= WM_operatortype_find(opname, TRUE);
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;
}
@@ -76,7 +76,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
Py_XINCREF(context_dict); /* so we done loose it */
if(WM_operator_poll((bContext*)C, ot) == FALSE) {
PyErr_SetString( PyExc_SystemError, "bpy.__ops__.call: operator poll() function failed, context is incorrect");
PyErr_SetString( PyExc_SystemError, "_bpy.ops.call: operator poll() function failed, context is incorrect");
error_val= -1;
}
else {
@@ -158,13 +158,13 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args)
bContext *C = BPy_GetContext();
if (!PyArg_ParseTuple(args, "s|O!i:bpy.__ops__.as_string", &opname, &PyDict_Type, &kw, &all_args))
if (!PyArg_ParseTuple(args, "s|O!i:_bpy.ops.as_string", &opname, &PyDict_Type, &kw, &all_args))
return NULL;
ot= WM_operatortype_find(opname, TRUE);
if (ot == NULL) {
PyErr_Format( PyExc_SystemError, "bpy.__ops__.as_string: operator \"%s\"could not be found", opname);
PyErr_Format( PyExc_SystemError, "_bpy.ops.as_string: operator \"%s\"could not be found", opname);
return NULL;
}
@@ -217,12 +217,12 @@ static PyObject *pyop_getrna(PyObject *self, PyObject *value)
BPy_StructRNA *pyrna= NULL;
if(opname==NULL) {
PyErr_SetString(PyExc_TypeError, "bpy.__ops__.get_rna() expects a string argument");
PyErr_SetString(PyExc_TypeError, "_bpy.ops.get_rna() expects a string argument");
return NULL;
}
ot= WM_operatortype_find(opname, TRUE);
if(ot==NULL) {
PyErr_Format(PyExc_KeyError, "bpy.__ops__.get_rna(\"%s\") not found", opname);
PyErr_Format(PyExc_KeyError, "_bpy.ops.get_rna(\"%s\") not found", opname);
return NULL;
}
@@ -245,8 +245,8 @@ PyObject *BPY_operator_module( void )
static PyMethodDef pyop_add_meth = {"add", (PyCFunction) PYOP_wrap_add, METH_O, NULL};
static PyMethodDef pyop_remove_meth = {"remove", (PyCFunction) PYOP_wrap_remove, METH_O, NULL};
PyObject *submodule = PyModule_New("bpy.__ops__");
PyDict_SetItemString(PySys_GetObject("modules"), "bpy.__ops__", submodule);
PyObject *submodule = PyModule_New("_bpy.ops");
PyDict_SetItemString(PySys_GetObject("modules"), "_bpy.ops", submodule);
PyModule_AddObject( submodule, "call", PyCFunction_New(&pyop_call_meth, NULL) );
PyModule_AddObject( submodule, "as_string",PyCFunction_New(&pyop_as_string_meth,NULL) );

View File

@@ -341,7 +341,11 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
// in python would be...
//PyObject *optype = PyObject_GetAttrString(PyObject_GetAttrString(PyDict_GetItemString(PyEval_GetGlobals(), "bpy"), "types"), "Operator");
base_class = PyObject_GetAttrStringArgs(PyDict_GetItemString(PyEval_GetGlobals(), "bpy"), 2, "types", "Operator");
//PyObject bpy_mod= PyDict_GetItemString(PyEval_GetGlobals(), "bpy");
PyObject *bpy_mod= PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
base_class = PyObject_GetAttrStringArgs(bpy_mod, 2, "types", "Operator");
Py_DECREF(bpy_mod);
if(BPY_class_validate("Operator", py_class, base_class, pyop_class_attr_values, NULL) < 0) {
return NULL; /* BPY_class_validate sets the error */

View File

@@ -48,7 +48,7 @@ static struct PyMethodDef ui_methods[] = {
static struct PyModuleDef ui_module = {
PyModuleDef_HEAD_INIT,
"bpy.ui",
"_bpy.ui",
"",
-1,/* multiple "initialization" just copies the module dict. */
ui_methods,