mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-31 07:40:34 +02:00
Fix new models not obeying dynamic checkbox
This commit is contained in:
parent
db87fe9696
commit
4593b33435
1 changed files with 9 additions and 27 deletions
|
@ -484,23 +484,28 @@ var toolBar = (function () {
|
||||||
originalProperties[key] = newProperties[key];
|
originalProperties[key] = newProperties[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function createNewEntity(properties) {
|
function createNewEntity(requestedProperties) {
|
||||||
var dimensions = properties.dimensions ? properties.dimensions : DEFAULT_DIMENSIONS;
|
var dimensions = requestedProperties.dimensions ? requestedProperties.dimensions : DEFAULT_DIMENSIONS;
|
||||||
var position = getPositionToCreateEntity();
|
var position = getPositionToCreateEntity();
|
||||||
var entityID = null;
|
var entityID = null;
|
||||||
|
|
||||||
|
var properties = {};
|
||||||
|
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.All);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.All);
|
||||||
|
|
||||||
var type = properties.type;
|
var type = requestedProperties.type;
|
||||||
if (type == "Box" || type == "Sphere") {
|
if (type == "Box" || type == "Sphere") {
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Shape);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Shape);
|
||||||
} else if (type == "Image") {
|
} else if (type == "Image") {
|
||||||
properties.type = "Model";
|
requestedProperties.type = "Model";
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Image);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Image);
|
||||||
} else {
|
} else {
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES[type]);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES[type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We apply the requested properties first so that they take priority over any default properties.
|
||||||
|
applyProperties(properties, requestedProperties);
|
||||||
|
|
||||||
|
|
||||||
if (position !== null && position !== undefined) {
|
if (position !== null && position !== undefined) {
|
||||||
var direction;
|
var direction;
|
||||||
|
@ -845,41 +850,18 @@ var toolBar = (function () {
|
||||||
addButton("newCubeButton", function () {
|
addButton("newCubeButton", function () {
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Box",
|
type: "Box",
|
||||||
dimensions: DEFAULT_DIMENSIONS,
|
|
||||||
color: {
|
|
||||||
red: 255,
|
|
||||||
green: 0,
|
|
||||||
blue: 0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
addButton("newSphereButton", function () {
|
addButton("newSphereButton", function () {
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Sphere",
|
type: "Sphere",
|
||||||
dimensions: DEFAULT_DIMENSIONS,
|
|
||||||
color: {
|
|
||||||
red: 255,
|
|
||||||
green: 0,
|
|
||||||
blue: 0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
addButton("newLightButton", function () {
|
addButton("newLightButton", function () {
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Light",
|
type: "Light",
|
||||||
isSpotlight: false,
|
|
||||||
color: {
|
|
||||||
red: 150,
|
|
||||||
green: 150,
|
|
||||||
blue: 150
|
|
||||||
},
|
|
||||||
constantAttenuation: 1,
|
|
||||||
linearAttenuation: 0,
|
|
||||||
quadraticAttenuation: 0,
|
|
||||||
exponent: 0,
|
|
||||||
cutoff: 180 // in degrees
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue