From e1672281e6e5d3eb2dfa9a9f452c06b4d8616dd6 Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Mon, 6 Mar 2023 11:57:10 +0100 Subject: [PATCH] UDBScript: fixed a problem where hot reloading would not select the previously selected script --- Source/Plugins/UDBScript/Controls/ScriptDockerControl.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Plugins/UDBScript/Controls/ScriptDockerControl.cs b/Source/Plugins/UDBScript/Controls/ScriptDockerControl.cs index 75776356..66fd7424 100644 --- a/Source/Plugins/UDBScript/Controls/ScriptDockerControl.cs +++ b/Source/Plugins/UDBScript/Controls/ScriptDockerControl.cs @@ -235,7 +235,6 @@ namespace CodeImp.DoomBuilder.UDBScript filetree.Nodes.Clear(); filetree.Nodes.AddRange(AddToTree(filtertext, BuilderPlug.Me.ScriptDirectoryStructure)); - //filetree.ExpandAll(); foreach(TreeNode node in filetree.Nodes) { @@ -259,6 +258,10 @@ namespace CodeImp.DoomBuilder.UDBScript /// Found TreeNode or null private TreeNode FindScriptTreeNode(string name, TreeNode root) { + // The "root" node might already be the one we're looking for + if (root.Tag is ScriptInfo && ((ScriptInfo)root.Tag).ScriptFile == name) + return root; + foreach (TreeNode node in root.Nodes) { if (node.Tag is ScriptInfo && ((ScriptInfo)node.Tag).ScriptFile == name)