From c31ccc7a786ee19113d2572ae99cdcbc7f9cfefe Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sat, 8 Aug 2020 00:04:44 -0400 Subject: [PATCH 1/5] Fix unit for localAngularVelocity and other things Revisiting the tooltips for: - colorSpread - localAngularVelocity (Set the correct unit 'deg/s'. This addresses issue #530 ) - damping - angularDamping --- .../system/create/assets/data/createAppTooltips.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/system/create/assets/data/createAppTooltips.json b/scripts/system/create/assets/data/createAppTooltips.json index 4efd0593fb..c247bc7cae 100644 --- a/scripts/system/create/assets/data/createAppTooltips.json +++ b/scripts/system/create/assets/data/createAppTooltips.json @@ -319,7 +319,7 @@ "tooltip": "The finish color of each particle." }, "colorSpread": { - "tooltip": "The spread in color that each particle is given, resulting in a variety of colors." + "tooltip": "The spread in color that each particle is given, resulting in a variety of colors. The variation range (-/+) on each RGB channel to use around the RGB values of the particle color." }, "particleAlphaTriple": { "tooltip": "The opacity of each particle between 0.0 fully transparent and 1.0 completely opaque.", @@ -531,7 +531,7 @@ "tooltip": "If enabled, grabbed entities will follow the movements of your hand controller instead of your avatar's hand." }, "canCastShadow": { - "tooltip": "If enabled, the geometry of this entity casts shadows when a shadow-casting light source shines on it. Note: Shadows are rendered only on high-profiled computers. This setting will have no effect on computers profiled to medium or low graphics.." + "tooltip": "If enabled, the geometry of this entity casts shadows when a shadow-casting light source shines on it. Note: Shadows are rendered only on high-profiled computers. This setting will have no effect on computers profiled to medium or low graphics." }, "ignorePickIntersection": { "tooltip": "If enabled, this entity will not be considered for ray picks, and will also not occlude other entities when picking." @@ -569,13 +569,13 @@ "tooltip": "The linear velocity vector of the entity. The velocity at which this entity moves forward in space." }, "damping": { - "tooltip": "The linear damping to slow down the linear velocity of an entity over time." + "tooltip": "The linear damping to slow down the linear velocity of an entity over time. A higher damping value slows down the entity more quickly. The default value is for an exponential decay timescale of 2.0s, where it takes 2.0s for the movement to slow to 1/e = 0.368 of its initial value." }, "localAngularVelocity": { - "tooltip": "The angular velocity of the entity in rad/s with respect to its axes, about its pivot point." + "tooltip": "The angular velocity of the entity in 'deg/s' with respect to its axes, about its pivot point." }, "angularDamping": { - "tooltip": "The angular damping to slow down the angular velocity of an entity over time." + "tooltip": "The angular damping to slow down the angular velocity of an entity over time. A higher damping value slows down the entity more quickly. The default value is for an exponential decay timescale of 2.0s, where it takes 2.0s for the movement to slow to 1/e = 0.368 of its initial value." }, "restitution": { "tooltip": "If enabled, the entity can bounce against other objects that also have Bounciness." From 797d18d59dd5b5341c4bb58d89fb90d68df27b47 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sat, 8 Aug 2020 00:07:33 -0400 Subject: [PATCH 2/5] CSS adjustment for the new field type 'vec3rgb' CSS has been adjusted for the new field type 'vec3rgb'. Part of the fix for issue #593. --- scripts/system/html/css/edit-style.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/system/html/css/edit-style.css b/scripts/system/html/css/edit-style.css index c72456d414..ada8116a0d 100644 --- a/scripts/system/html/css/edit-style.css +++ b/scripts/system/html/css/edit-style.css @@ -1688,17 +1688,17 @@ input.rename-entity { margin-left: 4px; margin-right: 10px; } -.fstuple label.red, .fstuple label.x, .fstuple label.w { +.fstuple label.red, .fstuple label.r, .fstuple label.x, .fstuple label.w { color: #C62147; } -.fstuple label.green, .fstuple label.y, .fstuple label.h { +.fstuple label.green, .fstuple label.g, .fstuple label.y, .fstuple label.h { color: #359D85; } -.fstuple label.blue, .fstuple label.z { +.fstuple label.blue, .fstuple label.b, .fstuple label.z { color: #0093C5; } -.xyz.fstuple, .pyr.fstuple { +.xyz.fstuple, .pyr.fstuple, .vec3rgb.fstuple { position: relative; left: -12px; min-width: 50px; From f3a6fa527b2825e3eb8fceaa4c4d607e4608c43d Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sat, 8 Aug 2020 00:14:26 -0400 Subject: [PATCH 3/5] Replace the colorSpread color-picker by a vector Replace the color picker of the attribute particle.colorSpread by a color vec3 To do this, a new type of UI field has been added "vec3rgb" to support the "red, green, blue" vector (non-Color-picker). This addresses issue #593 Fix also the broken particle texture preview that, as for 'atp:/', doesn't support 'file:/'. This will be required for issue #534 --- .../html/js/entityProperties.js | 70 +++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index 182dddf817..f8f7063828 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -1133,7 +1133,13 @@ const GROUPS = [ }, { label: "Color Spread", - type: "color", + type: "vec3rgb", + vec3Type: "vec3rgb", + min: 0, + max: 255, + step: 1, + decimals: 0, + subLabels: [ "r", "g", "b" ], propertyID: "colorSpread", }, { @@ -1791,6 +1797,8 @@ function getPropertyInputElement(propertyID) { return { x: property.elNumberX.elInput, y: property.elNumberY.elInput, z: property.elNumberZ.elInput }; case 'color': return { red: property.elNumberR.elInput, green: property.elNumberG.elInput, blue: property.elNumberB.elInput }; + case 'vec3rgb': + return { red: property.elNumberR.elInput, green: property.elNumberG.elInput, blue: property.elNumberB.elInput }; case 'icon': return property.elLabel; case 'dynamic-multiselect': @@ -1889,6 +1897,12 @@ function resetProperties() { property.elNumberB.setValue("", false); break; } + case 'vec3rgb': { + property.elNumberR.setValue("", false); + property.elNumberG.setValue("", false); + property.elNumberB.setValue("", false); + break; + } case 'dropdown': { property.elInput.classList.remove('multi-diff'); property.elInput.value = ""; @@ -1995,7 +2009,7 @@ function isCurrentlyDraggingProperty(propertyName) { return properties[propertyName] && properties[propertyName].dragging === true; } -const SUPPORTED_FALLBACK_TYPES = ['number', 'number-draggable', 'rect', 'vec3', 'vec2', 'color']; +const SUPPORTED_FALLBACK_TYPES = ['number', 'number-draggable', 'rect', 'vec3', 'vec2', 'color', 'vec3rgb']; function getMultiplePropertyValue(originalPropertyName) { // if this is a compound property name (i.e. animation.running) @@ -2051,6 +2065,9 @@ function getMultiplePropertyValue(originalPropertyName) { case 'color': isPropertyNotNumber = isNaN(propertyValue.red) || propertyValue.red === null; break; + case 'vec3rgb': + isPropertyNotNumber = isNaN(propertyValue.red) || propertyValue.red === null; + break; } if (isPropertyNotNumber) { if (fallbackMultiValue === null) { @@ -2662,6 +2679,33 @@ function createVec3Property(property, elProperty) { return elResult; } +function createVec3rgbProperty(property, elProperty) { + let propertyData = property.data; + + elProperty.className = propertyData.vec3Type + " fstuple"; + + let elNumberR = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.X_NUMBER]); + let elNumberG = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.Y_NUMBER]); + let elNumberB = createTupleNumberInput(property, propertyData.subLabels[VECTOR_ELEMENTS.Z_NUMBER]); + elProperty.appendChild(elNumberR.elDiv); + elProperty.appendChild(elNumberG.elDiv); + elProperty.appendChild(elNumberB.elDiv); + + elNumberR.setValueChangeFunction(createEmitNumberPropertyComponentUpdateFunction(property, 'red')); + elNumberG.setValueChangeFunction(createEmitNumberPropertyComponentUpdateFunction(property, 'green')); + elNumberB.setValueChangeFunction(createEmitNumberPropertyComponentUpdateFunction(property, 'blue')); + + elNumberR.setMultiDiffStepFunction(createMultiDiffStepFunction(property, 'red')); + elNumberG.setMultiDiffStepFunction(createMultiDiffStepFunction(property, 'green')); + elNumberB.setMultiDiffStepFunction(createMultiDiffStepFunction(property, 'blue')); + + let elResult = []; + elResult[VECTOR_ELEMENTS.X_NUMBER] = elNumberR; + elResult[VECTOR_ELEMENTS.Y_NUMBER] = elNumberG; + elResult[VECTOR_ELEMENTS.Z_NUMBER] = elNumberB; + return elResult; +} + function createVec2Property(property, elProperty) { let propertyData = property.data; @@ -2856,7 +2900,7 @@ function createTextureProperty(property, elProperty) { let imageLoad = function(url) { elDiv.style.display = null; - if (url.slice(0, 5).toLowerCase() === "atp:/") { + if (url.slice(0, 5).toLowerCase() === "atp:/" || url.slice(0, 6).toLowerCase() === "file:/") { elImage.src = ""; elImage.style.display = "none"; elDiv.classList.remove("with-texture"); @@ -3048,6 +3092,13 @@ function createProperty(propertyData, propertyElementID, propertyName, propertyI property.elNumberB = elColor[COLOR_ELEMENTS.BLUE_NUMBER]; break; } + case 'vec3rgb': { + let elVec3 = createVec3rgbProperty(property, elProperty); + property.elNumberR = elVec3[VECTOR_ELEMENTS.X_NUMBER]; + property.elNumberG = elVec3[VECTOR_ELEMENTS.Y_NUMBER]; + property.elNumberB = elVec3[VECTOR_ELEMENTS.Z_NUMBER]; + break; + } case 'dropdown': { property.elInput = createDropdownProperty(property, propertyID, elProperty); break; @@ -4096,6 +4147,13 @@ function handleEntitySelectionUpdate(selections, isPropertiesToolUpdate) { property.elNumberB.setValue(displayColor.blue); break; } + case 'vec3rgb': { + let detailedNumberDiff = getDetailedNumberMPVDiff(propertyMultiValue, propertyData); + property.elNumberR.setValue(detailedNumberDiff.averagePerPropertyComponent.red, detailedNumberDiff.propertyComponentDiff.red); + property.elNumberG.setValue(detailedNumberDiff.averagePerPropertyComponent.green, detailedNumberDiff.propertyComponentDiff.green); + property.elNumberB.setValue(detailedNumberDiff.averagePerPropertyComponent.blue, detailedNumberDiff.propertyComponentDiff.blue); + break; + } case 'dropdown': { property.elInput.classList.toggle('multi-diff', isMultiDiffValue); property.elInput.value = isMultiDiffValue ? "" : propertyValue; @@ -4350,7 +4408,8 @@ function loaded() { properties[propertyID] = property; } if (propertyData.type === 'number' || propertyData.type === 'number-draggable' || - propertyData.type === 'vec2' || propertyData.type === 'vec3' || propertyData.type === 'rect') { + propertyData.type === 'vec2' || propertyData.type === 'vec3' || + propertyData.type === 'rect' || propertyData.type === 'vec3rgb') { propertyRangeRequests.push(propertyID); } @@ -4435,6 +4494,9 @@ function loaded() { case 'vec2': updateVectorMinMax(properties[property]); break; + case 'vec3rgb': + updateVectorMinMax(properties[property]); + break; case 'rect': updateRectMinMax(properties[property]); break; From d31f161d887aaf973c3854f4ea6fbc302d4e2cdd Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 9 Aug 2020 00:10:40 -0400 Subject: [PATCH 4/5] Remove the deprecated "acceleration" attribute This removes the "acceleration" attribute from the Create App. (Physic section) because this attribute is deprecated. --- .../entityProperties/html/js/entityProperties.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/scripts/system/create/entityProperties/html/js/entityProperties.js b/scripts/system/create/entityProperties/html/js/entityProperties.js index f8f7063828..0b0a3a286a 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -1657,16 +1657,6 @@ const GROUPS = [ decimals: 4, unit: "m/s2", propertyID: "gravity", - }, - { - label: "Acceleration", - type: "vec3", - vec3Type: "xyz", - subLabels: [ "x", "y", "z" ], - step: 0.1, - decimals: 4, - unit: "m/s2", - propertyID: "acceleration", } ] }, From 8d217d215fe23a11390666326b1c8f3eeeb032a4 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 17 Aug 2020 21:58:42 -0400 Subject: [PATCH 5/5] Better code fix for preview being more specific on the validation for the unresolvable relative path. checking now if the path start with "file:///~" instead of only: "file:/" This was too much restrictive since those direct path works and wouldn't return a preview: Ex: "file://MYSERVER/folder/100_0057.jpg" --- .../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 0b0a3a286a..f6dcf10bc8 100644 --- a/scripts/system/create/entityProperties/html/js/entityProperties.js +++ b/scripts/system/create/entityProperties/html/js/entityProperties.js @@ -2890,7 +2890,7 @@ function createTextureProperty(property, elProperty) { let imageLoad = function(url) { elDiv.style.display = null; - if (url.slice(0, 5).toLowerCase() === "atp:/" || url.slice(0, 6).toLowerCase() === "file:/") { + if (url.slice(0, 5).toLowerCase() === "atp:/" || url.slice(0, 9).toLowerCase() === "file:///~") { elImage.src = ""; elImage.style.display = "none"; elDiv.classList.remove("with-texture");