Local Entities in Create app Entity List

Local Entities in Create app Entity List
This commit is contained in:
Alezia Kurdis 2025-03-19 21:23:26 -04:00 committed by GitHub
parent a00986ecce
commit 79aafbcb26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 82 additions and 11 deletions

View file

@ -161,7 +161,7 @@
editTools.addListener(selectionManager.updateEditSettings); editTools.addListener(selectionManager.updateEditSettings);
var entityShapeVisualizerSessionName = "SHAPE_VISUALIZER_" + Uuid.generate(); var entityShapeVisualizerSessionName = "SHAPE_VISUALIZER_" + Uuid.generate();
createApp.entityShapeVisualizerLocalEntityToExclude = [];
var EntityShapeVisualizer = Script.require('./modules/entityShapeVisualizer.js'); var EntityShapeVisualizer = Script.require('./modules/entityShapeVisualizer.js');
var entityShapeVisualizer = new EntityShapeVisualizer(["Zone"], entityShapeVisualizerSessionName); var entityShapeVisualizer = new EntityShapeVisualizer(["Zone"], entityShapeVisualizerSessionName);
@ -174,6 +174,7 @@
selectionDisplay.updateHandles(); selectionDisplay.updateHandles();
entityIconOverlayManager.updatePositions(selectionManager.selections); entityIconOverlayManager.updatePositions(selectionManager.selections);
entityShapeVisualizer.setEntities(selectionManager.selections); entityShapeVisualizer.setEntities(selectionManager.selections);
createApp.entityShapeVisualizerLocalEntityToExclude = entityShapeVisualizer.getLocalEntityToExclude();
}); });
var DEGREES_TO_RADIANS = Math.PI / 180.0; var DEGREES_TO_RADIANS = Math.PI / 180.0;

View file

