MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSceneLoad.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRObject.h"
4#include "MRUnitInfo.h"
5#include <optional>
6
7namespace MR::SceneLoad
8{
9
11{
14 std::optional<LengthUnit> targetUnit;
15
18
21 using OpenFolder = std::function<Expected<LoadedObjects>( const std::filesystem::path&, const ProgressCallback& )>;
23};
24
26struct Result
27{
29 std::shared_ptr<SceneRootObject> scene;
31 bool isSceneConstructed = false;
33 std::vector<std::filesystem::path> loadedFiles;
35 // TODO: user-defined error format
36 std::string errorSummary;
38 // TODO: user-defined warning format
39 std::string warningSummary;
40};
41
44MRMESH_API Result fromAnySupportedFormat( const std::vector<std::filesystem::path>& files, const Settings& settings = {} );
45
48using PostLoadCallback = std::function<void ( Result )>;
49MRMESH_API void asyncFromAnySupportedFormat( const std::vector<std::filesystem::path>& files, const PostLoadCallback& postLoadCallback, const Settings& settings = {} );
50
51} // namespace MR::SceneLoad
#define MRMESH_API
Definition MRMeshFwd.h:80
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:742
Definition MRIOFormatsRegistry.h:346
MRMESH_API Result fromAnySupportedFormat(const std::vector< std::filesystem::path > &files, const Settings &settings={})
std::function< void(Result)> PostLoadCallback
Definition MRSceneLoad.h:48
MRMESH_API void asyncFromAnySupportedFormat(const std::vector< std::filesystem::path > &files, const PostLoadCallback &postLoadCallback, const Settings &settings={})
Scene loading result.
Definition MRSceneLoad.h:27
bool isSceneConstructed
Marks whether the scene was loaded from a single file (false) or was built from scratch (true)
Definition MRSceneLoad.h:31
std::string errorSummary
Error summary text.
Definition MRSceneLoad.h:36
std::vector< std::filesystem::path > loadedFiles
List of successfully loaded files.
Definition MRSceneLoad.h:33
std::string warningSummary
Warning summary text.
Definition MRSceneLoad.h:39
std::shared_ptr< SceneRootObject > scene
The loaded scene or empty object.
Definition MRSceneLoad.h:29
Definition MRSceneLoad.h:11
std::function< Expected< LoadedObjects >(const std::filesystem::path &, const ProgressCallback &)> OpenFolder
Definition MRSceneLoad.h:21
ProgressCallback progress
to report loading progress and allow the user to cancel it
Definition MRSceneLoad.h:17
OpenFolder openFolder
Definition MRSceneLoad.h:22
std::optional< LengthUnit > targetUnit
Definition MRSceneLoad.h:14