Fix #114415: USDZ conversion happens outside of main thread. #114420

Merged
Bastien Montagne merged 1 commits from mont29/blender:tmp-fix-114415-usdz-export into blender-v4.0-release 2023-11-03 10:56:05 +01:00
1 changed files with 10 additions and 10 deletions

View File

@ -340,16 +340,6 @@ static void export_startjob(void *customdata,
usd_stage->GetRootLayer()->Save();
if (data->targets_usdz()) {
bool usd_conversion_success = perform_usdz_conversion(data);
if (!usd_conversion_success) {
data->export_ok = false;
*progress = 1.0f;
*do_update = true;
return;
}
}
data->export_ok = true;
*progress = 1.0f;
*do_update = true;
@ -380,6 +370,16 @@ static void export_endjob(void *customdata)
DEG_graph_free(data->depsgraph);
if (data->targets_usdz()) {
/* NOTE: call to #perform_usdz_conversion has to be done here instead of the main threaded
* worker callback (#export_startjob) because USDZ conversion requires changing the current
* working directory. This is not safe to do from a non-main thread. Once the USD library fix
* this weird requirement, this call can be moved back at the end of #export_startjob, and not
* block the main user interface anymore. */
bool usd_conversion_success = perform_usdz_conversion(data);
if (!usd_conversion_success) {
data->export_ok = false;
}
export_endjob_usdz_cleanup(data);
}