UI: Clicking the camera icon while rendering should open render window #105765
|
@ -6124,7 +6124,8 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
|||
ScrArea *area = CTX_wm_area(C);
|
||||
void *owner = nullptr;
|
||||
int handle_event, icon = 0;
|
||||
const char* op_name = NULL;
|
||||
const char *op_name = nullptr;
|
||||
const char *op_desc = nullptr;
|
||||
|
||||
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
UI_block_layout_set_current(block, layout);
|
||||
|
@ -6187,6 +6188,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
|||
handle_event = B_STOPRENDER;
|
||||
icon = ICON_SCENE;
|
||||
op_name = "RENDER_OT_view_show";
|
||||
op_desc = "Show the render window";
|
||||
break;
|
||||
}
|
||||
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
|
||||
|
@ -6243,53 +6245,38 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
|
|||
|
||||
const char *name = active ? WM_jobs_name(wm, owner) : "Canceling...";
|
||||
|
||||
/* job name and icon */
|
||||
const int textwidth = UI_fontstyle_string_width(fstyle, name);
|
||||
if(op_name) {
|
||||
/* 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_("Show/ focus render window"));
|
||||
uiDefIconTextBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
0,
|
||||
name,
|
||||
0,
|
||||
0,
|
||||
textwidth + UI_UNIT_X * 1.5f,
|
||||
UI_UNIT_Y,
|
||||
nullptr,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
"");
|
||||
}
|
||||
else {
|
||||
uiDefIconTextBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
icon,
|
||||
name,
|
||||
0,
|
||||
0,
|
||||
textwidth + UI_UNIT_X * 1.5f,
|
||||
UI_UNIT_Y,
|
||||
nullptr,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
"");
|
||||
UI_BTYPE_BUT,
|
||||
op_name,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
icon,
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_X,
|
||||
UI_UNIT_Y,
|
||||
TIP_(op_desc));
|
||||
}
|
||||
|
||||
/* job name and icon if not previously set */
|
||||
const int textwidth = UI_fontstyle_string_width(fstyle, name);
|
||||
uiDefIconTextBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
op_name ? 0 : icon,
|
||||
name,
|
||||
0,
|
||||
0,
|
||||
textwidth + UI_UNIT_X * 1.5f,
|
||||
UI_UNIT_Y,
|
||||
nullptr,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
"");
|
||||
|
||||
/* stick progress bar and cancel button together */
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiLayoutSetActive(row, active);
|
||||
|
|
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.