Merge pull request #1374 from AleziaKurdis/createApp_2025_03_localEntityInList
Some checks are pending
Master API-docs CI Build and Deploy / Build and deploy API-docs (push) Waiting to run
Master Doxygen CI Build and Deploy / Build and deploy Doxygen documentation (push) Waiting to run

Create App: View "Local Entities" in Entity List.
This commit is contained in:
ksuprynowicz 2025-04-06 14:20:12 +02:00 committed by GitHub
commit ef5cc802a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 149 additions and 19 deletions

View file

@ -161,12 +161,13 @@
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);
var entityListTool = new EntityListTool(shouldUseEditTabletApp, selectionManager);
entityListTool.createApp = createApp;
entityListTool.grid = grid;
entityListTool.cameraManager = cameraManager;
entityListTool.selectionDisplay = selectionDisplay;
@ -174,6 +175,7 @@
selectionDisplay.updateHandles();
entityIconOverlayManager.updatePositions(selectionManager.selections);
entityShapeVisualizer.setEntities(selectionManager.selections);
createApp.entityShapeVisualizerLocalEntityToExclude = entityShapeVisualizer.getLocalEntityToExclude();
});
var DEGREES_TO_RADIANS = Math.PI / 180.0;

View file

@ -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,37 @@ 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,
that.grid.getGridEntityToolID()
];
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;
@ -411,7 +439,8 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) {
emitJSONScriptEvent({
"type": "loadedConfigSetting",
"columnsData": columnsData,
"defaultRadius": defaultRadius
"defaultRadius": defaultRadius,
"localEntityFilter": localEntityFilter
});
} else if (data.type === 'saveColumnsConfigSetting') {
Settings.setValue(that.createApp.SETTING_EDITOR_COLUMNS_SETUP, data.columnsData);
@ -433,6 +462,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();
}
};

View file

@ -1,10 +1,10 @@
<!--
// entityList.html
//
// Created by Ryan Huffman on 19 Nov 2014
// Created by Ryan Huffman on November 19th, 2014
// Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors.
// Copyright 2024 Overte e.V.
// Copyright 2024-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
@ -39,6 +39,7 @@
</div>
<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="localEntity glyph" id="localEntityFilter" value="&#xe03D;" />
<input type="button" class="red glyph" id="delete" value="{" />
</div>
<div id="entity-list">

View file

