From a4df8cd992c7ec18a01ae0637debad47c88b4bf1 Mon Sep 17 00:00:00 2001 From: George Rolfe Date: Sat, 4 Mar 2023 12:57:12 +1100 Subject: [PATCH] [UPDATE] Added parameter restoration to *Gaea TOR Processor SOP 4.0* that attempts to restore previous values after "Reset Parameters" is executed. --- .../PythonModule | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/otls/gaea_tor_processor.hda/labs_8_8Sop_1gaea__tor__processor_8_84.0/PythonModule b/otls/gaea_tor_processor.hda/labs_8_8Sop_1gaea__tor__processor_8_84.0/PythonModule index 1933a300..e1d413fa 100644 --- a/otls/gaea_tor_processor.hda/labs_8_8Sop_1gaea__tor__processor_8_84.0/PythonModule +++ b/otls/gaea_tor_processor.hda/labs_8_8Sop_1gaea__tor__processor_8_84.0/PythonModule @@ -206,15 +206,38 @@ def RunGaea(a_node, cmd, gaea_dir): # Resets entire interface with Gaea Parms def ResetInterface(a_node): - ParmGroup = a_node.parmTemplateGroup() - - if a_node.parm("generated_gaeaparms") is not None: - for spareparm in ParmGroup.find("generated_gaeaparms").parmTemplates(): - ParmGroup.remove(spareparm.name()) - ParmGroup.remove("generated_gaeaparms") - a_node.setParmTemplateGroup(ParmGroup) + ParamGroup = a_node.parmTemplateGroup() + GeneratedGroupName = 'generated_gaeaparms' + + # store existing values + CurrentValues = dict() + if a_node.parm(GeneratedGroupName) is not None: + # these will be folders + for folderparm in ParamGroup.find(GeneratedGroupName).parmTemplates(): + FolderValues = dict() + for spareparm in folderparm.parmTemplates(): + FolderValues[spareparm.name()] = a_node.parm(spareparm.name()).eval() + CurrentValues[folderparm.name()] = FolderValues + + if a_node.parm(GeneratedGroupName) is not None: + for spareparm in ParamGroup.find(GeneratedGroupName).parmTemplates(): + ParamGroup.remove(spareparm.name()) + ParamGroup.remove("generated_gaeaparms") + a_node.setParmTemplateGroup(ParamGroup) LoadXML(a_node) + ParamGroup = a_node.parmTemplateGroup() + + # restore matching values + if a_node.parm(GeneratedGroupName) is not None: + # these will be folders + for folderparm in ParamGroup.find(GeneratedGroupName).parmTemplates(): + if folderparm.name() in CurrentValues: + FolderValues = CurrentValues[folderparm.name()] + for spareparm in folderparm.parmTemplates(): + if spareparm.name() in FolderValues: + CurrentValue = FolderValues[spareparm.name()] + a_node.parm(spareparm.name()).set(CurrentValue)