diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-05 11:02:25 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-05 11:02:25 +0300 |
commit | e9bb018a4aea1b4aeb692cdadce158496a270e32 (patch) | |
tree | 9f8c122feb8a68cc34f5ab6c99407a20d72fa50d /source/blender/alembic/intern/alembic_capi.cc | |
parent | 4dadb6d4453d84d537e25e753f7904ce5c8539fb (diff) | |
parent | 8647d5af9015097698984e9864802848914e803c (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/alembic/intern/abc_exporter.h
Diffstat (limited to 'source/blender/alembic/intern/alembic_capi.cc')
-rw-r--r-- | source/blender/alembic/intern/alembic_capi.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index ee8ec0fa68c..20bdeeb96a7 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -301,10 +301,10 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo } } catch (const std::exception &e) { - std::cerr << "Abc Export error: " << e.what() << '\n'; + ABC_LOG(data->settings.logger) << "Abc Export error: " << e.what() << '\n'; } catch (...) { - std::cerr << "Abc Export error\n"; + ABC_LOG(data->settings.logger) << "Abc Export: unknown error...\n"; } } @@ -316,6 +316,11 @@ static void export_endjob(void *customdata) BLI_delete(data->filename, false, false); } + if (!data->settings.logger.empty()) { + std::cerr << data->settings.logger; + WM_report(RPT_ERROR, "Errors occured during the export, look in the console to know more..."); + } + G.is_rendering = false; BKE_spacedata_draw_locks(false); } @@ -331,6 +336,22 @@ void ABC_export( job->bmain = CTX_data_main(C); BLI_strncpy(job->filename, filepath, 1024); + /* Alright, alright, alright.... + * + * ExportJobData contains an ExportSettings containing a SimpleLogger. + * + * Since ExportJobData is a C-style struct dynamically allocated with + * MEM_mallocN (see above), its construtor is never called, therefore the + * ExportSettings constructor is not called which implies that the + * SimpleLogger one is not called either. SimpleLogger in turn does not call + * the constructor of its data members which ultimately means that its + * std::ostringstream member has a NULL pointer. To be able to properly use + * the stream's operator<<, the pointer needs to be set, therefore we have + * to properly construct everything. And this is done using the placement + * new operator as here below. It seems hackish, but I'm too lazy to + * do bigger refactor and maybe there is a better way which does not involve + * hardcore refactoring. */ + new (&job->settings) ExportSettings(); job->settings.scene = job->scene; /* Sybren: for now we only export the active scene layer. |