ufe  3.2
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/ECP/ufe/ufe-full-python3.9-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 
46 
48 
70 {
71 public:
72  typedef std::shared_ptr<Hierarchy> Ptr;
73  typedef std::list<ChildFilterFlag> ChildFilter;
74 
81  static Ptr hierarchy(const SceneItem::Ptr& item);
82 
91  static SceneItem::Ptr createItem(const Path& path);
92 
94  Hierarchy();
95 
97  Hierarchy(const Hierarchy&) = default;
98 
100  virtual ~Hierarchy();
101 
103  virtual SceneItem::Ptr sceneItem() const = 0;
104 
108  virtual bool hasChildren() const = 0;
109 
111  virtual SceneItemList children() const = 0;
112 
114  virtual SceneItemList filteredChildren(const ChildFilter&) const = 0;
115 
117  virtual SceneItem::Ptr parent() const = 0;
118 
123  virtual SceneItem::Ptr defaultParent() const = 0;
124 
132  virtual SceneItem::Ptr insertChild(
133  const SceneItem::Ptr& child, const SceneItem::Ptr& pos) = 0;
134 
142  virtual InsertChildCommand::Ptr insertChildCmd(
143  const SceneItem::Ptr& child, const SceneItem::Ptr& pos) = 0;
144 
151  return insertChildCmd(child, nullptr);
152  }
153 
162  virtual SceneItem::Ptr createGroup(const PathComponent& name) const = 0;
163 
172  virtual InsertChildCommand::Ptr createGroupCmd(const PathComponent& name) const = 0;
173 
178  virtual UndoableCommand::Ptr reorderCmd(const Ufe::SceneItemList& orderedList) const = 0;
179 
184  virtual bool reorder(const Ufe::SceneItemList& orderedList) {
185  auto cmd = reorderCmd(orderedList);
186  if (cmd) {
187  cmd->execute();
188  return true;
189  }
190  return false;
191  }
192 
196  virtual UndoableCommand::Ptr ungroupCmd() const = 0;
197 
200  virtual bool ungroup() {
201  auto cmd = ungroupCmd();
202  if (cmd) {
203  cmd->execute();
204  return true;
205  }
206  return false;
207  }
208 };
209 
210 }
211 
212 #endif /* _hierarchy */
213 
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:72
Definition of macros for symbol visibility.
InsertChildCommand::Ptr appendChildCmd(const SceneItem::Ptr &child)
Definition: hierarchy.h:150
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
std::string label
The user-visible string, possibly localized.
Definition: hierarchy.h:40
virtual bool ungroup()
Definition: hierarchy.h:200
#define UFE_NS_DEF
Definition: ufe.h:35
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:40
std::list< ChildFilterFlag > ChildFilter
Definition: hierarchy.h:73
Path path(const std::string &pathString)
Abstract base class for scene hierarchy interface.
Definition: hierarchy.h:69
#define UFE_SDK_DECL
Definition: ufeExport.h:36
std::shared_ptr< InsertChildCommand > Ptr
virtual bool reorder(const Ufe::SceneItemList &orderedList)
Definition: hierarchy.h:184