MeshLib
 
Loading...
Searching...
No Matches
MR::SceneRootObject Class Referencefinal

Object that is parent of all scene. More...

#include <MRSceneRoot.h>

+ Inheritance diagram for MR::SceneRootObject:

Public Member Functions

MRMESH_API SceneRootObject ()
 
 SceneRootObject (SceneRootObject &&) noexcept=default
 
SceneRootObjectoperator= (SceneRootObject &&) noexcept=default
 
 SceneRootObject (ProtectedStruct, const SceneRootObject &obj)
 
virtual const char * typeName () const override
 
virtual void setAncillary (bool) override
 
virtual bool select (bool) override
 selects the object, returns true if value changed, otherwise returns false
 
virtual void setName (std::string) override
 
virtual MRMESH_API std::shared_ptr< Objectclone () const override
 clones current object only, without parent and/or children
 
MRMESH_API std::shared_ptr< SceneRootObjectcloneRoot () const
 same as clone but returns correct type
 
- Public Member Functions inherited from MR::Object
 Object ()=default
 
 Object (Object &&) noexcept=default
 
Objectoperator= (Object &&) noexcept=default
 
virtual ~Object ()=default
 
template<typename T >
T * asType ()
 
template<typename T >
const T * asType () const
 
const std::string & name () const
 
MRMESH_API std::shared_ptr< const Objectfind (const std::string_view &name) const
 finds a direct child by name
 
std::shared_ptr< Objectfind (const std::string_view &name)
 
template<typename T >
std::shared_ptr< const T > find () const
 finds a direct child by type
 
template<typename T >
std::shared_ptr< T > find ()
 
template<typename T >
std::shared_ptr< const T > find (const std::string_view &name) const
 finds a direct child by name and type
 
template<typename T >
std::shared_ptr< T > find (const std::string_view &name)
 
const AffineXf3fxf (ViewportId id={}, bool *isDef=nullptr) const
 
virtual MRMESH_API void setXf (const AffineXf3f &xf, ViewportId id={})
 
virtual MRMESH_API void resetXf (ViewportId id={})
 forgets specific transform in given viewport (or forgets all specific transforms for {} input)
 
const ViewportProperty< AffineXf3f > & xfsForAllViewports () const
 returns xfs for all viewports, combined into a single object
 
virtual void setXfsForAllViewports (ViewportProperty< AffineXf3f > xf)
 modifies xfs for all viewports at once
 
MRMESH_API AffineXf3f worldXf (ViewportId id={}, bool *isDef=nullptr) const
 
MRMESH_API void setWorldXf (const AffineXf3f &xf, ViewportId id={})
 
virtual MRMESH_API void applyScale (float scaleFactor)
 scale object size (all point positions)
 
MRMESH_API ViewportMask globalVisibilityMask () const
 returns all viewports where this object is visible together with all its parents
 
bool globalVisibility (ViewportMask viewportMask=ViewportMask::any()) const
 returns true if this object is visible together with all its parents in any of given viewports
 
MRMESH_API void setGlobalVisibility (bool on, ViewportMask viewportMask=ViewportMask::any())
 if true sets all predecessors visible, otherwise sets this object invisible
 
bool isLocked () const
 object properties lock for UI
 
virtual void setLocked (bool on)
 
bool isParentLocked () const
 
virtual void setParentLocked (bool lock)
 
const Objectparent () const
 returns parent object in the tree
 
Objectparent ()
 
MRMESH_API bool isAncestor (const Object *ancestor) const
 return true if given object is ancestor of this one, false otherwise
 
MRMESH_API ObjectfindCommonAncestor (Object &other)
 
const ObjectfindCommonAncestor (const Object &other) const
 
virtual MRMESH_API bool detachFromParent ()
 
const std::vector< std::shared_ptr< Object > > & children ()
 an object can hold other sub-objects
 
const std::vector< std::shared_ptr< const Object > > & children () const
 
virtual MRMESH_API bool addChild (std::shared_ptr< Object > child, bool recognizedChild=true)
 
virtual MRMESH_API bool addChildBefore (std::shared_ptr< Object > newChild, const std::shared_ptr< Object > &existingChild)
 
