- report python script errors to blender report system, or through operators reports (when using operator callbacks).

- when python operators fail to execute they were returning RUNNING_MODAL, now return CANCELLED

now when an operator fails it gives an error popup as well as a message in the terminal.
This commit is contained in:
2010-11-20 16:39:15 +00:00
parent 6e5ccba6da
commit 7b16d7496d
2 changed files with 19 additions and 4 deletions

View File

@@ -5244,6 +5244,20 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
}
if(err != 0) {
ReportList *reports;
/* alert the user, else they wont know unless they see the console. */
if (!is_static && ptr->data && RNA_struct_is_a(ptr->type, &RNA_Operator)) {
wmOperator *op= ptr->data;
reports= op->reports;
}
else {
/* wont alert users but they can view in 'info' space */
reports= CTX_wm_reports(C);
}
BPy_errors_to_report(reports);
/* also print in the console for py */
PyErr_Print();
PyErr_Clear();
}