MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSceneRoot.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRObject.h"
4#include <memory>
5
6namespace MR
7{
8
10class MRMESH_CLASS SceneRootObject final : public Object
11{
12public:
13 MRMESH_API SceneRootObject();
14
15 SceneRootObject( SceneRootObject&& ) noexcept = default;
16
17 SceneRootObject& operator = ( SceneRootObject&& ) noexcept = default;
18
20 SceneRootObject( ProtectedStruct, const SceneRootObject& obj ) : SceneRootObject( obj ) {}
21
22 constexpr static const char* StaticTypeName() noexcept { return "RootObject"; }
23 virtual const char* typeName() const override { return StaticTypeName(); }
24
25 constexpr static const char* StaticClassName() noexcept { return "Root"; }
26 virtual std::string className() const override { return StaticClassName(); }
27
28 constexpr static const char* StaticClassNameInPlural() noexcept { return "Roots"; }
29 virtual std::string classNameInPlural() const override { return StaticClassNameInPlural(); }
30
31 constexpr static const char* RootName() noexcept { return "Root"; }
32
33 virtual void setAncillary( bool ) override { Object::setAncillary( false ); }
34
35 virtual bool select( bool ) override { return Object::select( false ); }
36
37 virtual void setName( std::string ) override { Object::setName( SceneRootObject::RootName() ); }
38
39 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
40
42 MRMESH_API std::shared_ptr<SceneRootObject> cloneRoot() const;
43
44protected:
45 SceneRootObject( const SceneRootObject& other ) = default;
46
47 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
48
49 MRMESH_API void deserializeFields_( const Json::Value& root ) override;
50};
51
54MRMESH_API std::shared_ptr<SceneRootObject> createRootFormObject( std::shared_ptr<Object> obj );
55
58class SceneRoot
59{
60public:
61#ifndef MR_SCENEROOT_CONST
62 MRMESH_API static SceneRootObject& get();
63 MRMESH_API static std::shared_ptr<SceneRootObject>& getSharedPtr();
64
65 MRMESH_API static void setScenePath( const std::filesystem::path& scenePath );
66#endif
67 MRMESH_API static const SceneRootObject& constGet();
68 MRMESH_API static std::shared_ptr<const SceneRootObject> constGetSharedPtr();
69
70 MRMESH_API static const std::filesystem::path& getScenePath();
71
72private:
73 static SceneRoot& instance_();
74 SceneRoot();
75
76 std::shared_ptr<SceneRootObject> root_;
77
79 std::filesystem::path scenePath_;
80};
81}
#define MRMESH_API
Definition MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMeshFwd.h:87
Definition MRSceneRoot.h:11
Definition MRSceneRoot.h:59
Definition MRCameraOrientationPlugin.h:8
MRMESH_API std::shared_ptr< SceneRootObject > createRootFormObject(std::shared_ptr< Object > obj)