From d920a3d7214f581e33a85fd32679ca96c4a8a79c Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 9 Feb 2016 18:05:14 -0800 Subject: [PATCH] updates --- .../CellScience/Scripts/deleteAll.js | 17 ---- .../CellScience/Scripts/findScripts.js | 21 ----- .../CellScience/Scripts/navigationButton.js | 18 ++-- .../Scripts/playBackgroundAudio.js | 86 ------------------- .../DomainContent/CellScience/Scripts/zoom.js | 9 +- .../CellScience/importCellScience.js | 74 +++++++--------- 6 files changed, 42 insertions(+), 183 deletions(-) delete mode 100644 unpublishedScripts/DomainContent/CellScience/Scripts/deleteAll.js delete mode 100644 unpublishedScripts/DomainContent/CellScience/Scripts/findScripts.js delete mode 100644 unpublishedScripts/DomainContent/CellScience/Scripts/playBackgroundAudio.js diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/deleteAll.js b/unpublishedScripts/DomainContent/CellScience/Scripts/deleteAll.js deleted file mode 100644 index 716a5a8424..0000000000 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/deleteAll.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 High Fidelity, Inc. -// -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -function deleteAllInRadius(r) { - var n = 0; - var arrayFound = Entities.findEntities(MyAvatar.position, r); - for (var i = 0; i < arrayFound.length; i++) { - Entities.deleteEntity(arrayFound[i]); - } - print("deleted " + arrayFound.length + " entities"); -} - -deleteAllInRadius(100000); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/findScripts.js b/unpublishedScripts/DomainContent/CellScience/Scripts/findScripts.js deleted file mode 100644 index bdf6278f19..0000000000 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/findScripts.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 High Fidelity, Inc. -// -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -var scriptName = "Controller"; - -function findScriptsInRadius(r) { - var n = 0; - var arrayFound = Entities.findEntities(MyAvatar.position, r); - for (var i = 0; i < arrayFound.length; i++) { - if (Entities.getEntityProperties(arrayFound[i]).script.indexOf(scriptName) != -1) { - n++; - } - } - print("found " + n + " copies of " + scriptName); -} - -findScriptsInRadius(100000); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js b/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js index ee8e3d0753..4136f1f81b 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js @@ -23,32 +23,32 @@ } this.initialize = function(entityId) { - // print(' should initialize' + entityId) + print('JBP nav button should initialize' + entityId) var properties = Entities.getEntityProperties(entityId); if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) { self.initTimeout = Script.setTimeout(function() { - // print(' no user data yet, try again in one second') + print('JBP no user data yet, try again in one second') self.initialize(entityId); }, 1000) } else { - // print(' userdata before parse attempt' + properties.userData) + print('JBP userdata before parse attempt' + properties.userData) self.userData = null; try { self.userData = JSON.parse(properties.userData); } catch (err) { - // print(' error parsing json'); - // print(' properties are:' + properties.userData); + print('JBP error parsing json'); + print('JBP properties are:' + properties.userData); return; } - + var mySavedSettings = Settings.getValue(entityId); if (mySavedSettings.buttons !== undefined) { - //print(' preload buttons' + mySavedSettings.buttons) + print('JBP preload buttons' + mySavedSettings.buttons) mySavedSettings.buttons.forEach(function(b) { - //print(' deleting button' + b) + print('JBP deleting button' + b) Overlays.deleteOverlay(b); }) Settings.setValue(entityId, '') @@ -56,7 +56,7 @@ self.buttonImageURL = baseURL + "GUI/GUI_" + self.userData.name + ".png?" + version; - //print('BUTTON IMAGE URL:' + self.buttonImageURL) + print('JBP BUTTON IMAGE URL:' + self.buttonImageURL) if (self.button === undefined) { // print('NAV NO BUTTON ADDING ONE!!') self.button = true; diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/playBackgroundAudio.js b/unpublishedScripts/DomainContent/CellScience/Scripts/playBackgroundAudio.js deleted file mode 100644 index 87302dd743..0000000000 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/playBackgroundAudio.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2016 High Fidelity, Inc. -// -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -(function() { - var self = this; - var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"; - var version = 11; - this.preload = function(entityId) { - self.soundPlaying = false; - self.entityId = entityId; - this.initTimeout = null; - this.initialize(entityId); - } - - this.initialize = function(entityID) { - //print(' should initialize' + entityID) - var properties = Entities.getEntityProperties(entityID); - if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) { - self.initTimeout = Script.setTimeout(function() { - //print(' no user data yet, try again in one second') - self.initialize(entityID); - }, 1000) - - } else { - //print(' userdata before parse attempt' + properties.userData) - self.userData = null; - try { - self.userData = JSON.parse(properties.userData); - } catch (err) { - //print(' error parsing json'); - //print(' properties are:' + properties.userData); - return; - } - - - //print(' USERDATA NAME ' + self.userData.name) - self.soundURL = baseURL + "Audio/" + self.userData.name + ".wav?" + version; - //print(" creating WAV name location is " + baseURL + "Audio/" + self.userData.name + ".wav"); - //print(' self soundURL' + self.soundURL) - - self.soundOptions = { - stereo: true, - loop: true, - localOnly: true, - volume: 0.035 - }; - - self.sound = SoundCache.getSound(self.soundURL); - } - } - - this.enterEntity = function(entityID) { - //print("entering audio zone"); - if (self.sound.downloaded) { - //print("playing background audio named " + self.userData.name + "which has been downloaded"); - this.soundPlaying = Audio.playSound(self.sound, self.soundOptions); - - } else { - //print("sound is not downloaded"); - } - } - - this.leaveEntity = function(entityID) { - //print("leaving audio area " + self.userData.name); - if (self.soundPlaying !== false) { - //print("not null"); - //print("Stopped sound " + self.userData.name); - self.soundPlaying.stop(); - } else { - //print("Sound not playing"); - } - } - - this.unload = function() { - if (this.initTimeout !== null) { - Script.clearTimeout(this.initTimeout); - } - } - - - -}); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js b/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js index f29d5023c9..da41ec64ba 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js @@ -45,12 +45,11 @@ } this.enterEntity = function(entityID) { - print('JBP ENTERED A BOUNDARY ENTITY, SHOULD ZOOM', entityID) - + //print('ENTERED A BOUNDARY ENTITY, SHOULD ZOOM', entityID) var data = JSON.parse(Entities.getEntityProperties(this.entityId).userData); - print('JBP DATA IS::' + data) + //print('DATA IS::' + data) if (data != null) { - print("JBP Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")"); + print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")"); MyAvatar.position = data.location; @@ -65,7 +64,7 @@ } this.lookAtTarget = function(entryPoint,target) { - print('JBP SHOULD LOOK AT TARGET') + //print('SHOULD LOOK AT TARGET') var direction = Vec3.normalize(Vec3.subtract(entryPoint, target)); var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { x: 1, diff --git a/unpublishedScripts/DomainContent/CellScience/importCellScience.js b/unpublishedScripts/DomainContent/CellScience/importCellScience.js index acc68da932..3885a29b89 100644 --- a/unpublishedScripts/DomainContent/CellScience/importCellScience.js +++ b/unpublishedScripts/DomainContent/CellScience/importCellScience.js @@ -5,7 +5,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var version = 1021; +var version = 1029; var cellLayout; var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"; @@ -163,7 +163,7 @@ var scenes = [{ z: 0 }, radius: 300, - number: 15, + number: 7, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -188,7 +188,7 @@ var scenes = [{ z: 0 }, radius: 1000, - number: 45, + number: 22, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -210,7 +210,7 @@ var scenes = [{ z: 976 }, radius: 140, - number: 20, + number: 10, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -232,7 +232,7 @@ var scenes = [{ z: 976 }, radius: 115, - number: 15, + number: 7, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -254,7 +254,7 @@ var scenes = [{ z: 0 }, radius: 600, - number: 30, + number: 15, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -276,7 +276,7 @@ var scenes = [{ z: 0 }, radius: 1600, - number: 45, + number: 22, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -298,7 +298,7 @@ var scenes = [{ z: 0 }, radius: 1400, - number: 45, + number: 22, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -320,7 +320,7 @@ var scenes = [{ z: 0 }, radius: 1800, - number: 45, + number: 22, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -365,7 +365,7 @@ var scenes = [{ z: 771 }, radius: 80, - number: 15, + number: 7, userData: JSON.stringify({ grabbableKey: { grabbable: false @@ -390,13 +390,15 @@ var scenes = [{ z: 771 }, radius: 60, - number: 15, + number: 7, userData: JSON.stringify({ grabbableKey: { grabbable: false - } + }, + target: locations.hexokinase[1], + location: locations.hexokinase[0], }), - script: "", + script: "zoom.js?" + version, visible: true }, { model: "glucose_isomerase", @@ -412,13 +414,15 @@ var scenes = [{ z: 771 }, radius: 70, - number: 15, + number: 7, userData: JSON.stringify({ grabbableKey: { grabbable: false - } + }, + target: locations.hexokinase[1], + location: locations.hexokinase[0], }), - script: "", + script: "zoom.js?" + version, visible: true } // { @@ -598,8 +602,6 @@ function ImportScene(scene) { CreateInstances(scene); CreateBoundary(scene); - // CreateBackgroundAudio(scene.name, scene.location, scene.dimensions); - // print("done " + scene.name); } @@ -647,7 +649,7 @@ function CreateNavigationButton(scene, number) { Entities.addEntity({ - type: "Sphere", + type: "Box", name: scene.name + " navigation button", color: { red: 200, @@ -655,9 +657,9 @@ function CreateNavigationButton(scene, number) { blue: 0 }, dimensions: { - x: 10, - y: 10, - z: 10 + x: 16000, + y: 16000, + z: 16000 }, visible: false, userData: JSON.stringify({ @@ -670,10 +672,13 @@ function CreateNavigationButton(scene, number) { grabbable: false } }), - // position:{x:3000,y:13500,z:3000}, + position: { + x: 0, + y: 0, + z: 0 + }, script: baseLocation + "Scripts/navigationButton.js?" + version, collisionless: true, - }); } @@ -850,27 +855,6 @@ function CreateIdentification(name, position, rotation, dimensions, showDistance } -function CreateBackgroundAudio(name, position) { - Entities.addEntity({ - type: "Sphere", - name: "Location " + name + " background audio", - dimensions: { - x: 4000, - y: 4000, - z: 4000 - }, - position: position, - visible: false, - userData: JSON.stringify({ - name: name, - baseURL: baseLocation - }), - script: baseLocation + "Scripts/playBackgroundAudio.js?" + version, - collisionless: true, - - }); - -} function getPointOnSphereOfRadius(radius, number, totalNumber) {