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};
19
21struct Result
22{
24 std::shared_ptr<SceneRootObject> scene;
26 bool isSceneConstructed = false;
28 std::vector<std::filesystem::path> loadedFiles;
30 // TODO: user-defined error format
31 std::string errorSummary;
33 // TODO: user-defined warning format
34 std::string warningSummary;
35};
36
39MRMESH_API Result fromAnySupportedFormat( const std::vector<std::filesystem::path>& files, const Settings& settings = {} );
40
43using PostLoadCallback = std::function<void ( Result )>;
44MRMESH_API void asyncFromAnySupportedFormat( const std::vector<std::filesystem::path>& files, const PostLoadCallback& postLoadCallback, const Settings& settings = {} );
45
46} // namespace MR::SceneLoad
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:80
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:732
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:43
MRMESH_API void asyncFromAnySupportedFormat(const std::vector< std::filesystem::path > &files, const PostLoadCallback &postLoadCallback, const Settings &settings={})
Scene loading result.
Definition MRSceneLoad.h:22
bool isSceneConstructed
Marks whether the scene was loaded from a single file (false) or was built from scratch (true)
Definition MRSceneLoad.h:26
std::string errorSummary
Error summary text.
Definition MRSceneLoad.h:31
std::vector< std::filesystem::path > loadedFiles
List of successfully loaded files.
Definition MRSceneLoad.h:28
std::string warningSummary
Warning summary text.
Definition MRSceneLoad.h:34
std::shared_ptr< SceneRootObject > scene
The loaded scene or empty object.
Definition MRSceneLoad.h:24
Definition MRSceneLoad.h:11
ProgressCallback progress
to report loading progress and allow the user to cancel it
Definition MRSceneLoad.h:17
std::optional< LengthUnit > targetUnit
Definition MRSceneLoad.h:14