UI: Clicking the camera icon while rendering should open render window #105765

Merged
Jeroen Bakker merged 6 commits from rems64/blender:T102210-click-camera-icon into main 2023-03-21 07:53:41 +01:00
1 changed files with 22 additions and 2 deletions

View File

@ -6123,6 +6123,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 = nullptr;
const char *op_description = nullptr;

Best to use none abbreviated names op_description.
Code is mostly written once, but read many times, code and naming should reflect this.

Best to use none abbreviated names `op_description`. Code is mostly written once, but read many times, code and naming should reflect this.
uiBlock *block = uiLayoutGetBlock(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)) {
handle_event = B_STOPRENDER;
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;
}
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...";
/* 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);
uiDefIconTextBut(block,
UI_BTYPE_LABEL,
0,
icon,
op_name ? 0 : icon,
name,
0,
0,