diff --git a/SHADE_Engine/src/Scripting/SHScriptEngine.h b/SHADE_Engine/src/Scripting/SHScriptEngine.h index 0d2c0c96..239d6b90 100644 --- a/SHADE_Engine/src/Scripting/SHScriptEngine.h +++ b/SHADE_Engine/src/Scripting/SHScriptEngine.h @@ -175,10 +175,10 @@ namespace SHADE /// Performs an undo for script inspector changes if it exists. /// void UndoScriptInspectorChanges() const; - /// - /// Performs a redo for script inspector changes if it exists. - /// - void RedoScriptInspectorChanges() const; + /// + /// Performs a redo for script inspector changes if it exists. + /// + void RedoScriptInspectorChanges() const; /*-----------------------------------------------------------------------------*/ /* Static Utility Functions */ @@ -251,8 +251,8 @@ namespace SHADE CsScriptSerialiseYamlFuncPtr csScriptDeserialiseYaml = nullptr; // - Editor CsScriptEditorFuncPtr csEditorRenderScripts = nullptr; - CsFuncPtr csEditorUndo = nullptr; - CsFuncPtr csEditorRedo = nullptr; + CsFuncPtr csEditorUndo = nullptr; + CsFuncPtr csEditorRedo = nullptr; /*-----------------------------------------------------------------------------*/ /* Event Handler Functions */ diff --git a/SHADE_Managed/src/Editor/UndoRedoStack.cxx b/SHADE_Managed/src/Editor/UndoRedoStack.cxx index 7a3b1930..08e289cc 100644 --- a/SHADE_Managed/src/Editor/UndoRedoStack.cxx +++ b/SHADE_Managed/src/Editor/UndoRedoStack.cxx @@ -22,15 +22,15 @@ of DigiPen Institute of Technology is prohibited. namespace SHADE { - bool UndoRedoStack::UndoActionPresent::get() - { - return commandStack->Count > 0 && latestActionIndex >= 0; - } + bool UndoRedoStack::UndoActionPresent::get() + { + return commandStack->Count > 0 && latestActionIndex >= 0; + } - bool UndoRedoStack::RedoActionPresent::get() - { + bool UndoRedoStack::RedoActionPresent::get() + { return latestActionIndex >= 0 && latestActionIndex < commandStack->Count - 1; - } + } void UndoRedoStack::Add(Command command) { @@ -47,7 +47,7 @@ namespace SHADE latestActionIndex = commandStack->Count - 1; } - void UndoRedoStack::Undo() + void UndoRedoStack::Undo() { if (!UndoActionPresent) return; @@ -60,10 +60,10 @@ namespace SHADE void UndoRedoStack::Redo() { if (!RedoActionPresent) - return; + return; - Command cmd = commandStack[latestActionIndex]; - cmd.Field->SetValue(cmd.Object, cmd.NewData); - ++latestActionIndex; + Command cmd = commandStack[latestActionIndex]; + cmd.Field->SetValue(cmd.Object, cmd.NewData); + ++latestActionIndex; } }