mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 11:39:41 +02:00
Merge pull request #14281 from dback2/collidesPropertyFix
Fix Collides With subproperties
This commit is contained in:
commit
c6403a44cb
1 changed files with 108 additions and 108 deletions
|
@ -710,15 +710,6 @@ const GROUPS = [
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
propertyID: "particleRadius",
|
propertyID: "particleRadius",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Size Spread",
|
|
||||||
type: "slider",
|
|
||||||
min: 0,
|
|
||||||
max: 4,
|
|
||||||
step: 0.01,
|
|
||||||
decimals: 2,
|
|
||||||
propertyID: "radiusSpread",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Size Start",
|
label: "Size Start",
|
||||||
type: "slider",
|
type: "slider",
|
||||||
|
@ -739,6 +730,15 @@ const GROUPS = [
|
||||||
propertyID: "radiusFinish",
|
propertyID: "radiusFinish",
|
||||||
fallbackProperty: "particleRadius",
|
fallbackProperty: "particleRadius",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Size Spread",
|
||||||
|
type: "slider",
|
||||||
|
min: 0,
|
||||||
|
max: 4,
|
||||||
|
step: 0.01,
|
||||||
|
decimals: 2,
|
||||||
|
propertyID: "radiusSpread",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -783,15 +783,6 @@ const GROUPS = [
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
propertyID: "alpha",
|
propertyID: "alpha",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Alpha Spread",
|
|
||||||
type: "slider",
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
step: 0.01,
|
|
||||||
decimals: 2,
|
|
||||||
propertyID: "alphaSpread",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Alpha Start",
|
label: "Alpha Start",
|
||||||
type: "slider",
|
type: "slider",
|
||||||
|
@ -812,6 +803,15 @@ const GROUPS = [
|
||||||
propertyID: "alphaFinish",
|
propertyID: "alphaFinish",
|
||||||
fallbackProperty: "alpha",
|
fallbackProperty: "alpha",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Alpha Spread",
|
||||||
|
type: "slider",
|
||||||
|
min: 0,
|
||||||
|
max: 1,
|
||||||
|
step: 0.01,
|
||||||
|
decimals: 2,
|
||||||
|
propertyID: "alphaSpread",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -853,17 +853,6 @@ const GROUPS = [
|
||||||
unit: "deg",
|
unit: "deg",
|
||||||
propertyID: "particleSpin",
|
propertyID: "particleSpin",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "Spin Spread",
|
|
||||||
type: "slider",
|
|
||||||
min: 0,
|
|
||||||
max: 360,
|
|
||||||
step: 1,
|
|
||||||
decimals: 0,
|
|
||||||
multiplier: DEGREES_TO_RADIANS,
|
|
||||||
unit: "deg",
|
|
||||||
propertyID: "spinSpread",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Spin Start",
|
label: "Spin Start",
|
||||||
type: "slider",
|
type: "slider",
|
||||||
|
@ -888,6 +877,17 @@ const GROUPS = [
|
||||||
propertyID: "spinFinish",
|
propertyID: "spinFinish",
|
||||||
fallbackProperty: "particleSpin",
|
fallbackProperty: "particleSpin",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Spin Spread",
|
||||||
|
type: "slider",
|
||||||
|
min: 0,
|
||||||
|
max: 360,
|
||||||
|
step: 1,
|
||||||
|
decimals: 0,
|
||||||
|
multiplier: DEGREES_TO_RADIANS,
|
||||||
|
unit: "deg",
|
||||||
|
propertyID: "spinSpread",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Rotate with Entity",
|
label: "Rotate with Entity",
|
||||||
type: "bool",
|
type: "bool",
|
||||||
|
@ -1356,15 +1356,15 @@ function getPropertyInputElement(propertyID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableChildren(el, selector) {
|
function enableChildren(el, selector) {
|
||||||
var elSelectors = el.querySelectorAll(selector);
|
let elSelectors = el.querySelectorAll(selector);
|
||||||
for (var selectorIndex = 0; selectorIndex < elSelectors.length; ++selectorIndex) {
|
for (let selectorIndex = 0; selectorIndex < elSelectors.length; ++selectorIndex) {
|
||||||
elSelectors[selectorIndex].removeAttribute('disabled');
|
elSelectors[selectorIndex].removeAttribute('disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableChildren(el, selector) {
|
function disableChildren(el, selector) {
|
||||||
var elSelectors = el.querySelectorAll(selector);
|
let elSelectors = el.querySelectorAll(selector);
|
||||||
for (var selectorIndex = 0; selectorIndex < elSelectors.length; ++selectorIndex) {
|
for (let selectorIndex = 0; selectorIndex < elSelectors.length; ++selectorIndex) {
|
||||||
elSelectors[selectorIndex].setAttribute('disabled', 'disabled');
|
elSelectors[selectorIndex].setAttribute('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1372,7 +1372,7 @@ function disableChildren(el, selector) {
|
||||||
function enableProperties() {
|
function enableProperties() {
|
||||||
enableChildren(document.getElementById("properties-list"), "input, textarea, checkbox, .dropdown dl, .color-picker");
|
enableChildren(document.getElementById("properties-list"), "input, textarea, checkbox, .dropdown dl, .color-picker");
|
||||||
enableChildren(document, ".colpick");
|
enableChildren(document, ".colpick");
|
||||||
var elLocked = getPropertyInputElement("locked");
|
let elLocked = getPropertyInputElement("locked");
|
||||||
|
|
||||||
if (elLocked.checked === false) {
|
if (elLocked.checked === false) {
|
||||||
removeStaticUserData();
|
removeStaticUserData();
|
||||||
|
@ -1383,10 +1383,10 @@ function enableProperties() {
|
||||||
function disableProperties() {
|
function disableProperties() {
|
||||||
disableChildren(document.getElementById("properties-list"), "input, textarea, checkbox, .dropdown dl, .color-picker");
|
disableChildren(document.getElementById("properties-list"), "input, textarea, checkbox, .dropdown dl, .color-picker");
|
||||||
disableChildren(document, ".colpick");
|
disableChildren(document, ".colpick");
|
||||||
for (var pickKey in colorPickers) {
|
for (let pickKey in colorPickers) {
|
||||||
colorPickers[pickKey].colpickHide();
|
colorPickers[pickKey].colpickHide();
|
||||||
}
|
}
|
||||||
var elLocked = getPropertyInputElement("locked");
|
let elLocked = getPropertyInputElement("locked");
|
||||||
|
|
||||||
if (elLocked.checked === true) {
|
if (elLocked.checked === true) {
|
||||||
if ($('#property-userData-editor').css('display') === "block") {
|
if ($('#property-userData-editor').css('display') === "block") {
|
||||||
|
@ -1527,7 +1527,7 @@ function getPropertyValue(originalPropertyName) {
|
||||||
* PROPERTY UPDATE FUNCTIONS
|
* PROPERTY UPDATE FUNCTIONS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function updateProperty(originalPropertyName, propertyValue) {
|
function updateProperty(originalPropertyName, propertyValue, isParticleProperty) {
|
||||||
let propertyUpdate = {};
|
let propertyUpdate = {};
|
||||||
// if this is a compound property name (i.e. animation.running) then split it by . up to 3 times
|
// if this is a compound property name (i.e. animation.running) then split it by . up to 3 times
|
||||||
let splitPropertyName = originalPropertyName.split('.');
|
let splitPropertyName = originalPropertyName.split('.');
|
||||||
|
@ -1546,8 +1546,8 @@ function updateProperty(originalPropertyName, propertyValue) {
|
||||||
propertyUpdate[originalPropertyName] = propertyValue;
|
propertyUpdate[originalPropertyName] = propertyValue;
|
||||||
}
|
}
|
||||||
// queue up particle property changes with the debounced sync to avoid
|
// queue up particle property changes with the debounced sync to avoid
|
||||||
// causing particle emitting to reset each frame when updating values
|
// causing particle emitting to reset excessively with each value change
|
||||||
if (properties[originalPropertyName].isParticleProperty) {
|
if (isParticleProperty) {
|
||||||
Object.keys(propertyUpdate).forEach(function (propertyUpdateKey) {
|
Object.keys(propertyUpdate).forEach(function (propertyUpdateKey) {
|
||||||
particlePropertyUpdates[propertyUpdateKey] = propertyUpdate[propertyUpdateKey];
|
particlePropertyUpdates[propertyUpdateKey] = propertyUpdate[propertyUpdateKey];
|
||||||
});
|
});
|
||||||
|
@ -1570,30 +1570,29 @@ function updateProperties(propertiesToUpdate) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createEmitTextPropertyUpdateFunction(propertyName, isParticleProperty) {
|
||||||
function createEmitTextPropertyUpdateFunction(propertyName) {
|
|
||||||
return function() {
|
return function() {
|
||||||
updateProperty(propertyName, this.value);
|
updateProperty(propertyName, this.value, isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitCheckedPropertyUpdateFunction(propertyName, inverse) {
|
function createEmitCheckedPropertyUpdateFunction(propertyName, inverse, isParticleProperty) {
|
||||||
return function() {
|
return function() {
|
||||||
updateProperty(propertyName, inverse ? !this.checked : this.checked);
|
updateProperty(propertyName, inverse ? !this.checked : this.checked, isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitNumberPropertyUpdateFunction(propertyName, multiplier) {
|
function createEmitNumberPropertyUpdateFunction(propertyName, multiplier, isParticleProperty) {
|
||||||
return function() {
|
return function() {
|
||||||
if (multiplier === undefined) {
|
if (multiplier === undefined) {
|
||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
}
|
}
|
||||||
let value = parseFloat(this.value) * multiplier;
|
let value = parseFloat(this.value) * multiplier;
|
||||||
updateProperty(propertyName, value);
|
updateProperty(propertyName, value, isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitVec2PropertyUpdateFunction(propertyName, elX, elY, multiplier) {
|
function createEmitVec2PropertyUpdateFunction(propertyName, elX, elY, multiplier, isParticleProperty) {
|
||||||
return function () {
|
return function () {
|
||||||
if (multiplier === undefined) {
|
if (multiplier === undefined) {
|
||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
|
@ -1602,11 +1601,11 @@ function createEmitVec2PropertyUpdateFunction(propertyName, elX, elY, multiplier
|
||||||
x: elX.value * multiplier,
|
x: elX.value * multiplier,
|
||||||
y: elY.value * multiplier
|
y: elY.value * multiplier
|
||||||
};
|
};
|
||||||
updateProperty(propertyName, newValue);
|
updateProperty(propertyName, newValue, isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitVec3PropertyUpdateFunction(propertyName, elX, elY, elZ, multiplier) {
|
function createEmitVec3PropertyUpdateFunction(propertyName, elX, elY, elZ, multiplier, isParticleProperty) {
|
||||||
return function() {
|
return function() {
|
||||||
if (multiplier === undefined) {
|
if (multiplier === undefined) {
|
||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
|
@ -1616,26 +1615,26 @@ function createEmitVec3PropertyUpdateFunction(propertyName, elX, elY, elZ, multi
|
||||||
y: elY.value * multiplier,
|
y: elY.value * multiplier,
|
||||||
z: elZ.value * multiplier
|
z: elZ.value * multiplier
|
||||||
};
|
};
|
||||||
updateProperty(propertyName, newValue);
|
updateProperty(propertyName, newValue, isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createEmitColorPropertyUpdateFunction(propertyName, elRed, elGreen, elBlue) {
|
function createEmitColorPropertyUpdateFunction(propertyName, elRed, elGreen, elBlue, isParticleProperty) {
|
||||||
return function() {
|
return function() {
|
||||||
emitColorPropertyUpdate(propertyName, elRed.value, elGreen.value, elBlue.value);
|
emitColorPropertyUpdate(propertyName, elRed.value, elGreen.value, elBlue.value, isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitColorPropertyUpdate(propertyName, red, green, blue) {
|
function emitColorPropertyUpdate(propertyName, red, green, blue, isParticleProperty) {
|
||||||
let newValue = {
|
let newValue = {
|
||||||
red: red,
|
red: red,
|
||||||
green: green,
|
green: green,
|
||||||
blue: blue
|
blue: blue
|
||||||
};
|
};
|
||||||
updateProperty(propertyName, newValue);
|
updateProperty(propertyName, newValue, isParticleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElement, subPropertyString) {
|
function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElement, subPropertyString, isParticleProperty) {
|
||||||
if (subPropertyElement.checked) {
|
if (subPropertyElement.checked) {
|
||||||
if (propertyValue.indexOf(subPropertyString)) {
|
if (propertyValue.indexOf(subPropertyString)) {
|
||||||
propertyValue += subPropertyString + ',';
|
propertyValue += subPropertyString + ',';
|
||||||
|
@ -1644,13 +1643,13 @@ function updateCheckedSubProperty(propertyName, propertyValue, subPropertyElemen
|
||||||
// We've unchecked, so remove
|
// We've unchecked, so remove
|
||||||
propertyValue = propertyValue.replace(subPropertyString + ",", "");
|
propertyValue = propertyValue.replace(subPropertyString + ",", "");
|
||||||
}
|
}
|
||||||
updateProperty(propertyName, propertyValue);
|
updateProperty(propertyName, propertyValue, isParticleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createImageURLUpdateFunction(propertyName) {
|
function createImageURLUpdateFunction(propertyName, isParticleProperty) {
|
||||||
return function () {
|
return function () {
|
||||||
var newTextures = JSON.stringify({ "tex.picture": this.value });
|
let newTextures = JSON.stringify({ "tex.picture": this.value });
|
||||||
updateProperty(propertyName, newTextures);
|
updateProperty(propertyName, newTextures, isParticleProperty);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1673,7 +1672,7 @@ function createStringProperty(property, elProperty, elLabel) {
|
||||||
elInput.readOnly = true;
|
elInput.readOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName));
|
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName, property.isParticleProperty));
|
||||||
|
|
||||||
elProperty.appendChild(elLabel);
|
elProperty.appendChild(elLabel);
|
||||||
elProperty.appendChild(elInput);
|
elProperty.appendChild(elInput);
|
||||||
|
@ -1709,10 +1708,10 @@ function createBoolProperty(property, elProperty, elLabel) {
|
||||||
let subPropertyOf = propertyData.subPropertyOf;
|
let subPropertyOf = propertyData.subPropertyOf;
|
||||||
if (subPropertyOf !== undefined) {
|
if (subPropertyOf !== undefined) {
|
||||||
elInput.addEventListener('change', function() {
|
elInput.addEventListener('change', function() {
|
||||||
updateCheckedSubProperty(subPropertyOf, selectedEntityProperties[subPropertyOf], elInput, propertyName);
|
updateCheckedSubProperty(subPropertyOf, selectedEntityProperties[subPropertyOf], elInput, propertyName, property.isParticleProperty);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
elInput.addEventListener('change', createEmitCheckedPropertyUpdateFunction(propertyName, propertyData.inverse));
|
elInput.addEventListener('change', createEmitCheckedPropertyUpdateFunction(propertyName, propertyData.inverse, property.isParticleProperty));
|
||||||
}
|
}
|
||||||
|
|
||||||
return elInput;
|
return elInput;
|
||||||
|
@ -1745,7 +1744,7 @@ function createNumberProperty(property, elProperty, elLabel) {
|
||||||
elInput.value = defaultValue;
|
elInput.value = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitNumberPropertyUpdateFunction(propertyName, propertyData.multiplier, propertyData.decimals));
|
elInput.addEventListener('change', createEmitNumberPropertyUpdateFunction(propertyName, propertyData.multiplier, propertyData.decimals, property.isParticleProperty));
|
||||||
|
|
||||||
elProperty.appendChild(elLabel);
|
elProperty.appendChild(elLabel);
|
||||||
elProperty.appendChild(elInput);
|
elProperty.appendChild(elInput);
|
||||||
|
@ -1791,7 +1790,7 @@ function createSliderProperty(property, elProperty, elLabel) {
|
||||||
if (propertyData.multiplier !== undefined) {
|
if (propertyData.multiplier !== undefined) {
|
||||||
inputValue *= propertyData.multiplier;
|
inputValue *= propertyData.multiplier;
|
||||||
}
|
}
|
||||||
updateProperty(property.name, inputValue);
|
updateProperty(property.name, inputValue, property.isParticleProperty);
|
||||||
};
|
};
|
||||||
elSlider.oninput = function (event) {
|
elSlider.oninput = function (event) {
|
||||||
let sliderValue = event.target.value;
|
let sliderValue = event.target.value;
|
||||||
|
@ -1807,7 +1806,7 @@ function createSliderProperty(property, elProperty, elLabel) {
|
||||||
if (propertyData.multiplier !== undefined) {
|
if (propertyData.multiplier !== undefined) {
|
||||||
sliderValue *= propertyData.multiplier;
|
sliderValue *= propertyData.multiplier;
|
||||||
}
|
}
|
||||||
updateProperty(property.name, sliderValue);
|
updateProperty(property.name, sliderValue, property.isParticleProperty);
|
||||||
};
|
};
|
||||||
|
|
||||||
elDiv.appendChild(elLabel);
|
elDiv.appendChild(elLabel);
|
||||||
|
@ -1843,8 +1842,8 @@ function createVec3Property(property, elProperty, elLabel) {
|
||||||
let elInputZ = createTupleNumberInput(elTuple, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Z_INPUT],
|
let elInputZ = createTupleNumberInput(elTuple, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Z_INPUT],
|
||||||
propertyData.min, propertyData.max, propertyData.step);
|
propertyData.min, propertyData.max, propertyData.step);
|
||||||
|
|
||||||
let inputChangeFunction = createEmitVec3PropertyUpdateFunction(propertyName, elInputX, elInputY,
|
let inputChangeFunction = createEmitVec3PropertyUpdateFunction(propertyName, elInputX, elInputY, elInputZ,
|
||||||
elInputZ, propertyData.multiplier);
|
propertyData.multiplier, property.isParticleProperty);
|
||||||
elInputX.addEventListener('change', inputChangeFunction);
|
elInputX.addEventListener('change', inputChangeFunction);
|
||||||
elInputY.addEventListener('change', inputChangeFunction);
|
elInputY.addEventListener('change', inputChangeFunction);
|
||||||
elInputZ.addEventListener('change', inputChangeFunction);
|
elInputZ.addEventListener('change', inputChangeFunction);
|
||||||
|
@ -1876,8 +1875,8 @@ function createVec2Property(property, elProperty, elLabel) {
|
||||||
let elInputY = createTupleNumberInput(elTuple, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Y_INPUT],
|
let elInputY = createTupleNumberInput(elTuple, elementID, propertyData.subLabels[VECTOR_ELEMENTS.Y_INPUT],
|
||||||
propertyData.min, propertyData.max, propertyData.step);
|
propertyData.min, propertyData.max, propertyData.step);
|
||||||
|
|
||||||
let inputChangeFunction = createEmitVec2PropertyUpdateFunction(propertyName, elInputX,
|
let inputChangeFunction = createEmitVec2PropertyUpdateFunction(propertyName, elInputX, elInputY,
|
||||||
elInputY, propertyData.multiplier);
|
propertyData.multiplier, property.isParticleProperty);
|
||||||
elInputX.addEventListener('change', inputChangeFunction);
|
elInputX.addEventListener('change', inputChangeFunction);
|
||||||
elInputY.addEventListener('change', inputChangeFunction);
|
elInputY.addEventListener('change', inputChangeFunction);
|
||||||
|
|
||||||
|
@ -1908,7 +1907,8 @@ function createColorProperty(property, elProperty, elLabel) {
|
||||||
let elInputG = createTupleNumberInput(elTuple, elementID, "green", COLOR_MIN, COLOR_MAX, COLOR_STEP);
|
let elInputG = createTupleNumberInput(elTuple, elementID, "green", COLOR_MIN, COLOR_MAX, COLOR_STEP);
|
||||||
let elInputB = createTupleNumberInput(elTuple, elementID, "blue", COLOR_MIN, COLOR_MAX, COLOR_STEP);
|
let elInputB = createTupleNumberInput(elTuple, elementID, "blue", COLOR_MIN, COLOR_MAX, COLOR_STEP);
|
||||||
|
|
||||||
let inputChangeFunction = createEmitColorPropertyUpdateFunction(propertyName, elInputR, elInputG, elInputB);
|
let inputChangeFunction = createEmitColorPropertyUpdateFunction(propertyName, elInputR, elInputG, elInputB,
|
||||||
|
property.isParticleProperty);
|
||||||
elInputR.addEventListener('change', inputChangeFunction);
|
elInputR.addEventListener('change', inputChangeFunction);
|
||||||
elInputG.addEventListener('change', inputChangeFunction);
|
elInputG.addEventListener('change', inputChangeFunction);
|
||||||
elInputB.addEventListener('change', inputChangeFunction);
|
elInputB.addEventListener('change', inputChangeFunction);
|
||||||
|
@ -1964,7 +1964,7 @@ function createDropdownProperty(property, propertyID, elProperty, elLabel) {
|
||||||
elInput.add(option);
|
elInput.add(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName));
|
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName, property.isParticleProperty));
|
||||||
|
|
||||||
elProperty.appendChild(elLabel);
|
elProperty.appendChild(elLabel);
|
||||||
elProperty.appendChild(elInput);
|
elProperty.appendChild(elInput);
|
||||||
|
@ -1991,7 +1991,7 @@ function createTextareaProperty(property, elProperty, elLabel) {
|
||||||
elInput.readOnly = true;
|
elInput.readOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName));
|
elInput.addEventListener('change', createEmitTextPropertyUpdateFunction(propertyName, property.isParticleProperty));
|
||||||
|
|
||||||
elProperty.appendChild(elInput);
|
elProperty.appendChild(elInput);
|
||||||
|
|
||||||
|
@ -2057,9 +2057,9 @@ function createTextureProperty(property, elProperty, elLabel) {
|
||||||
elInput.imageLoad = imageLoad;
|
elInput.imageLoad = imageLoad;
|
||||||
elInput.oninput = function (event) {
|
elInput.oninput = function (event) {
|
||||||
// Add throttle
|
// Add throttle
|
||||||
var url = event.target.value;
|
let url = event.target.value;
|
||||||
imageLoad(url);
|
imageLoad(url);
|
||||||
updateProperty(property.name, url)
|
updateProperty(property.name, url, property.isParticleProperty)
|
||||||
};
|
};
|
||||||
elInput.onchange = elInput.oninput;
|
elInput.onchange = elInput.oninput;
|
||||||
|
|
||||||
|
@ -2200,7 +2200,7 @@ function reloadServerScripts() {
|
||||||
function copySkyboxURLToAmbientURL() {
|
function copySkyboxURLToAmbientURL() {
|
||||||
let skyboxURL = getPropertyInputElement("skybox.url").value;
|
let skyboxURL = getPropertyInputElement("skybox.url").value;
|
||||||
getPropertyInputElement("ambientLight.ambientURL").value = skyboxURL;
|
getPropertyInputElement("ambientLight.ambientURL").value = skyboxURL;
|
||||||
updateProperty("ambientLight.ambientURL", skyboxURL);
|
updateProperty("ambientLight.ambientURL", skyboxURL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2215,13 +2215,13 @@ function clearUserData() {
|
||||||
showUserDataTextArea();
|
showUserDataTextArea();
|
||||||
showNewJSONEditorButton();
|
showNewJSONEditorButton();
|
||||||
hideSaveUserDataButton();
|
hideSaveUserDataButton();
|
||||||
updateProperty('userData', elUserData.value);
|
updateProperty('userData', elUserData.value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function newJSONEditor() {
|
function newJSONEditor() {
|
||||||
deleteJSONEditor();
|
deleteJSONEditor();
|
||||||
createJSONEditor();
|
createJSONEditor();
|
||||||
var data = {};
|
let data = {};
|
||||||
setEditorJSON(data);
|
setEditorJSON(data);
|
||||||
hideUserDataTextArea();
|
hideUserDataTextArea();
|
||||||
hideNewJSONEditorButton();
|
hideNewJSONEditorButton();
|
||||||
|
@ -2233,7 +2233,7 @@ function saveUserData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUserDataFromEditor(noUpdate) {
|
function setUserDataFromEditor(noUpdate) {
|
||||||
var json = null;
|
let json = null;
|
||||||
try {
|
try {
|
||||||
json = editor.get();
|
json = editor.get();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -2242,7 +2242,7 @@ function setUserDataFromEditor(noUpdate) {
|
||||||
if (json === null) {
|
if (json === null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var text = editor.getText();
|
let text = editor.getText();
|
||||||
if (noUpdate === true) {
|
if (noUpdate === true) {
|
||||||
EventBridge.emitWebEvent(
|
EventBridge.emitWebEvent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
@ -2255,15 +2255,15 @@ function setUserDataFromEditor(noUpdate) {
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
updateProperty('userData', text);
|
updateProperty('userData', text, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults, removeKeys) {
|
function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults, removeKeys) {
|
||||||
var propertyUpdate = {};
|
let propertyUpdate = {};
|
||||||
var parsedData = {};
|
let parsedData = {};
|
||||||
var keysToBeRemoved = removeKeys ? removeKeys : [];
|
let keysToBeRemoved = removeKeys ? removeKeys : [];
|
||||||
try {
|
try {
|
||||||
if ($('#property-userData-editor').css('height') !== "0px") {
|
if ($('#property-userData-editor').css('height') !== "0px") {
|
||||||
// if there is an expanded, we want to use its json.
|
// if there is an expanded, we want to use its json.
|
||||||
|
@ -2278,14 +2278,14 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults, r
|
||||||
if (!(groupName in parsedData)) {
|
if (!(groupName in parsedData)) {
|
||||||
parsedData[groupName] = {};
|
parsedData[groupName] = {};
|
||||||
}
|
}
|
||||||
var keys = Object.keys(updateKeyPair);
|
let keys = Object.keys(updateKeyPair);
|
||||||
keys.forEach(function (key) {
|
keys.forEach(function (key) {
|
||||||
if (updateKeyPair[key] !== null && updateKeyPair[key] !== "null") {
|
if (updateKeyPair[key] !== null && updateKeyPair[key] !== "null") {
|
||||||
if (updateKeyPair[key] instanceof Element) {
|
if (updateKeyPair[key] instanceof Element) {
|
||||||
if (updateKeyPair[key].type === "checkbox") {
|
if (updateKeyPair[key].type === "checkbox") {
|
||||||
parsedData[groupName][key] = updateKeyPair[key].checked;
|
parsedData[groupName][key] = updateKeyPair[key].checked;
|
||||||
} else {
|
} else {
|
||||||
var val = isNaN(updateKeyPair[key].value) ? updateKeyPair[key].value : parseInt(updateKeyPair[key].value);
|
let val = isNaN(updateKeyPair[key].value) ? updateKeyPair[key].value : parseInt(updateKeyPair[key].value);
|
||||||
parsedData[groupName][key] = val;
|
parsedData[groupName][key] = val;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2318,8 +2318,8 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults, r
|
||||||
var editor = null;
|
var editor = null;
|
||||||
|
|
||||||
function createJSONEditor() {
|
function createJSONEditor() {
|
||||||
var container = document.getElementById("property-userData-editor");
|
let container = document.getElementById("property-userData-editor");
|
||||||
var options = {
|
let options = {
|
||||||
search: false,
|
search: false,
|
||||||
mode: 'tree',
|
mode: 'tree',
|
||||||
modes: ['code', 'tree'],
|
modes: ['code', 'tree'],
|
||||||
|
@ -2331,7 +2331,7 @@ function createJSONEditor() {
|
||||||
alert('JSON editor:' + e);
|
alert('JSON editor:' + e);
|
||||||
},
|
},
|
||||||
onChange: function() {
|
onChange: function() {
|
||||||
var currentJSONString = editor.getText();
|
let currentJSONString = editor.getText();
|
||||||
|
|
||||||
if (currentJSONString === '{"":""}') {
|
if (currentJSONString === '{"":""}') {
|
||||||
return;
|
return;
|
||||||
|
@ -2432,13 +2432,13 @@ function clearMaterialData() {
|
||||||
showMaterialDataTextArea();
|
showMaterialDataTextArea();
|
||||||
showNewJSONMaterialEditorButton();
|
showNewJSONMaterialEditorButton();
|
||||||
hideSaveMaterialDataButton();
|
hideSaveMaterialDataButton();
|
||||||
updateProperty('materialData', elMaterialData.value);
|
updateProperty('materialData', elMaterialData.value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function newJSONMaterialEditor() {
|
function newJSONMaterialEditor() {
|
||||||
deleteJSONMaterialEditor();
|
deleteJSONMaterialEditor();
|
||||||
createJSONMaterialEditor();
|
createJSONMaterialEditor();
|
||||||
var data = {};
|
let data = {};
|
||||||
setMaterialEditorJSON(data);
|
setMaterialEditorJSON(data);
|
||||||
hideMaterialDataTextArea();
|
hideMaterialDataTextArea();
|
||||||
hideNewJSONMaterialEditorButton();
|
hideNewJSONMaterialEditorButton();
|
||||||
|
@ -2450,7 +2450,7 @@ function saveMaterialData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMaterialDataFromEditor(noUpdate) {
|
function setMaterialDataFromEditor(noUpdate) {
|
||||||
var json = null;
|
let json = null;
|
||||||
try {
|
try {
|
||||||
json = materialEditor.get();
|
json = materialEditor.get();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -2459,7 +2459,7 @@ function setMaterialDataFromEditor(noUpdate) {
|
||||||
if (json === null) {
|
if (json === null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var text = materialEditor.getText();
|
let text = materialEditor.getText();
|
||||||
if (noUpdate === true) {
|
if (noUpdate === true) {
|
||||||
EventBridge.emitWebEvent(
|
EventBridge.emitWebEvent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
@ -2472,7 +2472,7 @@ function setMaterialDataFromEditor(noUpdate) {
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
updateProperty('materialData', text);
|
updateProperty('materialData', text, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2480,8 +2480,8 @@ function setMaterialDataFromEditor(noUpdate) {
|
||||||
var materialEditor = null;
|
var materialEditor = null;
|
||||||
|
|
||||||
function createJSONMaterialEditor() {
|
function createJSONMaterialEditor() {
|
||||||
var container = document.getElementById("property-materialData-editor");
|
let container = document.getElementById("property-materialData-editor");
|
||||||
var options = {
|
let options = {
|
||||||
search: false,
|
search: false,
|
||||||
mode: 'tree',
|
mode: 'tree',
|
||||||
modes: ['code', 'tree'],
|
modes: ['code', 'tree'],
|
||||||
|
@ -2493,7 +2493,7 @@ function createJSONMaterialEditor() {
|
||||||
alert('JSON editor:' + e);
|
alert('JSON editor:' + e);
|
||||||
},
|
},
|
||||||
onChange: function() {
|
onChange: function() {
|
||||||
var currentJSONString = materialEditor.getText();
|
let currentJSONString = materialEditor.getText();
|
||||||
|
|
||||||
if (currentJSONString === '{"":""}') {
|
if (currentJSONString === '{"":""}') {
|
||||||
return;
|
return;
|
||||||
|
@ -2583,11 +2583,11 @@ function saveJSONMaterialData(noUpdate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindAllNonJSONEditorElements() {
|
function bindAllNonJSONEditorElements() {
|
||||||
var inputs = $('input');
|
let inputs = $('input');
|
||||||
var i;
|
let i;
|
||||||
for (i = 0; i < inputs.length; ++i) {
|
for (i = 0; i < inputs.length; ++i) {
|
||||||
var input = inputs[i];
|
let input = inputs[i];
|
||||||
var field = $(input);
|
let field = $(input);
|
||||||
// TODO FIXME: (JSHint) Functions declared within loops referencing
|
// TODO FIXME: (JSHint) Functions declared within loops referencing
|
||||||
// an outer scoped variable may lead to confusing semantics.
|
// an outer scoped variable may lead to confusing semantics.
|
||||||
field.on('focus', function(e) {
|
field.on('focus', function(e) {
|
||||||
|
@ -2650,7 +2650,7 @@ function setDropdownValue(event) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function setTextareaScrolling(element) {
|
function setTextareaScrolling(element) {
|
||||||
var isScrolling = element.scrollHeight > element.offsetHeight;
|
let isScrolling = element.scrollHeight > element.offsetHeight;
|
||||||
element.setAttribute("scrolling", isScrolling ? "true" : "false");
|
element.setAttribute("scrolling", isScrolling ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3236,22 +3236,22 @@ function loaded() {
|
||||||
let elParentMaterialNameNumber = getPropertyInputElement("submeshToReplace");
|
let elParentMaterialNameNumber = getPropertyInputElement("submeshToReplace");
|
||||||
let elParentMaterialNameCheckbox = getPropertyInputElement("selectSubmesh");
|
let elParentMaterialNameCheckbox = getPropertyInputElement("selectSubmesh");
|
||||||
elParentMaterialNameString.addEventListener('change', function () {
|
elParentMaterialNameString.addEventListener('change', function () {
|
||||||
updateProperty("parentMaterialName", MATERIAL_PREFIX_STRING + this.value);
|
updateProperty("parentMaterialName", MATERIAL_PREFIX_STRING + this.value, false);
|
||||||
});
|
});
|
||||||
elParentMaterialNameNumber.addEventListener('change', function () {
|
elParentMaterialNameNumber.addEventListener('change', function () {
|
||||||
updateProperty("parentMaterialName", this.value);
|
updateProperty("parentMaterialName", this.value, false);
|
||||||
});
|
});
|
||||||
elParentMaterialNameCheckbox.addEventListener('change', function () {
|
elParentMaterialNameCheckbox.addEventListener('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
updateProperty("parentMaterialName", elParentMaterialNameNumber.value);
|
updateProperty("parentMaterialName", elParentMaterialNameNumber.value, false);
|
||||||
showParentMaterialNameBox(true, elParentMaterialNameNumber, elParentMaterialNameString);
|
showParentMaterialNameBox(true, elParentMaterialNameNumber, elParentMaterialNameString);
|
||||||
} else {
|
} else {
|
||||||
updateProperty("parentMaterialName", MATERIAL_PREFIX_STRING + elParentMaterialNameString.value);
|
updateProperty("parentMaterialName", MATERIAL_PREFIX_STRING + elParentMaterialNameString.value, false);
|
||||||
showParentMaterialNameBox(false, elParentMaterialNameNumber, elParentMaterialNameString);
|
showParentMaterialNameBox(false, elParentMaterialNameNumber, elParentMaterialNameString);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getPropertyInputElement("image").addEventListener('change', createImageURLUpdateFunction('textures'));
|
getPropertyInputElement("image").addEventListener('change', createImageURLUpdateFunction('textures', false));
|
||||||
|
|
||||||
// Collapsible sections
|
// Collapsible sections
|
||||||
let elCollapsible = document.getElementsByClassName("section-header");
|
let elCollapsible = document.getElementsByClassName("section-header");
|
||||||
|
@ -3346,12 +3346,12 @@ function loaded() {
|
||||||
let propertyID = elDropdown.getAttribute("propertyID");
|
let propertyID = elDropdown.getAttribute("propertyID");
|
||||||
let property = properties[propertyID];
|
let property = properties[propertyID];
|
||||||
property.elInput = dt;
|
property.elInput = dt;
|
||||||
dt.addEventListener('change', createEmitTextPropertyUpdateFunction(property.name));
|
dt.addEventListener('change', createEmitTextPropertyUpdateFunction(property.name, property.isParticleProperty));
|
||||||
}
|
}
|
||||||
|
|
||||||
elDropdowns = document.getElementsByTagName("select");
|
elDropdowns = document.getElementsByTagName("select");
|
||||||
while (elDropdowns.length > 0) {
|
while (elDropdowns.length > 0) {
|
||||||
var el = elDropdowns[0];
|
let el = elDropdowns[0];
|
||||||
el.parentNode.removeChild(el);
|
el.parentNode.removeChild(el);
|
||||||
elDropdowns = document.getElementsByTagName("select");
|
elDropdowns = document.getElementsByTagName("select");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue