Merge pull request #606 from AleziaKurdis/530_593_CrAppUIadust

Change colorSpread color-picker and other small fixes
This commit is contained in:
daleglass 2020-08-27 23:30:16 +02:00 committed by GitHub
commit aba63051e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 23 deletions

View file

@ -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."

View file

@ -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",
},
{
@ -1651,16 +1657,6 @@ const GROUPS = [
decimals: 4,
unit: "m/s<sup>2</sup>",
propertyID: "gravity",
},
{
label: "Acceleration",
type: "vec3",
vec3Type: "xyz",
subLabels: [ "x", "y", "z" ],
step: 0.1,
decimals: 4,
unit: "m/s<sup>2</sup>",
propertyID: "acceleration",
}
]
},
@ -1791,6 +1787,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 +1887,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 +1999,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 +2055,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 +2669,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 +2890,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, 9).toLowerCase() === "file:///~") {
elImage.src = "";
elImage.style.display = "none";
elDiv.classList.remove("with-texture");
@ -3048,6 +3082,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 +4137,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 +4398,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 +4484,9 @@ function loaded() {
case 'vec2':
updateVectorMinMax(properties[property]);
break;
case 'vec3rgb':
updateVectorMinMax(properties[property]);
break;
case 'rect':
updateRectMinMax(properties[property]);
break;

View file

@ -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;