diff options
author | Matt Ebb <matt@mke3.net> | 2010-05-27 12:22:16 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-05-27 12:22:16 +0400 |
commit | 6e92ddf8b37dbfae733a9738a20777917610b4a0 (patch) | |
tree | 4f92654d234a24a85918f5ec37ad1a9e4d819e63 /source/blender/editors/interface/interface_templates.c | |
parent | ec70356424d687cb1cdb8cb80095a5593937e03a (diff) |
Progress indicators for threaded jobs
Now, rather than the bit-too-alarming stop sign, threaded wmJobs
display a progress indicator in the header. This is an optional feature
for each job type and still uses the same hardcoded ui template
(could use further work here...).
Currently implemented for:
Render - parts completed, then nodes comped
Compositor - nodes comped
Fluid Sim - frames simulated
Texture Bake - faces baked
Example: http://mke3.net/blender/devel/2.5/progress.mov
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8cf6c2915c2..4183ff49e51 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2423,24 +2423,40 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) wmWindowManager *wm= CTX_wm_manager(C); ScrArea *sa= CTX_wm_area(C); uiBlock *block; - + void *owner; + int handle_event; + block= uiLayoutGetBlock(layout); uiBlockSetCurLayout(block, layout); uiBlockSetHandleFunc(block, do_running_jobs, NULL); if(sa->spacetype==SPACE_NODE) { - if(WM_jobs_test(wm, sa)) - uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, "Composite", 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop composite"); + owner = sa; + handle_event= B_STOPCOMPO; + } else { + owner = scene; + handle_event= B_STOPRENDER; } - else { - if(WM_jobs_test(wm, scene)) - uiDefIconTextBut(block, BUT, B_STOPRENDER, ICON_CANCEL, "Render", 0,0,75,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop rendering"); - if(WM_jobs_test(wm, screen)) - uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, "Capture", 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop screencast"); - if(screen->animtimer) - 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"); + + if(WM_jobs_test(wm, owner)) { + uiLayout *abs; + + abs = uiLayoutAbsolute(layout, 0); + + uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, + 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, "Stop this job"); + uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner), + UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, "Progress"); + + uiLayoutRow(layout, 0); } + if(WM_jobs_test(wm, screen)) + uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, "Capture", 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop screencast"); + if(screen->animtimer) + 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"); + + uiItemS(layout); } /************************* Reports for Last Operator Template **************************/ |