From f29cde66cd430e1788528dca5669eb3f772f6e50 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 16 Mar 2020 23:16:14 -0400 Subject: [PATCH 01/13] Add alpha property on Shape entity Add the tooltip for the alpha property of Shape entity. --- scripts/system/create/assets/data/createAppTooltips.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/system/create/assets/data/createAppTooltips.json b/scripts/system/create/assets/data/createAppTooltips.json index 24f443f901..331b9aec65 100644 --- a/scripts/system/create/assets/data/createAppTooltips.json +++ b/scripts/system/create/assets/data/createAppTooltips.json @@ -5,6 +5,9 @@ "color": { "tooltip": "The RGB value of this entity." }, + "shapeAlpha": { + "tooltip": "The alpha of this entity." + }, "text": { "tooltip": "The text to display on the entity." }, From 1b3744ac73638e33e48bf354c4c1c68e9c7ae207 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 16 Mar 2020 23:19:04 -0400 Subject: [PATCH 02/13] Add alpha property on Shape entity Add the "Alpha" property on the "Shape" entity editor. propertyID: "shapeAlpha", propertyName: "alpha", --- .../entityProperties/html/js/entityProperties.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 9e476d80aa..68fff96856 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -142,7 +142,17 @@ const GROUPS = [ label: "Color", type: "color", propertyID: "color", - } + }, + { + label: "Alpha", + type: "number-draggable", + min: 0, + max: 1, + step: 0.01, + decimals: 2, + propertyID: "shapeAlpha", + propertyName: "alpha", + }, ] }, { From 500c2eff5d2cc0a99c5df71d5cb7442b449b2cbf Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 18 Mar 2020 00:01:53 -0400 Subject: [PATCH 03/13] Adding tooltips for 3 other missing properties Adding tooltips for 3 other missing properties: - "alpha" of the "Image" Entity. - "billboardMode" of the "Web" Entity. - "showKeyboardFocusHighlight" of the "Web" Entity. --- .../system/create/assets/data/createAppTooltips.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/system/create/assets/data/createAppTooltips.json b/scripts/system/create/assets/data/createAppTooltips.json index 331b9aec65..4b32bbf6db 100644 --- a/scripts/system/create/assets/data/createAppTooltips.json +++ b/scripts/system/create/assets/data/createAppTooltips.json @@ -199,6 +199,9 @@ "tooltip": "The tint to be applied to the image.", "jsPropertyName": "color" }, + "imageAlpha": { + "tooltip": "The alpha of the image." + }, "emissive": { "tooltip": "If enabled, the image will display at full brightness." }, @@ -218,6 +221,13 @@ "dpi": { "tooltip": "The resolution to display the page at, in pixels per inch. Use this to resize your web source in the frame." }, + "webBillboardMode": { + "tooltip": "If enabled, determines how the entity will face the camera.", + "jsPropertyName": "billboardMode" + }, + "showKeyboardFocusHighlight": { + "tooltip": "If enabled, highlights when it has keyboard focus." + }, "isEmitting": { "tooltip": "If enabled, then particles are emitted." }, From 35e76610a865e62bd41a41f4ae12e4a4b9e09b3c Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 18 Mar 2020 00:06:18 -0400 Subject: [PATCH 04/13] Added 3 other missing properties Added 3 other missing properties: - "alpha" of the "Image" Entity. - "billboardMode" of the "Web" Entity. - "showKeyboardFocusHighlight" of the "Web" Entity. --- .../html/js/entityProperties.js | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 68fff96856..63aa39e552 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -1,15 +1,9 @@ -//VERSION 2.0 -// Modified by Alezia Kurdis on on 02/27/2020 -// for "Project Athena" -// -// Addition of a tab mechanism instead of collapsible sections to reduce the scrolling. -// -//VERSION 1.0 // entityProperties.js // // Created by Ryan Huffman on 13 Nov 2014 // Modified by David Back on 19 Oct 2018 // Copyright 2014 High Fidelity, Inc. +// Copyright 2020 Project Athena contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -661,6 +655,16 @@ const GROUPS = [ propertyID: "imageColor", propertyName: "color", // actual entity property name }, + { + label: "Alpha", + type: "number-draggable", + min: 0, + max: 1, + step: 0.01, + decimals: 2, + propertyID: "imageAlpha", + propertyName: "alpha", + }, { label: "Emissive", type: "bool", @@ -725,6 +729,18 @@ const GROUPS = [ decimals: 0, propertyID: "maxFPS", }, + { + label: "Billboard Mode", + type: "dropdown", + options: { none: "None", yaw: "Yaw", full: "Full"}, + propertyID: "webBillboardMode", + propertyName: "billboardMode", // actual entity property name + }, + { + label: "Focus Highlight", + type: "bool", + propertyID: "showKeyboardFocusHighlight", + }, { label: "Script URL", type: "string", @@ -1870,7 +1886,7 @@ function resetServerScriptStatus() { function showGroupsForType(type) { if (type === "Box" || type === "Sphere") { showGroupsForTypes(["Shape"]); - showOnTheSamePage("Shape"); + showOnTheSamePage(["Shape"]); return; } if (type === "None") { @@ -1878,7 +1894,7 @@ function showGroupsForType(type) { return; } showGroupsForTypes([type]); - showOnTheSamePage(type); + showOnTheSamePage([type]); } function getGroupsForTypes(types) { From 5fad30dc179d1fb193e1526ad71b47522ac70440 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 18 Mar 2020 19:12:48 -0400 Subject: [PATCH 05/13] Added 5 missing properties Added 5 missing properties On "TEXT" entity: - font - textEffect - textEffectThickness - textEffectColor On "WEB" entity: - inputMode --- .../create/assets/data/createAppTooltips.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/system/create/assets/data/createAppTooltips.json b/scripts/system/create/assets/data/createAppTooltips.json index 4b32bbf6db..9ea7ad886b 100644 --- a/scripts/system/create/assets/data/createAppTooltips.json +++ b/scripts/system/create/assets/data/createAppTooltips.json @@ -26,6 +26,18 @@ "lineHeight": { "tooltip": "The height of each line of text. This determines the size of the text." }, + "font": { + "tooltip": "The font to render the text. Supported values: \"Courier\", \"Inconsolata\", \"Roboto\", \"Timeless\", or a URL to a .sdff file." + }, + "textEffect": { + "tooltip": "The effect that is applied to the text." + }, + "textEffectColor": { + "tooltip": "The color of the text effect." + }, + "textEffectThickness": { + "tooltip": "The magnitude of the text effect." + }, "textBillboardMode": { "tooltip": "If enabled, determines how the entity will face the camera.", "jsPropertyName": "billboardMode" @@ -225,6 +237,9 @@ "tooltip": "If enabled, determines how the entity will face the camera.", "jsPropertyName": "billboardMode" }, + "inputMode": { + "tooltip": "The user input mode to use." + }, "showKeyboardFocusHighlight": { "tooltip": "If enabled, highlights when it has keyboard focus." }, From 1b53014030c17f9e095d9dca6bb3f20587142bf6 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 18 Mar 2020 19:39:18 -0400 Subject: [PATCH 06/13] Added 5 missing properties Added 5 missing properties On "TEXT" entity: - font - textEffect - textEffectThickness - textEffectColor On "WEB" entity: - inputMode Added "physics" section to "MATERIAL" entity. Allowed negative values to be entered on the following light intensity properties: - ZONE: keyLight intensity - ZONE: ambientLight intensity - LIGHT: intensity --- .../html/js/entityProperties.js | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 63aa39e552..d5e29ac165 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -1,7 +1,6 @@ // entityProperties.js // // Created by Ryan Huffman on 13 Nov 2014 -// Modified by David Back on 19 Oct 2018 // Copyright 2014 High Fidelity, Inc. // Copyright 2020 Project Athena contributors. // @@ -195,6 +194,36 @@ const GROUPS = [ unit: "m", propertyID: "lineHeight", }, + { + label: "Font", + type: "string", + propertyID: "font", + }, + { + label: "Effect", + type: "dropdown", + options: { + none: "None", + outline: "Outline", + outlineFill: "Outline with fill", + shadow: "Shadow" + }, + propertyID: "textEffect", + }, + { + label: "Effect Color", + type: "color", + propertyID: "textEffectColor", + }, + { + label: "Effect Thickness", + type: "number-draggable", + min: 0.0, + max: 0.5, + step: 0.01, + decimals: 2, + propertyID: "textEffectThickness", + }, { label: "Billboard Mode", type: "dropdown", @@ -292,7 +321,7 @@ const GROUPS = [ { label: "Light Intensity", type: "number-draggable", - min: 0, + min: -40, max: 40, step: 0.01, decimals: 2, @@ -384,7 +413,7 @@ const GROUPS = [ { label: "Ambient Intensity", type: "number-draggable", - min: 0, + min: -200, max: 200, step: 0.1, decimals: 2, @@ -736,6 +765,15 @@ const GROUPS = [ propertyID: "webBillboardMode", propertyName: "billboardMode", // actual entity property name }, + { + label: "Input Mode", + type: "dropdown", + options: { + touch: "Touch events", + mouse: "Mouse events" + }, + propertyID: "inputMode", + }, { label: "Focus Highlight", type: "bool", @@ -762,7 +800,7 @@ const GROUPS = [ { label: "Intensity", type: "number-draggable", - min: 0, + min: -1000, max: 10000, step: 0.1, decimals: 2, @@ -1627,7 +1665,7 @@ const GROUPS_PER_TYPE = { Image: [ 'base', 'image', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], Web: [ 'base', 'web', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], Light: [ 'base', 'light', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], - Material: [ 'base', 'material', 'spatial', 'behavior', 'scripts' ], + Material: [ 'base', 'material', 'spatial', 'behavior', 'scripts', 'physics' ], ParticleEffect: [ 'base', 'particles', 'particles_emit', 'particles_size', 'particles_color', 'particles_behavior', 'particles_constraints', 'spatial', 'behavior', 'scripts', 'physics' ], PolyLine: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], From 1f72e995d76369b9052383180f8590f7f69a22ea Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Thu, 19 Mar 2020 01:00:21 -0400 Subject: [PATCH 07/13] Fix the "outline fill" of the textEffect property Fix the "outline fill" of the textEffect property The value to used was "outline fill" and not "outlineFill" as the JS doc pretends. Issue #221 has been open to fix the JSdoc. The usage of a space separated value has been imagined to preserve the backward compatibility of the existing script. in order to support a list (space separated) of effects to apply instead of a single effect as today. --- .../system/create/entityProperties/html/js/entityProperties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index d5e29ac165..8f3fdc53f2 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -205,7 +205,7 @@ const GROUPS = [ options: { none: "None", outline: "Outline", - outlineFill: "Outline with fill", + "outline fill": "Outline with fill", shadow: "Shadow" }, propertyID: "textEffect", From c86bf3dd7dfc906eaa5651a2d0e4f20dd870251f Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Fri, 20 Mar 2020 23:01:28 -0400 Subject: [PATCH 08/13] New tooltips for the alpha properties. This fix replaces the text of the tooltips of all the "alpha" properties by a more informative text for profane users. --- .../create/assets/data/createAppTooltips.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/system/create/assets/data/createAppTooltips.json b/scripts/system/create/assets/data/createAppTooltips.json index 9ea7ad886b..68b7cfe59a 100644 --- a/scripts/system/create/assets/data/createAppTooltips.json +++ b/scripts/system/create/assets/data/createAppTooltips.json @@ -3,10 +3,10 @@ "tooltip": "The shape of this entity's geometry." }, "color": { - "tooltip": "The RGB value of this entity." + "tooltip": "The color of this entity." }, "shapeAlpha": { - "tooltip": "The alpha of this entity." + "tooltip": "Set the opacity of the entity between 0.0 fully transparent and 1.0 completely opaque." }, "text": { "tooltip": "The text to display on the entity." @@ -15,13 +15,13 @@ "tooltip": "The color of the text." }, "textAlpha": { - "tooltip": "The alpha of the text." + "tooltip": "Set the opacity of the text between 0.0 fully transparent and 1.0 completely opaque." }, "backgroundColor": { "tooltip": "The color of the background." }, "backgroundAlpha": { - "tooltip": "The alpha of the background." + "tooltip": "Set the opacity of the background between 0.0 fully transparent and 1.0 completely opaque." }, "lineHeight": { "tooltip": "The height of each line of text. This determines the size of the text." @@ -212,7 +212,7 @@ "jsPropertyName": "color" }, "imageAlpha": { - "tooltip": "The alpha of the image." + "tooltip": "Set the opacity of the image between 0.0 fully transparent and 1.0 completely opaque." }, "emissive": { "tooltip": "If enabled, the image will display at full brightness." @@ -319,20 +319,20 @@ "tooltip": "The spread in color that each particle is given, resulting in a variety of colors." }, "particleAlphaTriple": { - "tooltip": "The alpha of each particle.", + "tooltip": "Set the opacity of the each particle between 0.0 fully transparent and 1.0 completely opaque.", "jsPropertyName": "alpha" }, "alpha": { - "tooltip": "The alpha of each particle." + "tooltip": "Set the opacity of the each particle between 0.0 fully transparent and 1.0 completely opaque." }, "alphaStart": { - "tooltip": "The start alpha of each particle." + "tooltip": "Set the initial opacity level of the each particle between 0.0 fully transparent and 1.0 completely opaque." }, "alphaFinish": { - "tooltip": "The finish alpha of each particle." + "tooltip": "Set the final opacity level of the each particle between 0.0 fully transparent and 1.0 completely opaque." }, "alphaSpread": { - "tooltip": "The spread in alpha that each particle is given, resulting in a variety of alphas." + "tooltip": "The spread in opacity that each particle is given, resulting in a variety of opacity levels." }, "emitAcceleration": { "tooltip": "The acceleration that is applied to each particle during its lifetime." @@ -602,7 +602,7 @@ "tooltip": "The tint of the web entity." }, "webAlpha": { - "tooltip": "The alpha of the web entity." + "tooltip": "Set the opacity of the web entity between 0.0 fully transparent and 1.0 completely opaque." }, "maxFPS": { "tooltip": "The FPS at which to render the web entity. Higher values will have a performance impact." From 90ef2ee0700938c8475bbc042405bd821b0ddcfa Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 22 Mar 2020 16:25:29 -0400 Subject: [PATCH 09/13] Replace Label "Allow Transition" Replace Label "Allow Transition" for "Allow Translation". --- .../system/create/entityProperties/html/js/entityProperties.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 8f3fdc53f2..0d15b8ece5 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -620,7 +620,7 @@ const GROUPS = [ propertyID: "animation.loop", }, { - label: "Allow Transition", + label: "Allow Translation", type: "bool", propertyID: "animation.allowTranslation", }, From cc6fc40b0eaf5f5c267e189557bc6c1a77b89fd7 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 27 Apr 2020 22:19:04 -0400 Subject: [PATCH 10/13] to avoid regression. --- .../html/js/entityProperties.js | 225 +++++++++++++++++- 1 file changed, 218 insertions(+), 7 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 0d15b8ece5..59755df122 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -2,7 +2,7 @@ // // Created by Ryan Huffman on 13 Nov 2014 // Copyright 2014 High Fidelity, Inc. -// Copyright 2020 Project Athena contributors. +// Copyright 2020 Vircadia contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -67,11 +67,16 @@ const GROUPS = [ replaceID: "placeholder-property-id", multiDisplayMode: PROPERTY_MULTI_DISPLAY_MODE.COMMA_SEPARATED_VALUES, }, - { + /*{ label: "Description", type: "string", propertyID: "description", - }, + },*/ + { //THIS IS ONLY FOR THE TEST ########################################## + label: "Description", + type: "multipleZonesSelection", + propertyID: "description", + }, // END TEST ############################# { label: "Parent", type: "string", @@ -575,6 +580,12 @@ const GROUPS = [ type: "dropdown", options: { inherit: "Inherit", crowd: "Crowd", hero: "Hero" }, propertyID: "avatarPriority", + }, + { + label: "Screen-share", + type: "dropdown", + options: { inherit: "Inherit", disabled: "Off", enabled: "On" }, + propertyID: "screenshare", } ] }, @@ -1669,7 +1680,6 @@ const GROUPS_PER_TYPE = { ParticleEffect: [ 'base', 'particles', 'particles_emit', 'particles_size', 'particles_color', 'particles_behavior', 'particles_constraints', 'spatial', 'behavior', 'scripts', 'physics' ], PolyLine: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], - PolyLine: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], PolyVox: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], Grid: [ 'base', 'grid', 'spatial', 'behavior', 'scripts', 'physics' ], Multiple: [ 'base', 'spatial', 'behavior', 'scripts', 'collision', 'physics' ], @@ -1739,7 +1749,7 @@ let selectedEntityIDs = new Set(); let currentSelections = []; let createAppTooltip = new CreateAppTooltip(); let currentSpaceMode = PROPERTY_SPACE_MODE.LOCAL; - +let zonesList = []; function createElementFromHTML(htmlString) { let elTemplate = document.createElement('template'); @@ -1765,6 +1775,8 @@ function getPropertyInputElement(propertyID) { case 'textarea': case 'texture': return property.elInput; + case 'multipleZonesSelection': + return property.elInput; case 'number-draggable': return property.elNumber.elInput; case 'rect': @@ -1805,6 +1817,7 @@ function disableChildren(el, selector) { function enableProperties() { enableChildren(document.getElementById("properties-list"), ENABLE_DISABLE_SELECTOR); enableChildren(document, ".colpick"); + enableAllMultipleZoneSelector(); } function disableProperties() { @@ -1813,6 +1826,7 @@ function disableProperties() { for (let pickKey in colorPickers) { colorPickers[pickKey].colpickHide(); } + disableAllMultipleZoneSelector(); } function showPropertyElement(propertyID, show) { @@ -1887,6 +1901,12 @@ function resetProperties() { setTextareaScrolling(property.elInput); break; } + case 'multipleZonesSelection': { + property.elInput.classList.remove('multi-diff'); + property.elInput.value = "[]"; //################################## PROBABLY SOMETHING TO ADJUST HERE! + setZonesSelectionData(property.elInput, false); + break; + } case 'icon': { property.elSpan.style.display = "none"; break; @@ -3036,6 +3056,10 @@ function createProperty(propertyData, propertyElementID, propertyName, propertyI property.elInput = createTextareaProperty(property, elProperty); break; } + case 'multipleZonesSelection': { + property.elInput = createZonesSelection(property, elProperty); + break; + } case 'icon': { property.elSpan = createIconProperty(property, elProperty); break; @@ -3528,6 +3552,175 @@ function setTextareaScrolling(element) { element.setAttribute("scrolling", isScrolling ? "true" : "false"); } +/** + * ZONE SELECTOR FUNCTIONS + */ + +function enableAllMultipleZoneSelector() { + let allMultiZoneSelectors = document.querySelectorAll(".hiddenMultiZonesSelection"); + let i, propId; + for ( i = 0; i < allMultiZoneSelectors.length; i++ ) { + propId = allMultiZoneSelectors[i].id; + displaySelectedZones(propId, true); + } +} + +function disableAllMultipleZoneSelector() { + let allMultiZoneSelectors = document.querySelectorAll(".hiddenMultiZonesSelection"); + let i, propId; + for ( i = 0; i < allMultiZoneSelectors.length; i++ ) { + propId = allMultiZoneSelectors[i].id; + displaySelectedZones(propId, false); + } +} + +function requestZoneList() { + EventBridge.emitWebEvent(JSON.stringify({ + type: "zoneListRequest" + })); +} + +function addZoneToZonesSelection(propertyId) { + let hiddenField = document.getElementById(propertyId); + if(JSON.stringify(hiddenField.value) === '"undefined"') { + hiddenField.value = "[]"; + } + let selectedZones = JSON.parse(hiddenField.value); + let zoneToAdd = document.getElementById("zones-select-" + propertyId).value; + if (!selectedZones.includes(zoneToAdd)) { + selectedZones.push(zoneToAdd); + } + hiddenField.value = JSON.stringify(selectedZones); + displaySelectedZones(propertyId, true); + let propertyName = propertyId.replace("property-", ""); + updateProperty(propertyName, JSON.stringify(selectedZones), false); //FOR TEMPORARY STRING FOR TEST + //updateProperty(propertyName, selectedZones, false); //DIRECTLY FOR ARRY +} + +function removeZoneFromZonesSelection(propertyId, zoneId) { + let hiddenField = document.getElementById(propertyId); + if(JSON.stringify(hiddenField.value) === '"undefined"') { + hiddenField.value = "[]"; + } + let selectedZones = JSON.parse(hiddenField.value); + let index = selectedZones.indexOf(zoneId); + if (index > -1) { + selectedZones.splice(index, 1); + } + hiddenField.value = JSON.stringify(selectedZones); + displaySelectedZones(propertyId, true); + let propertyName = propertyId.replace("property-", ""); + updateProperty(propertyName, JSON.stringify(selectedZones), false); //FOR TEMPORARY STRING FOR TEST + //updateProperty(propertyName, selectedZones, false); //DIRECTLY FOR ARRY +} + +function displaySelectedZones(propertyId, isEditable) { + let i,j, name, listedZoneInner, hiddenData, isMultiple; + hiddenData = document.getElementById(propertyId).value; + if (JSON.stringify(hiddenData) === '"undefined"') { + isMultiple = true; + hiddenData = "[]"; + } else { + isMultiple = false; + } + let selectedZones = JSON.parse(hiddenData); + listedZoneInner = ""; + if (selectedZones.length === 0) { + if (!isMultiple) { + listedZoneInner += ""; + } else { + listedZoneInner += ""; + } + } else { + for ( i = 0; i < selectedZones.length; i++ ) { + name = "{ERROR: NOT FOUND}"; + for ( j = 0; j < zonesList.length; j++ ) { + if (selectedZones[i] === zonesList[j].id) { + if (zonesList[j].name !== "") { + name = zonesList[j].name; + } else { + name = zonesList[j].id; + } + break; + } + } + if (isEditable) { + listedZoneInner += ""; + } else { + listedZoneInner += ""; + } + } + } + listedZoneInner += "
  
