add wm job types they are not used yet, so this just defines them for new jobs add...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 15 Aug 2012 09:42:06 +0000 (09:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 15 Aug 2012 09:42:06 +0000 (09:42 +0000)
17 files changed:
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_modifier.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_preview.c
source/blender/editors/screen/screendump.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/util/undo.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_jobs.c
source/blender/windowmanager/intern/wm_operators.c

index 9207a6ff3b8b34c624b80609a6066257f7c80182..59e097a1980adf437864ac5441de23694fb82dde 100644 (file)
@@ -2597,17 +2597,17 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
        uiBlockSetHandleFunc(block, do_running_jobs, NULL);
 
        if (sa->spacetype == SPACE_NODE) {
-               if (WM_jobs_test(wm, sa))
+               if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
                        owner = sa;
                handle_event = B_STOPCOMPO;
        }
        else if (sa->spacetype == SPACE_SEQ) {
-               if (WM_jobs_test(wm, sa))
+               if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
                        owner = sa;
                handle_event = B_STOPSEQ;
        }
        else if (sa->spacetype == SPACE_CLIP) {
-               if (WM_jobs_test(wm, sa))
+               if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
                        owner = sa;
                handle_event = B_STOPCLIP;
        }
@@ -2615,7 +2615,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
                Scene *scene;
                /* another scene can be rendering too, for example via compositor */
                for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next)
-                       if (WM_jobs_test(wm, scene))
+                       if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY))
                                break;
                owner = scene;
                handle_event = B_STOPRENDER;
@@ -2634,7 +2634,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
                
                uiLayoutRow(layout, FALSE);
        }
-       if (WM_jobs_test(wm, screen))
+       if (WM_jobs_test(wm, screen, WM_JOB_TYPE_ANY))
                uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
                                 TIP_("Stop screencast"));
        if (screen->animtimer)
index c3093259fd84b885187210c9d04ad433d4f1e214..be0d9e67779ae586572276f8c3edb50bdd70d751 100644 (file)
@@ -1255,7 +1255,8 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
        }
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake",
+                           WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
        WM_jobs_customdata_set(steve, bkr, multiresbake_freejob);
        WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
        WM_jobs_callbacks(steve, multiresbake_startjob, NULL, NULL, NULL);
@@ -1438,7 +1439,7 @@ static void bake_freejob(void *bkv)
 static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
        /* no running blender, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY))
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running render */
@@ -1468,7 +1469,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
        }
        else {
                /* only one render job at a time */
-               if (WM_jobs_test(CTX_wm_manager(C), scene))
+               if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_ANY))
                        return OPERATOR_CANCELLED;
 
                if (test_bake_internal(C, op->reports) == 0) {
@@ -1482,7 +1483,8 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
                        bkr->reports = op->reports;
 
                        /* setup job */
-                       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
+                       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake",
+                                           WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
                        WM_jobs_customdata_set(steve, bkr, bake_freejob);
                        WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
                        WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
index 2bace9c30d49ad52fea2ac8265777c5f85f929cd..556ed44520cb71b4f2f44a49f3e3387f78427e05 100644 (file)
@@ -2181,7 +2181,8 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
        scene->r.cfra = cfra;
        
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation",
+                           WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_SIM_OCEAN);
        oj = MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
        oj->ocean = ocean;
        oj->och = och;
index 621d06a7bd86444be0ab7a84ae9980910b75765a..60907e8cefaaf72bb5de84f5ae3f5c1acc597598 100644 (file)
@@ -1130,7 +1130,7 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object
 static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
        /* only one bake job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY))
                return OPERATOR_CANCELLED;
 
        if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE))
index ae1b82c6690aede336c8d221b46c73e75047335b..c5467051bb2738557225817a85b55ef5e9aa4170 100644 (file)
@@ -457,7 +457,7 @@ static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event)
        Scene *scene = (Scene *) op->customdata;
 
        /* no running blender, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), scene)) {
+       if (0 == WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_ANY)) {
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
        }
 
@@ -489,7 +489,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        const char *name;
        
        /* only one render job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), scene))
+       if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_ANY))
                return OPERATOR_CANCELLED;
 
        if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
@@ -564,7 +564,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
        else name = "Render";
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag, WM_JOB_TYPE_RENDER);
        WM_jobs_customdata_set(steve, rj, render_freejob);
        WM_jobs_timer(steve, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
        WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
index d705799b1d83b9d76d6d80ec058957f829c5aaf5..8151ba3f251bfe79729dcce000645ddd76b0eb33 100644 (file)
@@ -309,7 +309,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
        }
 
        /* only one render job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), scene))
+       if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_ANY))
                return 0;
        
        if (!is_view_context && scene->camera == NULL) {
index 03906c99c7463055920b3efa03a4dfab71ffc4f1..bdc44af76c8ad9d07e2acda26254aa972077a5d5 100644 (file)
@@ -1026,7 +1026,8 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
        IconPreview *ip, *old_ip;
        
        /* suspended start means it starts after 1 timer step, see WM_jobs_timer below */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview", WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview",
