ufe  2.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
hierarchy.h
Go to the documentation of this file.
1 #line 1 "S:/jenkins/workspace/ufe-full-windows/ufe/include/hierarchy.h"
2 #ifndef _hierarchy
3 #define _hierarchy
4 // ===========================================================================
5 // Copyright 2020 Autodesk, Inc. All rights reserved.
6 //
7 // Use of this software is subject to the terms of the Autodesk license
8 // agreement provided at the time of installation or download, or which
9 // otherwise accompanies this software in either electronic or hard copy form.
10 // ===========================================================================
11 
12 #include "common/ufeExport.h"
13 #include "sceneItemList.h"
14 #include "sceneItem.h"
15 #include "undoableCommand.h"
16 
17 #include <memory>
18 #include <string>
19 
20 UFE_NS_DEF {
21 
22 class Selection;
23 
25 
30  ChildFilterFlag() = default;
32  const std::string& filterName,
33  const std::string& filterLabel,
34  bool filterValue);
35 
38 
41 
43  bool value{false};
44 };
45 
47 
53 {
54 public:
55  typedef std::shared_ptr<InsertChildCommand> Ptr;
56 
58  InsertChildCommand() = default;
59 
61  virtual ~InsertChildCommand() = default;
62 
64  virtual SceneItem::Ptr insertedChild() const = 0;
65 };
66 
68 
90 {
91 public:
92  typedef std::shared_ptr<Hierarchy> Ptr;
93  typedef std::list<ChildFilterFlag> ChildFilter;
94 
101  static Ptr hierarchy(const SceneItem::Ptr& item);
102 
111  static SceneItem::Ptr createItem(const Path& path);
112 
114  Hierarchy();
115 
117  Hierarchy(const Hierarchy&) = default;
118 
120  virtual ~Hierarchy();
121 
123  virtual SceneItem::Ptr sceneItem() const = 0;
124 
128  virtual bool hasChildren() const = 0;
129 
131  virtual SceneItemList children() const = 0;
132 
134  virtual SceneItemList filteredChildren(const ChildFilter&) const = 0;
135 
137  virtual SceneItem::Ptr parent() const = 0;
138 
143  virtual SceneItem::Ptr defaultParent() const = 0;
144 
152  virtual SceneItem::Ptr insertChild(
153  const SceneItem::Ptr& child, const SceneItem::Ptr& pos) = 0;
154 
162  virtual InsertChildCommand::Ptr insertChildCmd(
163  const SceneItem::Ptr& child, const SceneItem::Ptr& pos) = 0;
164 
171  return insertChildCmd(child, nullptr);
172  }
173 
183  virtual SceneItem::Ptr createGroup(const Selection& selection, const PathComponent& name) const = 0;
184 
194  virtual UndoableCommand::Ptr createGroupCmd(const Selection& selection, const PathComponent& name) const = 0;
195 
200  virtual UndoableCommand::Ptr reorderCmd(const Ufe::SceneItemList& orderedList) const = 0;
201 
206  virtual bool reorder(const Ufe::SceneItemList& orderedList) {
207  auto cmd = reorderCmd(orderedList);
208  if (cmd) {
209  cmd->execute();
210  return true;
211  }
212  return false;
213  }
214 };
215 
216 }
217 
218 #endif /* _hierarchy */
219 
std::list< std::shared_ptr< SceneItem > > SceneItemList
Definition: sceneItemList.h:19
std::shared_ptr< UndoableCommand > Ptr
Structure to describe child filtering.
Definition: hierarchy.h:29
std::string string(const Path &path)
std::shared_ptr< Hierarchy > Ptr
Definition: hierarchy.h:92
Definition of macros for symbol visibility.
InsertChildCommand::Ptr appendChildCmd(const SceneItem::Ptr &child)
Definition: hierarchy.h:170
Constant string representation with fixed space and O(1) comparison.
Definition: pathComponent.h:33
Identify an object or 3D path in the scene.
Definition: path.h:37
std::string name
The implementation-specific name of this child filter flag.
Definition: hierarchy.h:37
Selection list for objects in the scene.
Definition: selection.h:27
std::string label
The user-visible string, possibly localized.
Definition: hierarchy.h:40
#define UFE_NS_DEF
Definition: ufe.h:35
Abstract base class for undoable commands.
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:40
std::list< ChildFilterFlag > ChildFilter
Definition: hierarchy.h:93
Command to change the parent of a scene item.
Definition: hierarchy.h:52
Path path(const std::string &pathString)
Abstract base class for scene hierarchy interface.
Definition: hierarchy.h:89
#define UFE_SDK_DECL
Definition: ufeExport.h:36
std::shared_ptr< InsertChildCommand > Ptr
Definition: hierarchy.h:55
virtual bool reorder(const Ufe::SceneItemList &orderedList)
Definition: hierarchy.h:206