loading and rendering atp and http image files

This commit is contained in:
Elisa Lupin-Jimenez 2018-01-23 16:45:54 -08:00
parent 42151b8fd4
commit fe3bc00baa

View file

@ -136,7 +136,8 @@ function createEmitGroupNumberPropertyUpdateFunction(group, propertyName) {
function createImageURLUpdateFunction(propertyName) { function createImageURLUpdateFunction(propertyName) {
return function () { return function () {
updateProperty(propertyName, this.value); var newTextures = JSON.stringify({ "tex.picture": this.value });
updateProperty(propertyName, newTextures);
}; };
} }
@ -511,10 +512,6 @@ function loaded() {
var elPropertiesList = document.getElementById("properties-list"); var elPropertiesList = document.getElementById("properties-list");
var elID = document.getElementById("property-id"); var elID = document.getElementById("property-id");
var elType = document.getElementById("property-type"); var elType = document.getElementById("property-type");
<<<<<<< HEAD
=======
debugPrint("the type is: " + JSON.stringify(elType));
>>>>>>> creating new image entity opens image property options
var elTypeIcon = document.getElementById("type-icon"); var elTypeIcon = document.getElementById("type-icon");
var elName = document.getElementById("property-name"); var elName = document.getElementById("property-name");
var elLocked = document.getElementById("property-locked"); var elLocked = document.getElementById("property-locked");
@ -665,28 +662,16 @@ function loaded() {
var elZoneKeyLightDirectionY = document.getElementById("property-zone-key-light-direction-y"); var elZoneKeyLightDirectionY = document.getElementById("property-zone-key-light-direction-y");
// Skybox // Skybox
<<<<<<< HEAD
var elZoneSkyboxModeInherit = document.getElementById("property-zone-skybox-mode-inherit"); var elZoneSkyboxModeInherit = document.getElementById("property-zone-skybox-mode-inherit");
var elZoneSkyboxModeDisabled = document.getElementById("property-zone-skybox-mode-disabled"); var elZoneSkyboxModeDisabled = document.getElementById("property-zone-skybox-mode-disabled");
var elZoneSkyboxModeEnabled = document.getElementById("property-zone-skybox-mode-enabled"); var elZoneSkyboxModeEnabled = document.getElementById("property-zone-skybox-mode-enabled");
=======
var elZoneSkyboxModeInherit = document.getElementById("property-zone-skybox-mode-inherit");
var elZoneSkyboxModeDisabled = document.getElementById("property-zone-skybox-mode-disabled");
var elZoneSkyboxModeEnabled = document.getElementById("property-zone-skybox-mode-enabled");
>>>>>>> creating new image entity opens image property options
// Ambient light // Ambient light
var elCopySkyboxURLToAmbientURL = document.getElementById("copy-skybox-url-to-ambient-url"); var elCopySkyboxURLToAmbientURL = document.getElementById("copy-skybox-url-to-ambient-url");
<<<<<<< HEAD
var elZoneAmbientLightModeInherit = document.getElementById("property-zone-ambient-light-mode-inherit"); var elZoneAmbientLightModeInherit = document.getElementById("property-zone-ambient-light-mode-inherit");
var elZoneAmbientLightModeDisabled = document.getElementById("property-zone-ambient-light-mode-disabled"); var elZoneAmbientLightModeDisabled = document.getElementById("property-zone-ambient-light-mode-disabled");
var elZoneAmbientLightModeEnabled = document.getElementById("property-zone-ambient-light-mode-enabled"); var elZoneAmbientLightModeEnabled = document.getElementById("property-zone-ambient-light-mode-enabled");
=======
var elZoneAmbientLightModeInherit = document.getElementById("property-zone-ambient-light-mode-inherit");
var elZoneAmbientLightModeDisabled = document.getElementById("property-zone-ambient-light-mode-disabled");
var elZoneAmbientLightModeEnabled = document.getElementById("property-zone-ambient-light-mode-enabled");
>>>>>>> creating new image entity opens image property options
var elZoneAmbientLightIntensity = document.getElementById("property-zone-key-ambient-intensity"); var elZoneAmbientLightIntensity = document.getElementById("property-zone-key-ambient-intensity");
var elZoneAmbientLightURL = document.getElementById("property-zone-key-ambient-url"); var elZoneAmbientLightURL = document.getElementById("property-zone-key-ambient-url");
@ -803,11 +788,6 @@ function loaded() {
} else { } else {
properties = data.selections[0].properties; properties = data.selections[0].properties;
<<<<<<< HEAD
=======
debugPrint("props: " + JSON.stringify(properties));
>>>>>>> creating new image entity opens image property options
if (lastEntityID !== '"' + properties.id + '"' && lastEntityID !== null && editor !== null) { if (lastEntityID !== '"' + properties.id + '"' && lastEntityID !== null && editor !== null) {
saveJSONUserData(true); saveJSONUserData(true);
} }
@ -816,14 +796,11 @@ function loaded() {
lastEntityID = '"' + properties.id + '"'; lastEntityID = '"' + properties.id + '"';
elID.value = properties.id; elID.value = properties.id;
<<<<<<< HEAD // HTML workaround since image is not yet a separate entity type
=======
// image is not yet a separate entity type
if (properties.type === "Model" && properties.modelURL === "https://hifi-content.s3.amazonaws.com/elisalj/image_entity/snapshot.fbx") { if (properties.type === "Model" && properties.modelURL === "https://hifi-content.s3.amazonaws.com/elisalj/image_entity/snapshot.fbx") {
properties.type = "Image"; properties.type = "Image";
} }
>>>>>>> creating new image entity opens image property options
// Create class name for css ruleset filtering // Create class name for css ruleset filtering
elPropertiesList.className = properties.type + 'Menu'; elPropertiesList.className = properties.type + 'Menu';
@ -1022,8 +999,9 @@ function loaded() {
elWebSourceURL.value = properties.sourceUrl; elWebSourceURL.value = properties.sourceUrl;
elWebDPI.value = properties.dpi; elWebDPI.value = properties.dpi;
} else if (properties.type === "Image") { } else if (properties.type === "Image") {
elImageURL.value = properties.imageURL; var imageLink = JSON.parse(properties.textures)["tex.picture"];
//elImageURL.value = properties.sourceURL; debugPrint("image url is: " + imageLink);
elImageURL.value = imageLink;
} else if (properties.type === "Text") { } else if (properties.type === "Text") {
elTextText.value = properties.text; elTextText.value = properties.text;
elTextLineHeight.value = properties.lineHeight.toFixed(4); elTextLineHeight.value = properties.lineHeight.toFixed(4);
@ -1052,15 +1030,9 @@ function loaded() {
} else if (properties.type === "Zone") { } else if (properties.type === "Zone") {
// Key light // Key light
<<<<<<< HEAD
elZoneKeyLightModeInherit.checked = (properties.keyLightMode === 'inherit'); elZoneKeyLightModeInherit.checked = (properties.keyLightMode === 'inherit');
elZoneKeyLightModeDisabled.checked = (properties.keyLightMode === 'disabled'); elZoneKeyLightModeDisabled.checked = (properties.keyLightMode === 'disabled');
elZoneKeyLightModeEnabled.checked = (properties.keyLightMode === 'enabled'); elZoneKeyLightModeEnabled.checked = (properties.keyLightMode === 'enabled');
=======
elZoneKeyLightModeInherit.checked = (properties.keyLightMode === 'inherit');
elZoneKeyLightModeDisabled.checked = (properties.keyLightMode === 'disabled');
elZoneKeyLightModeEnabled.checked = (properties.keyLightMode === 'enabled');
>>>>>>> creating new image entity opens image property options
elZoneKeyLightColor.style.backgroundColor = "rgb(" + properties.keyLight.color.red + "," + elZoneKeyLightColor.style.backgroundColor = "rgb(" + properties.keyLight.color.red + "," +
properties.keyLight.color.green + "," + properties.keyLight.color.blue + ")"; properties.keyLight.color.green + "," + properties.keyLight.color.blue + ")";
@ -1072,7 +1044,6 @@ function loaded() {
elZoneKeyLightDirectionY.value = properties.keyLight.direction.y.toFixed(2); elZoneKeyLightDirectionY.value = properties.keyLight.direction.y.toFixed(2);
// Skybox // Skybox
<<<<<<< HEAD
elZoneSkyboxModeInherit.checked = (properties.skyboxMode === 'inherit'); elZoneSkyboxModeInherit.checked = (properties.skyboxMode === 'inherit');
elZoneSkyboxModeDisabled.checked = (properties.skyboxMode === 'disabled'); elZoneSkyboxModeDisabled.checked = (properties.skyboxMode === 'disabled');
elZoneSkyboxModeEnabled.checked = (properties.skyboxMode === 'enabled'); elZoneSkyboxModeEnabled.checked = (properties.skyboxMode === 'enabled');
@ -1081,30 +1052,14 @@ function loaded() {
elZoneAmbientLightModeInherit.checked = (properties.ambientLightMode === 'inherit'); elZoneAmbientLightModeInherit.checked = (properties.ambientLightMode === 'inherit');
elZoneAmbientLightModeDisabled.checked = (properties.ambientLightMode === 'disabled'); elZoneAmbientLightModeDisabled.checked = (properties.ambientLightMode === 'disabled');
elZoneAmbientLightModeEnabled.checked = (properties.ambientLightMode === 'enabled'); elZoneAmbientLightModeEnabled.checked = (properties.ambientLightMode === 'enabled');
=======
elZoneSkyboxModeInherit.checked = (properties.skyboxMode === 'inherit');
elZoneSkyboxModeDisabled.checked = (properties.skyboxMode === 'disabled');
elZoneSkyboxModeEnabled.checked = (properties.skyboxMode === 'enabled');
// Ambient light
elZoneAmbientLightModeInherit.checked = (properties.ambientLightMode === 'inherit');
elZoneAmbientLightModeDisabled.checked = (properties.ambientLightMode === 'disabled');
elZoneAmbientLightModeEnabled.checked = (properties.ambientLightMode === 'enabled');
>>>>>>> creating new image entity opens image property options
elZoneAmbientLightIntensity.value = properties.ambientLight.ambientIntensity.toFixed(2); elZoneAmbientLightIntensity.value = properties.ambientLight.ambientIntensity.toFixed(2);
elZoneAmbientLightURL.value = properties.ambientLight.ambientURL; elZoneAmbientLightURL.value = properties.ambientLight.ambientURL;
// Haze // Haze
<<<<<<< HEAD
elZoneHazeModeInherit.checked = (properties.hazeMode === 'inherit'); elZoneHazeModeInherit.checked = (properties.hazeMode === 'inherit');
elZoneHazeModeDisabled.checked = (properties.hazeMode === 'disabled'); elZoneHazeModeDisabled.checked = (properties.hazeMode === 'disabled');
elZoneHazeModeEnabled.checked = (properties.hazeMode === 'enabled'); elZoneHazeModeEnabled.checked = (properties.hazeMode === 'enabled');
=======
elZoneHazeModeInherit.checked = (properties.hazeMode === 'inherit');
elZoneHazeModeDisabled.checked = (properties.hazeMode === 'disabled');
elZoneHazeModeEnabled.checked = (properties.hazeMode === 'enabled');
>>>>>>> creating new image entity opens image property options
elZoneHazeRange.value = properties.haze.hazeRange.toFixed(0); elZoneHazeRange.value = properties.haze.hazeRange.toFixed(0);
elZoneHazeColor.style.backgroundColor = "rgb(" + elZoneHazeColor.style.backgroundColor = "rgb(" +
@ -1370,24 +1325,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-color-control2').attr('active', 'true'); $('#property-color-control2').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-color-control2').attr('active', 'false'); $('#property-color-control2').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b); emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b);
} }
})); }));
@ -1403,24 +1349,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-light-color').attr('active', 'true'); $('#property-light-color').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-light-color').attr('active', 'false'); $('#property-light-color').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b); emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b);
} }
})); }));
@ -1432,7 +1369,7 @@ function loaded() {
elShape.addEventListener('change', createEmitTextPropertyUpdateFunction('shape')); elShape.addEventListener('change', createEmitTextPropertyUpdateFunction('shape'));
elImageURL.addEventListener('change', createImageURLUpdateFunction('imageURL')); elImageURL.addEventListener('change', createImageURLUpdateFunction('textures'));
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl')); elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
elWebDPI.addEventListener('change', createEmitNumberPropertyUpdateFunction('dpi', 0)); elWebDPI.addEventListener('change', createEmitNumberPropertyUpdateFunction('dpi', 0));
@ -1469,24 +1406,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-text-text-color').attr('active', 'true'); $('#property-text-text-color').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-text-text-color').attr('active', 'false'); $('#property-text-text-color').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
$(el).attr('active', 'false'); $(el).attr('active', 'false');
emitColorPropertyUpdate('textColor', rgb.r, rgb.g, rgb.b); emitColorPropertyUpdate('textColor', rgb.r, rgb.g, rgb.b);
} }
@ -1502,24 +1430,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-text-background-color').attr('active', 'true'); $('#property-text-background-color').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-text-background-color').attr('active', 'false'); $('#property-text-background-color').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('backgroundColor', rgb.r, rgb.g, rgb.b); emitColorPropertyUpdate('backgroundColor', rgb.r, rgb.g, rgb.b);
} }
})); }));
@ -1536,24 +1455,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-zone-key-light-color').attr('active', 'true'); $('#property-zone-key-light-color').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-zone-key-light-color').attr('active', 'false'); $('#property-zone-key-light-color').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'keyLight'); emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'keyLight');
} }
})); }));
@ -1614,24 +1524,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-zone-haze-color').attr('active', 'true'); $('#property-zone-haze-color').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-zone-haze-color').attr('active', 'false'); $('#property-zone-haze-color').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('hazeColor', rgb.r, rgb.g, rgb.b, 'haze'); emitColorPropertyUpdate('hazeColor', rgb.r, rgb.g, rgb.b, 'haze');
} }
})); }));
@ -1648,24 +1549,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-zone-haze-glare-color').attr('active', 'true'); $('#property-zone-haze-glare-color').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-zone-haze-glare-color').attr('active', 'false'); $('#property-zone-haze-glare-color').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('hazeGlareColor', rgb.r, rgb.g, rgb.b, 'haze'); emitColorPropertyUpdate('hazeGlareColor', rgb.r, rgb.g, rgb.b, 'haze');
} }
})); }));
@ -1699,24 +1591,15 @@ function loaded() {
colorScheme: 'dark', colorScheme: 'dark',
layout: 'hex', layout: 'hex',
color: '000000', color: '000000',
<<<<<<< HEAD
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
=======
>>>>>>> creating new image entity opens image property options
onShow: function(colpick) { onShow: function(colpick) {
$('#property-zone-skybox-color').attr('active', 'true'); $('#property-zone-skybox-color').attr('active', 'true');
}, },
onHide: function(colpick) { onHide: function(colpick) {
$('#property-zone-skybox-color').attr('active', 'false'); $('#property-zone-skybox-color').attr('active', 'false');
}, },
<<<<<<< HEAD
onChange: function(hsb, hex, rgb, el) { onChange: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex); $(el).css('background-color', '#' + hex);
=======
onSubmit: function(hsb, hex, rgb, el) {
$(el).css('background-color', '#' + hex);
$(el).colpickHide();
>>>>>>> creating new image entity opens image property options
emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'skybox'); emitColorPropertyUpdate('color', rgb.r, rgb.g, rgb.b, 'skybox');
} }
})); }));