From 699f28c9b49f7add16080c7e46ec8f6bbc53b5ba Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Tue, 8 Dec 2020 23:36:57 -0500 Subject: [PATCH 1/5] New Material Icon and Harmonization Add a new entity in-world edition icon for Material (when not parented) and new version for the 4 existing icons: Now they are all dark gray (same tone) with a white border for a better visibility under different lighting. --- .../create/assets/images/icon-material.svg | 5 + .../create/assets/images/icon-particles.svg | 43 +++---- .../create/assets/images/icon-point-light.svg | 105 ++++++++---------- .../create/assets/images/icon-spot-light.svg | 63 +++++------ .../system/create/assets/images/icon-zone.svg | 72 +----------- 5 files changed, 95 insertions(+), 193 deletions(-) create mode 100644 scripts/system/create/assets/images/icon-material.svg diff --git a/scripts/system/create/assets/images/icon-material.svg b/scripts/system/create/assets/images/icon-material.svg new file mode 100644 index 0000000000..470fed5dbd --- /dev/null +++ b/scripts/system/create/assets/images/icon-material.svg @@ -0,0 +1,5 @@ + + + + +Layer 1 \ No newline at end of file diff --git a/scripts/system/create/assets/images/icon-particles.svg b/scripts/system/create/assets/images/icon-particles.svg index 5e0105d7cd..2b3f365889 100644 --- a/scripts/system/create/assets/images/icon-particles.svg +++ b/scripts/system/create/assets/images/icon-particles.svg @@ -1,29 +1,14 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + +Layer 1 \ No newline at end of file diff --git a/scripts/system/create/assets/images/icon-point-light.svg b/scripts/system/create/assets/images/icon-point-light.svg index 896c35b63b..0f2e91d55b 100644 --- a/scripts/system/create/assets/images/icon-point-light.svg +++ b/scripts/system/create/assets/images/icon-point-light.svg @@ -1,57 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +Layer 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/system/create/assets/images/icon-spot-light.svg b/scripts/system/create/assets/images/icon-spot-light.svg index ac2f87bb27..d8e196ffd7 100644 --- a/scripts/system/create/assets/images/icon-spot-light.svg +++ b/scripts/system/create/assets/images/icon-spot-light.svg @@ -1,37 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +Layer 1 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/system/create/assets/images/icon-zone.svg b/scripts/system/create/assets/images/icon-zone.svg index 41aeac4951..bfd8e07160 100644 --- a/scripts/system/create/assets/images/icon-zone.svg +++ b/scripts/system/create/assets/images/icon-zone.svg @@ -1,73 +1,5 @@ - - - -image/svg+xmlLayer 1 \ No newline at end of file From 5a3f4b59c8db1d54180ba310ad66c94c12db637c Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Tue, 8 Dec 2020 23:39:26 -0500 Subject: [PATCH 2/5] Add a Name on the Material of the shape visualizer Add a Name on the Material of the shape visualizer to be able to exclude it when a zone is selected. --- scripts/system/create/modules/entityShapeVisualizer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/system/create/modules/entityShapeVisualizer.js b/scripts/system/create/modules/entityShapeVisualizer.js index 45cf68fdb5..7a1cd74d25 100644 --- a/scripts/system/create/modules/entityShapeVisualizer.js +++ b/scripts/system/create/modules/entityShapeVisualizer.js @@ -143,6 +143,7 @@ EntityShape.prototype = { var PROJECTED_MATERIALS = false; this.materialEntity = Entities.addEntity({ type: "Material", + name: "MATERIAL_" + this.entityShapeVisualizerSessionName, localPosition: Vec3.ZERO, localRotation: Quat.IDENTITY, localDimensions: properties.localDimensions, From aea3e7936fbdb971b5c702ff112c77fd0a126a3e Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Tue, 8 Dec 2020 23:52:04 -0500 Subject: [PATCH 3/5] Add Material icons in edit mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1- This adds a new Material icon to identify the material entities that are linked to a parent. Since those material entities become invisible, this help to figure their presence. 2- The Create App - Preference: "Show Zones in Create Mode" has been removed, since it was doing nothing for a couple of years now. the method behind is still in the API, but do nothing. (abandoned since it was only drawing a box that wasn't useful to figure the shape of the zone) There was no real value to bring this back in a different way. 3- The Create App - Preference: "Show Lights and Particle Systems in Create Mode" has been renamed for "Show Icons in Create Mode" since this setting was also managing all the icons (including Zones and now the Parented Materials) The objective of the setting is mainly to simplify the display at the edit when a scene is very dense. (In the future, we might want to make this "à la carte". For now, I think we can try as is. ) --- scripts/system/create/edit.js | 56 ++++++++++++++--------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index fc3d4fc10f..9e94b68ba1 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -87,21 +87,24 @@ var PARTICLE_SYSTEM_URL = Script.resolvePath("assets/images/icon-particles.svg") var POINT_LIGHT_URL = Script.resolvePath("assets/images/icon-point-light.svg"); var SPOT_LIGHT_URL = Script.resolvePath("assets/images/icon-spot-light.svg"); var ZONE_URL = Script.resolvePath("assets/images/icon-zone.svg"); +var MATERIAL_URL = Script.resolvePath("assets/images/icon-material.svg"); -var entityIconOverlayManager = new EntityIconOverlayManager(['Light', 'ParticleEffect', 'Zone'], function(entityID) { - var properties = Entities.getEntityProperties(entityID, ['type', 'isSpotlight']); - if (properties.type === 'Light') { - return { - url: properties.isSpotlight ? SPOT_LIGHT_URL : POINT_LIGHT_URL, - }; - } else if (properties.type === 'Zone') { - return { - url: ZONE_URL, +var entityIconOverlayManager = new EntityIconOverlayManager(["Light", "ParticleEffect", "Zone", "Material"], function(entityID) { + var properties = Entities.getEntityProperties(entityID, ["type", "isSpotlight", "parentID", "name"]); + if (properties.type === "Light") { + return { + imageURL: properties.isSpotlight ? SPOT_LIGHT_URL : POINT_LIGHT_URL }; + } else if (properties.type === "Zone") { + return { imageURL: ZONE_URL }; + } else if (properties.type === "Material") { + if (properties.parentID !== Uuid.NULL && properties.name !== "MATERIAL_" + entityShapeVisualizerSessionName) { + return { imageURL: MATERIAL_URL }; + } else { + return { imageURL: "" }; + } } else { - return { - url: PARTICLE_SYSTEM_URL, - }; + return { imageURL: PARTICLE_SYSTEM_URL }; } }); @@ -154,8 +157,7 @@ var MENU_CREATE_SEPARATOR = "Create Application"; var SUBMENU_ENTITY_EDITOR_PREFERENCES = "Edit > Preferences"; var MENU_AUTO_FOCUS_ON_SELECT = "Auto Focus on Select"; var MENU_EASE_ON_FOCUS = "Ease Orientation on Focus"; -var MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE = "Show Lights and Particle Systems in Create Mode"; -var MENU_SHOW_ZONES_IN_EDIT_MODE = "Show Zones in Create Mode"; +var MENU_SHOW_ICONS_IN_CREATE_MODE = "Show Icons in Create Mode"; var MENU_CREATE_ENTITIES_GRABBABLE = "Create Entities As Grabbable (except Zones, Particles, and Lights)"; var MENU_ALLOW_SELECTION_LARGE = "Allow Selecting of Large Models"; var MENU_ALLOW_SELECTION_SMALL = "Allow Selecting of Small Models"; @@ -1041,8 +1043,7 @@ var toolBar = (function () { // everybody else to think that Interface has lost focus overall. fogbugzid:558 // Window.setFocus(); } - entityIconOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE)); - Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE)); + entityIconOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_ICONS_IN_CREATE_MODE)); }; initialize(); @@ -1465,22 +1466,15 @@ function setupModelMenus() { }); Menu.addMenuItem({ menuName: SUBMENU_ENTITY_EDITOR_PREFERENCES, - menuItemName: MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE, + menuItemName: MENU_SHOW_ICONS_IN_CREATE_MODE, afterItem: MENU_EASE_ON_FOCUS, isCheckable: true, isChecked: Settings.getValue(SETTING_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE) !== "false" }); - Menu.addMenuItem({ - menuName: SUBMENU_ENTITY_EDITOR_PREFERENCES, - menuItemName: MENU_SHOW_ZONES_IN_EDIT_MODE, - afterItem: MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE, - isCheckable: true, - isChecked: Settings.getValue(SETTING_SHOW_ZONES_IN_EDIT_MODE) !== "false" - }); Menu.addMenuItem({ menuName: SUBMENU_ENTITY_EDITOR_PREFERENCES, menuItemName: MENU_ENTITY_LIST_DEFAULT_RADIUS, - afterItem: MENU_SHOW_ZONES_IN_EDIT_MODE + afterItem: MENU_SHOW_ICONS_IN_CREATE_MODE }); Entities.setLightsArePickable(false); @@ -1497,8 +1491,7 @@ function cleanupModelMenus() { Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_ALLOW_SELECTION_LIGHTS); Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_AUTO_FOCUS_ON_SELECT); Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_EASE_ON_FOCUS); - Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE); - Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_SHOW_ZONES_IN_EDIT_MODE); + Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_SHOW_ICONS_IN_CREATE_MODE); Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_CREATE_ENTITIES_GRABBABLE); Menu.removeMenuItem(SUBMENU_ENTITY_EDITOR_PREFERENCES, MENU_ENTITY_LIST_DEFAULT_RADIUS); Menu.removeMenu(SUBMENU_ENTITY_EDITOR_PREFERENCES); @@ -1511,8 +1504,7 @@ Script.scriptEnding.connect(function () { toolBar.setActive(false); Settings.setValue(SETTING_AUTO_FOCUS_ON_SELECT, Menu.isOptionChecked(MENU_AUTO_FOCUS_ON_SELECT)); Settings.setValue(SETTING_EASE_ON_FOCUS, Menu.isOptionChecked(MENU_EASE_ON_FOCUS)); - Settings.setValue(SETTING_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE, Menu.isOptionChecked(MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE)); - Settings.setValue(SETTING_SHOW_ZONES_IN_EDIT_MODE, Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE)); + Settings.setValue(SETTING_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE, Menu.isOptionChecked(MENU_SHOW_ICONS_IN_CREATE_MODE)); Settings.setValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LARGE, Menu.isOptionChecked(MENU_ALLOW_SELECTION_LARGE)); Settings.setValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_SMALL, Menu.isOptionChecked(MENU_ALLOW_SELECTION_SMALL)); @@ -1869,10 +1861,8 @@ function handleMenuEvent(menuItem) { undoHistory.undo(); } else if (menuItem === "Redo") { undoHistory.redo(); - } else if (menuItem === MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE) { - entityIconOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE)); - } else if (menuItem === MENU_SHOW_ZONES_IN_EDIT_MODE) { - Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE)); + } else if (menuItem === MENU_SHOW_ICONS_IN_CREATE_MODE) { + entityIconOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_ICONS_IN_CREATE_MODE)); } else if (menuItem === MENU_CREATE_ENTITIES_GRABBABLE) { Settings.setValue(SETTING_EDIT_PREFIX + menuItem, Menu.isOptionChecked(menuItem)); } else if (menuItem === MENU_ENTITY_LIST_DEFAULT_RADIUS) { From 28e53c9c8686345a2747c76333c81c2a0a57dad9 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Tue, 8 Dec 2020 23:54:32 -0500 Subject: [PATCH 4/5] Migrate from 3dImage Overlay to Local Entities Migrate from 3dImage Overlay to Local Entities --- .../libraries/entityIconOverlayManager.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/system/libraries/entityIconOverlayManager.js b/scripts/system/libraries/entityIconOverlayManager.js index 68104ff4bb..bed83b55a0 100644 --- a/scripts/system/libraries/entityIconOverlayManager.js +++ b/scripts/system/libraries/entityIconOverlayManager.js @@ -29,7 +29,7 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { overlayProperties[key] = customProperties[key]; } } - Overlays.editOverlay(entityOverlays[entityID], overlayProperties); + Entities.editEntity(entityOverlays[entityID], overlayProperties); } }; @@ -63,7 +63,7 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { if (visible !== isVisible) { visible = isVisible; for (var id in entityOverlays) { - Overlays.editOverlay(entityOverlays[id], { + Entities.editEntity(entityOverlays[id], { visible: visible, ignorePickIntersection: !visible }); @@ -75,7 +75,11 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { function getOverlay() { var overlay; if (unusedOverlays.length === 0) { - overlay = Overlays.addOverlay("image3d", {}); + overlay = Entities.addEntity({ + "type": "Image", + "billboardMode": "full", + "emissive": true + },"local"); allOverlays.push(overlay); } else { overlay = unusedOverlays.pop(); @@ -85,7 +89,7 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { function releaseOverlay(overlay) { unusedOverlays.push(overlay); - Overlays.editOverlay(overlay, { + Entities.editEntity(overlay, { visible: false, ignorePickIntersection: true }); @@ -103,9 +107,8 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { visible: visible, ignorePickIntersection: !visible, alpha: 0.9, - scale: 0.5, - drawInFront: true, - isFacingAvatar: true, + dimensions: { x: 0.5, y: 0.5, z: 0.01 }, + renderLayer: "front", color: { red: 255, green: 255, @@ -118,7 +121,7 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { overlayProperties[key] = customProperties[key]; } } - Overlays.editOverlay(overlay, overlayProperties); + Entities.editEntity(overlay, overlayProperties); } } @@ -149,7 +152,7 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { Script.scriptEnding.connect(function() { for (var i = 0; i < allOverlays.length; i++) { - Overlays.deleteOverlay(allOverlays[i]); + Entities.deleteEntity(allOverlays[i]); } }); }; From 7ff8236da26f0c0e2d1c3e37c425aeb22ddf6789 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Thu, 17 Dec 2020 22:07:11 -0500 Subject: [PATCH 5/5] Minor Code Adjustments Minor Code Adjustments --- scripts/system/libraries/entityIconOverlayManager.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/system/libraries/entityIconOverlayManager.js b/scripts/system/libraries/entityIconOverlayManager.js index bed83b55a0..f2ca5625ea 100644 --- a/scripts/system/libraries/entityIconOverlayManager.js +++ b/scripts/system/libraries/entityIconOverlayManager.js @@ -76,10 +76,10 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) { var overlay; if (unusedOverlays.length === 0) { overlay = Entities.addEntity({ - "type": "Image", - "billboardMode": "full", - "emissive": true - },"local"); + type: "Image", + billboardMode: "full", + emissive: true + }, "local"); allOverlays.push(overlay); } else { overlay = unusedOverlays.pop();