From 8899ac71a18fb96eb296859d6bdc6b126d1061dd Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Mon, 25 Apr 2016 10:16:39 -0700 Subject: [PATCH 01/16] move cellscience to production --- .../CellScience/Scripts/billboard.js | 2 +- .../CellScience/Scripts/clickToRideAndLook.js | 2 +- .../CellScience/Scripts/navigationButton.js | 2 +- .../Scripts/showButtonToPlaySound.js | 203 +++++++++--------- .../CellScience/Scripts/showIdentification.js | 2 +- .../DomainContent/CellScience/Scripts/zoom.js | 15 +- .../CellScience/backgroundMusicAC.js | 8 +- ...portCellScience.js => importEverything.js} | 65 +++--- .../CellScience/motorProteinControllerAC.js | 8 +- .../DomainContent/CellScience/moveCellsAC.js | 1 - .../CellScience/moveVesiclesAC.js | 1 - 11 files changed, 161 insertions(+), 148 deletions(-) rename unpublishedScripts/DomainContent/CellScience/{importCellScience.js => importEverything.js} (99%) diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/billboard.js b/unpublishedScripts/DomainContent/CellScience/Scripts/billboard.js index e0d5fe0cac..b5e725cfcf 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/billboard.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/billboard.js @@ -6,7 +6,7 @@ // -var spriteURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Sprites/nucleosomes_sprite.fbx"; +var spriteURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Sprites/nucleosomes_sprite.fbx"; var spriteDimensions = { x: 10, y: 10, diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/clickToRideAndLook.js b/unpublishedScripts/DomainContent/CellScience/Scripts/clickToRideAndLook.js index d6a9b79467..61ccec9f9b 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/clickToRideAndLook.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/clickToRideAndLook.js @@ -13,7 +13,7 @@ z: -1 } - var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; var self = this; diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js b/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js index b143678b42..9992c13acb 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/navigationButton.js @@ -14,7 +14,7 @@ Script.include(utilsScript); var self = this; - var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; this.preload = function(entityId) { this.entityId = entityId; diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/showButtonToPlaySound.js b/unpublishedScripts/DomainContent/CellScience/Scripts/showButtonToPlaySound.js index 8ee5e0092e..6ee3b9645b 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/showButtonToPlaySound.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/showButtonToPlaySound.js @@ -6,113 +6,114 @@ // (function() { - var baseURL = "https://hifi-content.s3.amazonaws.com/hifi-content/DomainContent/CellScience/"; - var self = this; - this.buttonImageURL = baseURL + "GUI/play_audio.svg?2"; + var baseURL = "https://hifi-production.s3.amazonaws.com/hifi-production/DomainContent/CellScience/"; + var self = this; + this.buttonImageURL = baseURL + "GUI/play_audio.svg?2"; + + this.preload = function(entityId) { + this.entityId = entityId; + this.initialize(entityId) + this.initTimeout = null; + } + + 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; + } + + self.addButton(); + self.buttonShowing = false; + self.showDistance = self.userData.showDistance; + self.soundURL = baseURL + "Audio/" + self.userData.soundName + ".wav"; + // print("distance = " + self.userData.showDistance + ", sound = " + self.soundURL); + self.soundOptions = { + stereo: true, + loop: false, + localOnly: true, + volume: 1 + }; + self.sound = SoundCache.getSound(this.soundURL); - this.preload = function(entityId) { - this.entityId = entityId; - this.initialize(entityId) - this.initTimeout = null; } + } - 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) + this.addButton = function() { + this.windowDimensions = Controller.getViewportDimensions(); + this.buttonWidth = 100; + this.buttonHeight = 100; + this.buttonPadding = 0; + this.buttonPositionX = (self.windowDimensions.x - self.buttonPadding) / 2 - self.buttonWidth; + this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - (self.buttonHeight + self.buttonPadding); + this.button = Overlays.addOverlay("image", { + x: self.buttonPositionX, + y: self.buttonPositionY, + width: self.buttonWidth, + height: self.buttonHeight, + imageURL: self.buttonImageURL, + visible: false, + alpha: 1.0 + }); + } + + this.update = function(deltaTime) { + + self.distance = Vec3.distance(MyAvatar.position, Entities.getEntityProperties(self.entityId).position); + //print(self.distance); + if (!self.buttonShowing && self.distance < self.userData.showDistance) { + self.buttonShowing = true; + Overlays.editOverlay(self.button, { + visible: true + }); + } else if (self.buttonShowing && self.distance > self.userData.showDistance) { + self.buttonShowing = false; + Overlays.editOverlay(self.button, { + visible: false + }); + } + } + + this.onClick = function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + if (clickedOverlay === self.button) { + //print("button was clicked"); + if (self.sound.downloaded) { + //print("play sound"); + Audio.playSound(self.sound, self.soundOptions); } 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; - } - - self.addButton(); - self.buttonShowing = false; - self.showDistance = self.userData.showDistance; - self.soundURL = baseURL + "Audio/" + self.userData.soundName + ".wav"; - // print("distance = " + self.userData.showDistance + ", sound = " + self.soundURL); - self.soundOptions = { - stereo: true, - loop: false, - localOnly: true, - volume: 1 - }; - self.sound = SoundCache.getSound(this.soundURL); - + //print("not downloaded"); } + } + } - this.addButton = function() { - this.windowDimensions = Controller.getViewportDimensions(); - this.buttonWidth = 100; - this.buttonHeight = 100; - this.buttonPadding = 0; + this.unload = function() { + Overlays.deleteOverlay(self.button); + Controller.mousePressEvent.disconnect(this.onClick); + Script.update.disconnect(this.update); + if (this.initTimeout !== null) { + Script.clearTimeout(this.initTimeout); + } + } - this.buttonPositionX = (self.windowDimensions.x - self.buttonPadding) / 2 - self.buttonWidth; - this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - (self.buttonHeight + self.buttonPadding); - this.button = Overlays.addOverlay("image", { - x: self.buttonPositionX, - y: self.buttonPositionY, - width: self.buttonWidth, - height: self.buttonHeight, - imageURL: self.buttonImageURL, - visible: false, - alpha: 1.0 - }); - } + Controller.mousePressEvent.connect(this.onClick); + Script.update.connect(this.update); - this.update = function(deltaTime) { - - self.distance = Vec3.distance(MyAvatar.position, Entities.getEntityProperties(self.entityId).position); - //print(self.distance); - if (!self.buttonShowing && self.distance < self.userData.showDistance) { - self.buttonShowing = true; - Overlays.editOverlay(self.button, { - visible: true - }); - } else if (self.buttonShowing && self.distance > self.userData.showDistance) { - self.buttonShowing = false; - Overlays.editOverlay(self.button, { - visible: false - }); - } - } - - this.onClick = function(event) { - var clickedOverlay = Overlays.getOverlayAtPoint({ - x: event.x, - y: event.y - }); - if (clickedOverlay === self.button) { - //print("button was clicked"); - if (self.sound.downloaded) { - //print("play sound"); - Audio.playSound(self.sound, self.soundOptions); - } else { - //print("not downloaded"); - } - } - } - - this.unload = function() { - Overlays.deleteOverlay(self.button); - Controller.mousePressEvent.disconnect(this.onClick); - Script.update.disconnect(this.update); - if (this.initTimeout !== null) { - Script.clearTimeout(this.initTimeout); - } - } - - Controller.mousePressEvent.connect(this.onClick); - Script.update.connect(this.update); - - }); \ No newline at end of file +}); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/showIdentification.js b/unpublishedScripts/DomainContent/CellScience/Scripts/showIdentification.js index 3f6067693c..a7a74fa79c 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/showIdentification.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/showIdentification.js @@ -8,7 +8,7 @@ (function() { var self = this; - var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; var version = 3; this.preload = function(entityId) { diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js b/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js index 3fc5acae2a..665049198e 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js @@ -22,9 +22,14 @@ this.initialize = function(entityID) { // print(' should initialize') var properties = Entities.getEntityProperties(entityID); - if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) { + if (properties.hasOwnProperty('userData') === false) { self.initTimeout = Script.setTimeout(function() { - // print(' no user data yet, try again in one second') + // print(' no user data yet, try again in one second') + self.initialize(entityID); + }, 1000) + } else if (properties.userData.length === 0 || ) { + self.initTimeout = Script.setTimeout(function() { + // print(' no user data yet, try again in one second') self.initialize(entityID); }, 1000) } else { @@ -39,7 +44,7 @@ volume: 0.5 }; - self.teleportSound = SoundCache.getSound("https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav"); + self.teleportSound = SoundCache.getSound("https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav"); // print(" portal destination is " + self.portalDestination); } } @@ -51,13 +56,13 @@ if (data != null) { print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")"); - MyAvatar.position = data.location; + MyAvatar.position = data.location; } } - this.lookAtTarget = function(entryPoint,target) { + this.lookAtTarget = function(entryPoint, 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, { diff --git a/unpublishedScripts/DomainContent/CellScience/backgroundMusicAC.js b/unpublishedScripts/DomainContent/CellScience/backgroundMusicAC.js index 1b4c06caaa..829dfbeae9 100644 --- a/unpublishedScripts/DomainContent/CellScience/backgroundMusicAC.js +++ b/unpublishedScripts/DomainContent/CellScience/backgroundMusicAC.js @@ -1,6 +1,6 @@ var soundMap = [{ name: 'Cells', - url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Cells.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Cells.wav", audioOptions: { position: { x: 15850, @@ -12,7 +12,7 @@ var soundMap = [{ } }, { name: 'Cell Layout', - url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/CellLayout.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/CellLayout.wav", audioOptions: { position: { x: 15950, @@ -24,7 +24,7 @@ var soundMap = [{ } }, { name: 'Ribsome', - url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Ribosome.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Ribosome.wav", audioOptions: { position: { x: 15650, @@ -36,7 +36,7 @@ var soundMap = [{ } }, { name: 'Hexokinase', - url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Hexokinase.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Hexokinase.wav", audioOptions: { position: { x: 15750, diff --git a/unpublishedScripts/DomainContent/CellScience/importCellScience.js b/unpublishedScripts/DomainContent/CellScience/importEverything.js similarity index 99% rename from unpublishedScripts/DomainContent/CellScience/importCellScience.js rename to unpublishedScripts/DomainContent/CellScience/importEverything.js index bd9da50989..11c3d95523 100644 --- a/unpublishedScripts/DomainContent/CellScience/importCellScience.js +++ b/unpublishedScripts/DomainContent/CellScience/importEverything.js @@ -38,7 +38,7 @@ function transformToSmallerWorld(vector) { } var cellLayout; -var baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"; +var baseLocation = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; var utilsScript = Script.resolvePath('Scripts/utils.js'); Script.include(utilsScript); @@ -219,6 +219,7 @@ var scenes = [{ grabbable: false } }), + script: null, visible: true }, { //golgi vesicles model: "vesicle", @@ -240,7 +241,7 @@ var scenes = [{ grabbable: false } }), - script: "", + script: null, visible: true }, { //golgi vesicles model: "vesicle", @@ -262,6 +263,7 @@ var scenes = [{ grabbable: false } }), + script: null, visible: true }, { model: "vesicle", @@ -283,7 +285,7 @@ var scenes = [{ grabbable: false } }), - script: "", + script: null, visible: true }, { //outer vesicles model: "vesicle", @@ -305,7 +307,7 @@ var scenes = [{ grabbable: false } }), - script: "", + script: null, visible: true }, { //outer vesicles model: "vesicle", @@ -327,6 +329,7 @@ var scenes = [{ grabbable: false } }), + script: null, visible: true }, { //outer vesicles model: "vesicle", @@ -348,6 +351,7 @@ var scenes = [{ grabbable: false } }), + script: null, visible: true }, { model: "hexokinase", @@ -469,7 +473,7 @@ var scenes = [{ grabbable: false } }), - script: "", + script: null, visible: true }], boundary: { @@ -518,7 +522,7 @@ var scenes = [{ grabbable: false } }), - script: "", + script: null, visible: true }], boundary: { @@ -863,15 +867,8 @@ function getPointOnSphereOfRadius(radius, number, totalNumber) { } function CreateEntity(name, position, rotation, dimensions, url, script, userData, visible) { - var scriptLocation; - if (script === "") { - scriptLocation = ""; - } else { - scriptLocation = baseLocation + "Scripts/" + script; - } - //print(' SCRIPT LOCATION IN CREATE ENTITY' + scriptLocation) - Entities.addEntity({ + var entityProps = { type: "Model", name: name, position: position, @@ -895,11 +892,19 @@ function CreateEntity(name, position, rotation, dimensions, url, script, userDat startAutomatically: true }), userData: userData, - script: scriptLocation, collisionless: true, shapeType: "compound", compoundShapeURL: url - }); + } + + + if (script !== null) { + if (script !== "" && typeof script !== undefined) { + entityProps.script = baseLocation + "Scripts/" + script; + } + } + + Entities.addEntity(entityProps); // print("added " + name + " at (" + position.x + ", " + position.y + ", " + position.z + ")"); @@ -9001,20 +9006,28 @@ function assignVariables() { cellLayout = "Object Name,TranslateX,TranslateY,TranslateZ,DimensionX,DimensionY,DimensionZ, RotateX, RotateY, RotateZ;NPC,197.8817968,187.1750856,343.3718791,24.13382446,34.22486206,30.38697693,46.23119528,-8.353895581,8.869973765;NPC,213.3709151,2.456316462,423.9885128,25.53621185,34.58618774,24.07834717,90.38281992,-7.832244708,0;NPC,33.34912856,2.090308135,365.04642,25.53621185,34.58618774,24.07834717,90.39885078,-38.49088523,0;NPC,397.5101386,159.5911591,319.6113615,25.53621185,34.58618774,24.07834717,50.3605842,37.83254121,0;NPC,156.5827125,-122.5087526,377.9210147,25.53621185,34.58618774,24.07834717,115.9481277,-11.66518146,0;golgi,-318.7046145,66.9773569,976.6478796,211.1744971,156.6775269,204.0570996,115.0039041,-35.67118658,-77.29622127;golgi,456.0077009,0,-837.4997205,235.0718115,174.4077612,227.1489771,-25.72753579,12.39046363,101.1906405;microtubule1,212.4149854,132.4649414,944.2434082,142.5869824,122.8758984,880.6406836,0,0,0;microtubule10,673.8832031,311.0911194,-148.9548248,200.3548828,452.0626831,200.2862878,0,0,0;microtubule11,732.2112598,361.0221094,-546.264873,89.10005859,364.5919922,488.656582,0,0,0;microtubule12,739.5973828,340.5306592,-314.7477979,71.43855469,381.5696191,163.5716895,0,0,0;microtubule13,547.683501,315.5453137,-194.0386853,450.7195605,452.5557788,230.4621606,0,0,0;microtubule14,556.663916,415.2724512,-436.4479395,283.920293,207.0583008,657.0294727,0,0,0;microtubule15,660.601377,201.7332788,-572.2047363,508.4347852,224.4388916,408.4554492,0,0,0;microtubule16,506.7585205,204.8784119,-527.3789355,154.4813965,242.6824146,450.410918,0,0,0;microtubule17,212.1601877,58.27322021,-728.5755762,367.6139996,489.4616455,107.694668,0,0,0;microtubule18,398.5259912,137.8724231,-665.1991992,112.6322754,371.4562866,196.6646484,0,0,0;microtubule19,380.7953174,226.3009131,-449.3071655,81.91825195,156.3450879,654.2884424,0,0,0;microtubule2,30.6969873,141.0839227,876.8226709,232.4791699,192.0579456,920.3092676,0,0,0;microtubule20,-17.70177979,102.1328238,-793.8511963,249.8578271,254.9617255,626.1412793,0,0,0;microtubule21,77.27729828,414.6652734,-875.5563281,112.0010284,370.8857812,414.7598437,0,0,0;microtubule22,206.3877283,127.7296783,-799.063623,248.5948755,233.9102527,596.1479883,0,0,0;microtubule23,26.83012939,306.4021143,-869.8149609,151.6807324,229.8870996,438.0902344,0,0,0;microtubule24,130.2055444,10.68804199,-875.882373,102.7668896,337.1855273,478.814707,0,0,0;microtubule25,466.3101562,323.6335986,125.3250128,363.4645312,146.882959,368.3232751,0,0,0;microtubule26,486.9932666,242.030116,363.5398682,289.2078809,287.3686157,132.0589746,0,0,0;microtubule27,577.1186426,218.112627,122.2437305,136.8993164,381.0901172,311.8405664,0,0,0;microtubule28,477.9364307,294.2746069,284.5083691,329.104834,203.73854,36.79857422,0,0,0;microtubule29,602.5964648,317.1294214,80.40759521,130.0769531,205.3262549,366.1346924,0,0,0;microtubule3,-139.0224133,-173.8191055,-427.1847363,337.7971655,363.020246,759.5431055,0,0,0;microtubule30,559.5994629,-337.2936108,210.2427393,166.3097461,468.162583,203.6533301,0,0,0;microtubule31,419.9002661,-500.184126,316.3121631,407.9912256,122.8493262,84.17920898,0,0,0;microtubule32,532.1963672,-447.1643115,104.0702747,257.4648047,199.2719238,389.7403491,0,0,0;microtubule33,482.8850098,-448.0571045,311.7472119,325.9098633,212.6162988,44.34436523,0,0,0;microtubule34,621.9338965,-416.982041,118.7065613,126.4250977,271.4240039,329.2003931,0,0,0;microtubule35,-118.3220728,110.4977856,955.7098828,622.6587451,493.0616748,154.8304687,0,0,0;microtubule36,-38.73700195,295.7910132,735.6735938,813.0149414,130.0887158,432.2794922,0,0,0;microtubule37,-147.0284253,183.0389575,716.1807568,518.7239502,341.7746631,490.7852051,0,0,0;microtubule38,-505.4994727,260.7653027,570.3792847,172.7321484,194.3118164,730.0565479,0,0,0;microtubule39,-330.203606,255.0918164,658.6816846,226.97896,194.4717773,593.7860449,0,0,0;microtubule4,97.25859375,-81.19509682,-651.4826221,787.3532813,177.7109001,338.228584,0,0,0;microtubule40,-200.9843848,60.38698975,720.7139062,519.6625781,586.7271533,430.7780859,0,0,0;microtubule41,287.1684814,114.7601161,777.7985156,734.9856152,206.0788889,468.8053125,0,0,0;microtubule42,589.3171875,134.296333,583.4237842,159.3030469,180.6350391,838.2054785,0,0,0;microtubule43,445.5135352,-95.13089355,938.1663281,392.8723828,599.7641895,169.9720312,0,0,0;microtubule44,428.9714355,45.15916992,676.3465869,449.8033008,347.0653711,673.1271387,0,0,0;microtubule45,505.1379199,-83.39869629,677.9993848,336.0916992,599.8922168,643.4302148,0,0,0;microtubule46,-279.8748102,-401.6762476,540.5428711,625.014364,334.9703174,104.5120312,0,0,0;microtubule47,-522.0736963,-360.1754443,303.4938977,123.0875684,374.5616895,402.6039624,0,0,0;microtubule48,-264.077915,-531.3914502,398.5253467,593.5828418,83.4909668,304.2609082,0,0,0;microtubule49,-462.3454541,-368.403479,406.0618945,204.1284668,400.7098389,246.7103906,0,0,0;microtubule5,-235.8658887,142.852633,-458.1761499,168.1641211,281.0347536,659.5777002,0,0,0;microtubule50,-270.6177164,-552.1942676,517.5230713,567.2812079,107.8213477,107.9428418,0,0,0;microtubule51,-309.9686316,345.4123975,-270.0235071,393.3619556,196.0721777,612.4700171,0,0,0;microtubule52,-461.5955127,164.0074951,-133.1996063,94.17870117,568.1300684,386.5102991,0,0,0;microtubule53,-349.3235669,233.7860156,-66.56753998,315.557124,399.5180273,164.2730255,0,0,0;microtubule54,-363.6500024,351.6772412,320.7801343,276.5947998,201.2884863,511.4768408,0,0,0;microtubule55,-393.347124,280.0743311,102.1417091,227.8053223,299.9349316,204.8680662,0,0,0;microtubule56,-227.535769,288.7856909,-53.67977051,539.6171338,325.6723096,250.9921875,0,0,0;microtubule6,-20.18329102,-70.09014084,-483.5474414,577.0610156,153.2483414,647.0252344,0,0,0;microtubule7,15.20736328,62.57915131,-463.1074878,619.3040039,159.3178107,683.8982666,0,0,0;microtubule8,557.853501,434.7157031,14.36625,435.7967871,218.8402734,572.1272461,0,0,0;microtubule9,790.0964648,302.6857306,-46.75898437,106.6875,484.5883044,487.1542383,0,0,0;mitochondria1,509.9553464,60.67585787,598.6037478,56.38573425,55.78621948,97.22390625,18.53970718,0,0;mitochondria2,236.1862652,8.347496228,771.7170695,69.44670044,68.70831848,160.0913306,0,-58.66119162,0;mitochondria3,-237.8879342,-80.8010362,794.9918666,74.3063324,72.65880615,278.4640576,12.50616674,-13.37802957,-34.78928216;mitochondria4,-480.3502638,0,623.5202907,56.38573425,55.78621948,97.22390625,0,0,0;mitochondria5,654.307804,246.0744739,370.0455458,69.44670044,68.70831848,160.0913306,-55.07883972,0,0;mitochondria6,0,-464.9341727,0,69.44670044,68.70831848,160.0913306,-25.64558815,-58.48676953,-21.37185167;mitochondria7,0,0,-581.7224431,69.44670044,68.70831848,160.0913306,4.948279917,-70.48661547,121.4859061;mitochondria8,624.0007,49.31601383,-87.21635338,69.44670044,68.70831848,160.0913306,89.76656115,-5.023110397,-48.14947773;nucleus,208.5936936,6.113100222,153.3202277,522.7149005,515.7176939,518.1826595,0,0,0;rough_ER1,253.871543,-69.16218018,184.1513013,624.6314062,553.1499756,621.0511084,0,0,0;rough_ER2,221.76854,64.61654297,146.9922729,621.8760059,558.2816016,585.9084229,0,0,0;smoothER,-132.954492,-89.25859014,80.62120204,376.5313623,386.0319287,318.3009668,122.954661,-71.58529221,-50.75833529;smoothER,-139.2748633,-37.55435675,275.4559992,350.3096777,359.3174121,299.3762402,-12.50517141,-27.97002065,5.954923214;smoothER,243.6573639,10.98815226,-278.1663356,402.7864746,412.9494434,340.4957227,0,0,0;"; } -Script.setTimeout(function(){ +Script.setTimeout(function() { -for (var i = 0; i < scenes.length; i++) { - // print('setting up scene. first, delete' + JSON.stringify(scenes[i])) + for (var i = 0; i < scenes.length; i++) { + // print('setting up scene. first, delete' + JSON.stringify(scenes[i])) + // deleteAllInRadius(scenes[i].location, scenes[i].zone.dimensions.x); + CreateNavigationButton(scenes[i], i); - CreateNavigationButton(scenes[i], i); - - ImportScene(scenes[i]); - // print('setting up scene. then import') + ImportScene(scenes[i]); + // print('setting up scene. then import') -} + } -createLayoutLights(); -},3500) + createLayoutLights(); +}, 3500) +// Script.scriptEnding.connect(function() { +// Entities.addingEntity.disconnect(makeUngrabbable); +// }); + +// Script.setTimeout(function() { +// print('JBP stopping cell science import'); +// Script.stop(); +// }, 30000) \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/motorProteinControllerAC.js b/unpublishedScripts/DomainContent/CellScience/motorProteinControllerAC.js index 5f2ef48369..54f8d8a924 100644 --- a/unpublishedScripts/DomainContent/CellScience/motorProteinControllerAC.js +++ b/unpublishedScripts/DomainContent/CellScience/motorProteinControllerAC.js @@ -9,12 +9,8 @@ var numDynein = 2; var numKinesin = 2; var percentOnMainMT = 100; -var baseLocation; -if (USE_LOCAL_HOST === true) { - baseLocation = "http://localhost:8080/"; -} else { - baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/" -} + +baseLocation = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/" var WORLD_OFFSET = { x: 0, diff --git a/unpublishedScripts/DomainContent/CellScience/moveCellsAC.js b/unpublishedScripts/DomainContent/CellScience/moveCellsAC.js index 595da71774..d696d464bf 100644 --- a/unpublishedScripts/DomainContent/CellScience/moveCellsAC.js +++ b/unpublishedScripts/DomainContent/CellScience/moveCellsAC.js @@ -18,7 +18,6 @@ function offsetVectorToWorld(vector) { newVector = Vec3.sum(vector, WORLD_OFFSET); - print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector)) return newVector } diff --git a/unpublishedScripts/DomainContent/CellScience/moveVesiclesAC.js b/unpublishedScripts/DomainContent/CellScience/moveVesiclesAC.js index b222abdb72..4d4ce76d74 100644 --- a/unpublishedScripts/DomainContent/CellScience/moveVesiclesAC.js +++ b/unpublishedScripts/DomainContent/CellScience/moveVesiclesAC.js @@ -17,7 +17,6 @@ function offsetVectorToWorld(vector) { newVector = Vec3.sum(vector, WORLD_OFFSET); - print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector)) return newVector } From 61ff4d0f60bcc15290ac36ed0883af4d38dfc100 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Mon, 25 Apr 2016 18:27:04 -0700 Subject: [PATCH 02/16] end of day --- .../CellScience/Scripts/nav_button_cells.js | 110 ++++++++++++++++++ .../Scripts/nav_button_hexokinase.js | 105 +++++++++++++++++ .../Scripts/nav_button_inside_the_cell.js | 106 +++++++++++++++++ .../Scripts/nav_button_ribosome.js | 106 +++++++++++++++++ .../DomainContent/CellScience/Scripts/zoom.js | 2 +- .../{importEverything.js => importNow.js} | 31 ++--- 6 files changed, 445 insertions(+), 15 deletions(-) create mode 100644 unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js create mode 100644 unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js create mode 100644 unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js create mode 100644 unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js rename unpublishedScripts/DomainContent/CellScience/{importEverything.js => importNow.js} (99%) diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js new file mode 100644 index 0000000000..da5f59bb58 --- /dev/null +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js @@ -0,0 +1,110 @@ +// 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 version = 12; + var added = false; + + var self = this; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + + this.preload = function(entityId) { + this.entityId = entityId; + self.buttonImageURL = baseURL + "GUI/GUI_Cells.png?" + version; + // print(' BUTTON IMAGE URL:' + self.buttonImageURL) + if (self.button === undefined) { + // print(' NO BUTTON ADDING ONE!!') + self.button = true; + self.addButton(); + + } else { + //print(' SELF ALREADY HAS A BUTTON!!') + } + } + + this.addButton = function() { + + this.windowDimensions = Controller.getViewportDimensions(); + this.buttonWidth = 150; + this.buttonHeight = 50; + this.buttonPadding = 10; + this.offset = 0; + this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); + + + this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; + this.button = Overlays.addOverlay("image", { + x: self.buttonPositionX, + y: self.buttonPositionY, + width: self.buttonWidth, + height: self.buttonHeight, + imageURL: self.buttonImageURL, + visible: true, + alpha: 1.0 + }); + + } + + + this.onClick = function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + + if (clickedOverlay == self.button) { + self.lookAtTarget(); + } + + } + + this.lookAtTarget = function() { + // entryPoint: scene.entryPoint, + // target: scene.location, + + + var entryPoint = { + x: 13500, + y: 13500, + z: 13500 + }; + + var target = { + x: 13501, + y: 13501, + z: 13501 + } + + var direction = Vec3.normalize(Vec3.subtract(target, entryPoint)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); + + MyAvatar.goToLocation(target, true, yaw); + + MyAvatar.headYaw = 0; + + } + + this.unload = function() { + Overlays.deleteOverlay(self.button); + Controller.mousePressEvent.disconnect(this.onClick); + + } + + Controller.mousePressEvent.connect(this.onClick); + +}); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js new file mode 100644 index 0000000000..759db1eced --- /dev/null +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js @@ -0,0 +1,105 @@ +// 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 version = 12; + var added = false; + var self = this; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + + this.preload = function(entityId) { + this.entityId = entityId; + self.buttonImageURL = baseURL + "GUI/GUI_Hexokinase.png?" + version; + // print(' BUTTON IMAGE URL:' + self.buttonImageURL) + if (self.button === undefined) { + // print(' NO BUTTON ADDING ONE!!') + self.button = true; + self.addButton(); + + } else { + //print(' SELF ALREADY HAS A BUTTON!!') + } + } + + this.addButton = function() { + + this.windowDimensions = Controller.getViewportDimensions(); + this.buttonWidth = 150; + this.buttonHeight = 50; + this.buttonPadding = 10; + this.offset = 2; + this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); + + + this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; + this.button = Overlays.addOverlay("image", { + x: self.buttonPositionX, + y: self.buttonPositionY, + width: self.buttonWidth, + height: self.buttonHeight, + imageURL: self.buttonImageURL, + visible: true, + alpha: 1.0 + }); + + } + + + this.onClick = function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + + if (clickedOverlay == self.button) { + self.lookAtTarget(); + } + + } + + this.lookAtTarget = function() { + var entryPoint = { + x: 3000, + y: 3000, + z: 13500 + } + + var target = { + x: 2755, + y: 3121, + z: 13501 + } + + + var direction = Vec3.normalize(Vec3.subtract(target, entryPoint)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); + + MyAvatar.goToLocation(target, true, yaw); + + MyAvatar.headYaw = 0; + } + + this.unload = function() { + Overlays.deleteOverlay(self.button); + Controller.mousePressEvent.disconnect(this.onClick); + + } + + Controller.mousePressEvent.connect(this.onClick); + +}); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js new file mode 100644 index 0000000000..5276da8c9c --- /dev/null +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js @@ -0,0 +1,106 @@ +// 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 version = 12; + var added = false; + var self = this; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + + this.preload = function(entityId) { + this.entityId = entityId; + self.buttonImageURL = baseURL + "GUI/GUI_CellLayout.png?" + version; + // print(' BUTTON IMAGE URL:' + self.buttonImageURL) + if (self.button === undefined) { + // print(' NO BUTTON ADDING ONE!!') + self.button = true; + self.addButton(); + + } else { + //print(' SELF ALREADY HAS A BUTTON!!') + } + } + + this.addButton = function() { + + this.windowDimensions = Controller.getViewportDimensions(); + this.buttonWidth = 150; + this.buttonHeight = 50; + this.buttonPadding = 10; + this.offset = 1; + this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); + + + this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; + this.button = Overlays.addOverlay("image", { + x: self.buttonPositionX, + y: self.buttonPositionY, + width: self.buttonWidth, + height: self.buttonHeight, + imageURL: self.buttonImageURL, + visible: true, + alpha: 1.0 + }); + + } + + + this.onClick = function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + + if (clickedOverlay == self.button) { + self.lookAtTarget(); + } + + } + + this.lookAtTarget = function() { + + var entryPoint = { + x: 3000, + y: 13500, + z: 3000 + }; + + var target = { + x: 3276.6, + y: 13703.3, + z: 4405.6 + } + + var direction = Vec3.normalize(Vec3.subtract(target, entryPoint)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); + + MyAvatar.goToLocation(target, true, yaw); + + MyAvatar.headYaw = 0; + + } + + this.unload = function() { + Overlays.deleteOverlay(self.button); + Controller.mousePressEvent.disconnect(this.onClick); + + } + + Controller.mousePressEvent.connect(this.onClick); + +}); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js new file mode 100644 index 0000000000..82291b082b --- /dev/null +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js @@ -0,0 +1,106 @@ +// 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 version = 12; + var added = false; + var self = this; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + + this.preload = function(entityId) { + this.entityId = entityId; + self.buttonImageURL = baseURL + "GUI/GUI_Ribosome.png?" + version; + // print(' BUTTON IMAGE URL:' + self.buttonImageURL) + if (self.button === undefined) { + // print(' NO BUTTON ADDING ONE!!') + self.button = true; + self.addButton(); + + } else { + //print(' SELF ALREADY HAS A BUTTON!!') + } + } + + this.addButton = function() { + + this.windowDimensions = Controller.getViewportDimensions(); + this.buttonWidth = 150; + this.buttonHeight = 50; + this.buttonPadding = 10; + this.offset = 3; + this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); + + + this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; + this.button = Overlays.addOverlay("image", { + x: self.buttonPositionX, + y: self.buttonPositionY, + width: self.buttonWidth, + height: self.buttonHeight, + imageURL: self.buttonImageURL, + visible: true, + alpha: 1.0 + }); + + } + + + this.onClick = function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + + if (clickedOverlay == self.button) { + self.lookAtTarget(); + } + + } + + this.lookAtTarget = function() { + + var entryPoint = { + x: 13500, + y: 3000, + z: 3000 + }; + + var target = { + x: 2755, + y: 3121, + z: 13501 + }; + + var direction = Vec3.normalize(Vec3.subtract(entryPoint, target)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); + + MyAvatar.goToLocation(entryPoint, true, yaw); + + MyAvatar.headYaw = 0; + + } + + this.unload = function() { + Overlays.deleteOverlay(self.button); + Controller.mousePressEvent.disconnect(this.onClick); + + } + + Controller.mousePressEvent.connect(this.onClick); + +}); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js b/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js index 665049198e..156774f8e3 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/zoom.js @@ -27,7 +27,7 @@ // print(' no user data yet, try again in one second') self.initialize(entityID); }, 1000) - } else if (properties.userData.length === 0 || ) { + } else if (properties.userData.length === 0) { self.initTimeout = Script.setTimeout(function() { // print(' no user data yet, try again in one second') self.initialize(entityID); diff --git a/unpublishedScripts/DomainContent/CellScience/importEverything.js b/unpublishedScripts/DomainContent/CellScience/importNow.js similarity index 99% rename from unpublishedScripts/DomainContent/CellScience/importEverything.js rename to unpublishedScripts/DomainContent/CellScience/importNow.js index 11c3d95523..26857ae02a 100644 --- a/unpublishedScripts/DomainContent/CellScience/importEverything.js +++ b/unpublishedScripts/DomainContent/CellScience/importNow.js @@ -5,7 +5,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var version = 1211; +var version = 1215; var WORLD_OFFSET = { x: 0, @@ -102,8 +102,6 @@ var locations = { }), 1000] }; -print('JBP locations locations' + JSON.stringify(locations)) - var scenes = [{ name: "Cells", objects: "", @@ -617,9 +615,9 @@ function createLayoutLights() { } -function CreateNavigationButton(scene, number) { +function CreateNavigationButton(scene, name) { - var nav = Entities.addEntity({ + var navProps = { type: "Box", name: scene.name + " navigation button", color: { @@ -637,7 +635,6 @@ function CreateNavigationButton(scene, number) { name: scene.name, entryPoint: scene.entryPoint, target: scene.location, - offset: number, baseURL: baseLocation, grabbableKey: { grabbable: false @@ -648,9 +645,15 @@ function CreateNavigationButton(scene, number) { y: 0, z: 0 }, - script: baseLocation + "Scripts/navigationButton.js?" + version, collisionless: true, - }); + } + + var scriptURL = baseLocation + "Scripts/nav_button_" + name + ".js?" + version; + + navProps.script = scriptURL; + var nav = Entities.addEntity(navProps); + + print('JBP CREATE NAV AT::' + nav + " name: " + scene.name + ": " + JSON.stringify(scene.location)) } @@ -9006,17 +9009,17 @@ function assignVariables() { cellLayout = "Object Name,TranslateX,TranslateY,TranslateZ,DimensionX,DimensionY,DimensionZ, RotateX, RotateY, RotateZ;NPC,197.8817968,187.1750856,343.3718791,24.13382446,34.22486206,30.38697693,46.23119528,-8.353895581,8.869973765;NPC,213.3709151,2.456316462,423.9885128,25.53621185,34.58618774,24.07834717,90.38281992,-7.832244708,0;NPC,33.34912856,2.090308135,365.04642,25.53621185,34.58618774,24.07834717,90.39885078,-38.49088523,0;NPC,397.5101386,159.5911591,319.6113615,25.53621185,34.58618774,24.07834717,50.3605842,37.83254121,0;NPC,156.5827125,-122.5087526,377.9210147,25.53621185,34.58618774,24.07834717,115.9481277,-11.66518146,0;golgi,-318.7046145,66.9773569,976.6478796,211.1744971,156.6775269,204.0570996,115.0039041,-35.67118658,-77.29622127;golgi,456.0077009,0,-837.4997205,235.0718115,174.4077612,227.1489771,-25.72753579,12.39046363,101.1906405;microtubule1,212.4149854,132.4649414,944.2434082,142.5869824,122.8758984,880.6406836,0,0,0;microtubule10,673.8832031,311.0911194,-148.9548248,200.3548828,452.0626831,200.2862878,0,0,0;microtubule11,732.2112598,361.0221094,-546.264873,89.10005859,364.5919922,488.656582,0,0,0;microtubule12,739.5973828,340.5306592,-314.7477979,71.43855469,381.5696191,163.5716895,0,0,0;microtubule13,547.683501,315.5453137,-194.0386853,450.7195605,452.5557788,230.4621606,0,0,0;microtubule14,556.663916,415.2724512,-436.4479395,283.920293,207.0583008,657.0294727,0,0,0;microtubule15,660.601377,201.7332788,-572.2047363,508.4347852,224.4388916,408.4554492,0,0,0;microtubule16,506.7585205,204.8784119,-527.3789355,154.4813965,242.6824146,450.410918,0,0,0;microtubule17,212.1601877,58.27322021,-728.5755762,367.6139996,489.4616455,107.694668,0,0,0;microtubule18,398.5259912,137.8724231,-665.1991992,112.6322754,371.4562866,196.6646484,0,0,0;microtubule19,380.7953174,226.3009131,-449.3071655,81.91825195,156.3450879,654.2884424,0,0,0;microtubule2,30.6969873,141.0839227,876.8226709,232.4791699,192.0579456,920.3092676,0,0,0;microtubule20,-17.70177979,102.1328238,-793.8511963,249.8578271,254.9617255,626.1412793,0,0,0;microtubule21,77.27729828,414.6652734,-875.5563281,112.0010284,370.8857812,414.7598437,0,0,0;microtubule22,206.3877283,127.7296783,-799.063623,248.5948755,233.9102527,596.1479883,0,0,0;microtubule23,26.83012939,306.4021143,-869.8149609,151.6807324,229.8870996,438.0902344,0,0,0;microtubule24,130.2055444,10.68804199,-875.882373,102.7668896,337.1855273,478.814707,0,0,0;microtubule25,466.3101562,323.6335986,125.3250128,363.4645312,146.882959,368.3232751,0,0,0;microtubule26,486.9932666,242.030116,363.5398682,289.2078809,287.3686157,132.0589746,0,0,0;microtubule27,577.1186426,218.112627,122.2437305,136.8993164,381.0901172,311.8405664,0,0,0;microtubule28,477.9364307,294.2746069,284.5083691,329.104834,203.73854,36.79857422,0,0,0;microtubule29,602.5964648,317.1294214,80.40759521,130.0769531,205.3262549,366.1346924,0,0,0;microtubule3,-139.0224133,-173.8191055,-427.1847363,337.7971655,363.020246,759.5431055,0,0,0;microtubule30,559.5994629,-337.2936108,210.2427393,166.3097461,468.162583,203.6533301,0,0,0;microtubule31,419.9002661,-500.184126,316.3121631,407.9912256,122.8493262,84.17920898,0,0,0;microtubule32,532.1963672,-447.1643115,104.0702747,257.4648047,199.2719238,389.7403491,0,0,0;microtubule33,482.8850098,-448.0571045,311.7472119,325.9098633,212.6162988,44.34436523,0,0,0;microtubule34,621.9338965,-416.982041,118.7065613,126.4250977,271.4240039,329.2003931,0,0,0;microtubule35,-118.3220728,110.4977856,955.7098828,622.6587451,493.0616748,154.8304687,0,0,0;microtubule36,-38.73700195,295.7910132,735.6735938,813.0149414,130.0887158,432.2794922,0,0,0;microtubule37,-147.0284253,183.0389575,716.1807568,518.7239502,341.7746631,490.7852051,0,0,0;microtubule38,-505.4994727,260.7653027,570.3792847,172.7321484,194.3118164,730.0565479,0,0,0;microtubule39,-330.203606,255.0918164,658.6816846,226.97896,194.4717773,593.7860449,0,0,0;microtubule4,97.25859375,-81.19509682,-651.4826221,787.3532813,177.7109001,338.228584,0,0,0;microtubule40,-200.9843848,60.38698975,720.7139062,519.6625781,586.7271533,430.7780859,0,0,0;microtubule41,287.1684814,114.7601161,777.7985156,734.9856152,206.0788889,468.8053125,0,0,0;microtubule42,589.3171875,134.296333,583.4237842,159.3030469,180.6350391,838.2054785,0,0,0;microtubule43,445.5135352,-95.13089355,938.1663281,392.8723828,599.7641895,169.9720312,0,0,0;microtubule44,428.9714355,45.15916992,676.3465869,449.8033008,347.0653711,673.1271387,0,0,0;microtubule45,505.1379199,-83.39869629,677.9993848,336.0916992,599.8922168,643.4302148,0,0,0;microtubule46,-279.8748102,-401.6762476,540.5428711,625.014364,334.9703174,104.5120312,0,0,0;microtubule47,-522.0736963,-360.1754443,303.4938977,123.0875684,374.5616895,402.6039624,0,0,0;microtubule48,-264.077915,-531.3914502,398.5253467,593.5828418,83.4909668,304.2609082,0,0,0;microtubule49,-462.3454541,-368.403479,406.0618945,204.1284668,400.7098389,246.7103906,0,0,0;microtubule5,-235.8658887,142.852633,-458.1761499,168.1641211,281.0347536,659.5777002,0,0,0;microtubule50,-270.6177164,-552.1942676,517.5230713,567.2812079,107.8213477,107.9428418,0,0,0;microtubule51,-309.9686316,345.4123975,-270.0235071,393.3619556,196.0721777,612.4700171,0,0,0;microtubule52,-461.5955127,164.0074951,-133.1996063,94.17870117,568.1300684,386.5102991,0,0,0;microtubule53,-349.3235669,233.7860156,-66.56753998,315.557124,399.5180273,164.2730255,0,0,0;microtubule54,-363.6500024,351.6772412,320.7801343,276.5947998,201.2884863,511.4768408,0,0,0;microtubule55,-393.347124,280.0743311,102.1417091,227.8053223,299.9349316,204.8680662,0,0,0;microtubule56,-227.535769,288.7856909,-53.67977051,539.6171338,325.6723096,250.9921875,0,0,0;microtubule6,-20.18329102,-70.09014084,-483.5474414,577.0610156,153.2483414,647.0252344,0,0,0;microtubule7,15.20736328,62.57915131,-463.1074878,619.3040039,159.3178107,683.8982666,0,0,0;microtubule8,557.853501,434.7157031,14.36625,435.7967871,218.8402734,572.1272461,0,0,0;microtubule9,790.0964648,302.6857306,-46.75898437,106.6875,484.5883044,487.1542383,0,0,0;mitochondria1,509.9553464,60.67585787,598.6037478,56.38573425,55.78621948,97.22390625,18.53970718,0,0;mitochondria2,236.1862652,8.347496228,771.7170695,69.44670044,68.70831848,160.0913306,0,-58.66119162,0;mitochondria3,-237.8879342,-80.8010362,794.9918666,74.3063324,72.65880615,278.4640576,12.50616674,-13.37802957,-34.78928216;mitochondria4,-480.3502638,0,623.5202907,56.38573425,55.78621948,97.22390625,0,0,0;mitochondria5,654.307804,246.0744739,370.0455458,69.44670044,68.70831848,160.0913306,-55.07883972,0,0;mitochondria6,0,-464.9341727,0,69.44670044,68.70831848,160.0913306,-25.64558815,-58.48676953,-21.37185167;mitochondria7,0,0,-581.7224431,69.44670044,68.70831848,160.0913306,4.948279917,-70.48661547,121.4859061;mitochondria8,624.0007,49.31601383,-87.21635338,69.44670044,68.70831848,160.0913306,89.76656115,-5.023110397,-48.14947773;nucleus,208.5936936,6.113100222,153.3202277,522.7149005,515.7176939,518.1826595,0,0,0;rough_ER1,253.871543,-69.16218018,184.1513013,624.6314062,553.1499756,621.0511084,0,0,0;rough_ER2,221.76854,64.61654297,146.9922729,621.8760059,558.2816016,585.9084229,0,0,0;smoothER,-132.954492,-89.25859014,80.62120204,376.5313623,386.0319287,318.3009668,122.954661,-71.58529221,-50.75833529;smoothER,-139.2748633,-37.55435675,275.4559992,350.3096777,359.3174121,299.3762402,-12.50517141,-27.97002065,5.954923214;smoothER,243.6573639,10.98815226,-278.1663356,402.7864746,412.9494434,340.4957227,0,0,0;"; } + + Script.setTimeout(function() { - + CreateNavigationButton(scenes[0], 'cells'); + CreateNavigationButton(scenes[1], 'inside_the_cell'); + CreateNavigationButton(scenes[2], 'ribosome'); + CreateNavigationButton(scenes[3], 'hexokinase'); for (var i = 0; i < scenes.length; i++) { - // print('setting up scene. first, delete' + JSON.stringify(scenes[i])) - // deleteAllInRadius(scenes[i].location, scenes[i].zone.dimensions.x); - CreateNavigationButton(scenes[i], i); - ImportScene(scenes[i]); // print('setting up scene. then import') - } createLayoutLights(); From e24c6f1b175667ccaef20706dcb014ad4683a548 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 26 Apr 2016 12:29:43 -0700 Subject: [PATCH 03/16] cell stuff --- .../CellScience/Scripts/nav_button_cells.js | 157 ++++++++--------- .../Scripts/nav_button_hexokinase.js | 160 +++++++++--------- .../Scripts/nav_button_inside_the_cell.js | 155 +++++++++-------- .../Scripts/nav_button_ribosome.js | 158 +++++++++-------- .../DomainContent/CellScience/importNow.js | 2 +- 5 files changed, 311 insertions(+), 321 deletions(-) diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js index da5f59bb58..265ffe2650 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js @@ -8,103 +8,96 @@ (function() { var version = 12; - var added = false; - var self = this; var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + var button; + var _this; - this.preload = function(entityId) { - this.entityId = entityId; - self.buttonImageURL = baseURL + "GUI/GUI_Cells.png?" + version; - // print(' BUTTON IMAGE URL:' + self.buttonImageURL) - if (self.button === undefined) { - // print(' NO BUTTON ADDING ONE!!') - self.button = true; - self.addButton(); - - } else { - //print(' SELF ALREADY HAS A BUTTON!!') - } + function NavButton() { + _this = this; } - this.addButton = function() { - - this.windowDimensions = Controller.getViewportDimensions(); - this.buttonWidth = 150; - this.buttonHeight = 50; - this.buttonPadding = 10; - this.offset = 0; - this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); - - - this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; - this.button = Overlays.addOverlay("image", { - x: self.buttonPositionX, - y: self.buttonPositionY, - width: self.buttonWidth, - height: self.buttonHeight, - imageURL: self.buttonImageURL, - visible: true, - alpha: 1.0 - }); - - } - - - this.onClick = function(event) { - var clickedOverlay = Overlays.getOverlayAtPoint({ - x: event.x, - y: event.y - }); - - - if (clickedOverlay == self.button) { - self.lookAtTarget(); - } - - } - - this.lookAtTarget = function() { - // entryPoint: scene.entryPoint, - // target: scene.location, - - - var entryPoint = { + NavButton.prototype = { + button: null, + buttonImageURL: baseURL + "GUI/GUI_Cells.png?" + version, + hasButton: false, + entryPoint: { x: 13500, y: 13500, z: 13500 - }; - - var target = { + }, + target: { x: 13501, y: 13501, z: 13501 + }, + preload: function(entityId) { + this.entityId = entityId; + this.addButton(); + Controller.mousePressEvent.connect(this.onClick); + }, + addButton: function() { + if (this.hasButton === false) { + var windowDimensions = Controller.getViewportDimensions(); + var buttonWidth = 150; + var buttonHeight = 50; + var buttonPadding = 10; + var offset = 0; + var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5); + var buttonPositionY = (windowDimensions.y - buttonHeight) - 50; + button = Overlays.addOverlay("image", { + x: buttonPositionX, + y: buttonPositionY, + width: buttonWidth, + height: buttonHeight, + imageURL: this.buttonImageURL, + visible: true, + alpha: 1.0 + }); + this.hasButton = true; + } + }, + onClick: function(event) { + //call to an internal function to get our scope back; + _this.handleClick(event); + }, + handleClick: function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + if (clickedOverlay === button) { + this.lookAtTarget(); + } + }, + lookAtTarget: function() { + var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); + + MyAvatar.goToLocation(this.target, true, yaw); + + MyAvatar.headYaw = 0; + }, + unload: function() { + this.hasButton = false; + Overlays.deleteOverlay(button); + Controller.mousePressEvent.disconnect(this.onClick); } - - var direction = Vec3.normalize(Vec3.subtract(target, entryPoint)); - var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { - x: 1, - y: 0, - z: 0 - }); - var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { - x: 0, - y: 1, - z: 0 - }); - - MyAvatar.goToLocation(target, true, yaw); - - MyAvatar.headYaw = 0; - } - this.unload = function() { - Overlays.deleteOverlay(self.button); - Controller.mousePressEvent.disconnect(this.onClick); - } + return new NavButton(); + - Controller.mousePressEvent.connect(this.onClick); }); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js index 759db1eced..1a87ab5d4f 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js @@ -4,102 +4,106 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +// 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 version = 12; - var added = false; - var self = this; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + var button; + var _this; - this.preload = function(entityId) { - this.entityId = entityId; - self.buttonImageURL = baseURL + "GUI/GUI_Hexokinase.png?" + version; - // print(' BUTTON IMAGE URL:' + self.buttonImageURL) - if (self.button === undefined) { - // print(' NO BUTTON ADDING ONE!!') - self.button = true; - self.addButton(); - - } else { - //print(' SELF ALREADY HAS A BUTTON!!') - } + function NavButton() { + _this = this; } - this.addButton = function() { - - this.windowDimensions = Controller.getViewportDimensions(); - this.buttonWidth = 150; - this.buttonHeight = 50; - this.buttonPadding = 10; - this.offset = 2; - this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); - - - this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; - this.button = Overlays.addOverlay("image", { - x: self.buttonPositionX, - y: self.buttonPositionY, - width: self.buttonWidth, - height: self.buttonHeight, - imageURL: self.buttonImageURL, - visible: true, - alpha: 1.0 - }); - - } - - - this.onClick = function(event) { - var clickedOverlay = Overlays.getOverlayAtPoint({ - x: event.x, - y: event.y - }); - - - if (clickedOverlay == self.button) { - self.lookAtTarget(); - } - - } - - this.lookAtTarget = function() { - var entryPoint = { + NavButton.prototype = { + button: null, + buttonImageURL: baseURL + "GUI/GUI_Hexokinase.png?" + version, + hasButton: false, + entryPoint: { x: 3000, y: 3000, z: 13500 - } - - var target = { + }, + target: { x: 2755, y: 3121, z: 13501 + }, + preload: function(entityId) { + this.entityId = entityId; + this.addButton(); + Controller.mousePressEvent.connect(this.onClick); + }, + addButton: function() { + if (this.hasButton === false) { + var windowDimensions = Controller.getViewportDimensions(); + var buttonWidth = 150; + var buttonHeight = 50; + var buttonPadding = 10; + var offset = 3; + var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5); + var buttonPositionY = (windowDimensions.y - buttonHeight) - 50; + button = Overlays.addOverlay("image", { + x: buttonPositionX, + y: buttonPositionY, + width: buttonWidth, + height: buttonHeight, + imageURL: this.buttonImageURL, + visible: true, + alpha: 1.0 + }); + this.hasButton = true; + } + }, + onClick: function(event) { + //call to an internal function to get our scope back; + _this.handleClick(event); + }, + handleClick: function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + if (clickedOverlay === button) { + this.lookAtTarget(); + } + }, + lookAtTarget: function() { + var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); + + MyAvatar.goToLocation(this.target, true, yaw); + + MyAvatar.headYaw = 0; + }, + unload: function() { + this.hasButton = false; + Overlays.deleteOverlay(button); + Controller.mousePressEvent.disconnect(this.onClick); } - - - var direction = Vec3.normalize(Vec3.subtract(target, entryPoint)); - var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { - x: 1, - y: 0, - z: 0 - }); - var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { - x: 0, - y: 1, - z: 0 - }); - - MyAvatar.goToLocation(target, true, yaw); - - MyAvatar.headYaw = 0; } - this.unload = function() { - Overlays.deleteOverlay(self.button); - Controller.mousePressEvent.disconnect(this.onClick); - } + return new NavButton(); + - Controller.mousePressEvent.connect(this.onClick); }); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js index 5276da8c9c..2367a7beb2 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js @@ -8,99 +8,96 @@ (function() { var version = 12; - var added = false; - var self = this; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + var button; + var _this; - this.preload = function(entityId) { - this.entityId = entityId; - self.buttonImageURL = baseURL + "GUI/GUI_CellLayout.png?" + version; - // print(' BUTTON IMAGE URL:' + self.buttonImageURL) - if (self.button === undefined) { - // print(' NO BUTTON ADDING ONE!!') - self.button = true; - self.addButton(); - - } else { - //print(' SELF ALREADY HAS A BUTTON!!') - } + function NavButton() { + _this = this; } - this.addButton = function() { - - this.windowDimensions = Controller.getViewportDimensions(); - this.buttonWidth = 150; - this.buttonHeight = 50; - this.buttonPadding = 10; - this.offset = 1; - this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); - - - this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; - this.button = Overlays.addOverlay("image", { - x: self.buttonPositionX, - y: self.buttonPositionY, - width: self.buttonWidth, - height: self.buttonHeight, - imageURL: self.buttonImageURL, - visible: true, - alpha: 1.0 - }); - - } - - - this.onClick = function(event) { - var clickedOverlay = Overlays.getOverlayAtPoint({ - x: event.x, - y: event.y - }); - - - if (clickedOverlay == self.button) { - self.lookAtTarget(); - } - - } - - this.lookAtTarget = function() { - - var entryPoint = { + NavButton.prototype = { + button: null, + buttonImageURL: baseURL + "GUI/GUI_CellLayout.png?" + version, + hasButton: false, + entryPoint: { x: 3000, y: 13500, z: 3000 - }; - - var target = { + }, + target: { x: 3276.6, y: 13703.3, z: 4405.6 + }, + preload: function(entityId) { + this.entityId = entityId; + this.addButton(); + Controller.mousePressEvent.connect(this.onClick); + }, + addButton: function() { + if (this.hasButton === false) { + var windowDimensions = Controller.getViewportDimensions(); + var buttonWidth = 150; + var buttonHeight = 50; + var buttonPadding = 10; + var offset = 1; + var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5); + var buttonPositionY = (windowDimensions.y - buttonHeight) - 50; + button = Overlays.addOverlay("image", { + x: buttonPositionX, + y: buttonPositionY, + width: buttonWidth, + height: buttonHeight, + imageURL: this.buttonImageURL, + visible: true, + alpha: 1.0 + }); + this.hasButton = true; + } + }, + onClick: function(event) { + //call to an internal function to get our scope back; + _this.handleClick(event); + }, + handleClick: function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + if (clickedOverlay === button) { + this.lookAtTarget(); + } + }, + lookAtTarget: function() { + var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); + + MyAvatar.goToLocation(this.target, true, yaw); + + MyAvatar.headYaw = 0; + }, + unload: function() { + this.hasButton = false; + Overlays.deleteOverlay(button); + Controller.mousePressEvent.disconnect(this.onClick); } - - var direction = Vec3.normalize(Vec3.subtract(target, entryPoint)); - var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { - x: 1, - y: 0, - z: 0 - }); - var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { - x: 0, - y: 1, - z: 0 - }); - - MyAvatar.goToLocation(target, true, yaw); - - MyAvatar.headYaw = 0; - } - this.unload = function() { - Overlays.deleteOverlay(self.button); - Controller.mousePressEvent.disconnect(this.onClick); - } + return new NavButton(); + - Controller.mousePressEvent.connect(this.onClick); }); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js index 82291b082b..903fe40c9b 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js @@ -4,103 +4,99 @@ // 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 version = 12; - var added = false; - var self = this; + var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"; + var button; + var _this; - this.preload = function(entityId) { - this.entityId = entityId; - self.buttonImageURL = baseURL + "GUI/GUI_Ribosome.png?" + version; - // print(' BUTTON IMAGE URL:' + self.buttonImageURL) - if (self.button === undefined) { - // print(' NO BUTTON ADDING ONE!!') - self.button = true; - self.addButton(); - - } else { - //print(' SELF ALREADY HAS A BUTTON!!') - } + function NavButton() { + _this = this; } - this.addButton = function() { - - this.windowDimensions = Controller.getViewportDimensions(); - this.buttonWidth = 150; - this.buttonHeight = 50; - this.buttonPadding = 10; - this.offset = 3; - this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5); - - - this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50; - this.button = Overlays.addOverlay("image", { - x: self.buttonPositionX, - y: self.buttonPositionY, - width: self.buttonWidth, - height: self.buttonHeight, - imageURL: self.buttonImageURL, - visible: true, - alpha: 1.0 - }); - - } - - - this.onClick = function(event) { - var clickedOverlay = Overlays.getOverlayAtPoint({ - x: event.x, - y: event.y - }); - - - if (clickedOverlay == self.button) { - self.lookAtTarget(); - } - - } - - this.lookAtTarget = function() { - - var entryPoint = { + NavButton.prototype = { + button: null, + buttonImageURL: baseURL + "GUI/GUI_Ribosome.png?" + version, + hasButton: false, + entryPoint: { x: 13500, y: 3000, z: 3000 - }; + }, + target: { + x: 3276.6, + y: 13703.3, + z: 4405.6 + }, + preload: function(entityId) { + this.entityId = entityId; + this.addButton(); + Controller.mousePressEvent.connect(this.onClick); + }, + addButton: function() { + if (this.hasButton === false) { + var windowDimensions = Controller.getViewportDimensions(); + var buttonWidth = 150; + var buttonHeight = 50; + var buttonPadding = 10; + var offset = 2; + var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5); + var buttonPositionY = (windowDimensions.y - buttonHeight) - 50; + button = Overlays.addOverlay("image", { + x: buttonPositionX, + y: buttonPositionY, + width: buttonWidth, + height: buttonHeight, + imageURL: this.buttonImageURL, + visible: true, + alpha: 1.0 + }); + this.hasButton = true; + } + }, + onClick: function(event) { + //call to an internal function to get our scope back; + _this.handleClick(event); + }, + handleClick: function(event) { + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); - var target = { - x: 2755, - y: 3121, - z: 13501 - }; + if (clickedOverlay === button) { + this.lookAtTarget(); + } + }, + lookAtTarget: function() { + var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint)); + var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { + x: 1, + y: 0, + z: 0 + }); + var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { + x: 0, + y: 1, + z: 0 + }); - var direction = Vec3.normalize(Vec3.subtract(entryPoint, target)); - var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, { - x: 1, - y: 0, - z: 0 - }); - var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, { - x: 0, - y: 1, - z: 0 - }); - - MyAvatar.goToLocation(entryPoint, true, yaw); - - MyAvatar.headYaw = 0; + MyAvatar.goToLocation(this.target, true, yaw); + MyAvatar.headYaw = 0; + }, + unload: function() { + this.hasButton = false; + Overlays.deleteOverlay(button); + Controller.mousePressEvent.disconnect(this.onClick); + } } - this.unload = function() { - Overlays.deleteOverlay(self.button); - Controller.mousePressEvent.disconnect(this.onClick); - } + return new NavButton(); + - Controller.mousePressEvent.connect(this.onClick); }); \ No newline at end of file diff --git a/unpublishedScripts/DomainContent/CellScience/importNow.js b/unpublishedScripts/DomainContent/CellScience/importNow.js index 26857ae02a..b3daa0a65d 100644 --- a/unpublishedScripts/DomainContent/CellScience/importNow.js +++ b/unpublishedScripts/DomainContent/CellScience/importNow.js @@ -5,7 +5,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var version = 1215; +var version = 1216; var WORLD_OFFSET = { x: 0, From 7406e5fd9c78a7ee551c2f1e75eff6a5103c79a2 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 23 Apr 2016 16:43:00 +1200 Subject: [PATCH 04/16] Add Navigate > Set Home Location menu item --- interface/src/Bookmarks.cpp | 14 ++++++++++++++ interface/src/Bookmarks.h | 1 + interface/src/Menu.h | 1 + 3 files changed, 16 insertions(+) diff --git a/interface/src/Bookmarks.cpp b/interface/src/Bookmarks.cpp index 0e7941a5a4..2a771662d7 100644 --- a/interface/src/Bookmarks.cpp +++ b/interface/src/Bookmarks.cpp @@ -95,6 +95,8 @@ void Bookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) { // Add menus/actions auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkLocation); QObject::connect(bookmarkAction, SIGNAL(triggered()), this, SLOT(bookmarkLocation()), Qt::QueuedConnection); + auto setHomeAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::SetHomeLocation); + QObject::connect(setHomeAction, SIGNAL(triggered()), this, SLOT(setHomeLocation()), Qt::QueuedConnection); _bookmarksMenu = menu->addMenu(MenuOption::Bookmarks); _deleteBookmarksAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::DeleteBookmark); QObject::connect(_deleteBookmarksAction, SIGNAL(triggered()), this, SLOT(deleteBookmark()), Qt::QueuedConnection); @@ -146,6 +148,18 @@ void Bookmarks::bookmarkLocation() { enableMenuItems(true); } +void Bookmarks::setHomeLocation() { + Menu* menubar = Menu::getInstance(); + QString bookmarkName = "Home"; + auto addressManager = DependencyManager::get(); + QString bookmarkAddress = addressManager->currentAddress().toString(); + + addLocationToMenu(menubar, bookmarkName, bookmarkAddress); + insert(bookmarkName, bookmarkAddress); // Overwrites any item with the same bookmarkName. + + enableMenuItems(true); +} + void Bookmarks::teleportToBookmark() { QAction* action = qobject_cast(sender()); QString address = action->data().toString(); diff --git a/interface/src/Bookmarks.h b/interface/src/Bookmarks.h index 7ff9d48e8a..f817aaba19 100644 --- a/interface/src/Bookmarks.h +++ b/interface/src/Bookmarks.h @@ -31,6 +31,7 @@ public: private slots: void bookmarkLocation(); + void setHomeLocation(); void teleportToBookmark(); void deleteBookmark(); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index b1bcf91e10..5796575780 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -170,6 +170,7 @@ namespace MenuOption { const QString RunTimingTests = "Run Timing Tests"; const QString ScriptEditor = "Script Editor..."; const QString ScriptedMotorControl = "Enable Scripted Motor Control"; + const QString SetHomeLocation = "Set Home Location"; const QString ShowDSConnectTable = "Show Domain Connection Timing"; const QString ShowBordersEntityNodes = "Show Entity Nodes"; const QString ShowRealtimeEntityStats = "Show Realtime Entity Stats"; From f74be226c88e187f37bc37417d609854cfcfce6d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 27 Apr 2016 10:28:05 +1200 Subject: [PATCH 05/16] Add "home" button to address bar --- interface/resources/images/address-bar.svg | 35 ++++++-------- interface/resources/images/home-button.svg | 48 ++++++++++++++++++++ interface/resources/qml/AddressBarDialog.qml | 42 ++++++++++++----- interface/src/ui/AddressBarDialog.cpp | 5 ++ interface/src/ui/AddressBarDialog.h | 1 + 5 files changed, 99 insertions(+), 32 deletions(-) create mode 100644 interface/resources/images/home-button.svg diff --git a/interface/resources/images/address-bar.svg b/interface/resources/images/address-bar.svg index dd907aa6c9..56dc4f028c 100644 --- a/interface/resources/images/address-bar.svg +++ b/interface/resources/images/address-bar.svg @@ -15,7 +15,7 @@ viewBox="0 0 1440 200" id="svg4136" inkscape:version="0.91 r13725" - sodipodi:docname="address-bar.002.svg"> + sodipodi:docname="address-bar.svg"> @@ -39,16 +39,16 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1835" - inkscape:window-height="1057" + inkscape:window-width="1536" + inkscape:window-height="687" id="namedview4140" showgrid="false" inkscape:zoom="0.61319416" - inkscape:cx="132.58366" + inkscape:cx="670.06567" inkscape:cy="52.468468" - inkscape:window-x="77" - inkscape:window-y="-8" - inkscape:window-maximized="1" + inkscape:window-x="105" + inkscape:window-y="0" + inkscape:window-maximized="0" inkscape:current-layer="svg4136" /> + width="328.72031" + height="139.64169" + x="150.33546" + y="30.179144" + rx="18.876532" + ry="20.609974" /> - diff --git a/interface/resources/images/home-button.svg b/interface/resources/images/home-button.svg new file mode 100644 index 0000000000..c7f9bfd607 --- /dev/null +++ b/interface/resources/images/home-button.svg @@ -0,0 +1,48 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/interface/resources/qml/AddressBarDialog.qml b/interface/resources/qml/AddressBarDialog.qml index c5712c11d2..7f107e44e9 100644 --- a/interface/resources/qml/AddressBarDialog.qml +++ b/interface/resources/qml/AddressBarDialog.qml @@ -55,15 +55,35 @@ Window { property int inputAreaHeight: 56.0 * root.scale // Height of the background's input area property int inputAreaStep: (height - inputAreaHeight) / 2 + Image { + id: homeButton + source: "../images/home-button.svg" + width: 29 + height: 26 + anchors { + left: parent.left + leftMargin: parent.height + 2 * hifi.layout.spacing + verticalCenter: parent.verticalCenter + } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onClicked: { + addressBarDialog.loadHome() + } + } + } + Image { id: backArrow source: addressBarDialog.backEnabled ? "../images/left-arrow.svg" : "../images/left-arrow-disabled.svg" + width: 22 + height: 26 anchors { - fill: parent - leftMargin: parent.height + hifi.layout.spacing + 6 - rightMargin: parent.height + hifi.layout.spacing * 60 - topMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing - bottomMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing + left: homeButton.right + leftMargin: 2 * hifi.layout.spacing + verticalCenter: parent.verticalCenter } MouseArea { @@ -78,12 +98,12 @@ Window { Image { id: forwardArrow source: addressBarDialog.forwardEnabled ? "../images/right-arrow.svg" : "../images/right-arrow-disabled.svg" + width: 22 + height: 26 anchors { - fill: parent - leftMargin: parent.height + hifi.layout.spacing * 9 - rightMargin: parent.height + hifi.layout.spacing * 53 - topMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing - bottomMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing + left: backArrow.right + leftMargin: 2 * hifi.layout.spacing + verticalCenter: parent.verticalCenter } MouseArea { @@ -101,7 +121,7 @@ Window { focus: true anchors { fill: parent - leftMargin: parent.height + parent.height + hifi.layout.spacing * 5 + leftMargin: parent.height + parent.height + hifi.layout.spacing * 7 rightMargin: hifi.layout.spacing * 2 topMargin: parent.inputAreaStep + hifi.layout.spacing bottomMargin: parent.inputAreaStep + hifi.layout.spacing diff --git a/interface/src/ui/AddressBarDialog.cpp b/interface/src/ui/AddressBarDialog.cpp index 9718aafd14..97b7703b63 100644 --- a/interface/src/ui/AddressBarDialog.cpp +++ b/interface/src/ui/AddressBarDialog.cpp @@ -50,6 +50,11 @@ void AddressBarDialog::loadAddress(const QString& address) { } } +void AddressBarDialog::loadHome() { + qDebug() << "Called LoadHome"; + // TODO +} + void AddressBarDialog::loadBack() { qDebug() << "Called LoadBack"; DependencyManager::get()->goBack(); diff --git a/interface/src/ui/AddressBarDialog.h b/interface/src/ui/AddressBarDialog.h index 811e2f5b12..eab1ebae69 100644 --- a/interface/src/ui/AddressBarDialog.h +++ b/interface/src/ui/AddressBarDialog.h @@ -36,6 +36,7 @@ protected: void hide(); Q_INVOKABLE void loadAddress(const QString& address); + Q_INVOKABLE void loadHome(); Q_INVOKABLE void loadBack(); Q_INVOKABLE void loadForward(); From 5e00a1ef49828f490a857ee12d2aa8575f6db06d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 27 Apr 2016 11:24:19 +1200 Subject: [PATCH 06/16] Implement "go home" action --- interface/src/Bookmarks.cpp | 10 +++++++++- interface/src/Bookmarks.h | 4 ++++ interface/src/ui/AddressBarDialog.cpp | 8 +++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/interface/src/Bookmarks.cpp b/interface/src/Bookmarks.cpp index 2a771662d7..476925a0c5 100644 --- a/interface/src/Bookmarks.cpp +++ b/interface/src/Bookmarks.cpp @@ -29,6 +29,10 @@ #include "Bookmarks.h" #include + +const QString Bookmarks::HOME_BOOKMARK = "Home"; + + Bookmarks::Bookmarks() { _bookmarksFilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + BOOKMARKS_FILENAME; readFromFile(); @@ -60,6 +64,10 @@ bool Bookmarks::contains(const QString& name) const { return _bookmarks.contains(name); } +QString Bookmarks::addressForBookmark(const QString& name) const { + return _bookmarks.value(name).toString(); +} + void Bookmarks::readFromFile() { QFile loadFile(_bookmarksFilename); @@ -150,7 +158,7 @@ void Bookmarks::bookmarkLocation() { void Bookmarks::setHomeLocation() { Menu* menubar = Menu::getInstance(); - QString bookmarkName = "Home"; + QString bookmarkName = HOME_BOOKMARK; auto addressManager = DependencyManager::get(); QString bookmarkAddress = addressManager->currentAddress().toString(); diff --git a/interface/src/Bookmarks.h b/interface/src/Bookmarks.h index f817aaba19..fd9598b7db 100644 --- a/interface/src/Bookmarks.h +++ b/interface/src/Bookmarks.h @@ -29,6 +29,10 @@ public: void setupMenus(Menu* menubar, MenuWrapper* menu); + QString addressForBookmark(const QString& name) const; + + static const QString HOME_BOOKMARK; + private slots: void bookmarkLocation(); void setHomeLocation(); diff --git a/interface/src/ui/AddressBarDialog.cpp b/interface/src/ui/AddressBarDialog.cpp index 97b7703b63..b483160552 100644 --- a/interface/src/ui/AddressBarDialog.cpp +++ b/interface/src/ui/AddressBarDialog.cpp @@ -10,6 +10,7 @@ // #include "AddressBarDialog.h" +#include "Application.h" #include @@ -52,7 +53,12 @@ void AddressBarDialog::loadAddress(const QString& address) { void AddressBarDialog::loadHome() { qDebug() << "Called LoadHome"; - // TODO + QString homeLocation = qApp->getBookmarks()->addressForBookmark(Bookmarks::HOME_BOOKMARK); + const QString DEFAULT_HOME_LOCATION = "localhost"; + if (homeLocation == "") { + homeLocation = DEFAULT_HOME_LOCATION; + } + DependencyManager::get()->handleLookupString(homeLocation); } void AddressBarDialog::loadBack() { From fc5960fa1511b866fc0db11fffd57107f55c8125 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 26 Apr 2016 17:00:12 -0700 Subject: [PATCH 07/16] individual buttons --- .../DomainContent/CellScience/Scripts/nav_button_cells.js | 6 ++++++ .../CellScience/Scripts/nav_button_hexokinase.js | 6 ++++++ .../CellScience/Scripts/nav_button_inside_the_cell.js | 6 ++++++ .../CellScience/Scripts/nav_button_ribosome.js | 6 ++++++ unpublishedScripts/DomainContent/CellScience/importNow.js | 2 +- 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js index 265ffe2650..343564c4e4 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_cells.js @@ -32,12 +32,15 @@ z: 13501 }, preload: function(entityId) { + print('CELL PRELOAD CeLLS 1 ') this.entityId = entityId; this.addButton(); Controller.mousePressEvent.connect(this.onClick); + print('CELL PRELOAD CeLLS 2 ') }, addButton: function() { if (this.hasButton === false) { + print('CELL ADDBuTTON CeLLS 1 ') var windowDimensions = Controller.getViewportDimensions(); var buttonWidth = 150; var buttonHeight = 50; @@ -55,6 +58,9 @@ alpha: 1.0 }); this.hasButton = true; + print('CELL ADDBuTTON CeLLS 2 button id is : ' +button) + } else { + print('CELL ADDBUTTON CeLLS FAIL - hasButton is' + this.hasButton) } }, onClick: function(event) { diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js index 1a87ab5d4f..6f704af7bd 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_hexokinase.js @@ -38,12 +38,15 @@ z: 13501 }, preload: function(entityId) { + print('CELL PRELOAD HEXOKINASE 1') this.entityId = entityId; this.addButton(); Controller.mousePressEvent.connect(this.onClick); + print('CELL PRELOAD HEXOKINASE 2') }, addButton: function() { if (this.hasButton === false) { + print('CELL ADDBUTTON HEXOKINASE 1') var windowDimensions = Controller.getViewportDimensions(); var buttonWidth = 150; var buttonHeight = 50; @@ -61,6 +64,9 @@ alpha: 1.0 }); this.hasButton = true; + print('CELL ADDBUTTON HEXOKINASE 2 button id is : ' +button) + } else { + print('CELL ADDBUTTON HEXOKINASE FAIL hasButton is' + this.hasButton) } }, onClick: function(event) { diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js index 2367a7beb2..5e9faf3086 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_inside_the_cell.js @@ -32,12 +32,15 @@ z: 4405.6 }, preload: function(entityId) { + print('CeLL PRELOAD INSIDECELL 1') this.entityId = entityId; this.addButton(); Controller.mousePressEvent.connect(this.onClick); + print('CeLL PRELOAD INSIDECELL 2') }, addButton: function() { if (this.hasButton === false) { + print('CELL ADDBUTTON INSIDECELL 1') var windowDimensions = Controller.getViewportDimensions(); var buttonWidth = 150; var buttonHeight = 50; @@ -55,6 +58,9 @@ alpha: 1.0 }); this.hasButton = true; + print('CELL ADDBUTTON INSIDECELL 2 button id is : ' +button) + } else { + print('CELL ADDBUTTON INSIDECELL FAIL - hasButton is' + this.hasButton) } }, onClick: function(event) { diff --git a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js index 903fe40c9b..4cbc375390 100644 --- a/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js +++ b/unpublishedScripts/DomainContent/CellScience/Scripts/nav_button_ribosome.js @@ -31,12 +31,15 @@ z: 4405.6 }, preload: function(entityId) { + print('CELL PRELOAD RIBOSOME 1') this.entityId = entityId; this.addButton(); Controller.mousePressEvent.connect(this.onClick); + print('CELL PRELOAD RIBOSOME 2') }, addButton: function() { if (this.hasButton === false) { + print('CELL ADBUTTON RIBOSOME 1') var windowDimensions = Controller.getViewportDimensions(); var buttonWidth = 150; var buttonHeight = 50; @@ -54,6 +57,9 @@ alpha: 1.0 }); this.hasButton = true; + print('CELL ADDBUTTON RIBOSOME 2 button id is : ' +button) + } else { + print('CELL ADDBUTTON RIBOSOME FAIL - hasButton is' + this.hasButton) } }, onClick: function(event) { diff --git a/unpublishedScripts/DomainContent/CellScience/importNow.js b/unpublishedScripts/DomainContent/CellScience/importNow.js index b3daa0a65d..eb4c0e4b64 100644 --- a/unpublishedScripts/DomainContent/CellScience/importNow.js +++ b/unpublishedScripts/DomainContent/CellScience/importNow.js @@ -5,7 +5,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var version = 1216; +var version = 1217; var WORLD_OFFSET = { x: 0, From 9ecffd626e2b80456c07e73c6a87690a5f6a689a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 28 Apr 2016 09:01:03 +1200 Subject: [PATCH 08/16] Capitalize title of directory window from "directory" to "Directory" --- scripts/system/directory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/directory.js b/scripts/system/directory.js index cf9aa6aba7..42f35a77db 100644 --- a/scripts/system/directory.js +++ b/scripts/system/directory.js @@ -17,7 +17,7 @@ var toolIconUrl = Script.resolvePath("assets/images/tools/"); var DIRECTORY_WINDOW_URL = "https://metaverse.highfidelity.com/directory"; var directoryWindow = new OverlayWebWindow({ - title: 'directory', + title: 'Directory', source: "about:blank", width: 900, height: 700, From 16874baf5f4da43be5f1c2e4a365985e9b738616 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 28 Apr 2016 11:14:39 +1200 Subject: [PATCH 09/16] Use UI Toolkit border styles for various dialogs File > Help... File > About Interface Settings > Avatar Settings > Browse Go To button (directory.js) Examples button (examples.js) --- interface/resources/qml/InfoView.qml | 22 ++++++++--- interface/resources/qml/QmlWebWindow.qml | 39 +++++++++++++------ .../resources/qml/controls-uit/WebView.qml | 2 + .../qml/dialogs/preferences/AvatarBrowser.qml | 19 +++++++-- 4 files changed, 60 insertions(+), 22 deletions(-) diff --git a/interface/resources/qml/InfoView.qml b/interface/resources/qml/InfoView.qml index 2e93c401d4..ecf928b7f7 100644 --- a/interface/resources/qml/InfoView.qml +++ b/interface/resources/qml/InfoView.qml @@ -1,8 +1,18 @@ +// +// DefaultFrame.qml +// +// Created by Bradley Austin Davis on 27 Apr 2015 +// Copyright 2015 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 +// + import QtQuick 2.5 import Hifi 1.0 as Hifi -import "controls" -import "windows" as Windows +import "controls-uit" +import "windows-uit" as Windows Windows.Window { id: root @@ -12,16 +22,16 @@ Windows.Window { Hifi.InfoView { id: infoView - // Fill the client area - anchors.fill: parent - + width: pane.contentWidth + implicitHeight: pane.scrollHeight + WebView { id: webview objectName: "WebView" anchors.fill: parent url: infoView.url } - } + } Component.onCompleted: { centerWindow(root); diff --git a/interface/resources/qml/QmlWebWindow.qml b/interface/resources/qml/QmlWebWindow.qml index 70c8afd298..d58456746a 100644 --- a/interface/resources/qml/QmlWebWindow.qml +++ b/interface/resources/qml/QmlWebWindow.qml @@ -1,11 +1,21 @@ -import QtQuick 2.3 -import QtQuick.Controls 1.2 +// +// DefaultFrame.qml +// +// Created by Bradley Austin Davis on 17 Dec 2015 +// Copyright 2015 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 +// + +import QtQuick 2.5 +import QtQuick.Controls 1.4 import QtWebEngine 1.1 import QtWebChannel 1.0 -import "windows" as Windows -import "controls" as Controls -import "styles" +import "windows-uit" as Windows +import "controls-uit" as Controls +import "styles-uit" Windows.Window { id: root @@ -29,11 +39,16 @@ Windows.Window { // missing signal signal sendToScript(var message); - Controls.WebView { - id: webview - url: "about:blank" - anchors.fill: parent - focus: true - webChannel.registeredObjects: [eventBridgeWrapper] + Item { + width: pane.contentWidth + implicitHeight: pane.scrollHeight + + Controls.WebView { + id: webview + url: "about:blank" + anchors.fill: parent + focus: true + webChannel.registeredObjects: [eventBridgeWrapper] + } } -} // dialog +} diff --git a/interface/resources/qml/controls-uit/WebView.qml b/interface/resources/qml/controls-uit/WebView.qml index 5ea4b22baf..e6005d5dcf 100644 --- a/interface/resources/qml/controls-uit/WebView.qml +++ b/interface/resources/qml/controls-uit/WebView.qml @@ -15,6 +15,8 @@ WebEngineView { id: root property var newUrl; + profile.httpUserAgent: "Mozilla/5.0 Chrome (HighFidelityInterface)" + Component.onCompleted: { console.log("Connecting JS messaging to Hifi Logging") // Ensure the JS from the web-engine makes it to our logging diff --git a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml index cdeddb5886..64c46e4f18 100644 --- a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml +++ b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml @@ -1,10 +1,20 @@ +// +// WebView.qml +// +// Created by Bradley Austin Davis on 30 Aug 2015 +// Copyright 2015 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 +// + import QtQuick 2.5 import QtQuick.Controls 1.4 import QtWebEngine 1.1 -import "../../windows" as Windows -import "../../controls" as Controls -import "../../styles" +import "../../windows-uit" as Windows +import "../../controls-uit" as Controls +import "../../styles-uit" Windows.Window { id: root @@ -14,7 +24,8 @@ Windows.Window { modality: Qt.ApplicationModal Item { - anchors.fill: parent + width: pane.contentWidth + implicitHeight: pane.scrollHeight Controls.WebView { id: webview From e5ee98ee60ed3cf6b7eb81fabe4060c4e5503fef Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 28 Apr 2016 11:19:30 +1200 Subject: [PATCH 10/16] Fix up filenames in headers --- interface/resources/qml/InfoView.qml | 2 +- interface/resources/qml/QmlWebWindow.qml | 2 +- interface/resources/qml/dialogs/preferences/AvatarBrowser.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/InfoView.qml b/interface/resources/qml/InfoView.qml index ecf928b7f7..c5dba7e1f3 100644 --- a/interface/resources/qml/InfoView.qml +++ b/interface/resources/qml/InfoView.qml @@ -1,5 +1,5 @@ // -// DefaultFrame.qml +// InfoView.qml // // Created by Bradley Austin Davis on 27 Apr 2015 // Copyright 2015 High Fidelity, Inc. diff --git a/interface/resources/qml/QmlWebWindow.qml b/interface/resources/qml/QmlWebWindow.qml index d58456746a..ae052879db 100644 --- a/interface/resources/qml/QmlWebWindow.qml +++ b/interface/resources/qml/QmlWebWindow.qml @@ -1,5 +1,5 @@ // -// DefaultFrame.qml +// QmlWebWindow.qml // // Created by Bradley Austin Davis on 17 Dec 2015 // Copyright 2015 High Fidelity, Inc. diff --git a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml index 64c46e4f18..2fc2af1a6a 100644 --- a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml +++ b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml @@ -1,5 +1,5 @@ // -// WebView.qml +// AvatarBrowser.qml // // Created by Bradley Austin Davis on 30 Aug 2015 // Copyright 2015 High Fidelity, Inc. From 9c0aeb9b814f188a0eeb9d92c3cc30af07de5307 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 26 Apr 2016 17:50:08 -0700 Subject: [PATCH 11/16] remove cruft --- libraries/animation/src/Rig.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 897fa358e8..0ce6f6639e 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -203,8 +203,6 @@ public: // rig space bool getModelRegistrationPoint(glm::vec3& modelRegistrationPointOut) const; - const glm::vec3& getEyesInRootFrame() const { return _eyesInRootFrame; } - // rig space AnimPose getAbsoluteDefaultPose(int index) const; @@ -275,7 +273,6 @@ protected: glm::vec3 _lastFront; glm::vec3 _lastPosition; glm::vec3 _lastVelocity; - glm::vec3 _eyesInRootFrame { Vectors::ZERO }; QUrl _animGraphURL; std::shared_ptr _animNode; From 5f98af1898a37f596db7cfa543d61a94b27e9da9 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 26 Apr 2016 17:50:23 -0700 Subject: [PATCH 12/16] avoid crossed eyes --- interface/src/avatar/SkeletonModel.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 7019944f3b..0fe1a59bb2 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -85,12 +85,23 @@ Rig::CharacterControllerState convertCharacterControllerState(CharacterControlle }; } + // Called within Model::simulate call, below. void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { const FBXGeometry& geometry = getFBXGeometry(); Head* head = _owningAvatar->getHead(); + + // make sure lookAt is not too close to face (avoid crosseyes) + glm::vec3 lookAt = _owningAvatar->isMyAvatar() ? head->getLookAtPosition() : head->getCorrectedLookAtPosition(); + glm::vec3 focusOffset = lookAt - _owningAvatar->getHead()->getEyePosition(); + float focusDistance = glm::length(focusOffset); + const float MIN_LOOK_AT_FOCUS_DISTANCE = 1.0f; + if (focusDistance < MIN_LOOK_AT_FOCUS_DISTANCE && focusDistance > EPSILON) { + lookAt = _owningAvatar->getHead()->getEyePosition() + (MIN_LOOK_AT_FOCUS_DISTANCE / focusDistance) * focusOffset; + } + if (_owningAvatar->isMyAvatar()) { MyAvatar* myAvatar = static_cast(_owningAvatar); @@ -164,7 +175,7 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { Rig::EyeParameters eyeParams; eyeParams.worldHeadOrientation = headParams.worldHeadOrientation; - eyeParams.eyeLookAt = head->getLookAtPosition(); + eyeParams.eyeLookAt = lookAt; eyeParams.eyeSaccade = head->getSaccade(); eyeParams.modelRotation = getRotation(); eyeParams.modelTranslation = getTranslation(); @@ -196,8 +207,8 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { Rig::EyeParameters eyeParams; eyeParams.worldHeadOrientation = head->getFinalOrientationInWorldFrame(); - eyeParams.eyeLookAt = head->getCorrectedLookAtPosition(); - eyeParams.eyeSaccade = glm::vec3(); + eyeParams.eyeLookAt = lookAt; + eyeParams.eyeSaccade = glm::vec3(0.0f); eyeParams.modelRotation = getRotation(); eyeParams.modelTranslation = getTranslation(); eyeParams.leftEyeJointIndex = geometry.leftEyeJointIndex; From 2f20e583014e4152f30bc1f4c9f19f6ce234a5b8 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Wed, 27 Apr 2016 19:53:28 -0700 Subject: [PATCH 13/16] Avoid crashing on missed pipelines --- libraries/render/src/render/DrawTask.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 2f0d81db3f..58b3a50e54 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -105,6 +105,9 @@ void render::renderStateSortShapes(const SceneContextPointer& sceneContext, cons for (auto& pipelineKey : sortedPipelines) { auto& bucket = sortedShapes[pipelineKey]; args->_pipeline = shapeContext->pickPipeline(args, pipelineKey); + if (!args->_pipeline) { + continue; + } for (auto& item : bucket) { item.render(args); } From 6b8109f16422a4f6d17e9fd92fea63e0f292d599 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 29 Apr 2016 12:42:10 +1200 Subject: [PATCH 14/16] Fix avatar browser top border height and remove separate "close" button --- .../resources/qml/dialogs/preferences/AvatarBrowser.qml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml index 2fc2af1a6a..e5bc9b80ef 100644 --- a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml +++ b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml @@ -29,16 +29,9 @@ Windows.Window { Controls.WebView { id: webview - anchors { top: parent.top; left: parent.left; right: parent.right; bottom: closeButton.top; margins: 8 } + anchors.fill: parent url: "https://metaverse.highfidelity.com/marketplace?category=avatars" focus: true } - - Button { - id: closeButton - anchors { bottom: parent.bottom; right: parent.right; margins: 8 } - text: "Close" - onClicked: root.destroy(); - } } } From 13945aa4d9bdbf456c2d82700df7afbd2cd5cf67 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Sat, 30 Apr 2016 13:48:59 -0700 Subject: [PATCH 15/16] Annotate all virtual fns with override --- interface/src/avatar/AvatarManager.h | 8 ++++---- interface/src/ui/overlays/Base3DOverlay.h | 4 ++-- interface/src/ui/overlays/Billboard3DOverlay.h | 2 +- interface/src/ui/overlays/Circle3DOverlay.h | 8 ++++---- interface/src/ui/overlays/Cube3DOverlay.h | 6 +++--- interface/src/ui/overlays/Grid3DOverlay.h | 10 +++++----- interface/src/ui/overlays/Image3DOverlay.h | 10 +++++----- interface/src/ui/overlays/Line3DOverlay.h | 8 ++++---- interface/src/ui/overlays/ModelOverlay.h | 18 +++++++++--------- interface/src/ui/overlays/Overlay2D.h | 4 ++-- interface/src/ui/overlays/Planar3DOverlay.h | 4 ++-- interface/src/ui/overlays/Rectangle3DOverlay.h | 6 +++--- interface/src/ui/overlays/Sphere3DOverlay.h | 6 +++--- interface/src/ui/overlays/Text3DOverlay.h | 10 +++++----- interface/src/ui/overlays/Volume3DOverlay.h | 4 ++-- interface/src/ui/overlays/Web3DOverlay.h | 10 +++++----- .../src/RenderableWebEntityItem.h | 2 +- .../src/RenderableZoneEntityItem.h | 12 ++++++------ libraries/entities/src/EntityItem.h | 2 +- libraries/entities/src/EntityTree.h | 2 +- .../src/model-networking/ModelCache.h | 2 +- .../src/procedural/ProceduralSkybox.h | 2 +- 22 files changed, 70 insertions(+), 70 deletions(-) diff --git a/interface/src/avatar/AvatarManager.h b/interface/src/avatar/AvatarManager.h index bedd089c93..94a66782f2 100644 --- a/interface/src/avatar/AvatarManager.h +++ b/interface/src/avatar/AvatarManager.h @@ -78,11 +78,11 @@ private: void simulateAvatarFades(float deltaTime); // virtual overrides - virtual AvatarSharedPointer newSharedAvatar(); - virtual AvatarSharedPointer addAvatar(const QUuid& sessionUUID, const QWeakPointer& mixerWeakPointer); + virtual AvatarSharedPointer newSharedAvatar() override; + virtual AvatarSharedPointer addAvatar(const QUuid& sessionUUID, const QWeakPointer& mixerWeakPointer) override; - virtual void removeAvatar(const QUuid& sessionUUID); - virtual void handleRemovedAvatar(const AvatarSharedPointer& removedAvatar); + virtual void removeAvatar(const QUuid& sessionUUID) override; + virtual void handleRemovedAvatar(const AvatarSharedPointer& removedAvatar) override; QVector _avatarFades; std::shared_ptr _myAvatar; diff --git a/interface/src/ui/overlays/Base3DOverlay.h b/interface/src/ui/overlays/Base3DOverlay.h index c001d39f69..41e7e517b7 100644 --- a/interface/src/ui/overlays/Base3DOverlay.h +++ b/interface/src/ui/overlays/Base3DOverlay.h @@ -23,7 +23,7 @@ public: Base3DOverlay(const Base3DOverlay* base3DOverlay); // getters - virtual bool is3D() const { return true; } + virtual bool is3D() const override { return true; } const glm::vec3& getPosition() const { return _transform.getTranslation(); } const glm::quat& getRotation() const { return _transform.getRotation(); } const glm::vec3& getScale() const { return _transform.getScale(); } @@ -50,7 +50,7 @@ public: void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; } void setDrawInFront(bool value) { _drawInFront = value; } - virtual AABox getBounds() const = 0; + virtual AABox getBounds() const override = 0; void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; diff --git a/interface/src/ui/overlays/Billboard3DOverlay.h b/interface/src/ui/overlays/Billboard3DOverlay.h index 1d4d60bf5b..d256a92afe 100644 --- a/interface/src/ui/overlays/Billboard3DOverlay.h +++ b/interface/src/ui/overlays/Billboard3DOverlay.h @@ -27,7 +27,7 @@ public: QVariant getProperty(const QString& property) override; protected: - virtual void applyTransformTo(Transform& transform, bool force = false); + virtual void applyTransformTo(Transform& transform, bool force = false) override; }; #endif // hifi_Billboard3DOverlay_h diff --git a/interface/src/ui/overlays/Circle3DOverlay.h b/interface/src/ui/overlays/Circle3DOverlay.h index f0bc49c313..c0e84ef1c6 100644 --- a/interface/src/ui/overlays/Circle3DOverlay.h +++ b/interface/src/ui/overlays/Circle3DOverlay.h @@ -19,12 +19,12 @@ class Circle3DOverlay : public Planar3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Circle3DOverlay(); Circle3DOverlay(const Circle3DOverlay* circle3DOverlay); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; virtual const render::ShapeKey getShapeKey() override; void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; @@ -54,9 +54,9 @@ public: void setMinorTickMarksColor(const xColor& value) { _minorTickMarksColor = value; } virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal); + BoxFace& face, glm::vec3& surfaceNormal) override; - virtual Circle3DOverlay* createClone() const; + virtual Circle3DOverlay* createClone() const override; protected: float _startAt; diff --git a/interface/src/ui/overlays/Cube3DOverlay.h b/interface/src/ui/overlays/Cube3DOverlay.h index 93ea46db4d..78b8b06582 100644 --- a/interface/src/ui/overlays/Cube3DOverlay.h +++ b/interface/src/ui/overlays/Cube3DOverlay.h @@ -18,15 +18,15 @@ class Cube3DOverlay : public Volume3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Cube3DOverlay() {} Cube3DOverlay(const Cube3DOverlay* cube3DOverlay); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; virtual const render::ShapeKey getShapeKey() override; - virtual Cube3DOverlay* createClone() const; + virtual Cube3DOverlay* createClone() const override; float getBorderSize() const { return _borderSize; } diff --git a/interface/src/ui/overlays/Grid3DOverlay.h b/interface/src/ui/overlays/Grid3DOverlay.h index aa372436de..90e3083dba 100644 --- a/interface/src/ui/overlays/Grid3DOverlay.h +++ b/interface/src/ui/overlays/Grid3DOverlay.h @@ -19,22 +19,22 @@ class Grid3DOverlay : public Planar3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Grid3DOverlay(); Grid3DOverlay(const Grid3DOverlay* grid3DOverlay); - virtual AABox getBounds() const; + virtual AABox getBounds() const override; - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; virtual const render::ShapeKey getShapeKey() override; void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; - virtual Grid3DOverlay* createClone() const; + virtual Grid3DOverlay* createClone() const override; // Grids are UI tools, and may not be intersected (pickable) - virtual bool findRayIntersection(const glm::vec3&, const glm::vec3&, float&, BoxFace&, glm::vec3&) { return false; } + virtual bool findRayIntersection(const glm::vec3&, const glm::vec3&, float&, BoxFace&, glm::vec3&) override { return false; } private: void updateGrid(); diff --git a/interface/src/ui/overlays/Image3DOverlay.h b/interface/src/ui/overlays/Image3DOverlay.h index 2bdc58709a..159c6b4ccb 100644 --- a/interface/src/ui/overlays/Image3DOverlay.h +++ b/interface/src/ui/overlays/Image3DOverlay.h @@ -22,14 +22,14 @@ class Image3DOverlay : public Billboard3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Image3DOverlay(); Image3DOverlay(const Image3DOverlay* image3DOverlay); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; - virtual void update(float deltatime); + virtual void update(float deltatime) override; virtual const render::ShapeKey getShapeKey() override; @@ -41,9 +41,9 @@ public: QVariant getProperty(const QString& property) override; virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal); + BoxFace& face, glm::vec3& surfaceNormal) override; - virtual Image3DOverlay* createClone() const; + virtual Image3DOverlay* createClone() const override; private: QString _url; diff --git a/interface/src/ui/overlays/Line3DOverlay.h b/interface/src/ui/overlays/Line3DOverlay.h index 8ff38859a2..db50d11276 100644 --- a/interface/src/ui/overlays/Line3DOverlay.h +++ b/interface/src/ui/overlays/Line3DOverlay.h @@ -18,14 +18,14 @@ class Line3DOverlay : public Base3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Line3DOverlay(); Line3DOverlay(const Line3DOverlay* line3DOverlay); ~Line3DOverlay(); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; virtual const render::ShapeKey getShapeKey() override; - virtual AABox getBounds() const; + virtual AABox getBounds() const override; // getters const glm::vec3& getStart() const { return _start; } @@ -38,7 +38,7 @@ public: void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; - virtual Line3DOverlay* createClone() const; + virtual Line3DOverlay* createClone() const override; protected: glm::vec3 _start; diff --git a/interface/src/ui/overlays/ModelOverlay.h b/interface/src/ui/overlays/ModelOverlay.h index 36ff75cb6a..dc4b4a853b 100644 --- a/interface/src/ui/overlays/ModelOverlay.h +++ b/interface/src/ui/overlays/ModelOverlay.h @@ -20,24 +20,24 @@ class ModelOverlay : public Volume3DOverlay { Q_OBJECT public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } ModelOverlay(); ModelOverlay(const ModelOverlay* modelOverlay); - virtual void update(float deltatime); - virtual void render(RenderArgs* args); + virtual void update(float deltatime) override; + virtual void render(RenderArgs* args) override; void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal); - virtual bool findRayIntersectionExtraInfo(const glm::vec3& origin, const glm::vec3& direction, - float& distance, BoxFace& face, glm::vec3& surfaceNormal, QString& extraInfo); + BoxFace& face, glm::vec3& surfaceNormal) override; + virtual bool findRayIntersectionExtraInfo(const glm::vec3& origin, const glm::vec3& direction, + float& distance, BoxFace& face, glm::vec3& surfaceNormal, QString& extraInfo) override; - virtual ModelOverlay* createClone() const; + virtual ModelOverlay* createClone() const override; - virtual bool addToScene(Overlay::Pointer overlay, std::shared_ptr scene, render::PendingChanges& pendingChanges); - virtual void removeFromScene(Overlay::Pointer overlay, std::shared_ptr scene, render::PendingChanges& pendingChanges); + virtual bool addToScene(Overlay::Pointer overlay, std::shared_ptr scene, render::PendingChanges& pendingChanges) override; + virtual void removeFromScene(Overlay::Pointer overlay, std::shared_ptr scene, render::PendingChanges& pendingChanges) override; private: diff --git a/interface/src/ui/overlays/Overlay2D.h b/interface/src/ui/overlays/Overlay2D.h index 3fd11f79f0..a1efe8a6de 100644 --- a/interface/src/ui/overlays/Overlay2D.h +++ b/interface/src/ui/overlays/Overlay2D.h @@ -22,9 +22,9 @@ public: Overlay2D() {} Overlay2D(const Overlay2D* overlay2D); - virtual AABox getBounds() const; + virtual AABox getBounds() const override; - virtual bool is3D() const { return false; } + virtual bool is3D() const override { return false; } // getters int getX() const { return _bounds.x(); } diff --git a/interface/src/ui/overlays/Planar3DOverlay.h b/interface/src/ui/overlays/Planar3DOverlay.h index ef391e61e4..9c502ab75e 100644 --- a/interface/src/ui/overlays/Planar3DOverlay.h +++ b/interface/src/ui/overlays/Planar3DOverlay.h @@ -20,7 +20,7 @@ public: Planar3DOverlay(); Planar3DOverlay(const Planar3DOverlay* planar3DOverlay); - virtual AABox getBounds() const; + virtual AABox getBounds() const override; glm::vec2 getDimensions() const { return _dimensions; } void setDimensions(float value) { _dimensions = glm::vec2(value); } @@ -30,7 +30,7 @@ public: QVariant getProperty(const QString& property) override; virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal); + BoxFace& face, glm::vec3& surfaceNormal) override; protected: glm::vec2 _dimensions; diff --git a/interface/src/ui/overlays/Rectangle3DOverlay.h b/interface/src/ui/overlays/Rectangle3DOverlay.h index 31ccac45a3..525224ef29 100644 --- a/interface/src/ui/overlays/Rectangle3DOverlay.h +++ b/interface/src/ui/overlays/Rectangle3DOverlay.h @@ -18,16 +18,16 @@ class Rectangle3DOverlay : public Planar3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Rectangle3DOverlay(); Rectangle3DOverlay(const Rectangle3DOverlay* rectangle3DOverlay); ~Rectangle3DOverlay(); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; virtual const render::ShapeKey getShapeKey() override; void setProperties(const QVariantMap& properties) override; - virtual Rectangle3DOverlay* createClone() const; + virtual Rectangle3DOverlay* createClone() const override; private: int _geometryCacheID; glm::vec2 _previousHalfDimensions; diff --git a/interface/src/ui/overlays/Sphere3DOverlay.h b/interface/src/ui/overlays/Sphere3DOverlay.h index ec2efa9f04..991b2ab51e 100644 --- a/interface/src/ui/overlays/Sphere3DOverlay.h +++ b/interface/src/ui/overlays/Sphere3DOverlay.h @@ -18,15 +18,15 @@ class Sphere3DOverlay : public Volume3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Sphere3DOverlay() {} Sphere3DOverlay(const Sphere3DOverlay* Sphere3DOverlay); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; virtual const render::ShapeKey getShapeKey() override; - virtual Sphere3DOverlay* createClone() const; + virtual Sphere3DOverlay* createClone() const override; }; diff --git a/interface/src/ui/overlays/Text3DOverlay.h b/interface/src/ui/overlays/Text3DOverlay.h index 181e9d526c..b7756d0400 100644 --- a/interface/src/ui/overlays/Text3DOverlay.h +++ b/interface/src/ui/overlays/Text3DOverlay.h @@ -22,14 +22,14 @@ class Text3DOverlay : public Billboard3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Text3DOverlay(); Text3DOverlay(const Text3DOverlay* text3DOverlay); ~Text3DOverlay(); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; - virtual void update(float deltatime); + virtual void update(float deltatime) override; virtual const render::ShapeKey getShapeKey() override; @@ -59,9 +59,9 @@ public: QSizeF textSize(const QString& test) const; // Meters virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal); + BoxFace& face, glm::vec3& surfaceNormal) override; - virtual Text3DOverlay* createClone() const; + virtual Text3DOverlay* createClone() const override; private: TextRenderer3D* _textRenderer = nullptr; diff --git a/interface/src/ui/overlays/Volume3DOverlay.h b/interface/src/ui/overlays/Volume3DOverlay.h index 42b3d439d6..4d087615d2 100644 --- a/interface/src/ui/overlays/Volume3DOverlay.h +++ b/interface/src/ui/overlays/Volume3DOverlay.h @@ -20,7 +20,7 @@ public: Volume3DOverlay() {} Volume3DOverlay(const Volume3DOverlay* volume3DOverlay); - virtual AABox getBounds() const; + virtual AABox getBounds() const override; const glm::vec3& getDimensions() const { return _localBoundingBox.getDimensions(); } void setDimensions(float value) { _localBoundingBox.setBox(glm::vec3(-value / 2.0f), value); } @@ -30,7 +30,7 @@ public: QVariant getProperty(const QString& property) override; virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal); + BoxFace& face, glm::vec3& surfaceNormal) override; protected: // Centered local bounding box diff --git a/interface/src/ui/overlays/Web3DOverlay.h b/interface/src/ui/overlays/Web3DOverlay.h index 062cff61d6..a828626715 100644 --- a/interface/src/ui/overlays/Web3DOverlay.h +++ b/interface/src/ui/overlays/Web3DOverlay.h @@ -18,16 +18,16 @@ class Web3DOverlay : public Billboard3DOverlay { public: static QString const TYPE; - virtual QString getType() const { return TYPE; } + virtual QString getType() const override { return TYPE; } Web3DOverlay(); Web3DOverlay(const Web3DOverlay* Web3DOverlay); virtual ~Web3DOverlay(); - virtual void render(RenderArgs* args); + virtual void render(RenderArgs* args) override; virtual const render::ShapeKey getShapeKey() override; - virtual void update(float deltatime); + virtual void update(float deltatime) override; // setters void setURL(const QString& url); @@ -36,9 +36,9 @@ public: QVariant getProperty(const QString& property) override; virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, - BoxFace& face, glm::vec3& surfaceNormal); + BoxFace& face, glm::vec3& surfaceNormal) override; - virtual Web3DOverlay* createClone() const; + virtual Web3DOverlay* createClone() const override; private: OffscreenQmlSurface* _webSurface{ nullptr }; diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.h b/libraries/entities-renderer/src/RenderableWebEntityItem.h index 49a55b6b27..4125be61dd 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.h +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.h @@ -33,7 +33,7 @@ public: QObject* getEventHandler(); void update(const quint64& now) override; - bool needsToCallUpdate() const { return _webSurface != nullptr; } + bool needsToCallUpdate() const override { return _webSurface != nullptr; } SIMPLE_RENDERABLE(); diff --git a/libraries/entities-renderer/src/RenderableZoneEntityItem.h b/libraries/entities-renderer/src/RenderableZoneEntityItem.h index 241a066341..58aa951e64 100644 --- a/libraries/entities-renderer/src/RenderableZoneEntityItem.h +++ b/libraries/entities-renderer/src/RenderableZoneEntityItem.h @@ -27,19 +27,19 @@ public: _needsInitialSimulation(true) { } - virtual bool setProperties(const EntityItemProperties& properties); + virtual bool setProperties(const EntityItemProperties& properties) override; virtual void somethingChangedNotification() override; virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args, EntityPropertyFlags& propertyFlags, bool overwriteLocalData, - bool& somethingChanged); + bool& somethingChanged) override; - virtual void render(RenderArgs* args); - virtual bool contains(const glm::vec3& point) const; + virtual void render(RenderArgs* args) override; + virtual bool contains(const glm::vec3& point) const override; - virtual bool addToScene(EntityItemPointer self, std::shared_ptr scene, render::PendingChanges& pendingChanges); - virtual void removeFromScene(EntityItemPointer self, std::shared_ptr scene, render::PendingChanges& pendingChanges); + virtual bool addToScene(EntityItemPointer self, std::shared_ptr scene, render::PendingChanges& pendingChanges) override; + virtual void removeFromScene(EntityItemPointer self, std::shared_ptr scene, render::PendingChanges& pendingChanges) override; private: virtual void locationChanged(bool tellPhysics = true) override { EntityItem::locationChanged(tellPhysics); notifyBoundChanged(); } diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index b3689b9b56..742ab337d0 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -361,7 +361,7 @@ public: void setPhysicsInfo(void* data) { _physicsInfo = data; } EntityTreeElementPointer getElement() const { return _element; } EntityTreePointer getTree() const; - virtual SpatialParentTree* getParentTree() const; + virtual SpatialParentTree* getParentTree() const override; bool wantTerseEditLogging() const; glm::mat4 getEntityToWorldMatrix() const; diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index 1937bf6daf..54e516d01d 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -127,7 +127,7 @@ public: EntityItemPointer findClosestEntity(glm::vec3 position, float targetRadius); EntityItemPointer findEntityByID(const QUuid& id); EntityItemPointer findEntityByEntityItemID(const EntityItemID& entityID); - virtual SpatiallyNestablePointer findByID(const QUuid& id) { return findEntityByID(id); } + virtual SpatiallyNestablePointer findByID(const QUuid& id) override { return findEntityByID(id); } EntityItemID assignEntityID(const EntityItemID& entityItemID); /// Assigns a known ID for a creator token ID diff --git a/libraries/model-networking/src/model-networking/ModelCache.h b/libraries/model-networking/src/model-networking/ModelCache.h index f479dc9ce2..88e89a57a9 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.h +++ b/libraries/model-networking/src/model-networking/ModelCache.h @@ -98,7 +98,7 @@ public: GeometryResource(const QUrl& url, const QUrl& textureBaseUrl = QUrl()) : Resource(url), _textureBaseUrl(textureBaseUrl) {} - virtual bool areTexturesLoaded() const { return isLoaded() && Geometry::areTexturesLoaded(); } + virtual bool areTexturesLoaded() const override { return isLoaded() && Geometry::areTexturesLoaded(); } virtual void deleter() override; diff --git a/libraries/procedural/src/procedural/ProceduralSkybox.h b/libraries/procedural/src/procedural/ProceduralSkybox.h index 2b8f2327a0..b38e481317 100644 --- a/libraries/procedural/src/procedural/ProceduralSkybox.h +++ b/libraries/procedural/src/procedural/ProceduralSkybox.h @@ -26,7 +26,7 @@ public: virtual void clear() override; - virtual void render(gpu::Batch& batch, const ViewFrustum& frustum) const; + virtual void render(gpu::Batch& batch, const ViewFrustum& frustum) const override; static void render(gpu::Batch& batch, const ViewFrustum& frustum, const ProceduralSkybox& skybox); protected: From f1de59083569511da1dfb4172c37b05a4e8a5d1e Mon Sep 17 00:00:00 2001 From: Eric Levin Date: Sat, 30 Apr 2016 14:45:28 -0700 Subject: [PATCH 16/16] updated script --- scripts/tutorials/createPingPongGun.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tutorials/createPingPongGun.js b/scripts/tutorials/createPingPongGun.js index aaeb55e591..a077e5308d 100644 --- a/scripts/tutorials/createPingPongGun.js +++ b/scripts/tutorials/createPingPongGun.js @@ -7,7 +7,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var SCRIPT_URL = "http://hifi-production.s3.amazonaws.com/tutorials/entity_scripts/pingPongGun.js"; +var SCRIPT_URL = "http://hifi-production.s3.amazonaws.com/tutorials/entity_scripts/pingPongGun.js"; var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/tutorials/pingPongGun/Pingpong-Gun-New.fbx'; var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/tutorials/pingPongGun/Pingpong-Gun-New.obj'; var center = Vec3.sum(Vec3.sum(MyAvatar.position, { @@ -70,4 +70,4 @@ var pingPongGunProperties = { var pingPongGun = Entities.addEntity(pingPongGunProperties); -Script.stop(); \ No newline at end of file +Script.stop();