UI: Clicking the camera icon while rendering should open render window #105765
|
@ -6123,6 +6123,8 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
||||||
ScrArea *area = CTX_wm_area(C);
|
ScrArea *area = CTX_wm_area(C);
|
||||||
void *owner = nullptr;
|
void *owner = nullptr;
|
||||||
int handle_event, icon = 0;
|
int handle_event, icon = 0;
|
||||||
|
const char *op_name = nullptr;
|
||||||
|
const char *op_description = nullptr;
|
||||||
|
|
||||||
|
|||||||
uiBlock *block = uiLayoutGetBlock(layout);
|
uiBlock *block = uiLayoutGetBlock(layout);
|
||||||
UI_block_layout_set_current(block, layout);
|
UI_block_layout_set_current(block, layout);
|
||||||
|
@ -6184,6 +6186,10 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
||||||
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
|
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
|
||||||
handle_event = B_STOPRENDER;
|
handle_event = B_STOPRENDER;
|
||||||
icon = ICON_SCENE;
|
icon = ICON_SCENE;
|
||||||
|
if (U.render_display_type != USER_RENDER_DISPLAY_NONE) {
|
||||||
|
op_name = "RENDER_OT_view_show";
|
||||||
|
op_description = "Show the render window";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
|
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
|
||||||
|
@ -6240,12 +6246,26 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
||||||
|
|
||||||
const char *name = active ? WM_jobs_name(wm, owner) : "Canceling...";
|
const char *name = active ? WM_jobs_name(wm, owner) : "Canceling...";
|
||||||
|
|
||||||
/* job name and icon */
|
/* job icon as a button */
|
||||||
|
if (op_name) {
|
||||||
|
uiDefIconButO(block,
|
||||||
|
UI_BTYPE_BUT,
|
||||||
|
op_name,
|
||||||
|
WM_OP_INVOKE_DEFAULT,
|
||||||
|
icon,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
UI_UNIT_X,
|
||||||
|
UI_UNIT_Y,
|
||||||
|
TIP_(op_description));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* job name and icon if not previously set */
|
||||||
const int textwidth = UI_fontstyle_string_width(fstyle, name);
|
const int textwidth = UI_fontstyle_string_width(fstyle, name);
|
||||||
uiDefIconTextBut(block,
|
uiDefIconTextBut(block,
|
||||||
UI_BTYPE_LABEL,
|
UI_BTYPE_LABEL,
|
||||||
0,
|
0,
|
||||||
icon,
|
op_name ? 0 : icon,
|
||||||
name,
|
name,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
Loading…
Reference in New Issue
Best to use none abbreviated names
op_description
.Code is mostly written once, but read many times, code and naming should reflect this.