diff options
Diffstat (limited to 'source/blender/io/alembic/exporter/abc_export_capi.cc')
-rw-r--r-- | source/blender/io/alembic/exporter/abc_export_capi.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index edaf53b3efa..dfca89e2c6d 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -24,6 +24,7 @@ #include "BLI_fileops.h" #include "BLI_path_util.h" #include "BLI_string.h" +#include "BLI_timeit.hh" #include "WM_api.h" #include "WM_types.h" @@ -44,6 +45,7 @@ struct ExportJobData { bool was_canceled; bool export_ok; + blender::timeit::TimePoint start_time; }; namespace blender::io::alembic { @@ -59,6 +61,14 @@ static void build_depsgraph(Depsgraph *depsgraph, const bool visible_objects_onl } } +static void report_job_duration(const ExportJobData *data) +{ + blender::timeit::Nanoseconds duration = blender::timeit::Clock::now() - data->start_time; + std::cout << "Alembic export of '" << data->filename << "' took "; + blender::timeit::print_duration(duration); + std::cout << '\n'; +} + static void export_startjob(void *customdata, /* Cannot be const, this function implements wm_jobs_start_callback. * NOLINTNEXTLINE: readability-non-const-parameter. */ @@ -68,6 +78,7 @@ static void export_startjob(void *customdata, { ExportJobData *data = static_cast<ExportJobData *>(customdata); data->was_canceled = false; + data->start_time = blender::timeit::Clock::now(); G.is_rendering = true; WM_set_locked_interface(data->wm, true); @@ -85,7 +96,7 @@ static void export_startjob(void *customdata, /* For restoring the current frame after exporting animation is done. */ Scene *scene = DEG_get_input_scene(data->depsgraph); - const int orig_frame = CFRA; + const int orig_frame = scene->r.cfra; const bool export_animation = (data->params.frame_start != data->params.frame_end); /* Create the Alembic archive. */ @@ -154,8 +165,8 @@ static void export_startjob(void *customdata, iter.release_writers(); /* Finish up by going back to the keyframe that was current before we started. */ - if (CFRA != orig_frame) { - CFRA = orig_frame; + if (scene->r.cfra != orig_frame) { + scene->r.cfra = orig_frame; BKE_scene_graph_update_for_newframe(data->depsgraph); } @@ -177,6 +188,7 @@ static void export_endjob(void *customdata) G.is_rendering = false; WM_set_locked_interface(data->wm, false); + report_job_duration(data); } } // namespace blender::io::alembic |