From 79aafbcb26b66a0e25d5799569107237ee4f0f2a Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:23:26 -0400 Subject: [PATCH] Local Entities in Create app Entity List Local Entities in Create app Entity List --- scripts/system/create/edit.js | 3 +- .../system/create/entityList/entityList.js | 38 +++++++++++++++++-- .../create/entityList/html/entityList.html | 5 ++- .../create/entityList/html/js/entityList.js | 31 +++++++++++++-- .../entitySelectionTool.js | 3 +- .../create/modules/entityShapeVisualizer.js | 13 +++++++ 6 files changed, 82 insertions(+), 11 deletions(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 24df1c9e0f..461dc49d25 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -161,7 +161,7 @@ editTools.addListener(selectionManager.updateEditSettings); var entityShapeVisualizerSessionName = "SHAPE_VISUALIZER_" + Uuid.generate(); - + createApp.entityShapeVisualizerLocalEntityToExclude = []; var EntityShapeVisualizer = Script.require('./modules/entityShapeVisualizer.js'); var entityShapeVisualizer = new EntityShapeVisualizer(["Zone"], entityShapeVisualizerSessionName); @@ -174,6 +174,7 @@ selectionDisplay.updateHandles(); entityIconOverlayManager.updatePositions(selectionManager.selections); entityShapeVisualizer.setEntities(selectionManager.selections); + createApp.entityShapeVisualizerLocalEntityToExclude = entityShapeVisualizer.getLocalEntityToExclude(); }); var DEGREES_TO_RADIANS = Math.PI / 180.0; diff --git a/scripts/system/create/entityList/entityList.js b/scripts/system/create/entityList/entityList.js index 9a1df1f76f..d057f91337 100644 --- a/scripts/system/create/entityList/entityList.js +++ b/scripts/system/create/entityList/entityList.js @@ -2,9 +2,10 @@ // entityList.js // +// Created by Ryan Huffman on November 19th, 2014 // Copyright 2014 High Fidelity, Inc. // Copyright 2020 Vircadia contributors. -// Copyright 2023-2024 Overte e.V. +// Copyright 2023-2025 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -70,6 +71,7 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) { var filterInView = false; var searchRadius = 100; + var localEntityFilter = false; var visible = false; @@ -78,7 +80,7 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) { that.setVisible = function(newVisible) { visible = newVisible; webView.setVisible(shouldUseEditTabletApp() && visible); - entityListWindow.setVisible(!shouldUseEditTabletApp() && visible); + entityListWindow.setVisible(!shouldUseEditTabletApp() && visible); }; that.isVisible = function() { @@ -200,11 +202,36 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) { var ids; PROFILE("findEntities", function() { + var domainAndAvatarIds; if (filterInView) { - ids = Entities.findEntitiesInFrustum(Camera.frustum); + domainAndAvatarIds = Entities.findEntitiesInFrustum(Camera.frustum); } else { - ids = Entities.findEntities(MyAvatar.position, searchRadius); + domainAndAvatarIds = Entities.findEntities(MyAvatar.position, searchRadius); } + var localIds = []; + if (localEntityFilter) { + localIds = Overlays.findOverlays(MyAvatar.position, searchRadius); + var tabletLocalEntityToExclude = [ + HMD.tabletID, + HMD.tabletScreenID, + HMD.homeButtonID, + HMD.homeButtonHighlightID, + HMD.miniTabletID, + HMD.miniTabletScreenID + ]; + var seltoolsIds = SelectionDisplay.toolEntityMaterial.concat( + SelectionDisplay.allToolEntities, + allOverlays, + that.createApp.entityShapeVisualizerLocalEntityToExclude, + tabletLocalEntityToExclude + ); + for (var i = localIds.length - 1; i >= 0; i--) { + if (seltoolsIds.includes(localIds[i]) || Keyboard.containsID(localIds[i])) { + localIds.splice(i, 1); + } + } + } + ids = domainAndAvatarIds.concat(localIds); }); var cameraPosition = Camera.position; @@ -433,6 +460,9 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) { that.createApp.toggleGridVisibility(); } else if (data.type === 'toggleSnapToGrid') { that.toggleSnapToGrid(); + } else if (data.type === 'localEntityFilter') { + localEntityFilter = data.localEntityFilter; + that.sendUpdate(); } }; diff --git a/scripts/system/create/entityList/html/entityList.html b/scripts/system/create/entityList/html/entityList.html index 2c024f256d..5e30a3c27f 100644 --- a/scripts/system/create/entityList/html/entityList.html +++ b/scripts/system/create/entityList/html/entityList.html @@ -1,10 +1,10 @@