ufe 5.5
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.11-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
22
23// Forward declarations
24class Connection;
25
27
37{
38public:
39 typedef std::shared_ptr<UndoableCommand> Ptr;
40
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
56protected:
61};
62
64
74{
75public:
76 typedef std::list<Ptr> CmdList;
77
79
81 static std::shared_ptr<CompositeUndoableCommand> create(
82 std::initializer_list<Ptr> undoableCommands
83 );
84 static std::shared_ptr<CompositeUndoableCommand> create(
85 const std::list<Ptr>& undoableCommands
86 );
87 static std::shared_ptr<CompositeUndoableCommand> create(
88 const Ptr& undoableCommand
89 );
91
93
95 CompositeUndoableCommand(std::initializer_list<Ptr> undoableCommands);
96 CompositeUndoableCommand(const std::list<Ptr>& undoableCommands);
97 CompositeUndoableCommand(const Ptr& undoableCommand);
99
101
103 void execute() override;
104
106 void undo() override;
107
109 void redo() override;
110
112 void append(const Ptr& cmd);
113
115 const CmdList& cmdsList() const;
116
117private:
120
122};
123
125
131{
132public:
133 typedef std::shared_ptr<InsertChildCommand> Ptr;
134
137
140
142 virtual SceneItem::Ptr insertedChild() const = 0;
143};
144
155{
156public:
157 typedef std::shared_ptr<SceneItemResultUndoableCommand> Ptr;
158
161
164
166 virtual SceneItem::Ptr sceneItem() const = 0;
167};
168
177{
178public:
179 typedef std::shared_ptr<ConnectionResultUndoableCommand> Ptr;
180
183
186
188 virtual std::shared_ptr<Connection> connection() const = 0;
189};
190
192
202{
203public:
204 typedef std::shared_ptr<SelectionUndoableCommand> Ptr;
205
209
212
220 virtual SceneItem::Ptr targetItem(const Path& sourcePath) const = 0;
221};
222
223}
224
225#endif /* _undoableCommand */
Composite undoable command.
CompositeUndoableCommand(const CompositeUndoableCommand &)=delete
Deleting copy constructor.
CompositeUndoableCommand(const Ptr &undoableCommand)
static std::shared_ptr< CompositeUndoableCommand > create(const Ptr &undoableCommand)
void redo() override
Calls redo() on each command in the list, in forward order.
static std::shared_ptr< CompositeUndoableCommand > create(const std::list< Ptr > &undoableCommands)
void undo() override
Calls undo() on each command in the list, in reverse order.
CompositeUndoableCommand(const std::list< Ptr > &undoableCommands)
const CmdList & cmdsList() const
Returns the list of undoable commands.
static std::shared_ptr< CompositeUndoableCommand > create(std::initializer_list< Ptr > undoableCommands)
CompositeUndoableCommand()
Constructors.
void execute() override
Calls execute() on each command in the list, in forward order.
CompositeUndoableCommand(std::initializer_list< Ptr > undoableCommands)
void append(const Ptr &cmd)
Append the argument to the list of commands.
~CompositeUndoableCommand() override
Destructor.
Command that modifies the data model and produces either a new or modified Connection.
~ConnectionResultUndoableCommand() override
Destructor.
std::shared_ptr< ConnectionResultUndoableCommand > Ptr
virtual std::shared_ptr< Connection > connection() const =0
Pure virtual method to retrieve the resulting scene item.
ConnectionResultUndoableCommand()=default
Default constructor.
Command to change the parent of a scene item.
std::shared_ptr< InsertChildCommand > Ptr
InsertChildCommand()=default
Default constructor.
virtual SceneItem::Ptr insertedChild() const =0
Pure virtual method to retrieve the reparented scene item.
~InsertChildCommand() override
Destructor.
Identify an object or 3D path in the scene.
Definition: path.h:38
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:44
Command that modifies the data model and produces either a new or modified SceneItem.
~SceneItemResultUndoableCommand() override
Destructor.
SceneItemResultUndoableCommand()=default
Default constructor.
std::shared_ptr< SceneItemResultUndoableCommand > Ptr
virtual SceneItem::Ptr sceneItem() const =0
Pure virtual method to retrieve the resulting scene item.
Command that handles a selection.
std::shared_ptr< SelectionUndoableCommand > Ptr
virtual SceneItem::Ptr targetItem(const Path &sourcePath) const =0
~SelectionUndoableCommand() override
Destructor.
Abstract base class for undoable commands.
virtual void undo()=0
virtual std::string commandString() const
Get a user friendly string representation of the command.
UndoableCommand()
Constructor.
std::shared_ptr< UndoableCommand > Ptr
virtual void execute()
UndoableCommand(const UndoableCommand &)=delete
Deleting copy constructor.
virtual ~UndoableCommand()
Destructor.
virtual void redo()=0
std::string string(const Path &path)
#define UFE_NS_DEF
Definition: ufe.h:35
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:36