bool removeChild (const std::shared_ptr< Object > &child)
 returns false if it was not child of this
 
virtual MRMESH_API bool removeChild (Object *child)
 
virtual MRMESH_API void removeAllChildren ()
 detaches all recognized children from this, keeping all unrecognized ones
 
MRMESH_API void sortChildren ()
 sort recognized children by name
 
virtual bool isSelected () const
 
bool isAncillary () const
 
MRMESH_API void setVisible (bool on, ViewportMask viewportMask=ViewportMask::all())
 sets the object visible in the viewports specified by the mask (by default in all viewports)
 
bool isVisible (ViewportMask viewportMask=ViewportMask::any()) const
 checks whether the object is visible in any of the viewports specified by the mask (by default in any viewport)
 
virtual MRMESH_API void setVisibilityMask (ViewportMask viewportMask)
 specifies object visibility as bitmask of viewports
 
virtual ViewportMask visibilityMask () const
 gets object visibility as bitmask of viewports
 
virtual bool getRedrawFlag (ViewportMask) const
 this method virtual because others data model types could have dirty flags or something
 
void resetRedrawFlag () const
 
MRMESH_API std::shared_ptr< ObjectcloneTree () const
 clones all tree of this object (except ancillary and unrecognized children)
 
MRMESH_API std::shared_ptr< ObjectshallowCloneTree () const
 
virtual MRMESH_API std::shared_ptr< ObjectshallowClone () const
 
virtual MRMESH_API std::vector< std::string > getInfoLines () const
 return several info lines that can better describe object in the UI
 
virtual std::string getClassName () const
 return human readable name of subclass
 
MRMESH_API Expected< std::vector< std::future< VoidOrErrStr > > > serializeRecursive (const std::filesystem::path &path, Json::Value &root, int childId) const
 
MRMESH_API VoidOrErrStr deserializeRecursive (const std::filesystem::path &path, const Json::Value &root, ProgressCallback progressCb={}, int *objCounter=nullptr)
 
MRMESH_API void swap (Object &other)
 
virtual Box3f getWorldBox (ViewportId={}) const
 returns bounding box of this object in world coordinates for default or specific viewport
 
MRMESH_API Box3f getWorldTreeBox (ViewportId={}) const
 returns bounding box of this object and all children visible in given (or default) viewport in world coordinates
 
virtual bool hasVisualRepresentation () const
 does the object have any visual representation (visible points, triangles, edges, etc.), no considering child objects
 
virtual bool hasModel () const
 
virtual MRMESH_API size_t heapBytes () const
 returns the amount of memory this object occupies on heap
 
 Object (ProtectedStruct, const Object &obj)
 
- Public Member Functions inherited from MR::ObjectChildrenHolder
 ObjectChildrenHolder ()=default
 
 ObjectChildrenHolder (const ObjectChildrenHolder &) noexcept
 
ObjectChildrenHolderoperator= (const ObjectChildrenHolder &) noexcept
 
MRMESH_API ObjectChildrenHolder (ObjectChildrenHolder &&) noexcept
 
MRMESH_API ObjectChildrenHolderoperator= (ObjectChildrenHolder &&) noexcept
 
MRMESH_API ~ObjectChildrenHolder ()
 
MRMESH_API std::shared_ptr< ObjectgetSharedPtr () const
 
MRMESH_API size_t heapBytes () const
 

Static Public Member Functions

static constexpr const char * TypeName () noexcept
 
static constexpr const char * RootName () noexcept
 
- Static Public Member Functions inherited from MR::Object
static constexpr const char * TypeName () noexcept
 

Protected Member Functions

 SceneRootObject (const SceneRootObject &other)=default
 
virtual MRMESH_API void serializeFields_ (Json::Value &root) const override
 
MRMESH_API void deserializeFields_ (const Json::Value &root) override
 
- Protected Member Functions inherited from MR::Object
 Object (const Object &obj)=default
 user should not be able to call copy implicitly, use clone() function instead
 
virtual MRMESH_API void swapBase_ (Object &other)
 swaps whole object (signals too)
 
virtual MRMESH_API void swapSignals_ (Object &other)
 
virtual MRMESH_API Expected< std::future< VoidOrErrStr > > serializeModel_ (const std::filesystem::path &path) const
 
virtual MRMESH_API VoidOrErrStr deserializeModel_ (const std::filesystem::path &path, ProgressCallback progressCb={})
 Reads model from file.
 
virtual MRMESH_API void propagateWorldXfChangedSignal_ ()
 

Additional Inherited Members

- Public Types inherited from MR::Object
using XfChangedSignal = Signal<void() >
 
- Public Attributes inherited from MR::Object
XfChangedSignal worldXfChangedSignal
 
- Protected Attributes inherited from MR::Object
std::string name_
 
ViewportProperty< AffineXf3fxf_
 
ViewportMask visibilityMask_ = ViewportMask::all()
 
bool locked_ = false
 
bool parentLocked_ = false
 
bool selected_ { false }
 
bool ancillary_ { false }
 
bool needRedraw_ {false}
 
- Protected Attributes inherited from MR::ObjectChildrenHolder
ObjectChildrenHolderparent_ = nullptr
 
std::vector< std::shared_ptr< Object > > children_
 
std::vector< std::weak_ptr< Object > > bastards_
 recognized ones
 

Detailed Description

Object that is parent of all scene.

Constructor & Destructor Documentation

◆ SceneRootObject() [1/4]

MRMESH_API MR::SceneRootObject::SceneRootObject ( )

◆ SceneRootObject() [2/4]

MR::SceneRootObject::SceneRootObject ( SceneRootObject && )
defaultnoexcept

◆ SceneRootObject() [3/4]

MR::SceneRootObject::SceneRootObject ( ProtectedStruct ,
const SceneRootObject & obj )
inline
Note
this ctor is public only for std::make_shared used inside clone()

◆ SceneRootObject() [4/4]

MR::SceneRootObject::SceneRootObject ( const SceneRootObject & other)
protecteddefault

Member Function Documentation

◆ clone()

virtual MRMESH_API std::shared_ptr< Object > MR::SceneRootObject::clone ( ) const
overridevirtual

clones current object only, without parent and/or children

Reimplemented from MR::Object.

◆ cloneRoot()

MRMESH_API std::shared_ptr< SceneRootObject > MR::SceneRootObject::cloneRoot ( ) const

same as clone but returns correct type

◆ deserializeFields_()

MRMESH_API void MR::SceneRootObject::deserializeFields_ ( const Json::Value & root)
overrideprotectedvirtual

Reads parameters from json value

Note
if you override this method, please call Base::deserializeFields_(root) in the beginning

Reimplemented from MR::Object.

◆ operator=()

SceneRootObject & MR::SceneRootObject::operator= ( SceneRootObject && )
defaultnoexcept

◆ RootName()

static constexpr const char * MR::SceneRootObject::RootName ( )
inlinestaticconstexprnoexcept

◆ select()

virtual bool MR::SceneRootObject::select ( bool on)
inlineoverridevirtual

selects the object, returns true if value changed, otherwise returns false

Reimplemented from MR::Object.

◆ serializeFields_()

virtual MRMESH_API void MR::SceneRootObject::serializeFields_ ( Json::Value & root) const
overrideprotectedvirtual

Write parameters to given Json::Value,

Note
if you override this method, please call Base::serializeFields_(root) in the beginning

Reimplemented from MR::Object.

◆ setAncillary()

virtual void MR::SceneRootObject::setAncillary ( bool ancillary)
inlineoverridevirtual

ancillary object is an object hidden (in scene menu) from a regular user such objects cannot be selected, and if it has been selected, it is unselected when turn ancillary

Reimplemented from MR::Object.

◆ setName()

virtual void MR::SceneRootObject::setName ( std::string )
inlineoverridevirtual

Reimplemented from MR::Object.

◆ TypeName()

static constexpr const char * MR::SceneRootObject::TypeName ( )
inlinestaticconstexprnoexcept

◆ typeName()

virtual const char * MR::SceneRootObject::typeName ( ) const
inlineoverridevirtual

Reimplemented from MR::Object.


The documentation for this class was generated from the following file: