Cogs.Core
Source
Editor
EditorCommand.h
1
#pragma once
2
3
#include "Base.h"
4
5
#include "Resources/Resources.h"
6
7
#include "Utilities/Parsing.h"
8
9
namespace
Cogs::Core
10
{
11
struct
EditorState;
12
class
Context;
13
18
struct
COGSCORE_DLL_API
EditorCommand
19
{
20
EditorCommand
(
EditorState
* state,
Context
* context);
21
virtual
~EditorCommand
() =
default
;
22
29
virtual
void
apply
() = 0;
30
virtual
void
undo() = 0;
31
virtual
void
redo()
32
{
33
apply();
34
}
35
39
virtual
bool
mergeWith
(
const
EditorCommand
*
/*command*/
) {
return
false
; }
40
42
virtual
MeshHandle
applyMesh
(
MeshHandle
/*mesh*/
) {
return
{}; }
43
45
virtual
void
close
()
46
{
47
closed =
true
;
48
}
49
50
bool
isClosed()
const
{
return
closed; }
51
53
bool
merge
(
const
EditorCommand
* command)
54
{
55
if
(closed)
return
false
;
56
57
return
mergeWith(command);
58
}
59
61
std::vector<ParsedValue>
options
;
62
64
bool
permanentUndo =
false
;
65
66
protected
:
67
EditorState
* state =
nullptr
;
68
Context
* context =
nullptr
;
69
70
private
:
71
bool
closed =
false
;
72
};
73
}
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Definition:
ComponentFunctions.h:10
Cogs::Core::EditorCommand
Base class for Cogs Editor commands.
Definition:
EditorCommand.h:19
Cogs::Core::EditorCommand::mergeWith
virtual bool mergeWith(const EditorCommand *)
Definition:
EditorCommand.h:39
Cogs::Core::EditorCommand::merge
bool merge(const EditorCommand *command)
Merge into this if not this is closed.
Definition:
EditorCommand.h:53
Cogs::Core::EditorCommand::apply
virtual void apply()=0
Run the command.
Cogs::Core::EditorCommand::applyMesh
virtual MeshHandle applyMesh(MeshHandle)
Workaround for having extendable mesh processing available without linking (e.g command -> RR).
Definition:
EditorCommand.h:42
Cogs::Core::EditorCommand::options
std::vector< ParsedValue > options
Options passed to the command when running in batch mode.
Definition:
EditorCommand.h:61
Cogs::Core::EditorCommand::close
virtual void close()
Close command, i.e. prevent merging with another command.
Definition:
EditorCommand.h:45
Cogs::Core::EditorState
Definition:
EditorState.h:76
Cogs::Core::ResourceHandle_t< Mesh >
Generated by
1.9.6