![]() |
NDEVR
API Documentation
|
A DesignCommand that creates a new Model to some specification. More...
Public Member Functions | |
| NewModelCommand (const TranslatedString &name, const std::function< void(Model &model)> &on_finished) | |
| Creates a model with the specified name and calls on_finished at the end of the command. | |
| virtual bool | addTarget (UUID target_id) override |
| Adds a target UUID to this command's target list. | |
| virtual void | execute (DesignObjectLookup *lookup) override |
| Executes the new model command against the given lookup. | |
| virtual StringView | icon () const override |
| Returns the icon identifier for this command. | |
| virtual TranslatedString | name () const override |
| Returns the 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 | |
| std::function< void(Model &model)> | finished_callback |
| Callback invoked after the model has been fully created and added to the lookup. | |
| TranslatedString | model_name |
| The display name assigned to the newly created model. | |
| std::function< void(Model &model)> | on_create |
| Callback invoked on the model immediately after creation, before it is added to the lookup. | |
| UUID | parent_id |
| The UUID of the parent model. If invalid, a top-level Scene is created instead. | |
| Buffer< UUID > | targets |
| The UUIDs of models created by this command, used for undo/redo tracking. | |
| 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 DesignCommand that creates a new Model to some specification.
Definition at line 13 of file NewModelCommand.h.
|
inlineoverridevirtual |
Adds a target UUID to this command's target list.
| [in] | target_id | The UUID of the model to add as a target. |
Reimplemented from DesignCommand.
Definition at line 117 of file NewModelCommand.h.
References targets.
|
inlineoverridevirtual |
Executes the new model command against the given lookup.
When undoing (is_undo is true), deletes all previously created target objects. When redoing with existing targets, restores models if they exist or recreates them with the original GUIDs. When executing for the first time with no targets, creates either a top-level Scene (if parent_id is invalid) or a child Model under the specified parent.
| [in] | lookup | The DesignObjectLookup to create or remove objects from. |
Reimplemented from DesignCommand.
Definition at line 50 of file NewModelCommand.h.
References DesignObjectLookup::addModel(), DesignObjectLookup::addScene(), Model::createChild(), DesignObjectLookup::deleteObject(), finished_callback, DesignObject::get(), guid, DesignObjectLookup::hasModelID(), DesignCommand::is_undo, IsInvalid(), DesignObjectLookup::model(), model_name, name, on_create, parent_id, DesignObjectLookup::restoreModel(), DesignObject::set(), targets, Model::updateModifiedTime(), and DesignObjectLookup::writeLock().
|
inlineoverridevirtual |
Returns the icon identifier for this command.
Implements DesignCommand.
Definition at line 28 of file NewModelCommand.h.
|
inlineoverridevirtual |
Returns the display name of this command.
Implements DesignCommand.
Definition at line 36 of file NewModelCommand.h.
Referenced by NewModelCommand().