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{
10
11
13class MRMESH_CLASS SceneRootObject final : public Object
14{
15public:
16 MRMESH_API SceneRootObject();
17
18 SceneRootObject( SceneRootObject&& ) noexcept = default;
19
20 SceneRootObject& operator = ( SceneRootObject&& ) noexcept = default;
21
24
25 constexpr static const char* StaticTypeName() noexcept { return "RootObject"; }
26 virtual const char* typeName() const override { return StaticTypeName(); }
27
28 constexpr static const char* StaticClassName() noexcept { return "Root"; }
29 virtual std::string className() const override { return StaticClassName(); }
30
31 constexpr static const char* StaticClassNameInPlural() noexcept { return "Roots"; }
32 virtual std::string classNameInPlural() const override { return StaticClassNameInPlural(); }
33
34 constexpr static const char* RootName() noexcept { return "Root"; }
35
36 virtual void setAncillary( bool ) override { Object::setAncillary( false ); }
37
38 virtual bool select( bool ) override { return Object::select( false ); }
39
40 virtual void setName( std::string ) override { Object::setName( SceneRootObject::RootName() ); }
41
42 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
43
45 MRMESH_API std::shared_ptr<SceneRootObject> cloneRoot() const;
46
47protected:
48 SceneRootObject( const SceneRootObject& other ) = default;
49
50 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
51
52 MRMESH_API void deserializeFields_( const Json::Value& root ) override;
53};
54
57MRMESH_API std::shared_ptr<SceneRootObject> createRootFormObject( std::shared_ptr<Object> obj );
58
62{
63public:
64#ifndef MR_SCENEROOT_CONST
65 MRMESH_API static SceneRootObject& get();
66 MRMESH_API static std::shared_ptr<SceneRootObject>& getSharedPtr();
67
68 MRMESH_API static void setScenePath( const std::filesystem::path& scenePath );
69#endif
70 MRMESH_API static const SceneRootObject& constGet();
71 MRMESH_API static std::shared_ptr<const SceneRootObject> constGetSharedPtr();
72
73 MRMESH_API static const std::filesystem::path& getScenePath();
74
75private:
76 static SceneRoot& instance_();
77 SceneRoot();
78
79 std::shared_ptr<SceneRootObject> root_;
80
82 std::filesystem::path scenePath_;
83};
84}
named object in the data model
Definition MRObject.h:62
Object that is parent of all scene.
Definition MRSceneRoot.h:14
Definition MRSceneRoot.h:62
virtual std::string classNameInPlural() const override
Definition MRSceneRoot.h:32
static constexpr const char * RootName() noexcept
Definition MRSceneRoot.h:34
SceneRootObject(const SceneRootObject &other)=default
virtual void setName(std::string) override
Definition MRSceneRoot.h:40
virtual const char * typeName() const override
Definition MRSceneRoot.h:26
SceneRootObject(SceneRootObject &&) noexcept=default
virtual MRMESH_API std::shared_ptr< Object > clone() const override
clones current object only, without parent and/or children
static MRMESH_API std::shared_ptr< const SceneRootObject > constGetSharedPtr()
static MRMESH_API SceneRootObject & get()
MRMESH_API std::shared_ptr< SceneRootObject > createRootFormObject(std::shared_ptr< Object > obj)
MRMESH_API std::shared_ptr< SceneRootObject > cloneRoot() const
same as clone but returns correct type
static MRMESH_API const SceneRootObject & constGet()
static constexpr const char * StaticClassName() noexcept
Definition MRSceneRoot.h:28
MRMESH_API void deserializeFields_(const Json::Value &root) override
static MRMESH_API std::shared_ptr< SceneRootObject > & getSharedPtr()
static constexpr const char * StaticTypeName() noexcept
Definition MRSceneRoot.h:25
virtual bool select(bool) override
selects the object, returns true if value changed, otherwise returns false
Definition MRSceneRoot.h:38
MRMESH_API SceneRootObject()
static constexpr const char * StaticClassNameInPlural() noexcept
Definition MRSceneRoot.h:31
virtual MRMESH_API void serializeFields_(Json::Value &root) const override
virtual void setAncillary(bool) override
Definition MRSceneRoot.h:36
static MRMESH_API const std::filesystem::path & getScenePath()
virtual std::string className() const override
Definition MRSceneRoot.h:29
static MRMESH_API void setScenePath(const std::filesystem::path &scenePath)
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRObject.h:284