From cbc8905e057b9de94dde4397fd0222d6111e28e1 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 19 Dec 2023 22:44:09 -0600 Subject: [PATCH] add an $undoIgnoreList of variable names for the editor's genericundoaction to ignore mostly aimed at action buttons --- .../scripts/guiEditorUndo.ed.tscript | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript index ba75ee7a0..e94c4d91d 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorUndo.ed.tscript @@ -20,6 +20,8 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//command variable feilds. do not trip them by unsetting or resetting these +$undoIgnoreList = "docsURL EditPosOffset Bake EditPostEffects selectAll sync Prototype"; //--------------------------------------------------------------------------------------------- @@ -451,6 +453,15 @@ function GenericUndoAction::undo(%this) for(%j = 0; %j < getWordCount(%fieldNames); %j++) { %field = getWord(%fieldNames, %j); + %skip = false; + for(%k = 0; %k < getWordCount($undoIgnoreList); %k++) + { + if(%field $= getWord(%fieldNames, %k)) //specialty field, we can't 'undo' it + %skip = true; + } + if (%skip) + continue; + %object.setFieldValue(%field, %this.fieldValues[%object, %field]); } // null out the fields in the null list @@ -469,7 +480,6 @@ function GenericUndoAction::undo(%this) function GenericUndoAction::redo(%this) { - // set the objects to the new values // set the objects to the new values // scan through our objects %objectList = %this.objectIdList; @@ -481,6 +491,15 @@ function GenericUndoAction::redo(%this) for(%j = 0; %j < getWordCount(%fieldNames); %j++) { %field = getWord(%fieldNames, %j); + %skip = false; + for(%k = 0; %k < getWordCount($undoIgnoreList); %k++) + { + if(%field $= getWord(%fieldNames, %k)) //specialty field, we can't 'redo' it + %skip = true; + } + if (%skip) + continue; + %object.setFieldValue(%field, %this.newFieldValues[%object, %field]); } // null out the fields in the null list