Excluding EntityShapeVisualizer from Children list

Excluding EntityShapeVisualizer from Children list
Now a name is given to the EntityShape of the EntityShapeVisualizer (used to display the zone)
so we can now exclude them from the children list when it's time to figure if there are children for an entity.
(This is a better approach than excluding al the local entities)
The name has been used because it gives better results than trying to use the id map that arrive always too late.
The name is unique for a session, it includes a UUID.
This commit is contained in:
Alezia Kurdis 2020-11-21 15:44:15 -05:00 committed by GitHub
parent 00575ae8f8
commit b633bc4a16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,12 +116,14 @@ function deepCopy(v) {
return JSON.parse(JSON.stringify(v));
}
function EntityShape(entityID) {
function EntityShape(entityID, entityShapeVisualizerSessionName) {
this.entityID = entityID;
this.entityShapeVisualizerSessionName = entityShapeVisualizerSessionName;
var propertiesForType = getEntityShapePropertiesForType(Entities.getEntityProperties(entityID, REQUESTED_ENTITY_SHAPE_PROPERTIES));
this.previousPropertiesForType = propertiesForType;
this.initialize(propertiesForType);
}
@ -130,6 +132,7 @@ EntityShape.prototype = {
// Create new instance of JS object:
var overlayProperties = deepCopy(properties);
overlayProperties.name = this.entityShapeVisualizerSessionName;
overlayProperties.localPosition = Vec3.ZERO;
overlayProperties.localRotation = Quat.IDENTITY;
overlayProperties.canCastShadows = false;
@ -172,11 +175,11 @@ EntityShape.prototype = {
}
};
function EntityShapeVisualizer(visualizedTypes) {
function EntityShapeVisualizer(visualizedTypes, entityShapeVisualizerSessionName) {
this.acceptedEntities = [];
this.ignoredEntities = [];
this.entityShapes = {};
this.entityShapeVisualizerSessionName = entityShapeVisualizerSessionName;
this.visualizedTypes = visualizedTypes;
}
@ -185,7 +188,7 @@ EntityShapeVisualizer.prototype = {
if (this.entityShapes[entityID]) {
return;
}
this.entityShapes[entityID] = new EntityShape(entityID);
this.entityShapes[entityID] = new EntityShape(entityID, this.entityShapeVisualizerSessionName);
},
updateEntity: function(entityID) {