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:
authorJoshua Leung <aligorith@gmail.com>2010-03-02 14:48:40 +0300
committerJoshua Leung <aligorith@gmail.com>2010-03-02 14:48:40 +0300
commitda3802f5590a14c703b100a480928eea8722746b (patch)
tree6f6f925b058844f4e58e23cf40e4be279f267442 /source/blender/editors
parent46d50b0d1f27857453d4810141f86ab2e5f49208 (diff)
Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again). For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner. The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos... * When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports... * There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest. * Timer based fade out/disappear?
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c41
3 files changed, 43 insertions, 1 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 54aeea484f0..5c6ac272c53 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -687,6 +687,7 @@ void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
void uiTemplateOperatorSearch(uiLayout *layout);
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex);
+void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C, struct wmOperator *op);
void uiTemplateList(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, struct PointerRNA *activeptr, char *activeprop, int rows, int maxrows, int type);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 8eba7e5505f..bc03be84b65 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2271,7 +2271,7 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
else if(report->type >= RPT_WARNING)
BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
else if(report->type >= RPT_INFO)
- BLI_dynstr_appendf(ds, "Info %%t|%s", report->message);
+ BLI_dynstr_appendf(ds, "Info %%i%d%%t|%s", ICON_INFO, report->message);
}
str= BLI_dynstr_get_cstring(ds);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e2804efe040..e3dac41979d 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2484,4 +2484,45 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, "Anim Player", 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop animation playback");
}
+/************************* Reports for Last Operator Template **************************/
+
+void uiTemplateReportsBanner(uiLayout *layout, bContext *C, wmOperator *op)
+{
+ ReportList *reports = op->reports;
+ uiLayout *box;
+
+ /* sanity checks */
+ if (ELEM(NULL, op, reports)) {
+ printf("uiTemplateReportsBanner: no operator with reports!\n");
+ return;
+ }
+
+ /* make a box around the report to make it stand out */
+ box = uiLayoutBox(layout);
+ uiLayoutSetScaleY(box, 0.48); /* experimentally determined value to reduce execessive padding... */
+
+ /* if more than one report, we need to show the popup when user clicks on the temp label... */
+ if (reports->list.first != reports->list.last) {
+ int numReports = BLI_countlist(&reports->list);
+ char buf[64];
+
+ // XXX: we need uiItem* to return uiBut pointer so that we can use it to set callbacks
+ // used to call uiPupMenuReports... as alternative, we could fall back to the "old ways"
+ //sprintf(buf, "Last Operator had %d errors. Click to see more...", numReports);
+ sprintf(buf, "Last Operator had %d errors", numReports);
+ uiItemL(box, buf, ICON_INFO);
+ }
+ else {
+ /* single report, so show report directly */
+ // XXX: what if the report is too long? should we truncate the text?
+ Report *report= (Report *)reports->list.first;
+
+ if(report->type >= RPT_ERROR)
+ uiItemL(box, report->message, ICON_ERROR);
+ else if(report->type >= RPT_WARNING)
+ uiItemL(box, report->message, ICON_ERROR);
+ else if(report->type >= RPT_INFO)
+ uiItemL(box, report->message, ICON_INFO);
+ }
+}