Cogs.Core
Public Member Functions | Private Attributes | List of all members
Cogs::Core::CreateEntityCommand Struct Reference
Inheritance diagram for Cogs::Core::CreateEntityCommand:
Cogs::Core::EditorCommand

Public Member Functions

 CreateEntityCommand (EditorState *state, const StringView &type, const StringView &name, bool openInRoot)
 
void apply () override
 Run the command.
 
void undo () override
 
- Public Member Functions inherited from Cogs::Core::EditorCommand
 EditorCommand (EditorState *state, Context *context)
 
virtual void apply ()=0
 Run the command.
 
virtual void undo ()=0
 
virtual void redo ()
 
virtual bool mergeWith (const EditorCommand *)
 
virtual MeshHandle applyMesh (MeshHandle)
 Workaround for having extendable mesh processing available without linking (e.g command -> RR).
 
virtual void close ()
 Close command, i.e. prevent merging with another command.
 
bool isClosed () const
 
bool merge (const EditorCommand *command)
 Merge into this if not this is closed.
 

Private Attributes

std::string type
 
std::string name
 
bool openInRoot
 
EntityId entityId = NoEntity
 
EntityId parentId = NoEntity
 
EntityIds previousSelection
 

Additional Inherited Members

- Public Attributes inherited from Cogs::Core::EditorCommand
std::vector< ParsedValueoptions
 Options passed to the command when running in batch mode.
 
bool permanentUndo = false
 True if cannot Redo after Undo.
 
- Protected Attributes inherited from Cogs::Core::EditorCommand
EditorStatestate = nullptr
 
Contextcontext = nullptr
 

Detailed Description

Definition at line 65 of file EditorCommand.h.

Constructor & Destructor Documentation

◆ CreateEntityCommand()

Cogs::Core::CreateEntityCommand::CreateEntityCommand ( EditorState state,
const StringView type,
const StringView name,
bool  openInRoot 
)

Definition at line 28 of file EditorCommand.cpp.

Member Function Documentation

◆ apply()

void Cogs::Core::CreateEntityCommand::apply ( )
overridevirtual

Run the command.

In batch scripts this method is called for all type of commands. In interactive mode this method is not called for model commands (subclasses of ModalEditorCommand)

Implements Cogs::Core::EditorCommand.

Definition at line 34 of file EditorCommand.cpp.

References Cogs::Core::EntityStore::createChildEntity(), Cogs::Core::EntityStore::createEntity(), Cogs::ComponentModel::Entity::getId(), Cogs::Core::EditorState::getSelected(), Cogs::Core::EditorState::setSelection(), and Cogs::Core::Context::store.

◆ undo()

void Cogs::Core::CreateEntityCommand::undo ( )
overridevirtual

Implements Cogs::Core::EditorCommand.

Definition at line 53 of file EditorCommand.cpp.

Member Data Documentation

◆ entityId

EntityId Cogs::Core::CreateEntityCommand::entityId = NoEntity
private

Definition at line 77 of file EditorCommand.h.

◆ name

std::string Cogs::Core::CreateEntityCommand::name
private

Definition at line 74 of file EditorCommand.h.

◆ openInRoot

bool Cogs::Core::CreateEntityCommand::openInRoot
private

Definition at line 75 of file EditorCommand.h.

◆ parentId

EntityId Cogs::Core::CreateEntityCommand::parentId = NoEntity
private

Definition at line 78 of file EditorCommand.h.

◆ previousSelection

EntityIds Cogs::Core::CreateEntityCommand::previousSelection
private

Definition at line 80 of file EditorCommand.h.

◆ type

std::string Cogs::Core::CreateEntityCommand::type
private

Definition at line 73 of file EditorCommand.h.


The documentation for this struct was generated from the following files: