NDEVR
API Documentation

A specified type of DesignCommand that can make objects visible or invisible in a 3D space such as a viewport. More...

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

Public Member Functions

 VisibleCommand (bool make_visible)
 Constructs a VisibleCommand that will either show or hide target objects.
virtual bool addTarget (UUID target_id) override
 Adds a target object UUID to the list of objects this command will affect.
virtual void execute (DesignObjectLookup *lookup) override
 Executes the visibility command on the given design lookup.
StringView icon () const override
 Returns the icon name representing the current visibility state.
TranslatedString name () const override
 Returns the translated display name for 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

Buffer< UUIDtargets
 The list of target object UUIDs whose visibility will be changed.
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.

Protected Attributes

bool m_make_visible
 Whether this command makes objects visible (true) or invisible (false).
Buffer< UUIDm_models_to_toggle
 Tracks UUIDs of all models actually toggled during execution, used for undo.
Protected Attributes inherited from DesignCommand
UUID m_undo_redo_group
 The undo-redo group this command belongs to, for batch undo/redo.

Detailed Description

A specified type of DesignCommand that can make objects visible or invisible in a 3D space such as a viewport.


See also
DesignCommand, Model

Definition at line 15 of file VisibleCommand.h.

Constructor & Destructor Documentation

◆ VisibleCommand()

VisibleCommand::VisibleCommand ( bool make_visible)
inline

Constructs a VisibleCommand that will either show or hide target objects.


Parameters
[in]make_visibleWhether this command makes objects visible (true) or invisible (false).

Definition at line 22 of file VisibleCommand.h.

References DesignCommand::DesignCommand(), and m_make_visible.

Member Function Documentation

◆ addTarget()

virtual bool VisibleCommand::addTarget ( UUID target_id)
inlineoverridevirtual

Adds a target object UUID to the list of objects this command will affect.


Parameters
[in]target_idThe UUID of the model or layer to add as a target.
Returns
Always returns true, indicating the target was accepted.

Reimplemented from DesignCommand.

Definition at line 107 of file VisibleCommand.h.

References targets.

◆ execute()

virtual void VisibleCommand::execute ( DesignObjectLookup * lookup)
inlineoverridevirtual

Executes the visibility command on the given design lookup.


When executed normally, iterates through all targets and sets their spacial_visible property to the desired state. When making objects visible, also walks up the parent hierarchy to ensure ancestor layers are visible. Tracks all toggled models so the operation can be undone.

When undoing, reverts the spacial_visible property of all previously toggled models.

Parameters
[in]lookupThe design object lookup providing access to models and layers.

Reimplemented from DesignCommand.

Definition at line 37 of file VisibleCommand.h.

References DesignObject::get(), Model::getLayer(), Model::getParent(), guid, Model::hasDirectLayer(), DesignCommand::is_undo, DesignObject::isValid(), Model::isVisible(), DesignObjectLookup::lockPtr(), m_make_visible, m_models_to_toggle, DesignObjectLookup::modelOrLayer(), spacial_visible, targets, and DesignObject::update().

◆ icon()

StringView VisibleCommand::icon ( ) const
inlineoverridevirtual

Returns the icon name representing the current visibility state.


Returns
"visible" if this command makes objects visible, "invisible" otherwise.

Implements DesignCommand.

Definition at line 84 of file VisibleCommand.h.

References m_make_visible.

◆ name()

TranslatedString VisibleCommand::name ( ) const
inlineoverridevirtual

Returns the translated display name for this command.


Returns
A TranslatedString of "Visible" or "Invisible" depending on the command mode.

Implements DesignCommand.

Definition at line 95 of file VisibleCommand.h.

References m_make_visible.


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