From f4442425ed2a0bdcaa6e0b70f995f069e8af8325 Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Mon, 24 May 2021 12:03:52 -0700 Subject: [PATCH] Convert CommandManagerCallback uint32 -> size_t Signed-off-by: Chris Burel --- .../EMStudioSDK/Source/EMStudioManager.h | 6 +-- .../EMStudioSDK/Source/MainWindow.h | 6 +-- .../ActionHistory/ActionHistoryCallback.cpp | 40 +++++++------------ .../ActionHistory/ActionHistoryCallback.h | 6 +-- .../MCore/Source/CommandManagerCallback.h | 6 +-- 5 files changed, 27 insertions(+), 37 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h index 62c4b5e115..915c45bc18 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h @@ -146,9 +146,9 @@ namespace EMStudio void OnPostExecuteCommand(MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine, bool wasSuccess, const AZStd::string& outResult) override; void OnPreExecuteCommandGroup(MCore::CommandGroup* group, bool undo) override { MCORE_UNUSED(group); MCORE_UNUSED(undo); } void OnPostExecuteCommandGroup(MCore::CommandGroup* group, bool wasSuccess) override { MCORE_UNUSED(group); MCORE_UNUSED(wasSuccess); } - void OnAddCommandToHistory(uint32 historyIndex, MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) override { MCORE_UNUSED(historyIndex); MCORE_UNUSED(group); MCORE_UNUSED(command); MCORE_UNUSED(commandLine); } - void OnRemoveCommand(uint32 historyIndex) override { MCORE_UNUSED(historyIndex); } - void OnSetCurrentCommand(uint32 index) override { MCORE_UNUSED(index); } + void OnAddCommandToHistory(size_t historyIndex, MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) override { MCORE_UNUSED(historyIndex); MCORE_UNUSED(group); MCORE_UNUSED(command); MCORE_UNUSED(commandLine); } + void OnRemoveCommand(size_t historyIndex) override { MCORE_UNUSED(historyIndex); } + void OnSetCurrentCommand(size_t index) override { MCORE_UNUSED(index); } }; EventProcessingCallback* mEventProcessingCallback; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h index 7217259bcb..d49d47452b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h @@ -296,9 +296,9 @@ namespace EMStudio void OnPreUndoCommand(MCore::Command* command, const MCore::CommandLine& commandLine); void OnPreExecuteCommandGroup(MCore::CommandGroup* /*group*/, bool /*undo*/) override { } void OnPostExecuteCommandGroup(MCore::CommandGroup* /*group*/, bool /*wasSuccess*/) override { } - void OnAddCommandToHistory(uint32 /*historyIndex*/, MCore::CommandGroup* /*group*/, MCore::Command* /*command*/, const MCore::CommandLine& /*commandLine*/) override { } - void OnRemoveCommand(uint32 /*historyIndex*/) override { } - void OnSetCurrentCommand(uint32 /*index*/) override { } + void OnAddCommandToHistory(size_t /*historyIndex*/, MCore::CommandGroup* /*group*/, MCore::Command* /*command*/, const MCore::CommandLine& /*commandLine*/) override { } + void OnRemoveCommand(size_t /*historyIndex*/) override { } + void OnSetCurrentCommand(size_t /*index*/) override { } void OnShowErrorReport(const AZStd::vector& errors) override; private: AZStd::vector m_skipClearRecorderCommands; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp index 0d36f19c5a..e99838b7bb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp @@ -125,7 +125,7 @@ namespace EMStudio } // Add a new item to the history. - void ActionHistoryCallback::OnAddCommandToHistory(uint32 historyIndex, MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) + void ActionHistoryCallback::OnAddCommandToHistory(size_t historyIndex, MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) { MCORE_UNUSED(commandLine); mTempString = MCore::CommandManager::CommandHistoryEntry::ToString(group, command, mIndex++).c_str(); @@ -135,28 +135,28 @@ namespace EMStudio } // Remove an item from the history. - void ActionHistoryCallback::OnRemoveCommand(uint32 historyIndex) + void ActionHistoryCallback::OnRemoveCommand(size_t historyIndex) { // Remove the item. mIsRemoving = true; - delete mList->takeItem(historyIndex); + delete mList->takeItem(aznumeric_caster(historyIndex)); mIsRemoving = false; } // Set the current command. - void ActionHistoryCallback::OnSetCurrentCommand(uint32 index) + void ActionHistoryCallback::OnSetCurrentCommand(size_t index) { if (mIsRemoving) { return; } - if (index == MCORE_INVALIDINDEX32) + if (index == InvalidIndex) { mList->setCurrentRow(-1); // Darken all history items. - const int numCommands = static_cast(GetCommandManager()->GetNumHistoryItems()); + const int numCommands = mList->count(); for (int i = 0; i < numCommands; ++i) { mList->item(i)->setForeground(m_darkenedBrush); @@ -165,19 +165,19 @@ namespace EMStudio } // get the list of selected items - mList->setCurrentRow(index); + mList->setCurrentRow(aznumeric_caster(index)); // Get the current history index. const uint32 historyIndex = GetCommandManager()->GetHistoryIndex(); - if (historyIndex == MCORE_INVALIDINDEX32) + if (historyIndex == InvalidIndex) { AZStd::string outResult; - const uint32 numRedos = index + 1; - for (uint32 i = 0; i < numRedos; ++i) + const size_t numRedos = index + 1; + for (size_t i = 0; i < numRedos; ++i) { outResult.clear(); const bool result = GetCommandManager()->Redo(outResult); - if (outResult.size() > 0) + if (!outResult.empty()) { if (!result) { @@ -195,7 +195,7 @@ namespace EMStudio // try to undo outResult.clear(); const bool result = GetCommandManager()->Undo(outResult); - if (outResult.size() > 0) + if (!outResult.empty()) { if (!result) { @@ -212,7 +212,7 @@ namespace EMStudio { outResult.clear(); const bool result = GetCommandManager()->Redo(outResult); - if (outResult.size() > 0) + if (!outResult.empty()) { if (!result) { @@ -222,13 +222,6 @@ namespace EMStudio } } - // Darken disabled commands. - const uint32 orgIndex = index; - if (index == MCORE_INVALIDINDEX32) - { - index = 0; - } - const int numCommands = static_cast(GetCommandManager()->GetNumHistoryItems()); for (int i = index; i < numCommands; ++i) { @@ -236,12 +229,9 @@ namespace EMStudio } // Color enabled ones. - if (orgIndex != MCORE_INVALIDINDEX32) + for (int i = 0; i <= static_cast(index); ++i) { - for (int i = 0; i <= static_cast(index); ++i) - { - mList->item(index)->setForeground(m_brush); - } + mList->item(i)->setForeground(m_brush); } } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h index ba7c5314b1..0433b22d5d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h @@ -37,11 +37,11 @@ namespace EMStudio void OnPreExecuteCommand(MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) override; void OnPostExecuteCommand(MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine, bool wasSuccess, const AZStd::string& outResult) override; - void OnAddCommandToHistory(uint32 historyIndex, MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) override; + void OnAddCommandToHistory(size_t historyIndex, MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) override; void OnPreExecuteCommandGroup(MCore::CommandGroup* group, bool undo) override; void OnPostExecuteCommandGroup(MCore::CommandGroup* group, bool wasSuccess) override; - void OnRemoveCommand(uint32 historyIndex) override; - void OnSetCurrentCommand(uint32 index) override; + void OnRemoveCommand(size_t historyIndex) override; + void OnSetCurrentCommand(size_t index) override; private: QListWidget* mList; diff --git a/Gems/EMotionFX/Code/MCore/Source/CommandManagerCallback.h b/Gems/EMotionFX/Code/MCore/Source/CommandManagerCallback.h index e08abde94d..b604465c75 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CommandManagerCallback.h +++ b/Gems/EMotionFX/Code/MCore/Source/CommandManagerCallback.h @@ -83,19 +83,19 @@ namespace MCore * @param command The command that is linked with this history item. * @param commandLine The command line that is linked to this history item. */ - virtual void OnAddCommandToHistory(uint32 historyIndex, CommandGroup* group, Command* command, const CommandLine& commandLine) = 0; + virtual void OnAddCommandToHistory(size_t historyIndex, CommandGroup* group, Command* command, const CommandLine& commandLine) = 0; /** * This callback is executed when a command is being removed from the command history. * @param historyIndex The history index of the command that is being removed. */ - virtual void OnRemoveCommand(uint32 historyIndex) = 0; + virtual void OnRemoveCommand(size_t historyIndex) = 0; /** * This callback is executed when we step back or forth in the command history. * @param index The new history index which will be the current state the system will be in. */ - virtual void OnSetCurrentCommand(uint32 index) = 0; + virtual void OnSetCurrentCommand(size_t index) = 0; /** * This callback is executed before the error array is getting cleared and the interfaces shall show some error reporting window or something similar.