[ WARNING: Any changes will apply to all ] 
" + name + "
" + name + " 
"; + document.getElementById("selected-zones-" + propertyId).innerHTML = listedZoneInner; + if (isEditable) { + document.getElementById("multiZoneSelTools-" + propertyId).style.display = "block"; + } else { + document.getElementById("multiZoneSelTools-" + propertyId).style.display = "none"; + } +} + +function createZonesSelection(property, elProperty) { + let elementID = property.elementID; + requestZoneList(); + elProperty.className = "multipleZonesSelection"; + let elInput = document.createElement('input'); + elInput.setAttribute("id", elementID); + elInput.setAttribute("type", "hidden"); // must be hidden ################################################################################# HEIL! ICITTE! + elInput.className = "hiddenMultiZonesSelection"; + + let elZonesSelector = document.createElement('div'); + elZonesSelector.setAttribute("id", "zones-selector-" + elementID); + + let elMultiDiff = document.createElement('span'); + elMultiDiff.className = "multi-diff"; + + elProperty.appendChild(elInput); + elProperty.appendChild(elZonesSelector); + elProperty.appendChild(elMultiDiff); + + return elInput; +} + +function setZonesSelectionData(element, isEditable) { + let zoneSelectorContainer = document.getElementById("zones-selector-" + element.id); + let zoneSelector = "
 
"; + zoneSelector += "
"; + zoneSelectorContainer.innerHTML = zoneSelector; + displaySelectedZones(element.id, isEditable); +} + +function updateAllZoneSelect() { + let allZoneSelects = document.querySelectorAll(".zoneSelect"); + let i, j, name, propId; + for ( i = 0; i < allZoneSelects.length; i++ ) { + allZoneSelects[i].options.length = 0; + for ( j = 0; j < zonesList.length; j++ ) { + if (zonesList[j].name === "") { + name = zonesList[j].id; + } else { + name = zonesList[j].name; + } + allZoneSelects[i].options[j] = new Option(name, zonesList[j].id, false , false); + } + propId = allZoneSelects[i].id.replace("zones-select-", ""); + if (document.getElementById("multiZoneSelTools-" + propId).style.display === "block") { + displaySelectedZones(propId, true); + } else { + displaySelectedZones(propId, false); + } + } +} /** * MATERIAL TARGET FUNCTIONS @@ -3701,7 +3894,9 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) { selectedEntityIDs = new Set(selections.map(selection => selection.id)); const multipleSelections = currentSelections.length > 1; const hasSelectedEntityChanged = !areSetsEqual(selectedEntityIDs, previouslySelectedEntityIDs); - + + requestZoneList(); + if (selections.length === 0) { deleteJSONEditor(); deleteJSONMaterialEditor(); @@ -3756,7 +3951,7 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) { } else { enableProperties(); disableSaveUserDataButton(); - disableSaveMaterialDataButton() + disableSaveMaterialDataButton(); } const certificateIDMultiValue = getMultiplePropertyValue('certificateID'); @@ -3912,6 +4107,19 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) { setTextareaScrolling(property.elInput); break; } + case 'multipleZonesSelection': { + if (propertyValue == ""){ //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS + property.elInput.value = "[]"; //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS + } else { //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS + property.elInput.value = propertyValue; //JSON.stringify(propertyValue); //##### TO CHECK depending what type the value is.. expecting an array so it willbe manage as a string. + } //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS + if (lockedMultiValue.isMultiDiffValue || lockedMultiValue.value) { + setZonesSelectionData(property.elInput, false); + } else { + setZonesSelectionData(property.elInput, true); + } + break; + } case 'icon': { property.elSpan.innerHTML = propertyData.icons[propertyValue]; property.elSpan.style.display = "inline-block"; @@ -4241,6 +4449,9 @@ function loaded() { if (data.entityID === getFirstSelectedID()) { setMaterialTargetData(data.materialTargetData); } + } else if (data.type === 'zoneListRequest') { + zonesList = data.zones; + updateAllZoneSelect(); } }); From 8c1d80d49581e8fc8950ffcab9fc66c72c84047b Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 27 Apr 2020 22:48:47 -0400 Subject: [PATCH 11/13] To really avoid a regression --- .../html/js/entityProperties.js | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 59755df122..b634517d03 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -67,16 +67,11 @@ const GROUPS = [ replaceID: "placeholder-property-id", multiDisplayMode: PROPERTY_MULTI_DISPLAY_MODE.COMMA_SEPARATED_VALUES, }, - /*{ + { label: "Description", type: "string", propertyID: "description", - },*/ - { //THIS IS ONLY FOR THE TEST ########################################## - label: "Description", - type: "multipleZonesSelection", - propertyID: "description", - }, // END TEST ############################# + }, { label: "Parent", type: "string", @@ -120,6 +115,11 @@ const GROUPS = [ lines: "Wireframe", }, propertyID: "primitiveMode", + }, + { + label: "Render With Zones", + type: "multipleZonesSelection", + propertyID: "renderWithZones", } ] }, @@ -1903,7 +1903,7 @@ function resetProperties() { } case 'multipleZonesSelection': { property.elInput.classList.remove('multi-diff'); - property.elInput.value = "[]"; //################################## PROBABLY SOMETHING TO ADJUST HERE! + property.elInput.value = "[]"; setZonesSelectionData(property.elInput, false); break; } @@ -3588,20 +3588,19 @@ function addZoneToZonesSelection(propertyId) { let selectedZones = JSON.parse(hiddenField.value); let zoneToAdd = document.getElementById("zones-select-" + propertyId).value; if (!selectedZones.includes(zoneToAdd)) { - selectedZones.push(zoneToAdd); + selectedZones.push(zoneToAdd); } hiddenField.value = JSON.stringify(selectedZones); displaySelectedZones(propertyId, true); let propertyName = propertyId.replace("property-", ""); - updateProperty(propertyName, JSON.stringify(selectedZones), false); //FOR TEMPORARY STRING FOR TEST - //updateProperty(propertyName, selectedZones, false); //DIRECTLY FOR ARRY + updateProperty(propertyName, selectedZones, false); } function removeZoneFromZonesSelection(propertyId, zoneId) { let hiddenField = document.getElementById(propertyId); if(JSON.stringify(hiddenField.value) === '"undefined"') { hiddenField.value = "[]"; - } + } let selectedZones = JSON.parse(hiddenField.value); let index = selectedZones.indexOf(zoneId); if (index > -1) { @@ -3610,8 +3609,7 @@ function removeZoneFromZonesSelection(propertyId, zoneId) { hiddenField.value = JSON.stringify(selectedZones); displaySelectedZones(propertyId, true); let propertyName = propertyId.replace("property-", ""); - updateProperty(propertyName, JSON.stringify(selectedZones), false); //FOR TEMPORARY STRING FOR TEST - //updateProperty(propertyName, selectedZones, false); //DIRECTLY FOR ARRY + updateProperty(propertyName, selectedZones, false); } function displaySelectedZones(propertyId, isEditable) { @@ -3629,7 +3627,7 @@ function displaySelectedZones(propertyId, isEditable) { if (!isMultiple) { listedZoneInner += "  "; } else { - listedZoneInner += "[ WARNING: Any changes will apply to all ] "; + listedZoneInner += "[ WARNING: Any changes will apply to all. ] "; } } else { for ( i = 0; i < selectedZones.length; i++ ) { @@ -3645,9 +3643,10 @@ function displaySelectedZones(propertyId, isEditable) { } } if (isEditable) { - listedZoneInner += "" + name + ""; + listedZoneInner += "" + name + ""; + listedZoneInner += ""; } else { - listedZoneInner += "" + name + " "; + listedZoneInner += "" + name + " "; } } } @@ -3666,7 +3665,7 @@ function createZonesSelection(property, elProperty) { elProperty.className = "multipleZonesSelection"; let elInput = document.createElement('input'); elInput.setAttribute("id", elementID); - elInput.setAttribute("type", "hidden"); // must be hidden ################################################################################# HEIL! ICITTE! + elInput.setAttribute("type", "hidden"); elInput.className = "hiddenMultiZonesSelection"; let elZonesSelector = document.createElement('div'); @@ -3694,7 +3693,8 @@ function setZonesSelectionData(element, isEditable) { } zoneSelector += ""; } - zoneSelector += " "; + zoneSelector += " "; + zoneSelector += ""; zoneSelector += "
"; zoneSelectorContainer.innerHTML = zoneSelector; displaySelectedZones(element.id, isEditable); @@ -4108,18 +4108,14 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) { break; } case 'multipleZonesSelection': { - if (propertyValue == ""){ //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS - property.elInput.value = "[]"; //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS - } else { //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS - property.elInput.value = propertyValue; //JSON.stringify(propertyValue); //##### TO CHECK depending what type the value is.. expecting an array so it willbe manage as a string. - } //THIS IS A PATCH FOR TESTING WITh A STRING FIELDS + property.elInput.value = JSON.stringify(propertyValue); if (lockedMultiValue.isMultiDiffValue || lockedMultiValue.value) { setZonesSelectionData(property.elInput, false); } else { setZonesSelectionData(property.elInput, true); } break; - } + } case 'icon': { property.elSpan.innerHTML = propertyData.icons[propertyValue]; property.elSpan.style.display = "inline-block"; From a94ed7f6c1b0601b6adc32a8c636f22631dd9b94 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 6 May 2020 23:37:36 -0400 Subject: [PATCH 12/13] Minor Code Adjustments Minor Code Adjustments --- .../html/js/entityProperties.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index b634517d03..8c041d2563 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -115,12 +115,12 @@ const GROUPS = [ lines: "Wireframe", }, propertyID: "primitiveMode", - }, + }/*, { label: "Render With Zones", type: "multipleZonesSelection", propertyID: "renderWithZones", - } + }*/ ] }, { @@ -3559,7 +3559,7 @@ function setTextareaScrolling(element) { function enableAllMultipleZoneSelector() { let allMultiZoneSelectors = document.querySelectorAll(".hiddenMultiZonesSelection"); let i, propId; - for ( i = 0; i < allMultiZoneSelectors.length; i++ ) { + for (i = 0; i < allMultiZoneSelectors.length; i++) { propId = allMultiZoneSelectors[i].id; displaySelectedZones(propId, true); } @@ -3568,7 +3568,7 @@ function enableAllMultipleZoneSelector() { function disableAllMultipleZoneSelector() { let allMultiZoneSelectors = document.querySelectorAll(".hiddenMultiZonesSelection"); let i, propId; - for ( i = 0; i < allMultiZoneSelectors.length; i++ ) { + for (i = 0; i < allMultiZoneSelectors.length; i++) { propId = allMultiZoneSelectors[i].id; displaySelectedZones(propId, false); } @@ -3582,7 +3582,7 @@ function requestZoneList() { function addZoneToZonesSelection(propertyId) { let hiddenField = document.getElementById(propertyId); - if(JSON.stringify(hiddenField.value) === '"undefined"') { + if (JSON.stringify(hiddenField.value) === '"undefined"') { hiddenField.value = "[]"; } let selectedZones = JSON.parse(hiddenField.value); @@ -3598,7 +3598,7 @@ function addZoneToZonesSelection(propertyId) { function removeZoneFromZonesSelection(propertyId, zoneId) { let hiddenField = document.getElementById(propertyId); - if(JSON.stringify(hiddenField.value) === '"undefined"') { + if (JSON.stringify(hiddenField.value) === '"undefined"') { hiddenField.value = "[]"; } let selectedZones = JSON.parse(hiddenField.value); @@ -3630,9 +3630,9 @@ function displaySelectedZones(propertyId, isEditable) { listedZoneInner += "[ WARNING: Any changes will apply to all. ] "; } } else { - for ( i = 0; i < selectedZones.length; i++ ) { + for (i = 0; i < selectedZones.length; i++) { name = "{ERROR: NOT FOUND}"; - for ( j = 0; j < zonesList.length; j++ ) { + for (j = 0; j < zonesList.length; j++) { if (selectedZones[i] === zonesList[j].id) { if (zonesList[j].name !== "") { name = zonesList[j].name; @@ -3685,7 +3685,7 @@ function setZonesSelectionData(element, isEditable) { let zoneSelectorContainer = document.getElementById("zones-selector-" + element.id); let zoneSelector = "