2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2022-01-03 14:49:31 -05:00
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
|
* \ingroup obj
|
|
|
|
|
*/
|
|
|
|
|
|
2024-09-26 21:13:39 +10:00
|
|
|
#include "BLI_path_utils.hh"
|
2022-01-03 14:49:31 -05:00
|
|
|
#include "BLI_timeit.hh"
|
|
|
|
|
|
2023-08-31 12:51:57 -04:00
|
|
|
#include "IO_wavefront_obj.hh"
|
2022-01-03 14:49:31 -05:00
|
|
|
|
|
|
|
|
#include "obj_exporter.hh"
|
OBJ: New C++ based wavefront OBJ importer
This takes state of soc-2020-io-performance branch as it was at
e9bbfd0c8c7 (2021 Oct 31), merges latest master (2022 Apr 4),
adds a bunch of tests, and fixes a bunch of stuff found by said
tests. The fixes are detailed in the differential.
Timings on my machine (Windows, VS2022 release build, AMD Ryzen
5950X 32 threads):
- Rungholt minecraft level (269MB file, 1 mesh): 54.2s -> 14.2s
(memory usage: 7.0GB -> 1.9GB).
- Blender 3.0 splash scene: "I waited for 90 minutes and gave up"
-> 109s. Now, this time is not great, but at least 20% of the
time is spent assigning unique names for the imported objects
(the scene has 24 thousand objects). This is not specific to obj
importer, but rather a general issue across blender overall.
Test suite file updates done in Subversion tests repository.
Reviewed By: @howardt, @sybren
Differential Revision: https://developer.blender.org/D13958
2022-04-04 13:36:10 +03:00
|
|
|
#include "obj_importer.hh"
|
2022-01-03 14:49:31 -05:00
|
|
|
|
2024-11-12 20:48:57 +01:00
|
|
|
#include <fmt/core.h>
|
|
|
|
|
|
2022-08-11 17:05:54 +03:00
|
|
|
using namespace blender::timeit;
|
|
|
|
|
|
|
|
|
|
static void report_duration(const char *job, const TimePoint &start_time, const char *path)
|
|
|
|
|
{
|
|
|
|
|
Nanoseconds duration = Clock::now() - start_time;
|
2024-11-12 20:48:57 +01:00
|
|
|
fmt::print("OBJ {} of '{}' took ", job, BLI_path_basename(path));
|
2022-08-11 17:05:54 +03:00
|
|
|
print_duration(duration);
|
2024-11-12 20:48:57 +01:00
|
|
|
fmt::print("\n");
|
2022-08-11 17:05:54 +03:00
|
|
|
}
|
|
|
|
|
|
2022-01-03 14:49:31 -05:00
|
|
|
void OBJ_export(bContext *C, const OBJExportParams *export_params)
|
|
|
|
|
{
|
2022-08-11 17:05:54 +03:00
|
|
|
TimePoint start_time = Clock::now();
|
2022-01-03 14:49:31 -05:00
|
|
|
blender::io::obj::exporter_main(C, *export_params);
|
2022-08-11 17:05:54 +03:00
|
|
|
report_duration("export", start_time, export_params->filepath);
|
2022-01-03 14:49:31 -05:00
|
|
|
}
|
OBJ: New C++ based wavefront OBJ importer
This takes state of soc-2020-io-performance branch as it was at
e9bbfd0c8c7 (2021 Oct 31), merges latest master (2022 Apr 4),
adds a bunch of tests, and fixes a bunch of stuff found by said
tests. The fixes are detailed in the differential.
Timings on my machine (Windows, VS2022 release build, AMD Ryzen
5950X 32 threads):
- Rungholt minecraft level (269MB file, 1 mesh): 54.2s -> 14.2s
(memory usage: 7.0GB -> 1.9GB).
- Blender 3.0 splash scene: "I waited for 90 minutes and gave up"
-> 109s. Now, this time is not great, but at least 20% of the
time is spent assigning unique names for the imported objects
(the scene has 24 thousand objects). This is not specific to obj
importer, but rather a general issue across blender overall.
Test suite file updates done in Subversion tests repository.
Reviewed By: @howardt, @sybren
Differential Revision: https://developer.blender.org/D13958
2022-04-04 13:36:10 +03:00
|
|
|
|
|
|
|
|
void OBJ_import(bContext *C, const OBJImportParams *import_params)
|
|
|
|
|
{
|
2022-08-11 17:05:54 +03:00
|
|
|
TimePoint start_time = Clock::now();
|
OBJ: New C++ based wavefront OBJ importer
This takes state of soc-2020-io-performance branch as it was at
e9bbfd0c8c7 (2021 Oct 31), merges latest master (2022 Apr 4),
adds a bunch of tests, and fixes a bunch of stuff found by said
tests. The fixes are detailed in the differential.
Timings on my machine (Windows, VS2022 release build, AMD Ryzen
5950X 32 threads):
- Rungholt minecraft level (269MB file, 1 mesh): 54.2s -> 14.2s
(memory usage: 7.0GB -> 1.9GB).
- Blender 3.0 splash scene: "I waited for 90 minutes and gave up"
-> 109s. Now, this time is not great, but at least 20% of the
time is spent assigning unique names for the imported objects
(the scene has 24 thousand objects). This is not specific to obj
importer, but rather a general issue across blender overall.
Test suite file updates done in Subversion tests repository.
Reviewed By: @howardt, @sybren
Differential Revision: https://developer.blender.org/D13958
2022-04-04 13:36:10 +03:00
|
|
|
blender::io::obj::importer_main(C, *import_params);
|
2022-08-11 17:05:54 +03:00
|
|
|
report_duration("import", start_time, import_params->filepath);
|
OBJ: New C++ based wavefront OBJ importer
This takes state of soc-2020-io-performance branch as it was at
e9bbfd0c8c7 (2021 Oct 31), merges latest master (2022 Apr 4),
adds a bunch of tests, and fixes a bunch of stuff found by said
tests. The fixes are detailed in the differential.
Timings on my machine (Windows, VS2022 release build, AMD Ryzen
5950X 32 threads):
- Rungholt minecraft level (269MB file, 1 mesh): 54.2s -> 14.2s
(memory usage: 7.0GB -> 1.9GB).
- Blender 3.0 splash scene: "I waited for 90 minutes and gave up"
-> 109s. Now, this time is not great, but at least 20% of the
time is spent assigning unique names for the imported objects
(the scene has 24 thousand objects). This is not specific to obj
importer, but rather a general issue across blender overall.
Test suite file updates done in Subversion tests repository.
Reviewed By: @howardt, @sybren
Differential Revision: https://developer.blender.org/D13958
2022-04-04 13:36:10 +03:00
|
|
|
}
|
2024-07-08 20:20:38 +02:00
|
|
|
|
|
|
|
|
void OBJ_import_geometries(const OBJImportParams *import_params,
|
|
|
|
|
blender::Vector<blender::bke::GeometrySet> &geometries)
|
|
|
|
|
{
|
|
|
|
|
blender::io::obj::importer_geometry(*import_params, geometries);
|
|
|
|
|
}
|