+                           WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND, WM_JOB_TYPE_RENDER_PREVIEW);
 
        ip = MEM_callocN(sizeof(IconPreview), "icon preview");
 
@@ -1056,7 +1057,8 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
        wmJob *steve;
        ShaderPreview *sp;
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview",
+                           WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
        sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
 
        /* customdata for preview thread */
index 166a4943db0281e11800b9e427a22cb5b25939da..3dd3a28a7e5986eafcc8c4afda5e057c4ea2671b 100644 (file)
@@ -396,7 +396,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 static int screencast_exec(bContext *C, wmOperator *op)
 {
        bScreen *screen = CTX_wm_screen(C);
-       wmJob *steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0);
+       wmJob *steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0, WM_JOB_TYPE_SCREENCAST);
        ScreenshotJob *sj = MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
 
        /* setup sj */
index 9b4f3fcdd68ff650ab6e8b48428ffb11b06f61ed..c88ab095b2e648759e637a13f227bde6fb686927 100644 (file)
@@ -1041,7 +1041,8 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
        if ((clip->flag & MCLIP_USE_PROXY) == 0)
                return OPERATOR_CANCELLED;
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies",
+                           WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_BUILD_PROXY);
 
        pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
        pj->scene = scene;
index bf0a6617e2b1c5b3ea2a3163f784d96db1c65e0a..580b23486e81700a4bb3f47ff6eb12a64f977669 100644 (file)
@@ -1239,7 +1239,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
        int backwards = RNA_boolean_get(op->ptr, "backwards");
        int sequence = RNA_boolean_get(op->ptr, "sequence");
 
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
                /* only one tracking is allowed at a time */
                return OPERATOR_CANCELLED;
        }
@@ -1261,7 +1261,8 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
        }
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers", WM_JOB_PROGRESS);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers",
+                           WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_TRACK_MARKERS);
        WM_jobs_customdata_set(steve, tmj, track_markers_freejob);
 
        /* if there's delay set in tracking job, tracking should happen
@@ -1289,7 +1290,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
        /* no running tracking, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY))
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running tracking */
@@ -1470,7 +1471,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
        wmJob *steve;
        char error_msg[256] = "\0";
 
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
                /* only one solve is allowed at a time */
                return OPERATOR_CANCELLED;
        }
@@ -1492,7 +1493,8 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
        WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera",
+                           WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_SOLVE_CAMERA);
        WM_jobs_customdata_set(steve, scj, solve_camera_freejob);
        WM_jobs_timer(steve, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0);
        WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
@@ -1511,7 +1513,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
        /* no running solver, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY))
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running tracking */
index 27db7907e30834e5063cea7c3fa5ed7e45822bf3..83ddead92dcd1c033b13539da3ca69c26e6032a1 100644 (file)
@@ -1368,7 +1368,8 @@ void thumbnails_start(struct FileList *filelist, const struct bContext *C)
        BKE_reports_init(&tj->reports, RPT_PRINT);
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails", 0);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails",
+                           0, WM_JOB_TYPE_FILESEL_THUMBNAIL);
        WM_jobs_customdata_set(steve, tj, thumbnails_free);
        WM_jobs_timer(steve, 0.5, NC_WINDOW, NC_WINDOW);
        WM_jobs_callbacks(steve, thumbnails_startjob, NULL, thumbnails_update, NULL);
@@ -1384,5 +1385,5 @@ void thumbnails_stop(struct FileList *filelist, const struct bContext *C)
 
 int thumbnails_running(struct FileList *filelist, const struct bContext *C)
 {
-       return WM_jobs_test(CTX_wm_manager(C), filelist);
+       return WM_jobs_test(CTX_wm_manager(C), filelist, WM_JOB_TYPE_ANY);
 }
index 60375e9ab029001ce6e99f06240b50e97e2b50b4..6ef466ba1c342f04eab1f9ee0a727dc2440ca6b9 100644 (file)
@@ -181,7 +181,8 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
                return;
        }
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing",
+                           WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS, WM_JOB_TYPE_COMPOSITE);
        cj = MEM_callocN(sizeof(CompoJob), "compo job");
 
        /* customdata for preview thread */
index 9e730fff940f725dc3934f550b023e6bf2432207..66739f83597ac3d9d329be6a66f8d057524a36f0 100644 (file)
@@ -186,7 +186,8 @@ static void seq_proxy_build_job(const bContext *C)
        LinkData *link;
        Sequence *seq;
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies",
+                           WM_JOB_PROGRESS, WM_JOB_TYPE_SEQ_BUILD_PROXY);
 
        pj = WM_jobs_customdata_get(steve);
 
index 65b921688423da6d51bc7713182b7c0cfdfb301f..4213ff68cf2d259cff1090e24ceedcae3fc472b6 100644 (file)
@@ -129,7 +129,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 
        /* undo during jobs are running can easily lead to freeing data using by jobs,
         * or they can just lead to freezing job in some other cases */
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY)) {
                return OPERATOR_CANCELLED;
        }
 
