Open 3D Engine EMotionFX Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <CommandGroup.h>
Public Member Functions | |
CommandGroup () | |
CommandGroup (const AZStd::string &groupName, size_t numCommandsToReserve=3) | |
~CommandGroup () | |
void | AddCommandString (const char *commandString) |
void | AddCommand (MCore::Command *command) |
void | AddCommandString (const AZStd::string &commandString) |
const char * | GetCommandString (size_t index) const |
const AZStd::string & | GetCommandStringAsString (size_t index) const |
Command * | GetCommand (size_t index) |
const CommandLine & | GetParameters (size_t index) const |
const char * | GetGroupName () const |
const AZStd::string & | GetGroupNameString () const |
void | SetGroupName (const char *groupName) |
void | SetGroupName (const AZStd::string &groupName) |
void | SetCommandString (size_t index, const char *commandString) |
void | SetParameters (size_t index, const CommandLine ¶ms) |
void | SetCommand (size_t index, Command *command) |
void | SetContinueAfterError (bool continueAfter) |
void | SetAddToHistoryAfterError (bool addAfterError) |
void | SetReturnFalseAfterError (bool returnAfterError) |
bool | GetContinueAfterError () const |
bool | GetAddToHistoryAfterError () const |
bool | GetReturnFalseAfterError () const |
size_t | GetNumCommands () const |
bool | IsEmpty () const |
void | RemoveAllCommands (bool delFromMem=false) |
void | Clear (bool delFromMem=false) |
CommandGroup * | Clone () const |
void | ReserveCommands (size_t numToReserve) |
The command group class, which executes a set of commands internally, while showing just one item inside the command history. Undoing a command group would undo all commands inside the group.
MCore::CommandGroup::CommandGroup | ( | ) |
Default constructor. You can set the name of the group with SetGroupName() manually.
MCore::CommandGroup::CommandGroup | ( | const AZStd::string & | groupName, |
size_t | numCommandsToReserve = 3 |
||
) |
The constructor.
groupName | The name of the command group, which is the name that will appear inside the command history. |
numCommandsToReserve | Pre-allocate memory for a given amount of commands. This can be used to prevent memory reallocations. |
MCore::CommandGroup::~CommandGroup | ( | ) |
The destructor. Please note that this does NOT delete the actual Command objects after the group has been executed. They are deleted by the command manager automatically.
void MCore::CommandGroup::AddCommandString | ( | const AZStd::string & | commandString | ) |
Add a command string to the group. This will be added to the back of the list of commands to be executed when executing this group.
commandString | The full command string, like you would execute using CommandManager::ExecuteCommand(...). |
void MCore::CommandGroup::AddCommandString | ( | const char * | commandString | ) |
Add a command string to the group. This will be added to the back of the list of commands to be executed when executing this group.
commandString | The full command string, like you would execute using CommandManager::ExecuteCommand(...). |
CommandGroup* MCore::CommandGroup::Clone | ( | ) | const |
Clone this command group.
bool MCore::CommandGroup::GetAddToHistoryAfterError | ( | ) | const |
Check whether this command group will be added to the history, even when one of the internal commands fails to execute. The default is true.
Command* MCore::CommandGroup::GetCommand | ( | size_t | index | ) |
Get a given command. The return value can be nullptr in case the group hasn't yet been executed or when the execution of this command failed.
index | The command number to get the pointer to. This must be in range of [0..GetNumCommands()-1]. |
const char* MCore::CommandGroup::GetCommandString | ( | size_t | index | ) | const |
Get the command execution string for a given command inside the group.
index | The command number to get the string for. This must be in range of [0..GetNumCommands()-1]. |
const AZStd::string& MCore::CommandGroup::GetCommandStringAsString | ( | size_t | index | ) | const |
Get the command execution string for a given command inside the group.
index | The command number to get the string for. This must be in range of [0..GetNumCommands()-1]. |
bool MCore::CommandGroup::GetContinueAfterError | ( | ) | const |
Check if we want to continue when one of the internal commands fails. If not, it will stop executing further commands. The default is true.
const char* MCore::CommandGroup::GetGroupName | ( | ) | const |
Get the name of the group. This is the name that will appear inside the command history also.
const AZStd::string& MCore::CommandGroup::GetGroupNameString | ( | ) | const |
Get the group name in form of a string object. This is the name that will appear inside the command history also.
size_t MCore::CommandGroup::GetNumCommands | ( | ) | const |
Get the number of commands inside this group. Using AddCommandString will increase the number returned by this method.
const CommandLine& MCore::CommandGroup::GetParameters | ( | size_t | index | ) | const |
Get the parameter commandline object for the given command. This is only set after executing the command. Otherwise the parameter list will be empty.
index | The command number ot get the parameter list for. This must be in range of [0..GetNumCommands()-1]. |
bool MCore::CommandGroup::GetReturnFalseAfterError | ( | ) | const |
Check whether the group returns false after calling CommandManager::ExecuteCommandGroup(). The default value is false.
void MCore::CommandGroup::RemoveAllCommands | ( | bool | delFromMem = false | ) |
Remove all commands from the group.
delFromMem | Set to true if you wish to delete the Command objects from memory as well. Normally you shouldn't do this as the command manager handles this. |
void MCore::CommandGroup::ReserveCommands | ( | size_t | numToReserve | ) |
Reserve space for a given amount of commands, to prevent reallocs.
[in] | numToReserve | The number of command strings to reserve memory for. This will prevent reallocs when adding new commands. |
void MCore::CommandGroup::SetAddToHistoryAfterError | ( | bool | addAfterError | ) |
Set whether to add the group to the command history if one of the commands failed to execute or not. The default value is true.
addAfterError | Set to true if you wish the group to be added to the command history, even if an error occurred. |
void MCore::CommandGroup::SetCommand | ( | size_t | index, |
Command * | command | ||
) |
Set the command pointer for a given command number. Normally you will not be using this function as this is automatically set by the command manager.
index | The command number to set the command pointer for. This must be in range of [0..GetNumCommands()-1]. |
command | The command to use. |
void MCore::CommandGroup::SetCommandString | ( | size_t | index, |
const char * | commandString | ||
) |
Set the command line string for a given command.
index | The command number to change the command string for. This must be in range of [0..GetNumCommands()-1]. |
commandString | The command string to use. This is the string you would pass to CommandManager::ExecuteCommand(...). |
void MCore::CommandGroup::SetContinueAfterError | ( | bool | continueAfter | ) |
Set if we want to continue when one of the internal commands fails. If not, it will stop executing further commands. The default value is true.
continueAfter | Set to true to continue even after an error, or false to stop when one of the commands fails to execute. |
void MCore::CommandGroup::SetGroupName | ( | const AZStd::string & | groupName | ) |
Set the name of the group, which is the name as it will appear inside the command history.
groupName | The name of the group. |
void MCore::CommandGroup::SetGroupName | ( | const char * | groupName | ) |
Set the name of the group, which is the name as it will appear inside the command history.
groupName | The name of the group. |
void MCore::CommandGroup::SetParameters | ( | size_t | index, |
const CommandLine & | params | ||
) |
Set the parameter list for a given command. Normally you will not be using this function as this is automatically set by the command manager.
index | The command number to change the parameter list for. This must be in range of [0..GetNumCommands()-1]. Please note that this isn't needed to be set normally. With normal usage you would only specify the command string and nothing more. |
params | The parameter list. |
void MCore::CommandGroup::SetReturnFalseAfterError | ( | bool | returnAfterError | ) |
Set whether the group returns false after calling CommandManager::ExecuteCommandGroup(). The default value is false.
returnAfterError | Set to true if you wish the group to fail and return false in case an error occurred. |