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
undoableCommand.h
Go to the documentation of this file.
1 #line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.10-windows/ufe/include/undoableCommand.h"
2 #ifndef _undoableCommand
3 #define _undoableCommand
4 // ===========================================================================
5 // Copyright 2018 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 
14 #include "sceneItem.h"
15 
16 #include <memory>
17 #include <list>
18 #include <initializer_list>
19 #include <string>
20 
21 UFE_NS_DEF {
22 
23 // Forward declarations
24 class Connection;
25 
27 
37 {
38 public:
39  typedef std::shared_ptr<UndoableCommand> Ptr;
40 
42  virtual ~UndoableCommand();
43 
47  virtual std::string commandString() const { return ""; }
48 
51  virtual void execute();
52 
53  virtual void undo() = 0;
54  virtual void redo() = 0;
55 
56 protected:
60  UndoableCommand(const UndoableCommand&) = delete;
61 };
62 
64 
74 {
75 public:
76  typedef std::list<Ptr> CmdList;
77 
80  static std::shared_ptr<CompositeUndoableCommand> create(
81  std::initializer_list<Ptr> undoableCommands
82  );
83 
87  CompositeUndoableCommand(std::initializer_list<Ptr> undoableCommands);
88  CompositeUndoableCommand(const std::list<Ptr>& undoableCommands);
90  ~CompositeUndoableCommand() override;
92 
94  void execute() override;
95 
97  void undo() override;
98 
100  void redo() override;
101 
103  void append(const Ptr& cmd);
104 
106  const CmdList& cmdsList() const;
107 
108 private:
111 
113 };
114 
116 
122 {
123 public:
124  typedef std::shared_ptr<InsertChildCommand> Ptr;
125 
127  InsertChildCommand() = default;
128 
130  ~InsertChildCommand() override;
131 
133  virtual SceneItem::Ptr insertedChild() const = 0;
134 };
135 
146 {
147 public:
148  typedef std::shared_ptr<SceneItemResultUndoableCommand> Ptr;
149 
151  SceneItemResultUndoableCommand() = default;
152 
154  ~SceneItemResultUndoableCommand() override;
155 
157  virtual SceneItem::Ptr sceneItem() const = 0;
158 };
159 
168 {
169 public:
170  typedef std::shared_ptr<ConnectionResultUndoableCommand> Ptr;
171 
174 
177 
179  virtual std::shared_ptr<Connection> connection() const = 0;
180 };
181 
183 
193 {
194 public:
195  typedef std::shared_ptr<SelectionUndoableCommand> Ptr;
196 
199  SelectionUndoableCommand() = default;
200 
202  ~SelectionUndoableCommand() override;
203 
211  virtual SceneItem::Ptr targetItem(const Path& sourcePath) const = 0;
212 };
213 
214 }
215 
216 #endif /* _undoableCommand */
virtual void redo()=0
std::shared_ptr< UndoableCommand > Ptr
std::string string(const Path &path)
std::shared_ptr< SelectionUndoableCommand > Ptr
Definition of macros for symbol visibility.
Command that modifies the data model and produces either a new or modified Connection.
Composite undoable command.
Identify an object or 3D path in the scene.
Definition: path.h:37
#define UFE_NS_DEF
Definition: ufe.h:35
Abstract base class for undoable commands.
virtual std::string commandString() const
Get a user friendly string representation of the command.
std::shared_ptr< ConnectionResultUndoableCommand > Ptr
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:40
virtual void execute()
Command that handles a selection.
Command to change the parent of a scene item.
virtual void undo()=0
Command that modifies the data model and produces either a new or modified SceneItem.
#define UFE_SDK_DECL
Definition: ufeExport.h:36
std::shared_ptr< SceneItemResultUndoableCommand > Ptr
std::shared_ptr< InsertChildCommand > Ptr