Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-11-20 19:39:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-20 19:39:15 +0300
commit7b16d7496d7347002f83bd52d779e52c06270115 (patch)
tree7deb173691a36d9576fb46674ba77dbf4eda2e4e /source/blender/python
parent6e5ccba6da0f89649bd74fbf5c14852509603d88 (diff)
- 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.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_rna.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 8daad50f5d0..e0257a38eb3 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -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();
}