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
11{
12public:
14
15 SceneRootObject( SceneRootObject&& ) noexcept = default;
16
17 SceneRootObject& operator = ( SceneRootObject&& ) noexcept = default;
18
21
22 constexpr static const char* TypeName() noexcept { return "RootObject"; }
23 virtual const char* typeName() const override { return TypeName(); }
24
25 constexpr static const char* ClassName() noexcept { return "Root"; }
26 virtual std::string className() const override { return ClassName(); }
27
28 constexpr static const char* ClassNameInPlural() noexcept { return "Roots"; }
29 virtual std::string classNameInPlural() const override { return ClassNameInPlural(); }
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
59{
60public:
61#ifndef MR_SCENEROOT_CONST
63 MRMESH_API static std::shared_ptr<SceneRootObject>& getSharedPtr();
64
65 MRMESH_API static void setScenePath( const std::filesystem::path& scenePath );
66#endif
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 MRMesh/MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMesh/MRMeshFwd.h:84
named object in the data model
Definition MRObject.h:62
Object that is parent of all scene.
Definition MRSceneRoot.h:11
virtual std::string classNameInPlural() const override
Definition MRSceneRoot.h:29
static constexpr const char * RootName() noexcept
Definition MRSceneRoot.h:31
SceneRootObject(const SceneRootObject &other)=default
virtual void setName(std::string) override
Definition MRSceneRoot.h:37
virtual const char * typeName() const override
Definition MRSceneRoot.h:23
SceneRootObject(SceneRootObject &&) noexcept=default
virtual MRMESH_API std::shared_ptr< Object > clone() const override
clones current object only, without parent and/or children
MRMESH_API std::shared_ptr< SceneRootObject > cloneRoot() const
same as clone but returns correct type
static constexpr const char * ClassName() noexcept
Definition MRSceneRoot.h:25
MRMESH_API void deserializeFields_(const Json::Value &root) override
virtual bool select(bool) override
selects the object, returns true if value changed, otherwise returns false
Definition MRSceneRoot.h:35
static constexpr const char * ClassNameInPlural() noexcept
Definition MRSceneRoot.h:28
MRMESH_API SceneRootObject()
virtual MRMESH_API void serializeFields_(Json::Value &root) const override
virtual void setAncillary(bool) override
Definition MRSceneRoot.h:33
static constexpr const char * TypeName() noexcept
Definition MRSceneRoot.h:22
virtual std::string className() const override
Definition MRSceneRoot.h:26
Definition MRSceneRoot.h:59
static MRMESH_API std::shared_ptr< const SceneRootObject > constGetSharedPtr()
static MRMESH_API SceneRootObject & get()
static MRMESH_API const SceneRootObject & constGet()
static MRMESH_API std::shared_ptr< SceneRootObject > & getSharedPtr()
static MRMESH_API const std::filesystem::path & getScenePath()
static MRMESH_API void setScenePath(const std::filesystem::path &scenePath)
Definition MRCameraOrientationPlugin.h:8
MRMESH_API std::shared_ptr< SceneRootObject > createRootFormObject(std::shared_ptr< Object > obj)
Definition MRObject.h:279