![]() |
NDEVR
API Documentation
|
A command that assigns one or more models to a specified layer, with full undo support. More...
Public Member Functions | |
| SetLayerCommand (UUID layer) | |
| Constructs a SetLayerCommand targeting the given layer. | |
| virtual bool | addTarget (UUID target_id) override |
| Adds a model to the set of targets for this layer command. | |
| virtual void | execute (DesignObjectLookup *lookup) override |
| Executes the layer assignment (or reverses it during undo). | |
| virtual StringView | icon () const override |
| Returns the icon identifier for this command. | |
| virtual TranslatedString | name () const override |
| Returns the translated display name of this command. | |
| Public Member Functions inherited from DesignCommand | |
| DesignCommand () | |
| Default constructor. | |
| DesignCommand (const DesignCommand &command)=default | |
| Default copy constructor. | |
| virtual | ~DesignCommand () |
| Virtual destructor. | |
| 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 bool | isAsyncExecution () const |
| Whether this command should be executed asynchronously. | |
| 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 | |
| UUID | m_layer |
| The UUID of the destination layer. Invalid UUID means clear layer. | |
| Buffer< UUID > | m_models_to_set |
| UUIDs of models to be assigned to the layer. | |
| Buffer< UUID > | m_original_layers |
| Original layer UUIDs for each model, stored for undo support. | |
| Public Attributes inherited from DesignCommand | |
| 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. | |
Additional Inherited Members | |
| Protected Attributes inherited from DesignCommand | |
| UUID | m_undo_redo_group |
| The undo-redo group this command belongs to, for batch undo/redo. | |
A command that assigns one or more models to a specified layer, with full undo support.
When executed, each target model is moved to the layer identified by m_layer. The original layer assignment of each model is stored so that the operation can be reversed when is_undo is set. If the target layer UUID is invalid, the models are cleared of any layer assignment instead.
Definition at line 20 of file LayerCommand.h.
|
inline |
Constructs a SetLayerCommand targeting the given layer.
| [in] | layer | The UUID of the layer to assign models to. Pass an invalid UUID to clear layer assignments. |
Definition at line 28 of file LayerCommand.h.
References DesignCommand::DesignCommand(), and m_layer.
|
inlineoverridevirtual |
Adds a model to the set of targets for this layer command.
| [in] | target_id | The UUID of the model to reassign. |
Reimplemented from DesignCommand.
Definition at line 105 of file LayerCommand.h.
References m_models_to_set.
|
inlineoverridevirtual |
Executes the layer assignment (or reverses it during undo).
Acquires a write lock on the lookup, deduplicates the target model list, and iterates over each model. During a forward execution the model's current layer is recorded before reassignment; during undo the previously recorded layer is restored. If the destination layer does not yet exist in the model's scene it is created automatically.
| [in] | lookup | The design object lookup used to resolve models, layers, and scenes. |
Reimplemented from DesignCommand.
Definition at line 62 of file LayerCommand.h.
References Model::clearLayer(), Model::directLayer(), DesignObjectLookup::ensureLayerExistsInScene(), DesignObject::get(), DesignObject::getScene(), guid, DesignObjectLookup::hasLayerID(), DesignCommand::is_undo, IsInvalid(), IsValid(), DesignObject::isValid(), DesignObjectLookup::layer(), m_layer, m_models_to_set, m_original_layers, DesignObjectLookup::model(), Model::setLayer(), Model::updateModifiedTime(), and DesignObjectLookup::writeLock().
|
inlineoverridevirtual |
Returns the icon identifier for this command.
Implements DesignCommand.
Definition at line 40 of file LayerCommand.h.
|
inlineoverridevirtual |
Returns the translated display name of this command.
Implements DesignCommand.
Definition at line 48 of file LayerCommand.h.