MeshLib
 
Loading...
Searching...
No Matches
MRObjectsAccess.h
Go to the documentation of this file.
1#pragma once
2#include "MRObject.h"
3
4namespace MR
5{
6
9
11{
14 Any
15};
16
18template<typename ObjectT = Object>
19std::shared_ptr<ObjectT> asSelectivityType( std::shared_ptr<Object> obj, const ObjectSelectivityType& type );
20
23template<typename ObjectT = Object>
24std::vector<std::shared_ptr<ObjectT>> getAllObjectsInTree( Object* root, const ObjectSelectivityType& type = ObjectSelectivityType::Selectable );
25template<typename ObjectT = Object>
26inline std::vector<std::shared_ptr<ObjectT>> getAllObjectsInTree( Object& root, const ObjectSelectivityType& type = ObjectSelectivityType::Selectable )
27 { return getAllObjectsInTree<ObjectT>( &root, type ); }
28
30template<typename ObjectT = Object>
31std::vector<std::shared_ptr<ObjectT>> getTopmostVisibleObjects( Object* root, const ObjectSelectivityType& type = ObjectSelectivityType::Selectable );
32template<typename ObjectT = Object>
33inline std::vector<std::shared_ptr<ObjectT>> getTopmostVisibleObjects( Object& root, const ObjectSelectivityType& type = ObjectSelectivityType::Selectable )
34 { return getTopmostVisibleObjects<ObjectT>( &root, type ); }
35
37template<typename ObjectT = Object>
38std::shared_ptr<ObjectT> getDepthFirstObject( Object* root, const ObjectSelectivityType& type );
39template<typename ObjectT = Object>
40inline std::shared_ptr<ObjectT> getDepthFirstObject( Object& root, const ObjectSelectivityType& type )
41 { return getDepthFirstObject<ObjectT>( &root, type ); }
42
44
45inline bool objectHasSelectableChildren( const MR::Object& object )
46{
47 for ( const auto& child : object.children() )
48 {
49 if ( !child->isAncillary() || objectHasSelectableChildren( *child ) )
50 return true;
51 }
52 return false;
53}
54
55}
56
57#include "MRObjectsAccess.hpp"
named object in the data model
Definition MRObject.h:60
ObjectSelectivityType
Definition MRObjectsAccess.h:11
std::vector< std::shared_ptr< ObjectT > > getAllObjectsInTree(Object *root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
std::shared_ptr< ObjectT > asSelectivityType(std::shared_ptr< Object > obj, const ObjectSelectivityType &type)
if input object is of given type then returns another pointer on it
std::vector< std::shared_ptr< ObjectT > > getTopmostVisibleObjects(Object *root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
Returns all topmost visible objects of given type (if an object is returned, its children are not) ex...
std::shared_ptr< ObjectT > getDepthFirstObject(Object *root, const ObjectSelectivityType &type)
return first object of given type in depth-first traverse order excluding root
Definition MRCameraOrientationPlugin.h:7
bool objectHasSelectableChildren(const MR::Object &object)
Definition MRObjectsAccess.h:45