@ -3,7 +3,7 @@
// Created by Ryan Huffman on November 19th, 2014
// Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors.
// Copyright 2024 Overte e.V.
// Copyright 2024-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
@ -210,6 +210,7 @@ let currentSortOrder = ASCENDING_SORT;
let elSortOrders = {};
let typeFilters = [];
let isFilterInView = false;
let localEntityFilter = false;
let columns = [];
let columnsByID = {};
@ -239,15 +240,16 @@ let elEntityTable,
elTransformMenu,
elToolsMenu,
elMenuBackgroundOverlay,
elLocalEntityFilter,
elHmdMultiSelect,
elHmdCopy,
elHmdCut,
elHmdPaste,
elHmdDuplicate,
elHmdDuplicate,
elUndo,
elRedo,
elParent,
elUnparent,
elUnparent,
elDelete,
elRotateAsTheNextClickedSurface,
elQuickRotate90x,
@ -329,6 +331,7 @@ function loaded() {
elTransformMenu = document.getElementById("transform");
elToolsMenu = document.getElementById("tools");
elMenuBackgroundOverlay = document.getElementById("menuBackgroundOverlay");
elLocalEntityFilter = document.getElementById("localEntityFilter");
elHmdCopy = document.getElementById("hmdcopy");
elHmdCopyID = document.getElementById("hmdcopyid");
elHmdCut = document.getElementById("hmdcut");
@ -394,6 +397,16 @@ function loaded() {
elExport.onclick = function() {
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() {
if (hmdMultiSelectMode) {
elHmdMultiSelect.className = "vglyph";
@ -1188,6 +1201,8 @@ function loaded() {
if (entity.elRow) {
if (entity.entityHostType === "avatar") {
entity.elRow.className = "avatarEntity";
} else if (entity.entityHostType === "local") {
entity.elRow.className = "localEntity";
} else {
entity.elRow.className = "";
}
@ -1206,12 +1221,16 @@ function loaded() {
if (id === lastSelectedEntity) {
if (entity.entityHostType === "avatar") {
entity.elRow.className = "lastSelAvatarEntity";
} else if (entity.entityHostType === "local") {
entity.elRow.className = "lastSelLocalEntity";
} else {
entity.elRow.className = "last-selected";
}
} else {
if (entity.entityHostType === "avatar") {
entity.elRow.className = "selAvatarEntity";
} else if (entity.entityHostType === "local") {
entity.elRow.className = "selLocalEntity";
} else {
entity.elRow.className = "selected";
}
@ -1287,12 +1306,16 @@ function loaded() {
if (itemData.id === lastSelectedEntity) {
if (itemData.entityHostType === "avatar") {
elRow.className = "lastSelAvatarEntity";
} else if (itemData.entityHostType === "local") {
elRow.className = "lastSelLocalEntity";
} else {
elRow.className = "last-selected";
}
} else {
if (itemData.entityHostType === "avatar") {
elRow.className = "selAvatarEntity";
} else if (itemData.entityHostType === "local") {
elRow.className = "selLocalEntity";
} else {
elRow.className = "selected";
}
@ -1300,6 +1323,8 @@ function loaded() {
} else {
if (itemData.entityHostType === "avatar") {
elRow.className = "avatarEntity";
} else if (itemData.entityHostType === "local") {
elRow.className = "localEntity";
} else {
elRow.className = "";
}
@ -1701,7 +1726,7 @@ function loaded() {
elToggleSpaceMode.innerText = "World";
}
}
const KEY_CODES = {
BACKSPACE: 8,
DELETE: 46
@ -1842,6 +1867,10 @@ function loaded() {
if (typeof(data.defaultRadius) === "number") {
elFilterRadius.value = data.defaultRadius;
onRadiusChange();
if (data.localEntityFilter) {
elLocalEntityFilter.className = "selLocalEntity glyph";
localEntityFilter = true;
}
}
if (data.columnsData !== "NO_DATA" && typeof(data.columnsData) === "object") {
var isValid = true;

View file

@ -6,7 +6,7 @@
// Modified by David Back on January 9th, 2018
// Copyright 2014 High Fidelity, Inc.
// 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.
//
@ -1277,6 +1277,7 @@ SelectionDisplay = (function() {
];
that.allToolEntities = allToolEntities;
that.toolEntityMaterial = toolEntityMaterial;
const nonLayeredToolEntities = [selectionBox, iconSelectionBox];

View file

@ -163,6 +163,9 @@ EntityShape.prototype = {
this.initialize(propertiesForType);
}
},
getIds: function() {
return {"materialEntityID": this.materialEntity, "entityID": this.entity};
},
clear: function() {
Entities.deleteEntity(this.materialEntity);
Entities.deleteEntity(this.entity);
@ -204,6 +207,16 @@ EntityShapeVisualizer.prototype = {
}, this);
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) {
var qualifiedEntities = entities.filter(function(entityID) {
if (this.acceptedEntities.indexOf(entityID) !== -1) {

View file

@ -4,7 +4,7 @@
// Created by Ryan Huffman on November 13th, 2014
// Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors.
// Copyright 2022-2024 Overte e.V.
// Copyright 2022-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
@ -197,6 +197,28 @@ tr.lastSelAvatarEntity + tr.lastSelAvatarEntity {
border-top: 1px solid #2e2e2e;
}
tr.localEntity {
color: #f0d769;
}
tr.selLocalEntity {
color: #000000;
background-color: #f0d769;
}
tr.selLocalEntity + tr.selLocalEntity {
border-top: 1px solid #2e2e2e;
}
tr.lastSelLocalEntity {
color: #000000;
background-color: #ebac00;
}
tr.lastSelLocalEntity + tr.lastSelLocalEntity {
border-top: 1px solid #2e2e2e;
}
tr.selected {
color: #000000;
background-color: #00b4ef;
@ -486,6 +508,21 @@ input[type=button].white, button.hifi-edit-button.white {
background-color: #afafaf;
background: linear-gradient(#fff 20%, #afafaf 100%);
}
input[type=button].localEntity, button.hifi-edit-button.localEntity {
color: #f0d769;
font-size: 26px;
padding-bottom: 2px;
}
input[type=button].selLocalEntity, button.hifi-edit-button.selLocalEntity {
color: #000000;
font-size: 26px;
background-color: #f0d769;
background: linear-gradient(#f0d769 20%, #ebac00 100%);
padding-bottom: 2px;
}
input[type=button].secondary, button.hifi-edit-button.secondary {
font-family: Raleway-Bold;
font-size: 10px;
@ -559,6 +596,17 @@ input[type=button].white:enabled:hover, button.hifi-edit-button.white:enabled:ho
border: none;
}
input[type=button].localEntity:enabled:hover, button.hifi-edit-button.localEntity:enabled:hover {
color: #ebac00;
border: none;
}
input[type=button].selLocalEntity:enabled:hover, button.hifi-edit-button.selLocalEntity:enabled:hover {
color: #000000;
background: linear-gradient(#ebac00, #ebac00);
border: none;
}
input[type=button]:active, button.hifi-edit-button:active {
background: linear-gradient(#343434, #343434);
}

View file

@ -1,11 +1,11 @@
/* globals EntityIconOverlayManager:true */
var allOverlays;
EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) {
var visible = false;
// List of all created overlays
var allOverlays = [];
allOverlays = [];
// List of overlays not currently being used
var unusedOverlays = [];
@ -99,7 +99,7 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) {
}
return overlay;
}
function releaseOverlay(overlay) {
unusedOverlays.push(overlay);
Entities.editEntity(overlay, {

View file

@ -1,9 +1,9 @@
// gridTool.js
//
// Created by Ryan Huffman on 6 Nov 2014
// Created by Ryan Huffman on November 6th, 2014
// Copyright 2014 High Fidelity, Inc.
// Copyright 2020 Vircadia contributors.
// Copyright 2022-2023 Overte e.V.
// Copyright 2022-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
@ -47,6 +47,10 @@ Grid = function() {
return origin;
};
that.getGridEntityToolID = function() {
return gridEntityTool;
};
that.getMinorIncrement = function() {
return minorGridEvery;
};