@@ -359,7 +359,7 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
                      * (which copy their data), wont stop redo, see [#29579]],
                      *
                      * note, - WM_operator_check_ui_enabled() jobs test _must_ stay in sync with this */
-                    (WM_jobs_test(wm, scene) == 0))
+                    (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY) == 0))
                {
                        int retval;
 
index 584790b4cdae80b1178dcb78e65b9ec806372e95..27507640bdcb3f1c7054295df103bf823f8b9276 100644 (file)
@@ -301,14 +301,34 @@ void              WM_framebuffer_index_set(int index);
 int                    WM_framebuffer_to_index(unsigned int col);
 
                        /* threaded Jobs Manager */
-#define WM_JOB_PRIORITY                1
-#define WM_JOB_EXCL_RENDER     2
-#define WM_JOB_PROGRESS                4
-#define WM_JOB_SUSPEND         8
-
-struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void *owner, const char *name, int flag);
-
-int                    WM_jobs_test(struct wmWindowManager *wm, void *owner);
+enum {
+       WM_JOB_PRIORITY     = (1 << 0),
+       WM_JOB_EXCL_RENDER  = (1 << 1),
+       WM_JOB_PROGRESS     = (1 << 2),
+       WM_JOB_SUSPEND      = (1 << 3)
+};
+
+/* identifying jobs by owner alone is unreliable, this isnt saved, order can change */
+enum {
+       WM_JOB_TYPE_ANY = -1,
+       WM_JOB_TYPE_COMPOSITE,
+       WM_JOB_TYPE_RENDER,
+       WM_JOB_TYPE_RENDER_PREVIEW,  /* UI preview */
+       WM_JOB_TYPE_SCREENCAST,
+       WM_JOB_TYPE_OBJECT_SIM_OCEAN,
+       WM_JOB_TYPE_OBJECT_BAKE_TEXTURE,
+       WM_JOB_TYPE_FILESEL_THUMBNAIL,
+       WM_JOB_TYPE_CLIP_BUILD_PROXY,
+       WM_JOB_TYPE_CLIP_TRACK_MARKERS,
+       WM_JOB_TYPE_CLIP_SOLVE_CAMERA,
+       WM_JOB_TYPE_SEQ_BUILD_PROXY,
+       /* add as needed, screencast, seq proxy build
+        * if having hard coded values is a problem */
+};
+
+struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void *owner, const char *name, int flag, int job_type);
+
+int                    WM_jobs_test(struct wmWindowManager *wm, void *owner, int job_type);
 float          WM_jobs_progress(struct wmWindowManager *wm, void *owner);
 char       *WM_jobs_name(struct wmWindowManager *wm, void *owner);
 
index ce0c7e134544c45666624caa49a31466f3f6a9c3..feca042d2a667234c44d64bb796db5b13b671ad1 100644 (file)
@@ -114,7 +114,7 @@ struct wmJob {
 /* internal */
        void *owner;
        int flag;
-       short suspended, running, ready, do_update, stop;
+       short suspended, running, ready, do_update, stop, job_type;
        float progress;
 
        /* for display in header, identification */
@@ -153,7 +153,7 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
 /* returns current or adds new job, but doesnt run it */
 /* every owner only gets a single job, adding a new one will stop running stop and 
  * when stopped it starts the new one */
-wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag)
+wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
 {
        wmJob *steve = wm_job_find(wm, owner, name);
        
@@ -164,6 +164,7 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
                steve->win = win;
                steve->owner = owner;
                steve->flag = flag;
+               steve->job_type = job_type;
                BLI_strncpy(steve->name, name, sizeof(steve->name));
        }
        
@@ -171,17 +172,22 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
 }
 
 /* returns true if job runs, for UI (progress) indicators */
-int WM_jobs_test(wmWindowManager *wm, void *owner)
+int WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
 {
        wmJob *steve;
        
        /* job can be running or about to run (suspended) */
-       for (steve = wm->jobs.first; steve; steve = steve->next)
-               if (steve->owner == owner)
-                       if (steve->running || steve->suspended)
-                               return 1;
+       for (steve = wm->jobs.first; steve; steve = steve->next) {
+               if (steve->owner == owner) {
+                       if (job_type == WM_JOB_TYPE_ANY || (steve->job_type == job_type)) {
+                               if (steve->running || steve->suspended) {
+                                       return TRUE;
+                               }
+                       }
+               }
+       }
 
-       return 0;
+       return FALSE;
 }
 
 float WM_jobs_progress(wmWindowManager *wm, void *owner)
index 59e0614b18aa5cbe3e6c7c2ff18d351e6a4a9b04..a2812d34e617b2379669bca6fa777b0b8c633737 100644 (file)
@@ -965,7 +965,7 @@ int WM_operator_check_ui_enabled(const bContext *C, const char *idname)
        wmWindowManager *wm = CTX_wm_manager(C);
        Scene *scene = CTX_data_scene(C);
 
-       return !(ED_undo_valid(C, idname) == 0 || WM_jobs_test(wm, scene));
+       return !(ED_undo_valid(C, idname) == 0 || WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY));
 }
 
 wmOperator *WM_operator_last_redo(const bContext *C)