From b6b432f1586d0d4f7b056ab165d9ccc8c780e7fc Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 18 Jun 2026 16:28:15 +0100 Subject: [PATCH] Fix deselected entities not being removed the editHandleHighlightList The entitySelectionTool would add items to the editHandleHighlightList but never remove them. This also removes them and I don't see anything broken with the changes. --- .../entitySelectionTool.js | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/system/create/entitySelectionTool/entitySelectionTool.js b/scripts/system/create/entitySelectionTool/entitySelectionTool.js index 6b3da40c815..f3020f72cd2 100644 --- a/scripts/system/create/entitySelectionTool/entitySelectionTool.js +++ b/scripts/system/create/entitySelectionTool/entitySelectionTool.js @@ -238,8 +238,21 @@ SelectionManager = (function() { that.setSelections = function(entityIDs, caller) { print("setSelections: " + JSON.stringify(entityIDs)); Script.logBacktrace("setSelections"); + + // Clear highlight handle list + const selection = Selection.getSelectedItemsList(HIGHLIGHT_LIST_NAME); + + if ( selection && selection.entities && selection.entities.length > 0 ) { + for (let i = 0; i < that.selections.length; i++) { + Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", that.selections[i]); + } + } + + // Clear class-level selections list that.selections = []; - for (var i = 0; i < entityIDs.length; i++) { + + // Add entities to the highlight handle list and Class selections list + for (let i = 0; i < entityIDs.length; i++) { var entityID = entityIDs[i]; that.selections.push(entityID); Selection.addToSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", entityID); @@ -290,6 +303,17 @@ SelectionManager = (function() { }; that.clearSelections = function(caller) { + + const selection = Selection.getSelectedItemsList(HIGHLIGHT_LIST_NAME); + + // Clear highlight handle list + if ( selection && selection.entities && selection.entities.length > 0 ) { + for (let i = 0; i < that.selections.length; i++) { + Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", that.selections[i]); + } + } + + // Clear class-level selections list that.selections = []; that._update(true, caller); };