#include <Command.h>
Inherited by CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandAdjustMotion, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandAdjustNodeGroup, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphRemoveStateAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandRemoveTransitionCondition, EMStudio::SourceControlCommand, EMotionFX::CommandAddCollider, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandAdjustCollider, EMotionFX::CommandAdjustJointLimit, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAdjustSimulatedJoint, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandRemoveCollider, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandRemoveSimulatedObject.
Classes | |
class | Callback |
Public Member Functions | |
Command (AZStd::string commandName, Command *originalCommand) | |
virtual | ~Command () |
virtual bool | Execute (const CommandLine ¶meters, AZStd::string &outResult)=0 |
virtual bool | Undo (const CommandLine ¶meters, AZStd::string &outResult) |
virtual Command * | Create ()=0 |
virtual bool | GetIsUndoable () const |
virtual void | InitSyntax () |
virtual bool | SetCommandParameters (const CommandLine ¶meters) |
virtual const char * | GetDescription () const |
virtual const char * | GetHistoryName () const |
const char * | GetName () const |
const AZStd::string & | GetNameString () const |
MCORE_INLINE CommandSyntax & | GetSyntax () |
size_t | GetNumCallbacks () const |
size_t | CalcNumPreCommandCallbacks () const |
size_t | CalcNumPostCommandCallbacks () const |
MCORE_INLINE Command::Callback * | GetCallback (size_t index) |
void | AddCallback (Command::Callback *callback) |
bool | CheckIfHasCallback (Command::Callback *callback) const |
void | RemoveCallback (Command::Callback *callback, bool delFromMem=true) |
void | RemoveAllCallbacks () |
void | SetOriginalCommand (Command *orgCommand) |
MCORE_INLINE Command * | GetOriginalCommand () |
template<class T > | |
void | ExecuteParameter (AZStd::optional< T > &oldParameter, AZStd::optional< T > ¶meter, T &value) |
Static Public Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
If a command changes the state of any data in an application, it should implement undo and redo methods. The command manager checks if a command is undoable when executing it and if that method returns true the command will be remained and saved in the command history. If it is not undoable, the command instance is destroyed right away.
MCore::Command::Command | ( | AZStd::string | commandName, |
Command * | originalCommand | ||
) |
Default constructor.
commandName | The unique identifier for the command. |
originalCommand | The original command, or nullptr when this is the original command. |
|
virtual |
Destructor.
void MCore::Command::AddCallback | ( | Command::Callback * | callback | ) |
Add (register) a command callback.
callBack | The command callback to register to this command. |
size_t MCore::Command::CalcNumPostCommandCallbacks | ( | ) | const |
Calculate the number of registered post-execute callbacks.
size_t MCore::Command::CalcNumPreCommandCallbacks | ( | ) | const |
Calculate the number of registered pre-execute callbacks.
bool MCore::Command::CheckIfHasCallback | ( | Command::Callback * | callback | ) | const |
Check if we already registered a given command callback.
callback | The callback object to check for. |
|
pure virtual |
This will be called by the CommandManager when the command is executed. The function will return an instance of the command implementation which will be stored in the command history. An instance of the called command is needed to be able to store information for the undo.
Implemented in CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandRemoveTransitionCondition, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphRemoveStateAction, EMotionFX::CommandAddCollider, EMotionFX::CommandAdjustCollider, EMotionFX::CommandRemoveCollider, EMotionFX::CommandAdjustJointLimit, CommandSystem::CommandAdjustMotion, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustNodeGroup, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandRemoveSimulatedObject, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandAdjustSimulatedJoint.
|
pure virtual |
The do it method should call redo it to make the command happen. The redo it method should do the actual work. This is a pure virtual method, and must be overridden in derived commands.
parameters | A list of the passed command arguments. |
outResult | The result/return value of the command. |
Implemented in CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandRemoveTransitionCondition, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphRemoveStateAction, EMotionFX::CommandAddCollider, EMotionFX::CommandAdjustCollider, EMotionFX::CommandRemoveCollider, EMotionFX::CommandAdjustJointLimit, CommandSystem::CommandAdjustMotion, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustNodeGroup, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandRemoveSimulatedObject, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandAdjustSimulatedJoint.
|
inline |
Get a given command callback.
index | The callback number, which must be in range of [0..GetNumCallbacks()-1]. |
|
inlinevirtual |
Get the command optional description. This can contain additional detailed information about the command.
Reimplemented in CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandRemoveTransitionCondition, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphRemoveStateAction, EMotionFX::CommandAddCollider, EMotionFX::CommandAdjustCollider, EMotionFX::CommandRemoveCollider, EMotionFX::CommandAdjustJointLimit, CommandSystem::CommandAdjustMotion, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustNodeGroup, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandRemoveSimulatedObject, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandAdjustSimulatedJoint.
|
inlinevirtual |
Get the name of the command as it can be shown in the command history. This can be a nicer name than the actual command name. For example some "MyAPILoadActor" command could be shown in the command history to the user with a more friendly name like "Load Actor". The "Load Actor" string could be returned by this function. On default the command name is returned.
Reimplemented in CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandRemoveTransitionCondition, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphRemoveStateAction, EMotionFX::CommandAddCollider, EMotionFX::CommandAdjustCollider, EMotionFX::CommandRemoveCollider, EMotionFX::CommandAdjustJointLimit, CommandSystem::CommandAdjustMotion, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustNodeGroup, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandRemoveSimulatedObject, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandAdjustSimulatedJoint.
|
virtual |
This method is used to specify whether or not the command is undoable. On default, when not overloaded, it always returns false. If you are writing a command that might be eligible for undo, you should override this method. The is undoable method will be called and used to indicate whether or not the command will be saved in the command history in the command manager.
Reimplemented in CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandRemoveTransitionCondition, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphRemoveStateAction, EMotionFX::CommandAddCollider, EMotionFX::CommandAdjustCollider, EMotionFX::CommandRemoveCollider, EMotionFX::CommandAdjustJointLimit, CommandSystem::CommandAdjustMotion, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustNodeGroup, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandRemoveSimulatedObject, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandAdjustSimulatedJoint.
const char * MCore::Command::GetName | ( | ) | const |
Get the command string that is associated with this command.
const AZStd::string & MCore::Command::GetNameString | ( | ) | const |
Get the command string that is associated with this command.
size_t MCore::Command::GetNumCallbacks | ( | ) | const |
Get the number of registered/added command callbacks.
|
inline |
Get the original command where this command has been cloned from. The original command contains the syntax. In case this is the original command, it returns a pointer to itself.
|
inline |
Get the command syntax. The syntax describes the possible parameters that can be passed to this command. Also it can verify and show info about these parameters.
|
virtual |
Initialize the command syntax. This is automatically called by the command constructor. On default the syntax will be empty, which means the command would have no parameters.
Reimplemented in EMStudio::SourceControlCommand, CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandRemoveTransitionCondition, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphRemoveStateAction, EMotionFX::CommandAddCollider, EMotionFX::CommandRemoveCollider, CommandSystem::CommandAdjustMotion, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustNodeGroup, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandRemoveSimulatedObject, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandAdjustSimulatedJoint.
void MCore::Command::RemoveAllCallbacks | ( | ) |
Remove all the registered command callbacks.
void MCore::Command::RemoveCallback | ( | Command::Callback * | callback, |
bool | delFromMem = true |
||
) |
Remove a given callback.
callBack | The callback to remove. |
delFromMem | Set to true when you want the callback to be automatically removed from memory as well (even if its not found and removed). |
|
inlinevirtual |
This method should undo the work done be the redo it method. This is a pure virtual method, and must be overridden in derived commands.
parameters | A list of the passed command arguments. |
outResult | The result/return value of the command. |
Reimplemented in CommandSystem::CommandAddTransitionCondition, CommandSystem::CommandRemoveTransitionCondition, CommandSystem::CommandAdjustTransitionCondition, CommandSystem::CommandAnimGraphAdjustTransition, CommandSystem::CommandAnimGraphAdjustNodeGroup, CommandSystem::CommandAnimGraphAddTransitionAction, CommandSystem::CommandAnimGraphRemoveTransitionAction, CommandSystem::CommandAnimGraphAddStateAction, CommandSystem::CommandAnimGraphRemoveStateAction, EMotionFX::CommandAddCollider, EMotionFX::CommandAdjustCollider, EMotionFX::CommandRemoveCollider, EMotionFX::CommandAdjustJointLimit, CommandSystem::CommandAdjustMotion, CommandSystem::CommandCreateMotionEventTrack, CommandSystem::CommandAdjustMotionEventTrack, CommandSystem::CommandClearMotionEvents, CommandSystem::CommandCreateMotionEvent, CommandSystem::CommandAdjustMotionEvent, CommandSystem::CommandAdjustNodeGroup, EMotionFX::CommandAddRagdollJoint, EMotionFX::CommandRemoveRagdollJoint, EMotionFX::CommandAdjustRagdollJoint, EMotionFX::CommandAddSimulatedObject, EMotionFX::CommandRemoveSimulatedObject, EMotionFX::CommandAdjustSimulatedObject, EMotionFX::CommandAddSimulatedJoints, EMotionFX::CommandRemoveSimulatedJoints, and EMotionFX::CommandAdjustSimulatedJoint.