ufe  4.2
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
selection.h
Go to the documentation of this file.
1 #line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.10-windows/ufe/include/selection.h"
2 #ifndef _ufeSelection
3 #define _ufeSelection
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 "sceneItemList.h"
13 #include "sceneItem.h"
14 #include "selectionTrieFwd.h"
15 
16 UFE_NS_DEF {
17 
19 
28 {
29 public:
30 
31  typedef SceneItemList::const_iterator const_iterator;
32  typedef SceneItemList::const_reverse_iterator const_reverse_iterator;
33 
35  Selection();
36 
38  Selection(const Selection&);
39 
41  virtual ~Selection();
42 
44  Selection& operator=(const Selection&);
45 
48 
50  Selection& operator=(Selection&& rhs);
51 
53  std::size_t size() const;
54 
56  bool empty() const;
57 
66  bool append(const SceneItem::Ptr& item);
67 
76  bool remove(const SceneItem::Ptr& item);
77 
88  bool insert(const SceneItem::Ptr& position, const SceneItem::Ptr& item);
89 
94  void clear();
95 
102  void replaceWith(const Selection& selection);
103 
107  bool contains(const Path& path) const;
108 
117  bool containsDescendant(const Path& path) const;
118 
126  bool containsDescendantInclusive(const Path& path) const;
127 
136  bool containsAncestor(const Path& path) const;
137 
145  bool containsAncestorInclusive(const Path& path) const;
146 
153  SceneItem::Ptr closestCommonAncestor() const;
154 
163  SceneItem::Ptr next(const SceneItem::Ptr& item) const;
164 
166  const SceneItem::Ptr& front() const;
168  const SceneItem::Ptr& back() const;
170 
172  const_iterator cbegin() const;
174  const_iterator begin() const;
175  const_iterator cend() const;
176  const_iterator end() const;
177  const_reverse_iterator crbegin() const;
178  const_reverse_iterator rbegin() const;
179  const_reverse_iterator crend() const;
180  const_reverse_iterator rend() const;
182 protected:
183 
185  bool doAppend(const SceneItem::Ptr& item);
191  bool doRemove(const SceneItem::Ptr& item);
192  bool doInsert(const SceneItem::Ptr& position, const SceneItem::Ptr& item);
193  void doClear();
194  void doReplaceWith(const Selection& selection);
196 
198  // Hook methods for append, remove, insert, clear, and replaceWith.
199  // postAppend(), postRemove(), and postInsert() are only called if
200  // doAppend(), doRemove(), and doInsert() return true, respectively.
201  // Implementations in this class do nothing.
202  virtual void postAppend(const SceneItem::Ptr& item);
203  virtual void postRemove(const SceneItem::Ptr& item);
204  virtual void postInsert(
205  const SceneItem::Ptr& position, const SceneItem::Ptr& item
206  );
207  virtual void postClear();
208  virtual void postReplaceWith();
210 
212  SelectionTrie& trie();
214  const SelectionTrie& trie() const;
216 
220  inline SceneItemList& list() { return fList; }
221 
222 private:
223  SceneItemList fList;
224 
227  void* fTrieStorage[2];
228 };
229 
230 }
231 
232 #endif /* _ufeSelection */
std::list< std::shared_ptr< SceneItem > > SceneItemList
Definition: sceneItemList.h:19
SceneItemList::const_reverse_iterator const_reverse_iterator
Definition: selection.h:32
Node for Universal Front End trie.
Identify an object or 3D path in the scene.
Definition: path.h:37
Selection list for objects in the scene.
Definition: selection.h:27
#define UFE_NS_DEF
Definition: ufe.h:35
SceneItemList::const_iterator const_iterator
Definition: selection.h:31
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:40
Path path(const std::string &pathString)
#define UFE_SDK_DECL
Definition: ufeExport.h:36