mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 12:12:39 +02:00
Local Entities in Create app Entity List
Local Entities in Create app Entity List
This commit is contained in:
parent
a00986ecce
commit
79aafbcb26
6 changed files with 82 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -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="" />
|
||||
<input type="button" class="red glyph" id="delete" value="{" />
|
||||
</div>
|
||||
<div id="entity-list">
|
||||
|
|
|
@ -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 = "";
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue