Cogs.Core
|
Base class for Cogs Editor commands. More...
#include <EditorCommand.h>
Public Member Functions | |
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. | |
Public Attributes | |
std::vector< ParsedValue > | options |
Options passed to the command when running in batch mode. | |
bool | permanentUndo = false |
True if cannot Redo after Undo. | |
Protected Attributes | |
EditorState * | state = nullptr |
Context * | context = nullptr |
Private Attributes | |
bool | closed = false |
Base class for Cogs Editor commands.
A framework for commands with undo/redo capabilities.
Definition at line 18 of file EditorCommand.h.
Cogs::Core::EditorCommand::EditorCommand | ( | EditorState * | state, |
Context * | context | ||
) |
Definition at line 3 of file EditorCommand.cpp.
|
pure virtual |
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)
Implemented in Cogs::Core::AboutCommand, Cogs::Core::AssetPipeCommand, Cogs::Core::AssetStatsCommand, Cogs::Core::DumpStatsCommand, Cogs::Core::ChangeEditingModeCommand, Cogs::Core::CreateEntityCommand, Cogs::Core::PasteEntityCommand, Cogs::Core::DestroyCommand, Cogs::Core::SelectCommand, Cogs::Core::AddComponentCommand, Cogs::Core::TranslateCommand, Cogs::Core::RotateCommand, Cogs::Core::ScaleCommand, Cogs::Core::ScaleToUnitCubeCommand, Cogs::Core::GroupCommand, Cogs::Core::ExportCommand, Cogs::Core::ExportGltfCommand, Cogs::Core::SetFieldCommand< T >, Cogs::Core::LoadRvmCommand, Cogs::Core::MergeCommand, Cogs::Core::MergeMeshCommand, Cogs::Core::ScaleMeshCommand, Cogs::Core::NoOpModalCommand, Cogs::Core::GenerateNormalsCommand, Cogs::Core::UniqueVerticesCommand, Cogs::Core::PackMeshCommand, Cogs::Core::SetMaterialPropertyCommand< T >, Cogs::Core::SetTexturePropertyCommand, Cogs::Core::RemapMaterialCommand, Cogs::Core::MergeMaterialCommand, Cogs::Core::GenerateTangentsCommand, Cogs::Core::GenNormalsCommand, Cogs::Core::ShowLicensesCommand, Cogs::Core::SparseBuildOctreeCommand, Cogs::Core::RRMultiSimplifyCommand, Cogs::Core::RRSaveAllLodCommand, and Cogs::Core::RRSimplifiyCommand.
|
inlinevirtual |
Workaround for having extendable mesh processing available without linking (e.g command -> RR).
Reimplemented in Cogs::Core::RRSimplifiyCommand.
Definition at line 42 of file EditorCommand.h.
|
inlinevirtual |
Close command, i.e. prevent merging with another command.
Reimplemented in Cogs::Core::SetFieldCommand< T >.
Definition at line 45 of file EditorCommand.h.
|
inline |
Definition at line 50 of file EditorCommand.h.
|
inline |
Merge into this if not this is closed.
Definition at line 53 of file EditorCommand.h.
|
inlinevirtual |
Check if the action in the given command should be merged into this. I.e. Multiple field-changes commands merged info one for undoing all-in-one. Client code shall use
Reimplemented in Cogs::Core::TranslateCommand, Cogs::Core::RotateCommand, Cogs::Core::ScaleCommand, Cogs::Core::SetFieldCommand< T >, and Cogs::Core::SetMaterialPropertyCommand< T >.
Definition at line 39 of file EditorCommand.h.
|
inlinevirtual |
Definition at line 31 of file EditorCommand.h.
|
private |
Definition at line 71 of file EditorCommand.h.
|
protected |
Definition at line 68 of file EditorCommand.h.
std::vector<ParsedValue> Cogs::Core::EditorCommand::options |
Options passed to the command when running in batch mode.
Definition at line 61 of file EditorCommand.h.
Referenced by Cogs::Core::DumpStatsCommand::apply(), Cogs::Core::ExportCommand::apply(), Cogs::Core::MergeCommand::apply(), and Cogs::Core::RRSimplifiyCommand::apply().
bool Cogs::Core::EditorCommand::permanentUndo = false |
True if cannot Redo after Undo.
Definition at line 64 of file EditorCommand.h.
|
protected |
Definition at line 67 of file EditorCommand.h.