diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 099cb94988..bc7afd8dc3 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -117,8 +117,10 @@ var gridTool = new GridTool({ }); gridTool.setVisible(false); +var entityShapeVisualizerSessionName = "SHAPE_VISUALIZER_" + Uuid.generate(); + var EntityShapeVisualizer = Script.require('./modules/entityShapeVisualizer.js'); -var entityShapeVisualizer = new EntityShapeVisualizer(["Zone"]); +var entityShapeVisualizer = new EntityShapeVisualizer(["Zone"], entityShapeVisualizerSessionName); var entityListTool = new EntityListTool(shouldUseEditTabletApp); @@ -2908,7 +2910,7 @@ function zoneSortOrder(a, b) { function getParentState(id) { var state = "NONE"; var properties = Entities.getEntityProperties(id, ["parentID"]); - var children = Entities.getChildrenIDs(id); + var children = getDomainOnlyChildrenIDs(id); if (properties.parentID !== Uuid.NULL) { if (children.length > 0) { state = "PARENT_CHILDREN"; @@ -2923,4 +2925,17 @@ function getParentState(id) { return state; } +function getDomainOnlyChildrenIDs(id) { + var allChildren = Entities.getChildrenIDs(id); + var realChildren = []; + var properties; + for (var i = 0; i < allChildren.length; i++) { + properties = Entities.getEntityProperties(allChildren[i], ["name"]); + if (properties.name !== undefined && properties.name !== entityShapeVisualizerSessionName) { + realChildren.push(allChildren[i]); + } + } + return realChildren; +} + }()); // END LOCAL_SCOPE diff --git a/scripts/system/create/entitySelectionTool/entitySelectionTool.js b/scripts/system/create/entitySelectionTool/entitySelectionTool.js index 71edbde765..f9a30ef6a5 100644 --- a/scripts/system/create/entitySelectionTool/entitySelectionTool.js +++ b/scripts/system/create/entitySelectionTool/entitySelectionTool.js @@ -724,12 +724,12 @@ SelectionManager = (function() { that.addChildrenToSelection = function() { if (that.hasSelection()) { for (var i = 0; i < that.selections.length; i++) { - var childrenIDs = Entities.getChildrenIDs(that.selections[i]); - var collectNewChildren; + var childrenIDs = getDomainOnlyChildrenIDs(that.selections[i]); + var collectNewChildren; var j; var k = 0; do { - collectNewChildren = Entities.getChildrenIDs(childrenIDs[k]); + collectNewChildren = getDomainOnlyChildrenIDs(childrenIDs[k]); if (collectNewChildren.length > 0) { for (j = 0; j < collectNewChildren.length; j++) { childrenIDs.push(collectNewChildren[j]); @@ -746,7 +746,7 @@ SelectionManager = (function() { that._update(true, this); } else { audioFeedback.rejection(); - Window.notifyEditError("You have nothing selected."); + Window.notifyEditError("You have nothing selected."); } }; @@ -832,7 +832,7 @@ SelectionDisplay = (function() { const BOUNDING_EDGE_OFFSET = 0.5; - const DUPLICATOR_OFFSET = { x: 0.6, y: 0, z: 0.6 }; + const DUPLICATOR_OFFSET = { x: 0.6, y: 0, z: 0.6 }; const CTRL_KEY_CODE = 16777249; diff --git a/scripts/system/create/modules/entityShapeVisualizer.js b/scripts/system/create/modules/entityShapeVisualizer.js index dbf09a1cb7..45cf68fdb5 100644 --- a/scripts/system/create/modules/entityShapeVisualizer.js +++ b/scripts/system/create/modules/entityShapeVisualizer.js @@ -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) {