Skip to content

Commit

Permalink
Excluding EntityShapeVisualizer from Children list
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AleziaKurdis authored Nov 21, 2020
1 parent 00575ae commit b633bc4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/system/create/modules/entityShapeVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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) {
Expand Down

0 comments on commit b633bc4

Please sign in to comment.