diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index 36f479ba9d6..40a53fce809 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -230,8 +230,12 @@ bool ABC_export(Scene *scene, bool export_ok = false; if (as_background_job) { - wmJob *wm_job = WM_jobs_get( - job->wm, CTX_wm_window(C), scene, "Alembic Export", WM_JOB_PROGRESS, WM_JOB_TYPE_ALEMBIC); + wmJob *wm_job = WM_jobs_get(job->wm, + CTX_wm_window(C), + scene, + "Alembic Export", + WM_JOB_PROGRESS, + WM_JOB_TYPE_ALEMBIC_EXPORT); /* setup job */ WM_jobs_customdata_set(wm_job, job, MEM_freeN); diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index 9da10eb68e7..830c85e3150 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -746,7 +746,7 @@ bool ABC_import(bContext *C, const AlembicImportParams *params, bool as_backgrou job->scene, "Alembic Import", WM_JOB_PROGRESS, - WM_JOB_TYPE_ALEMBIC); + WM_JOB_TYPE_ALEMBIC_IMPORT); /* setup job */ WM_jobs_customdata_set(wm_job, job, import_freejob); diff --git a/source/blender/io/usd/intern/usd_capi_export.cc b/source/blender/io/usd/intern/usd_capi_export.cc index 0b95cd5c634..53120ee86c3 100644 --- a/source/blender/io/usd/intern/usd_capi_export.cc +++ b/source/blender/io/usd/intern/usd_capi_export.cc @@ -641,7 +641,7 @@ bool USD_export(bContext *C, bool export_ok = false; if (as_background_job) { wmJob *wm_job = WM_jobs_get( - job->wm, CTX_wm_window(C), scene, "USD Export", WM_JOB_PROGRESS, WM_JOB_TYPE_ALEMBIC); + job->wm, CTX_wm_window(C), scene, "USD Export", WM_JOB_PROGRESS, WM_JOB_TYPE_USD_EXPORT); /* setup job */ WM_jobs_customdata_set(wm_job, job, MEM_freeN); diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc index 16920bfe88b..4bb572864b9 100644 --- a/source/blender/io/usd/intern/usd_capi_import.cc +++ b/source/blender/io/usd/intern/usd_capi_import.cc @@ -521,7 +521,7 @@ bool USD_import(bContext *C, job->scene, "USD Import", WM_JOB_PROGRESS, - WM_JOB_TYPE_ALEMBIC); + WM_JOB_TYPE_USD_IMPORT); /* setup job */ WM_jobs_customdata_set(wm_job, job, import_freejob); diff --git a/source/blender/windowmanager/WM_api.hh b/source/blender/windowmanager/WM_api.hh index 80eee297769..97d487801e4 100644 --- a/source/blender/windowmanager/WM_api.hh +++ b/source/blender/windowmanager/WM_api.hh @@ -1589,7 +1589,10 @@ enum eWM_JobType { WM_JOB_TYPE_SEQ_BUILD_PREVIEW, WM_JOB_TYPE_POINTCACHE, WM_JOB_TYPE_DPAINT_BAKE, - WM_JOB_TYPE_ALEMBIC, + WM_JOB_TYPE_ALEMBIC_IMPORT, + WM_JOB_TYPE_ALEMBIC_EXPORT, + WM_JOB_TYPE_USD_IMPORT, + WM_JOB_TYPE_USD_EXPORT, WM_JOB_TYPE_SHADER_COMPILATION, WM_JOB_TYPE_STUDIOLIGHT, WM_JOB_TYPE_LIGHT_BAKE, @@ -1609,8 +1612,8 @@ enum eWM_JobType { /** * \return current job or adds new job, but doesn't run it. * - * \note every owner only gets a single job, - * adding a new one will stop running job and when stopped it starts the new one. + * \note every owner only gets a single running job of the same \a job_type (or with the + * #WM_JOB_EXCL_RENDER flag). Adding a new one will wait for the running job to finish. */ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, @@ -1654,8 +1657,17 @@ void WM_jobs_callbacks_ex(wmJob *wm_job, void (*canceled)(void *)); /** - * If job running, the same owner gave it a new job. - * if different owner starts existing #wmJob::startjob, it suspends itself. + * Register the given \a wm_job and try to start it immediately. + * + * The new \a wm_job will not start immediately and wait for other blocking jobs + * to end in some way if: + * - the new job is flagged with #WM_JOB_EXCL_RENDER and another job with the same flag is already + * running (blocks it), or... + * - the new job is __not__ flagged with #WM_JOB_EXCL_RENDER and a job of the same #eWM_JobType is + * already running (blocks it). + * + * If the new \a wm_job is flagged with #WM_JOB_PRIORITY, it will request other blocking jobs to + * stop (using #WM_jobs_stop(), so this doesn't take immediate effect) rather than finish its work. */ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job); /** diff --git a/source/blender/windowmanager/intern/wm_jobs.cc b/source/blender/windowmanager/intern/wm_jobs.cc index ff0cfe4a276..0e8ac8fc022 100644 --- a/source/blender/windowmanager/intern/wm_jobs.cc +++ b/source/blender/windowmanager/intern/wm_jobs.cc @@ -419,9 +419,9 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test) continue; } - /* If new job is not render, then check for same startjob. */ + /* If new job is not render, then check for same job type. */ if (0 == (test->flag & WM_JOB_EXCL_RENDER)) { - if (wm_job->startjob != test->startjob) { + if (wm_job->job_type != test->job_type) { continue; } }