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:
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);
+ }
+}