MeshLib Documentation
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 SceneRootObject( SceneRootObject&& ) noexcept = default;
15 SceneRootObject& operator = ( SceneRootObject&& ) noexcept = default;
18 constexpr static const char* TypeName() noexcept { return "RootObject"; }
19 constexpr static const char* RootName() noexcept { return "Root"; }
20 virtual const char* typeName() const override { return TypeName(); }
21 virtual void setAncillary( bool ) override { Object::setAncillary( false ); }
22 virtual bool select( bool ) override { return Object::select( false ); }
23 virtual void setName( std::string ) override { Object::setName( SceneRootObject::RootName() ); }
24 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
26 MRMESH_API std::shared_ptr<SceneRootObject> cloneRoot() const;
27protected:
28 SceneRootObject( const SceneRootObject& other ) = default;
29 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
30 MRMESH_API void deserializeFields_( const Json::Value& root ) override;
31};
32
35MRMESH_API std::shared_ptr<SceneRootObject> createRootFormObject( std::shared_ptr<Object> obj );
36
40{
41public:
42#ifndef MR_SCENEROOT_CONST
44 MRMESH_API static std::shared_ptr<SceneRootObject>& getSharedPtr();
45
46 MRMESH_API static void setScenePath( const std::filesystem::path& scenePath );
47#endif
49 MRMESH_API static std::shared_ptr<const SceneRootObject> constGetSharedPtr();
50
51 MRMESH_API static const std::filesystem::path& getScenePath();
52
53private:
54 static SceneRoot& instance_();
55 SceneRoot();
56
57 std::shared_ptr<SceneRootObject> root_;
58
60 std::filesystem::path scenePath_;
61};
62}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
#define MRMESH_CLASS
Definition MRMesh/MRMeshFwd.h:50
named object in the data model
Definition MRObject.h:60
Object that is parent of all scene.
Definition MRSceneRoot.h:11
static constexpr const char * RootName() noexcept
Definition MRSceneRoot.h:19
SceneRootObject(const SceneRootObject &other)=default
virtual void setName(std::string) override
Definition MRSceneRoot.h:23
virtual const char * typeName() const override
Definition MRSceneRoot.h:20
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
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:22
MRMESH_API SceneRootObject()
virtual MRMESH_API void serializeFields_(Json::Value &root) const override
virtual void setAncillary(bool) override
Definition MRSceneRoot.h:21
static constexpr const char * TypeName() noexcept
Definition MRSceneRoot.h:18
Definition MRSceneRoot.h:40
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:246