@ -2,9 +2,10 @@
// entityList.js // entityList.js
// //
// Created by Ryan Huffman on November 19th, 2014
// Copyright 2014 High Fidelity, Inc. // Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors. // Copyright 2020 Vircadia contributors.
// Copyright 2023-2024 Overte e.V. // Copyright 2023-2025 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // 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 filterInView = false;
var searchRadius = 100; var searchRadius = 100;
var localEntityFilter = false;
var visible = false; var visible = false;
@ -78,7 +80,7 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) {
that.setVisible = function(newVisible) { that.setVisible = function(newVisible) {
visible = newVisible; visible = newVisible;
webView.setVisible(shouldUseEditTabletApp() && visible); webView.setVisible(shouldUseEditTabletApp() && visible);
entityListWindow.setVisible(!shouldUseEditTabletApp() && visible); entityListWindow.setVisible(!shouldUseEditTabletApp() && visible);
}; };
that.isVisible = function() { that.isVisible = function() {
@ -200,11 +202,36 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) {
var ids; var ids;
PROFILE("findEntities", function() { PROFILE("findEntities", function() {
var domainAndAvatarIds;
if (filterInView) { if (filterInView) {
ids = Entities.findEntitiesInFrustum(Camera.frustum); domainAndAvatarIds = Entities.findEntitiesInFrustum(Camera.frustum);
} else { } 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; var cameraPosition = Camera.position;
@ -433,6 +460,9 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) {
that.createApp.toggleGridVisibility(); that.createApp.toggleGridVisibility();
} else if (data.type === 'toggleSnapToGrid') { } else if (data.type === 'toggleSnapToGrid') {
that.toggleSnapToGrid(); that.toggleSnapToGrid();
} else if (data.type === 'localEntityFilter') {
localEntityFilter = data.localEntityFilter;
that.sendUpdate();
} }
}; };

View file

@ -1,10 +1,10 @@
<!-- <!--
// entityList.html // entityList.html
// //
// Created by Ryan Huffman on 19 Nov 2014 // Created by Ryan Huffman on November 19th, 2014
// Copyright 2014 High Fidelity, Inc. // Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors. // Copyright 2020 Vircadia contributors.
// Copyright 2024 Overte e.V. // Copyright 2024-2025 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -39,6 +39,7 @@
</div> </div>
<button id="toggle-space-mode" class="hifi-edit-button space-mode-local">Local</button> <button id="toggle-space-mode" class="hifi-edit-button space-mode-local">Local</button>
<input type="button" class="vglyph" id="hmdmultiselect" value="I" style="display: none;" /> <input type="button" class="vglyph" id="hmdmultiselect" value="I" style="display: none;" />
<input type="button" class="localEntity glyph" id="localEntityFilter" value="&#xe03D;" />
<input type="button" class="red glyph" id="delete" value="{" /> <input type="button" class="red glyph" id="delete" value="{" />
</div> </div>
<div id="entity-list"> <div id="entity-list">

View file

@ -3,7 +3,7 @@
// Created by Ryan Huffman on November 19th, 2014 // Created by Ryan Huffman on November 19th, 2014
// Copyright 2014 High Fidelity, Inc. // Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors. // Copyright 2020 Vircadia contributors.
// Copyright 2024 Overte e.V. // Copyright 2024-2025 Overte e.V.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@ -210,6 +210,7 @@ let currentSortOrder = ASCENDING_SORT;
let elSortOrders = {}; let elSortOrders = {};
let typeFilters = []; let typeFilters = [];
let isFilterInView = false; let isFilterInView = false;
let localEntityFilter = false;
let columns = []; let columns = [];
let columnsByID = {}; let columnsByID = {};
@ -239,15 +240,16 @@ let elEntityTable,
elTransformMenu, elTransformMenu,
elToolsMenu, elToolsMenu,
elMenuBackgroundOverlay, elMenuBackgroundOverlay,
elLocalEntityFilter,
elHmdMultiSelect, elHmdMultiSelect,
elHmdCopy, elHmdCopy,
elHmdCut, elHmdCut,
elHmdPaste, elHmdPaste,
elHmdDuplicate, elHmdDuplicate,
elUndo, elUndo,
elRedo, elRedo,
elParent, elParent,
elUnparent, elUnparent,
elDelete, elDelete,
elRotateAsTheNextClickedSurface, elRotateAsTheNextClickedSurface,
elQuickRotate90x, elQuickRotate90x,
@ -329,6 +331,7 @@ function loaded() {
elTransformMenu = document.getElementById("transform"); elTransformMenu = document.getElementById("transform");
elToolsMenu = document.getElementById("tools"); elToolsMenu = document.getElementById("tools");
elMenuBackgroundOverlay = document.getElementById("menuBackgroundOverlay"); elMenuBackgroundOverlay = document.getElementById("menuBackgroundOverlay");
elLocalEntityFilter = document.getElementById("localEntityFilter");
elHmdCopy = document.getElementById("hmdcopy"); elHmdCopy = document.getElementById("hmdcopy");
elHmdCopyID = document.getElementById("hmdcopyid"); elHmdCopyID = document.getElementById("hmdcopyid");
elHmdCut = document.getElementById("hmdcut"); elHmdCut = document.getElementById("hmdcut");
@ -394,6 +397,16 @@ function loaded() {
elExport.onclick = function() { elExport.onclick = function() {
EventBridge.emitWebEvent(JSON.stringify({ type: "export"})); EventBridge.emitWebEvent(JSON.stringify({ type: "export"}));
}; };
elLocalEntityFilter.onclick = function() {
if (localEntityFilter) {
elLocalEntityFilter.className = "localEntity glyph";
localEntityFilter = false;
} else {
elLocalEntityFilter.className = "selLocalEntity glyph";
localEntityFilter = true;
}
EventBridge.emitWebEvent(JSON.stringify({ "type": "localEntityFilter", "localEntityFilter": localEntityFilter }));
};
elHmdMultiSelect.onclick = function() { elHmdMultiSelect.onclick = function() {
if (hmdMultiSelectMode) { if (hmdMultiSelectMode) {
elHmdMultiSelect.className = "vglyph"; elHmdMultiSelect.className = "vglyph";
@ -1188,6 +1201,8 @@ function loaded() {
if (entity.elRow) { if (entity.elRow) {
if (entity.entityHostType === "avatar") { if (entity.entityHostType === "avatar") {
entity.elRow.className = "avatarEntity"; entity.elRow.className = "avatarEntity";
} else if (entity.entityHostType === "local") {
entity.elRow.className = "localEntity";
} else { } else {
entity.elRow.className = ""; entity.elRow.className = "";
} }
@ -1206,12 +1221,16 @@ function loaded() {
if (id === lastSelectedEntity) { if (id === lastSelectedEntity) {
if (entity.entityHostType === "avatar") { if (entity.entityHostType === "avatar") {
entity.elRow.className = "lastSelAvatarEntity"; entity.elRow.className = "lastSelAvatarEntity";
} else if (entity.entityHostType === "local") {
entity.elRow.className = "lastSelLocalEntity";
} else { } else {
entity.elRow.className = "last-selected"; entity.elRow.className = "last-selected";
} }
} else { } else {
if (entity.entityHostType === "avatar") { if (entity.entityHostType === "avatar") {
entity.elRow.className = "selAvatarEntity"; entity.elRow.className = "selAvatarEntity";
} else if (entity.entityHostType === "local") {
entity.elRow.className = "selLocalEntity";
} else { } else {
entity.elRow.className = "selected"; entity.elRow.className = "selected";
} }
@ -1287,12 +1306,16 @@ function loaded() {
if (itemData.id === lastSelectedEntity) { if (itemData.id === lastSelectedEntity) {
if (itemData.entityHostType === "avatar") { if (itemData.entityHostType === "avatar") {
elRow.className = "lastSelAvatarEntity"; elRow.className = "lastSelAvatarEntity";
} else if (itemData.entityHostType === "local") {
elRow.className = "lastSelLocalEntity";
} else { } else {
elRow.className = "last-selected"; elRow.className = "last-selected";
} }
} else { } else {
if (itemData.entityHostType === "avatar") { if (itemData.entityHostType === "avatar") {
elRow.className = "selAvatarEntity"; elRow.className = "selAvatarEntity";
} else if (itemData.entityHostType === "local") {
elRow.className = "selLocalEntity";
} else { } else {
elRow.className = "selected"; elRow.className = "selected";
} }
@ -1300,6 +1323,8 @@ function loaded() {
} else { } else {
if (itemData.entityHostType === "avatar") { if (itemData.entityHostType === "avatar") {
elRow.className = "avatarEntity"; elRow.className = "avatarEntity";
} else if (itemData.entityHostType === "local") {
elRow.className = "localEntity";
} else { } else {
elRow.className = ""; elRow.className = "";
} }

View file

@ -6,7 +6,7 @@
// Modified by David Back on January 9th, 2018 // Modified by David Back on January 9th, 2018
// Copyright 2014 High Fidelity, Inc. // Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors // Copyright 2020 Vircadia contributors
// Copyright 2022-2024 Overte e.V. // Copyright 2022-2025 Overte e.V.
// //
// This script implements a class useful for building tools for editing entities. // This script implements a class useful for building tools for editing entities.
// //
@ -1277,6 +1277,7 @@ SelectionDisplay = (function() {
]; ];
that.allToolEntities = allToolEntities; that.allToolEntities = allToolEntities;
that.toolEntityMaterial = toolEntityMaterial;
const nonLayeredToolEntities = [selectionBox, iconSelectionBox]; const nonLayeredToolEntities = [selectionBox, iconSelectionBox];

View file

@ -163,6 +163,9 @@ EntityShape.prototype = {
this.initialize(propertiesForType); this.initialize(propertiesForType);
} }
}, },
getIds: function() {
return {"materialEntityID": this.materialEntity, "entityID": this.entity};
},
clear: function() { clear: function() {
Entities.deleteEntity(this.materialEntity); Entities.deleteEntity(this.materialEntity);
Entities.deleteEntity(this.entity); Entities.deleteEntity(this.entity);
@ -204,6 +207,16 @@ EntityShapeVisualizer.prototype = {
}, this); }, this);
this.entityShapes = {}; this.entityShapes = {};
}, },
getLocalEntityToExclude: function() {
var ids = [];
var entityShapesIDs;
Object.keys(this.entityShapes).forEach(function(entityID) {
entityShapesIDs = this.entityShapes[entityID].getIds();
ids.push(entityShapesIDs.entityID);
ids.push(entityShapesIDs.materialEntityID);
}, this);
return ids;
},
setEntities: function(entities) { setEntities: function(entities) {
var qualifiedEntities = entities.filter(function(entityID) { var qualifiedEntities = entities.filter(function(entityID) {
if (this.acceptedEntities.indexOf(entityID) !== -1) { if (this.acceptedEntities.indexOf(entityID) !== -1) {