![]() |
NDEVR
API Documentation
|
A DesignCommand that creates a new Material and optionally associates it with a target object. More...
Public Member Functions | |
| NewMaterialCommand (const std::function< void(Material &material)> &on_finished) | |
| Constructs a NewMaterialCommand with a callback invoked after the material is created. | |
| virtual | ~NewMaterialCommand () |
| Default virtual destructor. | |
| virtual bool | addTarget (UUID target_id) override |
| Sets the target object that the new material will be assigned to. | |
| virtual void | execute (DesignObjectLookup *lookup) override |
| Executes the command, creating a new Material within the given lookup. | |
| 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 | |
| std::function< void(Material &model)> | finished_callback |
| Callback invoked after the command finishes execution. | |
| std::function< void(Material &model)> | on_create |
| Optional callback invoked during material creation. | |
| UUID | parent_id |
| UUID of the parent object under which the new material is created. | |
| UUID | target |
| UUID of the target object to receive the new material. | |
| 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 Material and optionally associates it with a target object.
Upon execution, a new Material is created within the DesignObjectLookup. An optional callback is invoked after creation, and a finish callback is invoked when the command completes. The command supports undo by tracking the previously assigned material.
Definition at line 16 of file MaterialCommands.h.
| NewMaterialCommand::NewMaterialCommand | ( | const std::function< void(Material &material)> & | on_finished | ) |
Constructs a NewMaterialCommand with a callback invoked after the material is created.
| [in] | on_finished | Callback invoked with the newly created Material once the command finishes. |
|
inlineoverridevirtual |
Sets the target object that the new material will be assigned to.
| [in] | target_id | The UUID of the target design object. |
Reimplemented from DesignCommand.
Definition at line 48 of file MaterialCommands.h.
References target.
|
overridevirtual |
Executes the command, creating a new Material within the given lookup.
| [in] | lookup | The DesignObjectLookup in which to create the material. |
Reimplemented from DesignCommand.
|
overridevirtual |
Returns the icon identifier for this command.
Implements DesignCommand.
|
overridevirtual |
Returns the translated display name of this command.
Implements DesignCommand.