NDEVR
API Documentation
DesignCommandabstract

Forward declaration of the central design object registry. More...

Inheritance diagram for DesignCommand:
[legend]
Collaboration diagram for DesignCommand:
[legend]

Public Member Functions

 DesignCommand ()
 Default constructor.
 DesignCommand (const DesignCommand &command)=default
 Default copy constructor.
virtual ~DesignCommand ()
 Virtual destructor.
virtual bool addTarget (UUID)
 Adds a target object by UUID to this command.
virtual bool canCombineWith (const DynamicPointer< DesignCommand > &)
 Checks whether this command can be combined with another command into a single operation.
virtual bool canGroupWith (const DynamicPointer< DesignCommand > &)
 Checks whether this command can be grouped with another command for batch execution.
virtual void combineWith (const DynamicPointer< DesignCommand > &command)
 Combines this command with another compatible command, merging their operations.
virtual void execute (DesignObjectLookup *)
 Executes this command against the given DesignObjectLookup.
virtual StringView icon () const =0
 Gets the icon identifier for this command.
virtual bool isAsyncExecution () const
 Whether this command should be executed asynchronously.
virtual TranslatedString name () const =0
 Gets the human-readable name of this command for display in the UI.
void setUndoRedoID (UUID undo_redo_group)
 Sets the undo-redo group identifier for this command.
UUID undoRedoID () const
 Gets the undo-redo group identifier for this command.

Public Attributes

bool can_undo = true
 Whether this command supports being undone.
bool has_executed = false
 Whether this command has already been executed.
UUID id
 Unique identifier for this command instance.
bool is_undo = false
 Whether this command represents an undo operation.
LogPtr log
 Log pipe for reporting command progress and errors.
Time time = Constant<Time>::Invalid
 Timestamp of when the command was created or executed.
bool update_project_modified = true
 Whether executing this command should mark the project as modified.

Protected Attributes

UUID m_undo_redo_group
 The undo-redo group this command belongs to, for batch undo/redo.

Detailed Description

Forward declaration of the central design object registry.


A command for safely modifying something in a DesignObjectLookup. Modifications will be done in a separate thread from the UI and will be recorded for undo-redo. Most user modifications of data should occur via a DesignCommand.

See also
DesignCommandManager, ManagedDesignCommand, DesignCommandGroup

Definition at line 54 of file DesignCommand.h.

Constructor & Destructor Documentation

◆ DesignCommand() [1/2]

◆ DesignCommand() [2/2]

DesignCommand::DesignCommand ( const DesignCommand & command)
default

Default copy constructor.

Parameters
[in]commandThe command to copy from.

References DesignCommand().

Member Function Documentation

◆ addTarget()

virtual bool DesignCommand::addTarget ( UUID )
inlinevirtual

Adds a target object by UUID to this command.

Parameters
[in]targetThe UUID of the target design object.
Returns
True if the target was successfully added, false otherwise.

Reimplemented in ClearMaterialDescendentsCommand, DesignCommandGroup, ManagedDesignCommand, ModelTileCommand, NewMaterialCommand, NewModelCommand, SetLayerCommand, SetMaterialCommand, SetPaletteCommand, SetProperties< t_property, t_type >, SetPropertiesCommand, SetProperty< t_property, t_type >, SetTextValue, and VisibleCommand.

Definition at line 91 of file DesignCommand.h.

◆ canCombineWith()

virtual bool DesignCommand::canCombineWith ( const DynamicPointer< DesignCommand > & )
inlinevirtual

Checks whether this command can be combined with another command into a single operation.

Parameters
[in]commandThe other command to check combination compatibility with.
Returns
True if the commands can be combined, false otherwise.

Reimplemented in ManagedDesignCommand, and ModelTileCommand.

Definition at line 80 of file DesignCommand.h.

◆ canGroupWith()

virtual bool DesignCommand::canGroupWith ( const DynamicPointer< DesignCommand > & )
inlinevirtual

Checks whether this command can be grouped with another command for batch execution.

Parameters
[in]commandThe other command to check grouping compatibility with.
Returns
True if the commands can be grouped together, false otherwise.

Reimplemented in ManagedDesignCommand, and ModelTileCommand.

Definition at line 74 of file DesignCommand.h.

◆ combineWith()

virtual void DesignCommand::combineWith ( const DynamicPointer< DesignCommand > & command)
virtual

Combines this command with another compatible command, merging their operations.

Parameters
[in]commandThe command to combine with this one.

Reimplemented in ManagedDesignCommand, and ModelTileCommand.

◆ execute()

virtual void DesignCommand::execute ( DesignObjectLookup * )
inlinevirtual

◆ icon()

◆ isAsyncExecution()

virtual bool DesignCommand::isAsyncExecution ( ) const
inlinevirtual

Whether this command should be executed asynchronously.

Returns
True if execution should occur on an async thread, false for synchronous execution.

Reimplemented in DesignCommandGroup, ManagedDesignCommand, and ModelTileCommand.

Definition at line 85 of file DesignCommand.h.

◆ name()

virtual TranslatedString DesignCommand::name ( ) const
pure virtual

◆ setUndoRedoID()

void DesignCommand::setUndoRedoID ( UUID undo_redo_group)

Sets the undo-redo group identifier for this command.

Parameters
[in]undo_redo_groupThe UUID of the undo-redo group this command belongs to.

◆ undoRedoID()

UUID DesignCommand::undoRedoID ( ) const

Gets the undo-redo group identifier for this command.

Returns
The UUID of the undo-redo group.

The documentation for this class was generated from the following file: