minor changes and error checking.

tested first PyOperator, basics work now, invoke/exec can be used to make an operator that edits RNA or calls other operators.
This commit is contained in:
2008-12-28 13:03:37 +00:00
parent 1e463b22eb
commit f9fd3d7139
2 changed files with 42 additions and 14 deletions

View File

@@ -188,10 +188,9 @@ static PyObject * pyop_func_call(BPy_OperatorFunc * self, PyObject *args, PyObje
RNA_pointer_create(NULL, NULL, ot->srna, &properties, &ptr);
PYOP_props_from_dict(&ptr, kw);
error_val= PYOP_props_from_dict(&ptr, kw);
if (error_val==0) {
//WM_operator_name_call(self->C, self->name, WM_OP_INVOKE_DEFAULT, properties);
WM_operator_name_call(self->C, self->name, WM_OP_EXEC_DEFAULT, properties);
}
@@ -200,7 +199,21 @@ static PyObject * pyop_func_call(BPy_OperatorFunc * self, PyObject *args, PyObje
MEM_freeN(properties);
}
if (error_val) {
#if 0
/* if there is some way to know an operator takes args we should use this */
{
/* no props */
if (kw != NULL) {
PyErr_Format(PyExc_AttributeError, "Operator \"%s\" does not take any args", self->name);
return NULL;
}
WM_operator_name_call(self->C, self->name, WM_OP_EXEC_DEFAULT, NULL);
}
#endif
if (error_val==-1) {
return NULL;
}