[Bf-blender-cvs] [bc3db85] master: UI: show error when pasting fails
Campbell Barton
noreply at git.blender.org
Thu Jan 14 03:04:29 CET 2016
Commit: bc3db85da8c6aa101d6ccf8d50f8d11ee1b143de
Author: Campbell Barton
Date: Thu Jan 14 12:53:42 2016 +1100
Branches: master
https://developer.blender.org/rBbc3db85da8c6aa101d6ccf8d50f8d11ee1b143de
UI: show error when pasting fails
===================================================================
M source/blender/editors/interface/interface_handlers.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index f71dcc0..0294925 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2218,6 +2218,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
int buf_paste_len = 0;
const char *buf_paste = "";
bool buf_paste_alloc = false;
+ bool show_report = false; /* use to display errors parsing paste input */
if (mode == 'v' && but->lock == true) {
return;
@@ -2268,6 +2269,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
ui_but_string_set(C, but, buf_paste);
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
+ else {
+ /* evaluating will report errors */
+ show_report = true;
+ }
}
}
@@ -2294,6 +2299,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
ui_but_v3_set(but, xyz);
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
+ else {
+ WM_report(C, RPT_ERROR, "Paste expected 3 numbers, formatted: '[n, n, n]'");
+ show_report = true;
+ }
}
}
@@ -2335,6 +2344,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
+ else {
+ WM_report(C, RPT_ERROR, "Paste expected 4 numbers, formatted: '[n, n, n, n]'");
+ show_report = true;
+ }
}
}
@@ -2429,6 +2442,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
if (buf_paste_alloc) {
MEM_freeN((void *)buf_paste);
}
+
+ if (show_report) {
+ WM_report_banner_show(C);
+ }
}
/**
More information about the Bf-blender-cvs
mailing list