| 1329 | } |
| 1330 | |
| 1331 | Expected<LoadedObject> deserializeObjectTreeFrom3mf( const std::filesystem::path& path, const ProgressCallback& callback ) |
| 1332 | { |
| 1333 | const UniqueTemporaryFolder tmpFolder; |
| 1334 | |
| 1335 | auto resZip = decompressZip( path, tmpFolder ); |
| 1336 | if ( !resZip ) |
| 1337 | return unexpected( "ZIP container error: " + resZip.error() ); |
| 1338 | |
| 1339 | if ( !reportProgress( callback, 0.1f ) ) |
| 1340 | return unexpectedOperationCanceled(); |
| 1341 | |
| 1342 | std::vector<std::filesystem::path> files; |
| 1343 | std::error_code ec; |
| 1344 | |
| 1345 | for ( auto const& dirEntry : DirectoryRecursive{ tmpFolder, ec } ) |
| 1346 | if ( !dirEntry.is_directory( ec ) ) |
| 1347 | files.push_back( dirEntry.path() ); |
| 1348 | |
| 1349 | if ( files.empty() ) |
| 1350 | return unexpected( "Could not find .model" ); |
| 1351 | |
| 1352 | return ThreeMFLoader{}.load( files, tmpFolder, subprogress( callback, 0.1f, 0.9f ) ); |
| 1353 | } |
| 1354 | |
| 1355 | Expected<LoadedObject> deserializeObjectTreeFromModel( const std::filesystem::path& path, const ProgressCallback& callback ) |
| 1356 | { |
nothing calls this directly
no test coverage detected