UI: click on status bar report message now opens window with Info editor
Patch by Valentin (Poulpator) Differential Revision: https://developer.blender.org/D5468
This commit is contained in:
parent
42cee6ab21
commit
145f851731
|
@ -6392,22 +6392,17 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
|
|||
block, UI_BTYPE_LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
}
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
uiDefBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
but = uiDefButO(block,
|
||||
UI_BTYPE_BUT,
|
||||
"SCREEN_OT_info_log_show",
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
report->message,
|
||||
UI_UNIT_X + 5,
|
||||
0,
|
||||
UI_UNIT_X + width,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
"Show in Info Log");
|
||||
rgba_float_to_uchar(but->col, rti->col);
|
||||
}
|
||||
|
||||
void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
|
||||
|
|
|
@ -4774,6 +4774,45 @@ static void SCREEN_OT_drivers_editor_show(struct wmOperatorType *ot)
|
|||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Show Info Log Operator
|
||||
* \{ */
|
||||
|
||||
static int info_log_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
PointerRNA ptr = {{NULL}};
|
||||
PropertyRNA *prop = NULL;
|
||||
|
||||
int sizex = 900 * UI_DPI_FAC;
|
||||
int sizey = 580 * UI_DPI_FAC;
|
||||
int shift_y = 480;
|
||||
|
||||
/* changes context! */
|
||||
if (WM_window_open_temp(C, event->x, event->y+shift_y, sizex, sizey, WM_WINDOW_INFO) != NULL) {
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_HEADER);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
static void SCREEN_OT_info_log_show(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Show Info Log";
|
||||
ot->description = "Show info log in a separate window";
|
||||
ot->idname = "SCREEN_OT_info_log_show";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke = info_log_show_invoke;
|
||||
ot->poll = ED_operator_screenactive;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name New Screen Operator
|
||||
* \{ */
|
||||
|
@ -5241,6 +5280,7 @@ void ED_operatortypes_screen(void)
|
|||
WM_operatortype_append(SCREEN_OT_screenshot);
|
||||
WM_operatortype_append(SCREEN_OT_userpref_show);
|
||||
WM_operatortype_append(SCREEN_OT_drivers_editor_show);
|
||||
WM_operatortype_append(SCREEN_OT_info_log_show);
|
||||
WM_operatortype_append(SCREEN_OT_region_blend);
|
||||
WM_operatortype_append(SCREEN_OT_space_type_set_or_cycle);
|
||||
WM_operatortype_append(SCREEN_OT_space_context_cycle);
|
||||
|
|
|
@ -162,6 +162,7 @@ enum {
|
|||
WM_WINDOW_RENDER = 1,
|
||||
WM_WINDOW_USERPREFS,
|
||||
WM_WINDOW_DRIVERS,
|
||||
WM_WINDOW_INFO,
|
||||
// WM_WINDOW_FILESEL // UNUSED
|
||||
};
|
||||
|
||||
|
|
|
@ -893,6 +893,9 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
|||
else if (type == WM_WINDOW_DRIVERS) {
|
||||
ED_area_newspace(C, sa, SPACE_GRAPH, false);
|
||||
}
|
||||
else if (type == WM_WINDOW_INFO) {
|
||||
ED_area_newspace(C,sa, SPACE_INFO,false);
|
||||
}
|
||||
else {
|
||||
ED_area_newspace(C, sa, SPACE_USERPREF, false);
|
||||
}
|
||||
|
@ -917,6 +920,9 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
|||
else if (sa->spacetype == SPACE_GRAPH) {
|
||||
title = IFACE_("Blender Drivers Editor");
|
||||
}
|
||||
else if (sa->spacetype == SPACE_INFO){
|
||||
title = IFACE_("Blender Info Log");
|
||||
}
|
||||
else {
|
||||
title = "Blender";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue