From 72f272b5d3ba908f202c4878dacbee96a7643b77 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 27 Apr 2016 09:48:16 -0700 Subject: [PATCH 01/34] lampfix --- .../DomainContent/Home/kineticObjects/deskLamp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json b/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json index 9b15f6c260..762a43658f 100644 --- a/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json +++ b/unpublishedScripts/DomainContent/Home/kineticObjects/deskLamp.json @@ -20,7 +20,7 @@ "parentID": "{f59b50d8-13fb-4ceb-b80a-62cd03428a7c}", "position": { "x": 0, - "y": -0.075, + "y": 0.11, "z": 0 }, "queryAACube": { From c686418be0f434139c09e950dab74a2f156e9d12 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 27 Apr 2016 10:34:29 -0700 Subject: [PATCH 02/34] optimize use of EntityItem::getDimensions() --- libraries/entities/src/EntityItem.cpp | 73 +++++++++++++++------------ libraries/entities/src/EntityItem.h | 2 +- 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 938fbe12ac..2d1bbf2f88 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -781,7 +781,8 @@ void EntityItem::adjustEditPacketForClockSkew(QByteArray& buffer, qint64 clockSk } float EntityItem::computeMass() const { - return _density * _volumeMultiplier * getDimensions().x * getDimensions().y * getDimensions().z; + glm::vec3 dimensions = getDimensions(); + return _density * _volumeMultiplier * dimensions.x * dimensions.y * dimensions.z; } void EntityItem::setDensity(float density) { @@ -801,7 +802,8 @@ void EntityItem::setMass(float mass) { // we must protect the density range to help maintain stability of physics simulation // therefore this method might not accept the mass that is supplied. - float volume = _volumeMultiplier * getDimensions().x * getDimensions().y * getDimensions().z; + glm::vec3 dimensions = getDimensions(); + float volume = _volumeMultiplier * dimensions.x * dimensions.y * dimensions.z; // compute new density const float MIN_VOLUME = 1.0e-6f; // 0.001mm^3 @@ -1222,11 +1224,13 @@ AACube EntityItem::getMaximumAACube(bool& success) const { // * we know that the position is the center of rotation glm::vec3 centerOfRotation = getPosition(success); // also where _registration point is if (success) { + _recalcMaxAACube = false; // * we know that the registration point is the center of rotation // * we can calculate the length of the furthest extent from the registration point // as the dimensions * max (registrationPoint, (1.0,1.0,1.0) - registrationPoint) - glm::vec3 registrationPoint = (getDimensions() * getRegistrationPoint()); - glm::vec3 registrationRemainder = (getDimensions() * (glm::vec3(1.0f, 1.0f, 1.0f) - getRegistrationPoint())); + glm::vec3 dimensions = getDimensions(); + glm::vec3 registrationPoint = (dimensions * _registrationPoint); + glm::vec3 registrationRemainder = (dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint)); glm::vec3 furthestExtentFromRegistration = glm::max(registrationPoint, registrationRemainder); // * we know that if you rotate in any direction you would create a sphere @@ -1238,7 +1242,6 @@ AACube EntityItem::getMaximumAACube(bool& success) const { glm::vec3 minimumCorner = centerOfRotation - glm::vec3(radius, radius, radius); _maxAACube = AACube(minimumCorner, radius * 2.0f); - _recalcMaxAACube = false; } } else { success = true; @@ -1251,28 +1254,27 @@ AACube EntityItem::getMaximumAACube(bool& success) const { /// AACube EntityItem::getMinimumAACube(bool& success) const { if (_recalcMinAACube) { - // _position represents the position of the registration point. - glm::vec3 registrationRemainder = glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint; - - glm::vec3 unrotatedMinRelativeToEntity = - (getDimensions() * getRegistrationPoint()); - glm::vec3 unrotatedMaxRelativeToEntity = getDimensions() * registrationRemainder; - Extents unrotatedExtentsRelativeToRegistrationPoint = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity }; - Extents rotatedExtentsRelativeToRegistrationPoint = - unrotatedExtentsRelativeToRegistrationPoint.getRotated(getRotation()); - - // shift the extents to be relative to the position/registration point - rotatedExtentsRelativeToRegistrationPoint.shiftBy(getPosition(success)); - + // position represents the position of the registration point. + glm::vec3 position = getPosition(success); if (success) { + _recalcMinAACube = false; + glm::vec3 dimensions = getDimensions(); + glm::vec3 unrotatedMinRelativeToEntity = - (dimensions * _registrationPoint); + glm::vec3 unrotatedMaxRelativeToEntity = dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint); + Extents extents = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity }; + extents.rotate(getRotation()); + + // shift the extents to be relative to the position/registration point + extents.shiftBy(position); + // the cube that best encompasses extents is... - AABox box(rotatedExtentsRelativeToRegistrationPoint); + AABox box(extents); glm::vec3 centerOfBox = box.calcCenter(); float longestSide = box.getLargestDimension(); float halfLongestSide = longestSide / 2.0f; glm::vec3 cornerOfCube = centerOfBox - glm::vec3(halfLongestSide, halfLongestSide, halfLongestSide); _minAACube = AACube(cornerOfCube, longestSide); - _recalcMinAACube = false; } } else { success = true; @@ -1282,21 +1284,20 @@ AACube EntityItem::getMinimumAACube(bool& success) const { AABox EntityItem::getAABox(bool& success) const { if (_recalcAABox) { - // _position represents the position of the registration point. - glm::vec3 registrationRemainder = glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint; - - glm::vec3 unrotatedMinRelativeToEntity = - (getDimensions() * _registrationPoint); - glm::vec3 unrotatedMaxRelativeToEntity = getDimensions() * registrationRemainder; - Extents unrotatedExtentsRelativeToRegistrationPoint = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity }; - Extents rotatedExtentsRelativeToRegistrationPoint = - unrotatedExtentsRelativeToRegistrationPoint.getRotated(getRotation()); - - // shift the extents to be relative to the position/registration point - rotatedExtentsRelativeToRegistrationPoint.shiftBy(getPosition(success)); - + // position represents the position of the registration point. + glm::vec3 position = getPosition(success); if (success) { - _cachedAABox = AABox(rotatedExtentsRelativeToRegistrationPoint); _recalcAABox = false; + glm::vec3 dimensions = getDimensions(); + glm::vec3 unrotatedMinRelativeToEntity = - (dimensions * _registrationPoint); + glm::vec3 unrotatedMaxRelativeToEntity = dimensions * (glm::vec3(1.0f, 1.0f, 1.0f) - _registrationPoint); + Extents extents = { unrotatedMinRelativeToEntity, unrotatedMaxRelativeToEntity }; + extents.rotate(getRotation()); + + // shift the extents to be relative to the position/registration point + extents.shiftBy(position); + + _cachedAABox = AABox(extents); } } else { success = true; @@ -1373,6 +1374,11 @@ void EntityItem::computeShapeInfo(ShapeInfo& info) { adjustShapeInfoByRegistration(info); } +float EntityItem::getVolumeEstimate() const { + glm::vec3 dimensions = getDimensions(); + return dimensions.x * dimensions.y * dimensions.z; +} + void EntityItem::updateRegistrationPoint(const glm::vec3& value) { if (value != _registrationPoint) { setRegistrationPoint(value); @@ -1433,7 +1439,8 @@ void EntityItem::updateMass(float mass) { // we must protect the density range to help maintain stability of physics simulation // therefore this method might not accept the mass that is supplied. - float volume = _volumeMultiplier * getDimensions().x * getDimensions().y * getDimensions().z; + glm::vec3 dimensions = getDimensions(); + float volume = _volumeMultiplier * dimensions.x * dimensions.y * dimensions.z; // compute new density float newDensity = _density; diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index 5e34d942f6..b3689b9b56 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -314,7 +314,7 @@ public: virtual bool isReadyToComputeShape() { return !isDead(); } virtual void computeShapeInfo(ShapeInfo& info); - virtual float getVolumeEstimate() const { return getDimensions().x * getDimensions().y * getDimensions().z; } + virtual float getVolumeEstimate() const; /// return preferred shape type (actual physical shape may differ) virtual ShapeType getShapeType() const { return SHAPE_TYPE_NONE; } From b5ad98981128a586e2adedc05acc184e7da9e358 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 27 Apr 2016 11:04:22 -0700 Subject: [PATCH 03/34] more optimized uses of EntityItem::getDimensions() --- .../entities-renderer/src/RenderableModelEntityItem.cpp | 5 +++-- .../entities-renderer/src/RenderablePolyVoxEntityItem.cpp | 8 +++++--- .../entities-renderer/src/RenderableWebEntityItem.cpp | 5 +++-- libraries/entities/src/LightEntityItem.cpp | 5 +++-- libraries/entities/src/LineEntityItem.cpp | 4 +--- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index f3a8d3110c..c4ac9b09e5 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -339,15 +339,16 @@ void RenderableModelEntityItem::updateModelBounds() { return; } bool movingOrAnimating = isMovingRelativeToParent() || isAnimatingSomething(); + glm::vec3 dimensions = getDimensions(); if ((movingOrAnimating || _needsInitialSimulation || _needsJointSimulation || _model->getTranslation() != getPosition() || - _model->getScaleToFitDimensions() != getDimensions() || + _model->getScaleToFitDimensions() != dimensions || _model->getRotation() != getRotation() || _model->getRegistrationPoint() != getRegistrationPoint()) && _model->isActive() && _dimensionsInitialized) { - _model->setScaleToFit(true, getDimensions()); + _model->setScaleToFit(true, dimensions); _model->setSnapModelToRegistrationPoint(true, getRegistrationPoint()); _model->setRotation(getRotation()); _model->setTranslation(getPosition()); diff --git a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp index c9c4c8503a..6c4e3994c6 100644 --- a/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp @@ -206,13 +206,14 @@ glm::mat4 RenderablePolyVoxEntityItem::voxelToLocalMatrix() const { voxelVolumeSize = _voxelVolumeSize; }); - glm::vec3 scale = getDimensions() / voxelVolumeSize; // meters / voxel-units + glm::vec3 dimensions = getDimensions(); + glm::vec3 scale = dimensions / voxelVolumeSize; // meters / voxel-units bool success; // TODO -- Does this actually have to happen in world space? glm::vec3 center = getCenterPosition(success); // this handles registrationPoint changes glm::vec3 position = getPosition(success); glm::vec3 positionToCenter = center - position; - positionToCenter -= getDimensions() * Vectors::HALF - getSurfacePositionAdjustment(); + positionToCenter -= dimensions * Vectors::HALF - getSurfacePositionAdjustment(); glm::mat4 centerToCorner = glm::translate(glm::mat4(), positionToCenter); glm::mat4 scaled = glm::scale(centerToCorner, scale); return scaled; @@ -445,7 +446,8 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o // the PolyVox ray intersection code requires a near and far point. // set ray cast length to long enough to cover all of the voxel space float distanceToEntity = glm::distance(origin, getPosition()); - float largestDimension = glm::max(getDimensions().x, getDimensions().y, getDimensions().z) * 2.0f; + glm::vec3 dimensions = getDimensions(); + float largestDimension = glm::max(dimensions.x, dimensions.y, dimensions.z) * 2.0f; glm::vec3 farPoint = origin + normDirection * (distanceToEntity + largestDimension); glm::vec4 originInVoxel = wtvMatrix * glm::vec4(origin, 1.0f); diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp index 855fd16408..26aecf6050 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp @@ -119,12 +119,13 @@ bool RenderableWebEntityItem::buildWebSurface(EntityTreeRenderer* renderer) { // Map the intersection point to an actual offscreen pixel glm::vec3 point = intersection.intersection; + glm::vec3 dimensions = getDimensions(); point -= getPosition(); point = glm::inverse(getRotation()) * point; - point /= getDimensions(); + point /= dimensions; point += 0.5f; point.y = 1.0f - point.y; - point *= getDimensions() * METERS_TO_INCHES * DPI; + point *= dimensions * (METERS_TO_INCHES * DPI); if (event->button() == Qt::MouseButton::LeftButton) { if (event->type() == QEvent::MouseButtonPress) { diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index 852b37a751..1be133463c 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -76,12 +76,13 @@ void LightEntityItem::setIsSpotlight(bool value) { if (value != _isSpotlight) { _isSpotlight = value; + glm::vec3 dimensions = getDimensions(); if (_isSpotlight) { - const float length = getDimensions().z; + const float length = dimensions.z; const float width = length * glm::sin(glm::radians(_cutoff)); setDimensions(glm::vec3(width, width, length)); } else { - float maxDimension = glm::max(getDimensions().x, getDimensions().y, getDimensions().z); + float maxDimension = glm::max(dimensions.x, dimensions.y, dimensions.z); setDimensions(glm::vec3(maxDimension, maxDimension, maxDimension)); } } diff --git a/libraries/entities/src/LineEntityItem.cpp b/libraries/entities/src/LineEntityItem.cpp index d48780845f..78b6107d88 100644 --- a/libraries/entities/src/LineEntityItem.cpp +++ b/libraries/entities/src/LineEntityItem.cpp @@ -101,15 +101,13 @@ bool LineEntityItem::setLinePoints(const QVector& points) { if (points.size() > MAX_POINTS_PER_LINE) { return false; } + glm::vec3 halfBox = getDimensions() * 0.5f; for (int i = 0; i < points.size(); i++) { glm::vec3 point = points.at(i); - // glm::vec3 pos = getPosition(); - glm::vec3 halfBox = getDimensions() * 0.5f; if ( (point.x < - halfBox.x || point.x > halfBox.x) || (point.y < -halfBox.y || point.y > halfBox.y) || (point.z < - halfBox.z || point.z > halfBox.z) ) { qDebug() << "Point is outside entity's bounding box"; return false; } - } _points = points; _pointsChanged = true; From 26e8e22b8bbfe3e21d49c0ce3eab93b25b8fe7ae Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 28 Apr 2016 12:23:47 +1200 Subject: [PATCH 04/34] Move directory, examples, and edit toolbar buttons down Moved down as far as they can go within the getRecommendedOverlayRect(), i.e., there's a 50px margin. --- scripts/system/directory.js | 2 +- scripts/system/edit.js | 2 +- scripts/system/examples.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/system/directory.js b/scripts/system/directory.js index cf9aa6aba7..881b25b771 100644 --- a/scripts/system/directory.js +++ b/scripts/system/directory.js @@ -26,7 +26,7 @@ var directoryWindow = new OverlayWebWindow({ var toolHeight = 50; var toolWidth = 50; -var TOOLBAR_MARGIN_Y = 25; +var TOOLBAR_MARGIN_Y = 0; function showDirectory() { diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 2796297e40..b82554aae0 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -53,7 +53,7 @@ selectionManager.addEventListener(function() { var toolIconUrl = Script.resolvePath("assets/images/tools/"); var toolHeight = 50; var toolWidth = 50; -var TOOLBAR_MARGIN_Y = 25; +var TOOLBAR_MARGIN_Y = 0; var DEGREES_TO_RADIANS = Math.PI / 180.0; var RADIANS_TO_DEGREES = 180.0 / Math.PI; diff --git a/scripts/system/examples.js b/scripts/system/examples.js index 9caedec70f..9438aef613 100644 --- a/scripts/system/examples.js +++ b/scripts/system/examples.js @@ -26,7 +26,7 @@ var examplesWindow = new OverlayWebWindow({ var toolHeight = 50; var toolWidth = 50; -var TOOLBAR_MARGIN_Y = 25; +var TOOLBAR_MARGIN_Y = 0; function showExamples(marketplaceID) { From eee3cedd951fa1bc82d83cec04aeb82340a9aaec Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 28 Apr 2016 12:55:41 +1200 Subject: [PATCH 05/34] Fix typo --- scripts/system/examples.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/examples.js b/scripts/system/examples.js index 9438aef613..9d33e473af 100644 --- a/scripts/system/examples.js +++ b/scripts/system/examples.js @@ -58,7 +58,7 @@ var toolBar = (function() { browseExamplesButton; function initialize() { - toolBar = new ToolBar(0, 0, ToolBar.HORIXONTAL, "highfidelity.examples.toolbar", function(windowDimensions, toolbar) { + toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.examples.toolbar", function(windowDimensions, toolbar) { return { x: windowDimensions.x / 2, y: windowDimensions.y From b2564e8266e35aff2ff4e1e8598a3aa435ba4326 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Wed, 27 Apr 2016 23:42:01 -0700 Subject: [PATCH 06/34] move toybox resetter scripts --- .../{ => DomainContent/Toybox}/basketballsResetter.js | 0 .../{ => DomainContent/Toybox}/hiddenEntityReset.js | 0 .../{ => DomainContent/Toybox}/immediateClientReset.js | 0 unpublishedScripts/{ => DomainContent/Toybox}/masterReset.js | 0 unpublishedScripts/{ => DomainContent/Toybox}/targetsResetter.js | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename unpublishedScripts/{ => DomainContent/Toybox}/basketballsResetter.js (100%) rename unpublishedScripts/{ => DomainContent/Toybox}/hiddenEntityReset.js (100%) rename unpublishedScripts/{ => DomainContent/Toybox}/immediateClientReset.js (100%) rename unpublishedScripts/{ => DomainContent/Toybox}/masterReset.js (100%) rename unpublishedScripts/{ => DomainContent/Toybox}/targetsResetter.js (100%) diff --git a/unpublishedScripts/basketballsResetter.js b/unpublishedScripts/DomainContent/Toybox/basketballsResetter.js similarity index 100% rename from unpublishedScripts/basketballsResetter.js rename to unpublishedScripts/DomainContent/Toybox/basketballsResetter.js diff --git a/unpublishedScripts/hiddenEntityReset.js b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js similarity index 100% rename from unpublishedScripts/hiddenEntityReset.js rename to unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js diff --git a/unpublishedScripts/immediateClientReset.js b/unpublishedScripts/DomainContent/Toybox/immediateClientReset.js similarity index 100% rename from unpublishedScripts/immediateClientReset.js rename to unpublishedScripts/DomainContent/Toybox/immediateClientReset.js diff --git a/unpublishedScripts/masterReset.js b/unpublishedScripts/DomainContent/Toybox/masterReset.js similarity index 100% rename from unpublishedScripts/masterReset.js rename to unpublishedScripts/DomainContent/Toybox/masterReset.js diff --git a/unpublishedScripts/targetsResetter.js b/unpublishedScripts/DomainContent/Toybox/targetsResetter.js similarity index 100% rename from unpublishedScripts/targetsResetter.js rename to unpublishedScripts/DomainContent/Toybox/targetsResetter.js From 3f0807fc6810b03655816a512e7acb44559f2cd3 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Wed, 27 Apr 2016 23:49:38 -0700 Subject: [PATCH 07/34] add utils and rewrite a lot of include refs --- .../Toybox/basketball/createRack.js | 2 +- .../DomainContent/Toybox/bow/bow.js | 2 +- .../DomainContent/Toybox/bow/createBow.js | 2 +- .../Toybox/bubblewand/createWand.js | 2 +- .../DomainContent/Toybox/bubblewand/wand.js | 2 +- .../DomainContent/Toybox/doll/doll.js | 2 +- .../Toybox/flashlight/createFlashlight.js | 2 +- .../Toybox/flashlight/flashlight.js | 2 +- .../DomainContent/Toybox/hiddenEntityReset.js | 22 +- .../DomainContent/Toybox/libraries/utils.js | 313 ++++++++++++++++++ .../Toybox/lights/lightSwitch.js | 2 +- .../DomainContent/Toybox/masterReset.js | 24 +- .../Toybox/ping_pong_gun/createTargets.js | 2 +- .../Toybox/ping_pong_gun/pingPongGun.js | 2 +- .../DomainContent/Toybox/pistol/pistol.js | 7 +- .../Toybox/spray_paint/sprayPaintCan.js | 2 +- .../DomainContent/Toybox/targetsResetter.js | 2 +- 17 files changed, 352 insertions(+), 40 deletions(-) create mode 100644 unpublishedScripts/DomainContent/Toybox/libraries/utils.js diff --git a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js index 4295170045..cfb8092c10 100644 --- a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js +++ b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js @@ -9,7 +9,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html /*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("libraries/utils.js"); var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; diff --git a/unpublishedScripts/DomainContent/Toybox/bow/bow.js b/unpublishedScripts/DomainContent/Toybox/bow/bow.js index c947b59518..157f319dca 100644 --- a/unpublishedScripts/DomainContent/Toybox/bow/bow.js +++ b/unpublishedScripts/DomainContent/Toybox/bow/bow.js @@ -11,7 +11,7 @@ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var NOTCH_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/notch.wav'; var SHOOT_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/String_release2.L.wav'; diff --git a/unpublishedScripts/DomainContent/Toybox/bow/createBow.js b/unpublishedScripts/DomainContent/Toybox/bow/createBow.js index eb6d8bb81b..6722669307 100644 --- a/unpublishedScripts/DomainContent/Toybox/bow/createBow.js +++ b/unpublishedScripts/DomainContent/Toybox/bow/createBow.js @@ -10,7 +10,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var utilsPath = Script.resolvePath('../../libraries/utils.js'); +var utilsPath = Script.resolvePath('libraries/utils.js'); Script.include(utilsPath); var SCRIPT_URL = Script.resolvePath('bow.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js b/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js index d0b1372755..5d5ab3ac0e 100644 --- a/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js +++ b/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js @@ -10,7 +10,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("libraries/utils.js"); var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx'; var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj'; diff --git a/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js b/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js index 379e94333f..3f7ff6365e 100644 --- a/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js +++ b/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js @@ -14,7 +14,7 @@ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var BUBBLE_MODEL = "http://hifi-content.s3.amazonaws.com/james/bubblewand/bubble.fbx"; diff --git a/unpublishedScripts/DomainContent/Toybox/doll/doll.js b/unpublishedScripts/DomainContent/Toybox/doll/doll.js index 15c587ba4c..cc9ab194e6 100644 --- a/unpublishedScripts/DomainContent/Toybox/doll/doll.js +++ b/unpublishedScripts/DomainContent/Toybox/doll/doll.js @@ -13,7 +13,7 @@ /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var _this; // this is the "constructor" for the entity as a JS object we don't do much here var Doll = function() { diff --git a/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js b/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js index be91516e63..a6f3dca6fd 100644 --- a/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js +++ b/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js @@ -12,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("libraries/utils.js"); var scriptURL = Script.resolvePath('flashlight.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js b/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js index 02a2e07985..98545fc3ab 100644 --- a/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js +++ b/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js @@ -17,7 +17,7 @@ /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ (function() { - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); var ON_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_on.wav'; var OFF_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_off.wav'; diff --git a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js index 08c5b5857a..a1010b4dd7 100644 --- a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js +++ b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js @@ -14,17 +14,17 @@ var _this; - var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js"); - var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js"); - var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js"); - var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js'); - var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js'); - var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js"); - var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js"); - var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js"); - var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js'); - var bowScriptURL = Script.resolvePath('../examples/toybox/bow/bow.js'); - var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js"); + var gunScriptURL = Script.resolvePath("pistol/pistol.js"); + var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js"); + var catScriptURL = Script.resolvePath("cat/cat.js"); + var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js'); + var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js'); + var wandScriptURL = Script.resolvePath("bubblewand/wand.js"); + var dollScriptURL = Script.resolvePath("doll/doll.js"); + var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js"); + var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js'); + var bowScriptURL = Script.resolvePath('bow/bow.js'); + var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js"); var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js'); var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/libraries/utils.js b/unpublishedScripts/DomainContent/Toybox/libraries/utils.js new file mode 100644 index 0000000000..f39f4d7913 --- /dev/null +++ b/unpublishedScripts/DomainContent/Toybox/libraries/utils.js @@ -0,0 +1,313 @@ +// +// Created by Bradley Austin Davis on 2015/08/29 +// 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 +// + +vec3toStr = function(v, digits) { + if (!digits) { digits = 3; } + return "{ " + v.x.toFixed(digits) + ", " + v.y.toFixed(digits) + ", " + v.z.toFixed(digits)+ " }"; +} + +quatToStr = function(q, digits) { + if (!digits) { digits = 3; } + return "{ " + q.w.toFixed(digits) + ", " + q.x.toFixed(digits) + ", " + + q.y.toFixed(digits) + ", " + q.z.toFixed(digits)+ " }"; +} + +vec3equal = function(v0, v1) { + return (v0.x == v1.x) && (v0.y == v1.y) && (v0.z == v1.z); +} + +colorMix = function(colorA, colorB, mix) { + var result = {}; + for (var key in colorA) { + result[key] = (colorA[key] * (1 - mix)) + (colorB[key] * mix); + } + return result; +} +scaleLine = function (start, end, scale) { + var v = Vec3.subtract(end, start); + var length = Vec3.length(v); + v = Vec3.multiply(scale, v); + return Vec3.sum(start, v); +} + +findAction = function(name) { + return Controller.findAction(name); +} + +addLine = function(origin, vector, color) { + if (!color) { + color = COLORS.WHITE + } + return Entities.addEntity(mergeObjects(LINE_PROTOTYPE, { + position: origin, + linePoints: [ + ZERO_VECTOR, + vector, + ], + color: color + })); +} + +// FIXME fetch from a subkey of user data to support non-destructive modifications +setEntityUserData = function(id, data) { + var json = JSON.stringify(data) + Entities.editEntity(id, { userData: json }); +} + +// FIXME do non-destructive modification of the existing user data +getEntityUserData = function(id) { + var results = null; + var properties = Entities.getEntityProperties(id, "userData"); + if (properties.userData) { + try { + results = JSON.parse(properties.userData); + } catch(err) { + logDebug(err); + logDebug(properties.userData); + } + } + return results ? results : {}; +} + + +// Non-destructively modify the user data of an entity. +setEntityCustomData = function(customKey, id, data) { + var userData = getEntityUserData(id); + if (data == null) { + delete userData[customKey]; + } else { + userData[customKey] = data; + } + setEntityUserData(id, userData); +} + +getEntityCustomData = function(customKey, id, defaultValue) { + var userData = getEntityUserData(id); + if (undefined != userData[customKey]) { + return userData[customKey]; + } else { + return defaultValue; + } +} + +mergeObjects = function(proto, custom) { + var result = {}; + for (var attrname in proto) { + result[attrname] = proto[attrname]; + } + for (var attrname in custom) { + result[attrname] = custom[attrname]; + } + return result; +} + +LOG_WARN = 1; + +logWarn = function(str) { + if (LOG_WARN) { + print(str); + } +} + +LOG_ERROR = 1; + +logError = function(str) { + if (LOG_ERROR) { + print(str); + } +} + +LOG_INFO = 1; + +logInfo = function(str) { + if (LOG_INFO) { + print(str); + } +} + +LOG_DEBUG = 0; + +logDebug = function(str) { + if (LOG_DEBUG) { + print(str); + } +} + +LOG_TRACE = 0; + +logTrace = function(str) { + if (LOG_TRACE) { + print(str); + } +} + +// Computes the penetration between a point and a sphere (centered at the origin) +// if point is inside sphere: returns true and stores the result in 'penetration' +// (the vector that would move the point outside the sphere) +// otherwise returns false +findSphereHit = function(point, sphereRadius) { + var EPSILON = 0.000001; //smallish positive number - used as margin of error for some computations + var vectorLength = Vec3.length(point); + if (vectorLength < EPSILON) { + return true; + } + var distance = vectorLength - sphereRadius; + if (distance < 0.0) { + return true; + } + return false; +} + +findSpherePointHit = function(sphereCenter, sphereRadius, point) { + return findSphereHit(Vec3.subtract(point,sphereCenter), sphereRadius); +} + +findSphereSphereHit = function(firstCenter, firstRadius, secondCenter, secondRadius) { + return findSpherePointHit(firstCenter, firstRadius + secondRadius, secondCenter); +} + +// Given a vec3 v, return a vec3 that is the same vector relative to the avatars +// DEFAULT eye position, rotated into the avatars reference frame. +getEyeRelativePosition = function(v) { + return Vec3.sum(MyAvatar.getDefaultEyePosition(), Vec3.multiplyQbyV(MyAvatar.orientation, v)); +} + +getAvatarRelativeRotation = function(q) { + return Quat.multiply(MyAvatar.orientation, q); +} + +pointInExtents = function(point, minPoint, maxPoint) { + return (point.x >= minPoint.x && point.x <= maxPoint.x) && + (point.y >= minPoint.y && point.y <= maxPoint.y) && + (point.z >= minPoint.z && point.z <= maxPoint.z); +} + +/** + * Converts an HSL color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes h, s, and l are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + * + * @param Number h The hue + * @param Number s The saturation + * @param Number l The lightness + * @return Array The RGB representation + */ +hslToRgb = function(hsl) { + var r, g, b; + if (hsl.s == 0) { + r = g = b = hsl.l; // achromatic + } else { + var hue2rgb = function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + + var q = hsl.l < 0.5 ? hsl.l * (1 + hsl.s) : hsl.l + hsl.s - hsl.l * hsl.s; + var p = 2 * hsl.l - q; + r = hue2rgb(p, q, hsl.h + 1 / 3); + g = hue2rgb(p, q, hsl.h); + b = hue2rgb(p, q, hsl.h - 1 / 3); + } + + return { + red: Math.round(r * 255), + green: Math.round(g * 255), + blue: Math.round(b * 255) + }; +} + +map = function(value, min1, max1, min2, max2) { + return min2 + (max2 - min2) * ((value - min1) / (max1 - min1)); +} + +orientationOf = function(vector) { + var Y_AXIS = { + x: 0, + y: 1, + z: 0 + }; + var X_AXIS = { + x: 1, + y: 0, + z: 0 + }; + + var theta = 0.0; + + var RAD_TO_DEG = 180.0 / Math.PI; + var direction, yaw, pitch; + direction = Vec3.normalize(vector); + yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS); + pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS); + return Quat.multiply(yaw, pitch); +} + +randFloat = function(low, high) { + return low + Math.random() * (high - low); +} + + +randInt = function(low, high) { + return Math.floor(randFloat(low, high)); +} + + +randomColor = function() { + return { + red: randInt(0, 255), + green: randInt(0, 255), + blue: randInt(0, 255) + } +} + + +hexToRgb = function(hex) { + var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + return result ? { + red: parseInt(result[1], 16), + green: parseInt(result[2], 16), + blue: parseInt(result[3], 16) + } : null; +} + +calculateHandSizeRatio = function() { + // Get the ratio of the current avatar's hand to Owen's hand + + var standardCenterHandPoint = 0.11288; + var jointNames = MyAvatar.getJointNames(); + //get distance from handJoint up to leftHandIndex3 as a proxy for center of hand + var wristToFingertipDistance = 0;; + for (var i = 0; i < jointNames.length; i++) { + var jointName = jointNames[i]; + print(jointName) + if (jointName.indexOf("LeftHandIndex") !== -1) { + // translations are relative to parent joint, so simply add them together + // joints face down the y-axis + var translation = MyAvatar.getDefaultJointTranslation(i).y; + wristToFingertipDistance += translation; + } + } + // Right now units are in cm, so convert to meters + wristToFingertipDistance /= 100; + + var centerHandPoint = wristToFingertipDistance/2; + + // Compare against standard hand (Owen) + var handSizeRatio = centerHandPoint/standardCenterHandPoint; + return handSizeRatio; +} + +clamp = function(val, min, max){ + return Math.max(min, Math.min(max, val)) + } + diff --git a/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js b/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js index 6051b7c0ae..6410e2d92c 100644 --- a/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js +++ b/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js @@ -17,7 +17,7 @@ (function() { var _this; - var utilitiesScript = Script.resolvePath("../../libraries/utils.js"); + var utilitiesScript = Script.resolvePath("libraries/utils.js"); Script.include(utilitiesScript); LightSwitch = function() { _this = this; diff --git a/unpublishedScripts/DomainContent/Toybox/masterReset.js b/unpublishedScripts/DomainContent/Toybox/masterReset.js index cbcee30b0b..4820aa6292 100644 --- a/unpublishedScripts/DomainContent/Toybox/masterReset.js +++ b/unpublishedScripts/DomainContent/Toybox/masterReset.js @@ -11,20 +11,20 @@ /*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLights */ -var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js"); +var utilitiesScript = Script.resolvePath("libraries/utils.js"); Script.include(utilitiesScript); -var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js"); -var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js"); -var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js"); -var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js'); -var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js'); -var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js"); -var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js"); -var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js"); -var bowScriptURL = Script.resolvePath("../examples/toybox/bow/bow.js"); -var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js"); -var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js'); +var gunScriptURL = Script.resolvePath("pistol/pistol.js"); +var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js"); +var catScriptURL = Script.resolvePath("cat/cat.js"); +var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js'); +var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js'); +var wandScriptURL = Script.resolvePath("bubblewand/wand.js"); +var dollScriptURL = Script.resolvePath("doll.js"); +var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js"); +var bowScriptURL = Script.resolvePath("toybox/bow/bow.js"); +var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js"); +var targetsScriptURL = Script.resolvePath('toybox/ping_pong_gun/wallTarget.js'); var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js'); var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js'); diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js index fcd187a687..2685599824 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js @@ -11,7 +11,7 @@ // /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -Script.include("../../libraries/utils.js"); +Script.include("utils.js"); var scriptURL = Script.resolvePath('wallTarget.js'); var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx'; diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js index 415913ea6d..24edbe8522 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js @@ -11,7 +11,7 @@ /*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ (function() { - Script.include("../../libraries/utils.js"); + Script.include("utils.js"); var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/ping_pong_gun/pong_sound.wav'; var PING_PONG_BALL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_ball.fbx'; diff --git a/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js b/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js index 99b7503cba..272da68bec 100644 --- a/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js +++ b/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js @@ -11,8 +11,7 @@ (function() { - Script.include("../../libraries/utils.js"); - Script.include("../../libraries/constants.js"); + Script.include("libraries/utils.js"); var _this; var DISABLE_LASER_THRESHOLD = 0.2; @@ -343,8 +342,8 @@ preload: function(entityID) { this.entityID = entityID; this.laser = Overlays.addOverlay("line3d", { - start: ZERO_VECTOR, - end: ZERO_VECTOR, + start: { x: 0, y: 0, z: 0 }, + end: { x: 0, y: 0, z: 0 }, color: COLORS.RED, alpha: 1, visible: true, diff --git a/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js b/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js index 05715ff787..05d9b4efc5 100644 --- a/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js +++ b/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js @@ -13,7 +13,7 @@ // Script.include("../libraries/utils.js"); //Need absolute path for now, for testing before PR merge and s3 cloning. Will change post-merge - Script.include("../../libraries/utils.js"); + Script.include("libraries/utils.js"); this.spraySound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/sprayPaintSound.wav"); diff --git a/unpublishedScripts/DomainContent/Toybox/targetsResetter.js b/unpublishedScripts/DomainContent/Toybox/targetsResetter.js index ccec8173de..10ba968ac9 100644 --- a/unpublishedScripts/DomainContent/Toybox/targetsResetter.js +++ b/unpublishedScripts/DomainContent/Toybox/targetsResetter.js @@ -8,7 +8,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html (function() { - var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js'); + var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js'); var _this; Resetter = function() { From 90c59c5af079274826db3ee5b71cdeb2a9cc3f1a Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 10:39:53 -0700 Subject: [PATCH 08/34] remove directory from default --- scripts/defaultScripts.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 3772fd51e9..ceccf20647 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -17,7 +17,5 @@ Script.load("system/notifications.js"); Script.load("system/controllers/handControllerGrab.js"); Script.load("system/controllers/squeezeHands.js"); Script.load("system/controllers/grab.js"); -Script.load("system/directory.js"); Script.load("system/dialTone.js"); -// Script.load("attachedEntitiesManager.js"); Script.load("system/depthReticle.js"); \ No newline at end of file From b7188bad30510298f4810f22b2009444cf5bc553 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 29 Apr 2016 07:13:56 +1200 Subject: [PATCH 09/34] Automatically upgrade toolbar position to bottom center of window --- scripts/system/libraries/toolBars.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/system/libraries/toolBars.js b/scripts/system/libraries/toolBars.js index 1f83a4ffa6..110e3d1ea9 100644 --- a/scripts/system/libraries/toolBars.js +++ b/scripts/system/libraries/toolBars.js @@ -452,7 +452,11 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit return id; } if (this.fractionKey || optionalInitialPositionFunction) { - var savedFraction = JSON.parse(Settings.getValue(this.fractionKey) || '0'); // getValue can answer empty string + var NEW_TOOLBAR_POSITION = "newToolbarPosition"; // New default position is bottom center of screen instead of right. + var isNewPosition = Settings.getValue(NEW_TOOLBAR_POSITION); + var savedFraction = isNewPosition ? JSON.parse(Settings.getValue(this.fractionKey) || "0") : 0; + Settings.setValue(NEW_TOOLBAR_POSITION, true); + var recommendedRect = Controller.getRecommendedOverlayRect(); var screenSize = { x: recommendedRect.width, y: recommendedRect.height }; if (savedFraction) { From 1cf53829d3adab9875ec28962e75ece01c60cbc7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 29 Apr 2016 08:20:20 +1200 Subject: [PATCH 10/34] Fix upgrading for all toolbar buttons --- scripts/system/libraries/toolBars.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/system/libraries/toolBars.js b/scripts/system/libraries/toolBars.js index 110e3d1ea9..d97575d349 100644 --- a/scripts/system/libraries/toolBars.js +++ b/scripts/system/libraries/toolBars.js @@ -383,6 +383,9 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit }; if (optionalPersistenceKey) { this.fractionKey = optionalPersistenceKey + '.fraction'; + // FIXME: New default position in RC8 is bottom center of screen instead of right. Can remove this key and associated + // code once the new toolbar position is well established with users. + this.isNewPositionKey = optionalPersistenceKey + '.isNewPosition'; this.save = function () { var recommendedRect = Controller.getRecommendedOverlayRect(); var screenSize = { x: recommendedRect.width, y: recommendedRect.height }; @@ -452,10 +455,9 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit return id; } if (this.fractionKey || optionalInitialPositionFunction) { - var NEW_TOOLBAR_POSITION = "newToolbarPosition"; // New default position is bottom center of screen instead of right. - var isNewPosition = Settings.getValue(NEW_TOOLBAR_POSITION); + var isNewPosition = Settings.getValue(this.isNewPositionKey); var savedFraction = isNewPosition ? JSON.parse(Settings.getValue(this.fractionKey) || "0") : 0; - Settings.setValue(NEW_TOOLBAR_POSITION, true); + Settings.setValue(this.isNewPositionKey, true); var recommendedRect = Controller.getRecommendedOverlayRect(); var screenSize = { x: recommendedRect.width, y: recommendedRect.height }; From 795d866da9555f8151b07705e85c5874de07860c Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 13:29:54 -0700 Subject: [PATCH 11/34] re add locking/visibility tools to edit.js --- scripts/system/edit.js | 22 +++++++++------------- scripts/system/html/entityList.html | 2 +- scripts/system/libraries/entityList.js | 8 +++++++- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 2796297e40..163ac867b4 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -50,10 +50,9 @@ selectionManager.addEventListener(function() { lightOverlayManager.updatePositions(); }); -var toolIconUrl = Script.resolvePath("assets/images/tools/"); +var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/"; var toolHeight = 50; var toolWidth = 50; -var TOOLBAR_MARGIN_Y = 25; var DEGREES_TO_RADIANS = Math.PI / 180.0; var RADIANS_TO_DEGREES = 180.0 / Math.PI; @@ -106,7 +105,7 @@ IMPORTING_SVO_OVERLAY_HEIGHT = 30; IMPORTING_SVO_OVERLAY_MARGIN = 5; IMPORTING_SVO_OVERLAY_LEFT_MARGIN = 34; var importingSVOImageOverlay = Overlays.addOverlay("image", { - imageURL: Script.resolvePath("assets") + "/images/hourglass.svg", + imageURL: HIFI_PUBLIC_BUCKET + "images/hourglass.svg", width: 20, height: 20, alpha: 1.0, @@ -180,18 +179,15 @@ var toolBar = (function() { newParticleButton function initialize() { - toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.edit.toolbar", function(windowDimensions, toolbar) { + toolBar = new ToolBar(0, 0, ToolBar.VERTICAL, "highfidelity.edit.toolbar", function(windowDimensions, toolbar) { return { - x: windowDimensions.x / 2, - y: windowDimensions.y + x: windowDimensions.x - 8 - toolbar.width, + y: (windowDimensions.y - toolbar.height) / 2 }; - }, { - x: toolWidth, - y: -TOOLBAR_MARGIN_Y - toolHeight }); activeButton = toolBar.addTool({ - imageURL: toolIconUrl + "edit-01.svg", + imageURL: toolIconUrl + "edit-01.svg", subImage: { x: 0, y: Tool.IMAGE_WIDTH, @@ -205,7 +201,7 @@ var toolBar = (function() { }, true, false); newModelButton = toolBar.addTool({ - imageURL:toolIconUrl + "model-01.svg", + imageURL: toolIconUrl + "model-01.svg", subImage: { x: 0, y: Tool.IMAGE_WIDTH, @@ -220,7 +216,7 @@ var toolBar = (function() { }); newCubeButton = toolBar.addTool({ - imageURL:toolIconUrl + "cube-01.svg", + imageURL: toolIconUrl + "cube-01.svg", subImage: { x: 0, y: Tool.IMAGE_WIDTH, @@ -1864,4 +1860,4 @@ entityListTool.webView.webEventReceived.connect(function(data) { } } } -}); +}); \ No newline at end of file diff --git a/scripts/system/html/entityList.html b/scripts/system/html/entityList.html index e5fa2ce839..dbc224e9fb 100644 --- a/scripts/system/html/entityList.html +++ b/scripts/system/html/entityList.html @@ -378,4 +378,4 @@ - + \ No newline at end of file diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js index 00120ab4c2..e9baeac86c 100644 --- a/scripts/system/libraries/entityList.js +++ b/scripts/system/libraries/entityList.js @@ -59,6 +59,8 @@ EntityListTool = function(opts) { name: properties.name, type: properties.type, url: properties.type == "Model" ? properties.modelURL : "", + locked: properties.locked, + visible: properties.visible }); } @@ -99,6 +101,10 @@ EntityListTool = function(opts) { } } else if (data.type == "delete") { deleteSelectedEntities(); + } else if (data.type == "toggleLocked") { + toggleSelectedEntitiesLocked(); + } else if (data.type == "toggleVisible") { + toggleSelectedEntitiesVisible(); } else if (data.type === "radius") { searchRadius = data.radius; that.sendUpdate(); @@ -112,4 +118,4 @@ EntityListTool = function(opts) { }); return that; -}; +}; \ No newline at end of file From b52406e127504c3264d9986143733a5bf630d715 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 13:40:58 -0700 Subject: [PATCH 12/34] horizontal --- scripts/system/edit.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 163ac867b4..30e1996bae 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -53,6 +53,7 @@ selectionManager.addEventListener(function() { var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/"; var toolHeight = 50; var toolWidth = 50; +var TOOLBAR_MARGIN_Y = 25; var DEGREES_TO_RADIANS = Math.PI / 180.0; var RADIANS_TO_DEGREES = 180.0 / Math.PI; @@ -179,11 +180,14 @@ var toolBar = (function() { newParticleButton function initialize() { - toolBar = new ToolBar(0, 0, ToolBar.VERTICAL, "highfidelity.edit.toolbar", function(windowDimensions, toolbar) { + toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.edit.toolbar", function(windowDimensions, toolbar) { return { - x: windowDimensions.x - 8 - toolbar.width, - y: (windowDimensions.y - toolbar.height) / 2 + x: windowDimensions.x / 2, + y: windowDimensions.y }; + }, { + x: toolWidth, + y: -TOOLBAR_MARGIN_Y - toolHeight }); activeButton = toolBar.addTool({ From aafed4e1b8470889ac9284bb52547aef83bfeb20 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 13:42:10 -0700 Subject: [PATCH 13/34] fix horizontal typo in examples --- scripts/system/examples.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/examples.js b/scripts/system/examples.js index 9caedec70f..eeadfc21a0 100644 --- a/scripts/system/examples.js +++ b/scripts/system/examples.js @@ -58,7 +58,7 @@ var toolBar = (function() { browseExamplesButton; function initialize() { - toolBar = new ToolBar(0, 0, ToolBar.HORIXONTAL, "highfidelity.examples.toolbar", function(windowDimensions, toolbar) { + toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.examples.toolbar", function(windowDimensions, toolbar) { return { x: windowDimensions.x / 2, y: windowDimensions.y From e68909ce3e65288c27790403693d23a1a6180e5a Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 13:48:09 -0700 Subject: [PATCH 14/34] re add local paths --- scripts/system/edit.js | 47 +++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 30e1996bae..568ee28bc6 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -48,9 +48,9 @@ var entityListTool = EntityListTool(); selectionManager.addEventListener(function() { selectionDisplay.updateHandles(); lightOverlayManager.updatePositions(); -}); +}); -var toolIconUrl = HIFI_PUBLIC_BUCKET + "images/tools/"; +var toolIconUrl = Script.resolvePath("assets/images/tools/"); var toolHeight = 50; var toolWidth = 50; var TOOLBAR_MARGIN_Y = 25; @@ -106,7 +106,7 @@ IMPORTING_SVO_OVERLAY_HEIGHT = 30; IMPORTING_SVO_OVERLAY_MARGIN = 5; IMPORTING_SVO_OVERLAY_LEFT_MARGIN = 34; var importingSVOImageOverlay = Overlays.addOverlay("image", { - imageURL: HIFI_PUBLIC_BUCKET + "images/hourglass.svg", + imageURL: Script.resolvePath("assets") + "/images/hourglass.svg", width: 20, height: 20, alpha: 1.0, @@ -336,7 +336,9 @@ var toolBar = (function() { if (active && !Entities.canAdjustLocks()) { Window.alert(INSUFFICIENT_PERMISSIONS_ERROR_MSG); } else { - Messages.sendLocalMessage("edit-events", JSON.stringify({enabled: active})); + Messages.sendLocalMessage("edit-events", JSON.stringify({ + enabled: active + })); isActive = active; if (!isActive) { entityListTool.setVisible(false); @@ -549,8 +551,16 @@ var toolBar = (function() { type: "ParticleEffect", isEmitting: true, particleRadius: 0.1, - emitAcceleration: {x: 0, y: -1, z: 0}, - accelerationSpread: {x: 5, y: 0, z: 5}, + emitAcceleration: { + x: 0, + y: -1, + z: 0 + }, + accelerationSpread: { + x: 5, + y: 0, + z: 5 + }, emitSpeed: 1, lifespan: 1, particleRadius: 0.025, @@ -563,7 +573,7 @@ var toolBar = (function() { return false; }; - that.mouseReleaseEvent = function (event) { + that.mouseReleaseEvent = function(event) { return false; } @@ -604,7 +614,7 @@ var intersection; var SCALE_FACTOR = 200.0; -function rayPlaneIntersection(pickRay, point, normal) { // +function rayPlaneIntersection(pickRay, point, normal) { // // // This version of the test returns the intersection of a line with a plane // @@ -1207,7 +1217,9 @@ function toggleSelectedEntitiesLocked() { var locked = !Entities.getEntityProperties(SelectionManager.selections[0], ["locked"]).locked; for (var i = 0; i < selectionManager.selections.length; i++) { var entityID = SelectionManager.selections[i]; - Entities.editEntity(entityID, { locked: locked }); + Entities.editEntity(entityID, { + locked: locked + }); } entityListTool.sendUpdate(); selectionManager._update(); @@ -1219,7 +1231,9 @@ function toggleSelectedEntitiesVisible() { var visible = !Entities.getEntityProperties(SelectionManager.selections[0], ["visible"]).visible; for (var i = 0; i < selectionManager.selections.length; i++) { var entityID = SelectionManager.selections[i]; - Entities.editEntity(entityID, { visible: visible }); + Entities.editEntity(entityID, { + visible: visible + }); } entityListTool.sendUpdate(); selectionManager._update(); @@ -1554,8 +1568,7 @@ PropertiesTool = function(opts) { data.properties.keyLight.direction.x * DEGREES_TO_RADIANS, data.properties.keyLight.direction.y * DEGREES_TO_RADIANS); } Entities.editEntity(selectionManager.selections[0], data.properties); - if (data.properties.name !== undefined || data.properties.modelURL !== undefined - || data.properties.visible !== undefined || data.properties.locked !== undefined) { + if (data.properties.name !== undefined || data.properties.modelURL !== undefined || data.properties.visible !== undefined || data.properties.locked !== undefined) { entityListTool.sendUpdate(); } } @@ -1835,15 +1848,15 @@ entityListTool.webView.webEventReceived.connect(function(data) { var data = JSON.parse(data); if (data.type == "selectionUpdate") { var ids = data.entityIds; - if(ids.length === 1) { - if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect" ) { + if (ids.length === 1) { + if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") { if (JSON.stringify(selectedParticleEntity) === JSON.stringify(ids[0])) { // This particle entity is already selected, so return return; } // Destroy the old particles web view first - particleExplorerTool.destroyWebView(); - particleExplorerTool.createWebView(); + particleExplorerTool.destroyWebView(); + particleExplorerTool.createWebView(); var properties = Entities.getEntityProperties(ids[0]); var particleData = { messageType: "particle_settings", @@ -1855,7 +1868,7 @@ entityListTool.webView.webEventReceived.connect(function(data) { particleExplorerTool.webView.webEventReceived.connect(function(data) { var data = JSON.parse(data); if (data.messageType === "page_loaded") { - particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData)); + particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData)); } }); } else { From 40c1563b1f06b8c9901c6531bcb80e42ad292aab Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 16:21:03 -0700 Subject: [PATCH 15/34] convert bball rack --- .../DomainContent/Toybox/basketball/createHoop.js | 8 +++----- .../DomainContent/Toybox/basketball/createRack.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/basketball/createHoop.js b/unpublishedScripts/DomainContent/Toybox/basketball/createHoop.js index 792232b98f..cc67a4d479 100644 --- a/unpublishedScripts/DomainContent/Toybox/basketball/createHoop.js +++ b/unpublishedScripts/DomainContent/Toybox/basketball/createHoop.js @@ -6,12 +6,10 @@ // // This is a script that creates a persistent basketball hoop with a working collision hull. Feel free to move it. // -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ -var hoopURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop.fbx"; -var hoopCollisionHullURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop_collision_hull.obj"; + +var hoopURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop.fbx"; +var hoopCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop_collision_hull.obj"; var hoopStartPosition = Vec3.sum(MyAvatar.position, diff --git a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js index cfb8092c10..7790051280 100644 --- a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js +++ b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js @@ -8,7 +8,7 @@ // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ + Script.include("libraries/utils.js"); var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; From 851f9b09148e16aae52722c1f663b0eca45f0cfc Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 16:23:32 -0700 Subject: [PATCH 16/34] move dev templates into a dif location --- .../templates/entityScripts/exampleSelfCallingTimeoutNoCleanup.js | 0 .../utilities}/templates/entityScripts/exampleTimeoutNoCleanup.js | 0 .../utilities}/templates/entityScripts/exampleUpdate.js | 0 .../templates/entityScripts/exampleUpdateNoDisconnect.js | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename scripts/{ => developer/utilities}/templates/entityScripts/exampleSelfCallingTimeoutNoCleanup.js (100%) rename scripts/{ => developer/utilities}/templates/entityScripts/exampleTimeoutNoCleanup.js (100%) rename scripts/{ => developer/utilities}/templates/entityScripts/exampleUpdate.js (100%) rename scripts/{ => developer/utilities}/templates/entityScripts/exampleUpdateNoDisconnect.js (100%) diff --git a/scripts/templates/entityScripts/exampleSelfCallingTimeoutNoCleanup.js b/scripts/developer/utilities/templates/entityScripts/exampleSelfCallingTimeoutNoCleanup.js similarity index 100% rename from scripts/templates/entityScripts/exampleSelfCallingTimeoutNoCleanup.js rename to scripts/developer/utilities/templates/entityScripts/exampleSelfCallingTimeoutNoCleanup.js diff --git a/scripts/templates/entityScripts/exampleTimeoutNoCleanup.js b/scripts/developer/utilities/templates/entityScripts/exampleTimeoutNoCleanup.js similarity index 100% rename from scripts/templates/entityScripts/exampleTimeoutNoCleanup.js rename to scripts/developer/utilities/templates/entityScripts/exampleTimeoutNoCleanup.js diff --git a/scripts/templates/entityScripts/exampleUpdate.js b/scripts/developer/utilities/templates/entityScripts/exampleUpdate.js similarity index 100% rename from scripts/templates/entityScripts/exampleUpdate.js rename to scripts/developer/utilities/templates/entityScripts/exampleUpdate.js diff --git a/scripts/templates/entityScripts/exampleUpdateNoDisconnect.js b/scripts/developer/utilities/templates/entityScripts/exampleUpdateNoDisconnect.js similarity index 100% rename from scripts/templates/entityScripts/exampleUpdateNoDisconnect.js rename to scripts/developer/utilities/templates/entityScripts/exampleUpdateNoDisconnect.js From e519d483a9a2c11b0b1363e9ffa30a80aaef4792 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 16:27:31 -0700 Subject: [PATCH 17/34] convert sounds --- .../Toybox/AC_scripts/toybox_sounds.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/AC_scripts/toybox_sounds.js b/unpublishedScripts/DomainContent/Toybox/AC_scripts/toybox_sounds.js index ee87943f00..e73630e380 100644 --- a/unpublishedScripts/DomainContent/Toybox/AC_scripts/toybox_sounds.js +++ b/unpublishedScripts/DomainContent/Toybox/AC_scripts/toybox_sounds.js @@ -10,7 +10,7 @@ var soundMap = [{ name: 'river water', - url: "http://hifi-public.s3.amazonaws.com/ryan/Water_Lap_River_Edge_Gentle.L.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Water_Lap_River_Edge_Gentle.L.wav", audioOptions: { position: { x: 580, @@ -22,7 +22,7 @@ var soundMap = [{ } }, { name: 'windmill', - url: "http://hifi-public.s3.amazonaws.com/ryan/WINDMILL_Mono.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/WINDMILL_Mono.wav", audioOptions: { position: { x: 530, @@ -34,7 +34,7 @@ var soundMap = [{ } }, { name: 'insects', - url: "http://hifi-public.s3.amazonaws.com/ryan/insects3.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/insects3.wav", audioOptions: { position: { x: 560, @@ -46,7 +46,7 @@ var soundMap = [{ } }, { name: 'fireplace', - url: "http://hifi-public.s3.amazonaws.com/ryan/demo/0619_Fireplace__Tree_B.L.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/0619_Fireplace__Tree_B.L.wav", audioOptions: { position: { x: 551.61, @@ -58,7 +58,7 @@ var soundMap = [{ } }, { name: 'cat purring', - url: "http://hifi-public.s3.amazonaws.com/ryan/Cat_Purring_Deep_Low_Snor.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Cat_Purring_Deep_Low_Snor.wav", audioOptions: { position: { x: 551.48, @@ -70,7 +70,7 @@ var soundMap = [{ } }, { name: 'dogs barking', - url: "http://hifi-public.s3.amazonaws.com/ryan/dogs_barking_1.L.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/dogs_barking_1.L.wav", audioOptions: { position: { x: 523, @@ -83,7 +83,7 @@ var soundMap = [{ playAtInterval: 60 * 1000 }, { name: 'arcade game', - url: "http://hifi-public.s3.amazonaws.com/ryan/ARCADE_GAMES_VID.L.L.wav", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/ARCADE_GAMES_VID.L.L.wav", audioOptions: { position: { x: 543.77, From 6c6d5905cc892657398fa71f379131600faf645c Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 16:29:32 -0700 Subject: [PATCH 18/34] more bball --- .../DomainContent/Toybox/basketball/createRack.js | 10 ++++------ .../Toybox/basketball/createSingleBasketball.js | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js index 7790051280..3ab288dfc4 100644 --- a/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js +++ b/unpublishedScripts/DomainContent/Toybox/basketball/createRack.js @@ -11,12 +11,10 @@ Script.include("libraries/utils.js"); -var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; - -var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx"; -var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav"; -var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx"; -var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj"; +var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; +var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav"; +var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx"; +var rackCollisionHullURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj"; var NUMBER_OF_BALLS = 4; var DIAMETER = 0.30; var RESET_DISTANCE = 1; diff --git a/unpublishedScripts/DomainContent/Toybox/basketball/createSingleBasketball.js b/unpublishedScripts/DomainContent/Toybox/basketball/createSingleBasketball.js index 7663b40c42..d70b9a1bd8 100644 --- a/unpublishedScripts/DomainContent/Toybox/basketball/createSingleBasketball.js +++ b/unpublishedScripts/DomainContent/Toybox/basketball/createSingleBasketball.js @@ -9,10 +9,9 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; -var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx"; -var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav"; +var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; +var collisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav"; var basketball = null; From 6fc1cdc41fe7e4f3dbf118849715c29d98008985 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 16:37:19 -0700 Subject: [PATCH 19/34] convert bow --- unpublishedScripts/DomainContent/Toybox/bow/bow.js | 12 ++++++------ .../DomainContent/Toybox/bow/createBow.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/bow/bow.js b/unpublishedScripts/DomainContent/Toybox/bow/bow.js index 157f319dca..1e3c0ef0eb 100644 --- a/unpublishedScripts/DomainContent/Toybox/bow/bow.js +++ b/unpublishedScripts/DomainContent/Toybox/bow/bow.js @@ -13,10 +13,10 @@ Script.include("libraries/utils.js"); - var NOTCH_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/notch.wav'; - var SHOOT_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/String_release2.L.wav'; - var STRING_PULL_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Bow_draw.1.L.wav'; - var ARROW_HIT_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Arrow_impact1.L.wav' + var NOTCH_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/notch.wav'; + var SHOOT_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/String_release2.L.wav'; + var STRING_PULL_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Bow_draw.1.L.wav'; + var ARROW_HIT_SOUND_URL = 'https://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Arrow_impact1.L.wav' var ARROW_DIMENSIONS = { x: 0.02, @@ -32,9 +32,9 @@ z: 0 }; - var ARROW_MODEL_URL = "http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_textured.fbx"; + var ARROW_MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_textured.fbx"; var ARROW_COLLISION_HULL_URL = - "http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_collision_hull.obj"; + "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_collision_hull.obj"; var ARROW_DIMENSIONS = { x: 0.02, diff --git a/unpublishedScripts/DomainContent/Toybox/bow/createBow.js b/unpublishedScripts/DomainContent/Toybox/bow/createBow.js index 6722669307..ab64a55f38 100644 --- a/unpublishedScripts/DomainContent/Toybox/bow/createBow.js +++ b/unpublishedScripts/DomainContent/Toybox/bow/createBow.js @@ -15,8 +15,8 @@ Script.include(utilsPath); var SCRIPT_URL = Script.resolvePath('bow.js'); -var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx"; -var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj"; +var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx"; +var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj"; var BOW_DIMENSIONS = { x: 0.04, y: 1.3, From 703acd61eb48391b6069ce43b8502ea62ef36c41 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 16:38:33 -0700 Subject: [PATCH 20/34] convert bubblewand --- .../DomainContent/Toybox/bubblewand/createWand.js | 4 ++-- unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js b/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js index 5d5ab3ac0e..848aa0dfae 100644 --- a/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js +++ b/unpublishedScripts/DomainContent/Toybox/bubblewand/createWand.js @@ -12,8 +12,8 @@ Script.include("libraries/utils.js"); -var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx'; -var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj'; +var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx'; +var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj'; var WAND_SCRIPT_URL = Script.resolvePath("wand.js"); diff --git a/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js b/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js index 3f7ff6365e..fbef018131 100644 --- a/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js +++ b/unpublishedScripts/DomainContent/Toybox/bubblewand/wand.js @@ -16,7 +16,7 @@ Script.include("libraries/utils.js"); - var BUBBLE_MODEL = "http://hifi-content.s3.amazonaws.com/james/bubblewand/bubble.fbx"; + var BUBBLE_MODEL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/bubble.fbx"; var BUBBLE_INITIAL_DIMENSIONS = { x: 0.01, From 688389174841ead7b11ce901382dd8a1b990234f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 28 Apr 2016 17:08:40 -0700 Subject: [PATCH 21/34] don't require authentication to send user activity --- libraries/networking/src/UserActivityLogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/UserActivityLogger.cpp b/libraries/networking/src/UserActivityLogger.cpp index 8eefaac9b0..09cfc298bc 100644 --- a/libraries/networking/src/UserActivityLogger.cpp +++ b/libraries/networking/src/UserActivityLogger.cpp @@ -63,7 +63,7 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall } accountManager.sendRequest(USER_ACTIVITY_URL, - AccountManagerAuth::Required, + AccountManagerAuth::Optional, QNetworkAccessManager::PostOperation, params, NULL, multipart); } From cf2d82d320b385539a21295a80edd530520d33c4 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 17:19:35 -0700 Subject: [PATCH 22/34] convert cat and doll --- unpublishedScripts/DomainContent/Toybox/cat/cat.js | 2 +- unpublishedScripts/DomainContent/Toybox/doll/createDoll.js | 2 +- unpublishedScripts/DomainContent/Toybox/doll/doll.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/cat/cat.js b/unpublishedScripts/DomainContent/Toybox/cat/cat.js index 103752bb1b..78b3a92bc3 100644 --- a/unpublishedScripts/DomainContent/Toybox/cat/cat.js +++ b/unpublishedScripts/DomainContent/Toybox/cat/cat.js @@ -16,7 +16,7 @@ var _this; Cat = function() { _this = this; - this.meowSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Animals/cat_meow.wav"); + this.meowSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/cat_meow.wav"); }; Cat.prototype = { diff --git a/unpublishedScripts/DomainContent/Toybox/doll/createDoll.js b/unpublishedScripts/DomainContent/Toybox/doll/createDoll.js index 4a3f1cfbd8..37771fee4a 100644 --- a/unpublishedScripts/DomainContent/Toybox/doll/createDoll.js +++ b/unpublishedScripts/DomainContent/Toybox/doll/createDoll.js @@ -11,7 +11,7 @@ /*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */ function createDoll() { - var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx"; var scriptURL = Script.resolvePath("doll.js"); diff --git a/unpublishedScripts/DomainContent/Toybox/doll/doll.js b/unpublishedScripts/DomainContent/Toybox/doll/doll.js index cc9ab194e6..9abf7c33c0 100644 --- a/unpublishedScripts/DomainContent/Toybox/doll/doll.js +++ b/unpublishedScripts/DomainContent/Toybox/doll/doll.js @@ -18,7 +18,7 @@ // this is the "constructor" for the entity as a JS object we don't do much here var Doll = function() { _this = this; - this.screamSounds = [SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/KenDoll_1%2303.wav")]; + this.screamSounds = [SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/KenDoll_1%2303.wav")]; }; Doll.prototype = { @@ -31,7 +31,7 @@ Entities.editEntity(this.entityID, { animation: { - url: "https://hifi-public.s3.amazonaws.com/models/Bboys/zombie_scream.fbx", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/zombie_scream.fbx", running: true } }); From a9c95d8e7cdee3828b3e7eb54c2790e44bf8eabc Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 17:42:33 -0700 Subject: [PATCH 23/34] convert flappy avatars --- .../Toybox/flappyAvatars/flappyAvatars.js | 24 +++++++++---------- .../Toybox/flappyAvatars/flappyAvatars.json | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.js b/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.js index 06a0a8e751..deefad3507 100644 --- a/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.js +++ b/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.js @@ -37,7 +37,7 @@ var yVelocity = 0.0; var yAcceleration = -G; - var airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Air Swipe 05.wav"); + var airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Air%20Swipe%2005.wav"); var injector = null; this.position = function() { @@ -51,7 +51,7 @@ type: "Model", modelURL: MyAvatar.skeletonModelURL, animation: { - url: "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims_160127/fly.fbx", + url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/fly.fbx", running: true, fps: 30, firstFrame: 1.0, @@ -76,7 +76,7 @@ animation: {running: false} }); - airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/8bit Jump 03.wav"); + airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/8bit%20Jump%2003.wav"); injector = null; } @@ -132,7 +132,7 @@ var id = entityManager.add({ type: "Model", - modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/coin.fbx", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/coin.fbx", angularVelocity: { x: 0, y: 20, z: 0 }, position: to3DPosition(this.position()), dimensions:dimensions @@ -172,14 +172,14 @@ var idUp = entityManager.add({ type: "Model", - modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx", rotation: Quat.fromPitchYawRollDegrees(180, 0, 0), position: to3DPosition({ x: xPosition, y: upYPosition }), dimensions: { x: width, y: upHeight, z: width } }); var idDown = entityManager.add({ type: "Model", - modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx", position: to3DPosition({ x: xPosition, y: height / 2.0 }), dimensions: { x: width, y: height, z: width } }); @@ -217,7 +217,7 @@ var pipes = new Array(); var coins = new Array(); - var coinsSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Coin.wav"); + var coinsSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Coin.wav"); var injector = null; this.update = function(deltaTime, gameTime, startedPlaying) { @@ -325,7 +325,7 @@ var numberDimensions = { x: 0.0660, y: 0.1050, z: 0.0048 }; function numberUrl(number) { - return "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/" + number + ".fbx" + return "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/" + number + ".fbx" } function digitPosition(digit) { return Vec3.multiplyQbyV(space.orientation, { x: 0.3778 + digit * (numberDimensions.x + 0.01), y: 0.0, z: 0.0 }); @@ -341,7 +341,7 @@ var bestId = entityManager.add({ type: "Model", - modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/best.fbx", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/best.fbx", position: topLeft, rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)), dimensions: { x: 0.2781, y: 0.0063, z: 0.1037 } @@ -359,7 +359,7 @@ var scoreId = entityManager.add({ type: "Model", - modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/score.fbx", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/score.fbx", position: bottomLeft, rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)), dimensions: { x: 0.3678, y: 0.0063, z: 0.1037 } @@ -453,7 +453,7 @@ var pipes = null; var score = null; - var gameOverSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Game Over.wav"); + var gameOverSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Game%20Over.wav"); var injector = null; var directions = ["UP", "DOWN", "LEFT", "RIGHT"]; @@ -466,7 +466,7 @@ current = 0; } if (current === sequence.length) { - avatar.changeModel("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/mario.fbx"); + avatar.changeModel("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/mario.fbx"); current = 0; } } diff --git a/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.json b/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.json index ed6dae8851..90c6e5b13d 100644 --- a/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.json +++ b/unpublishedScripts/DomainContent/Toybox/flappyAvatars/flappyAvatars.json @@ -10,7 +10,7 @@ }, "dynamic": 1, "id": "{ee5b25e6-aca2-4dc7-9462-51537d89c126}", - "modelURL": "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/cube.fbx", + "modelURL": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/cube.fbx", "queryAACube": { "scale": 0.5974045991897583, "x": -5.1575918197631836, @@ -23,7 +23,7 @@ "y": -0.13279926776885986, "z": 0.34688329696655273 }, - "script": "https://raw.githubusercontent.com/Atlante45/hifi/feat/hackaton/examples/toybox/flappyAvatars/flappyAvatars.js", + "script": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/flappyAvatars.js", "scriptTimestamp": 1457031937425, "shapeType": "box", "type": "Model", From 5e31c5f38563bf07ca5c23666fa4d07b0a201421 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 17:44:14 -0700 Subject: [PATCH 24/34] convert flashlight and music player --- .../DomainContent/Toybox/flashlight/createFlashlight.js | 2 +- .../DomainContent/Toybox/flashlight/flashlight.js | 4 ++-- unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js | 2 +- .../DomainContent/Toybox/musicPlayer/musicPlayer.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js b/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js index a6f3dca6fd..d6414fca6e 100644 --- a/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js +++ b/unpublishedScripts/DomainContent/Toybox/flashlight/createFlashlight.js @@ -16,7 +16,7 @@ Script.include("libraries/utils.js"); var scriptURL = Script.resolvePath('flashlight.js'); -var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx"; +var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx"; var center = Vec3.sum(Vec3.sum(MyAvatar.position, { x: 0, diff --git a/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js b/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js index 98545fc3ab..e58d68c425 100644 --- a/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js +++ b/unpublishedScripts/DomainContent/Toybox/flashlight/flashlight.js @@ -19,8 +19,8 @@ Script.include("libraries/utils.js"); - var ON_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_on.wav'; - var OFF_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_off.wav'; + var ON_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_on.wav'; + var OFF_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_off.wav'; //we are creating lights that we don't want to get stranded so lets make sure that we can get rid of them var startTime = Date.now(); diff --git a/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js b/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js index 6410e2d92c..77e89b3111 100644 --- a/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js +++ b/unpublishedScripts/DomainContent/Toybox/lights/lightSwitch.js @@ -21,7 +21,7 @@ Script.include(utilitiesScript); LightSwitch = function() { _this = this; - this.switchSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/lamp_switch_2.wav"); + this.switchSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lamp_switch_2.wav"); }; LightSwitch.prototype = { diff --git a/unpublishedScripts/DomainContent/Toybox/musicPlayer/musicPlayer.js b/unpublishedScripts/DomainContent/Toybox/musicPlayer/musicPlayer.js index 4a7655efcc..e3280e8f9c 100644 --- a/unpublishedScripts/DomainContent/Toybox/musicPlayer/musicPlayer.js +++ b/unpublishedScripts/DomainContent/Toybox/musicPlayer/musicPlayer.js @@ -19,7 +19,7 @@ var PLAYLIST_URL = "https://spreadsheets.google.com/feeds/cells/1x-ceGPGHldkHadARABFWfujLPTOWzXJPhrf2bTwg2cQ/od6/public/basic?alt=json"; var SONG_VOLUME = 0.1; var HEADPHONES_ATTACHMENT = { - modelURL: "https://s3.amazonaws.com/hifi-public/brad/musicplayer/headphones2-v2.fbx", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/musicPlayer/headphones2-v2.fbx", jointName: "Head", translation: {"x": 0, "y": 0.19, "z": 0.06}, rotation: {"x":0,"y":0.7071067690849304,"z":0.7071067690849304,"w":0}, From 366d9869e63288aa19382bec13927a81c5c4b1b2 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 18:03:18 -0700 Subject: [PATCH 25/34] convert the rest --- .../Toybox/basketballsResetter.js | 5 +- .../DomainContent/Toybox/hiddenEntityReset.js | 75 ++++++++-------- .../DomainContent/Toybox/masterReset.js | 87 +++++++++---------- .../Toybox/ping_pong_gun/createPingPongGun.js | 6 +- .../Toybox/ping_pong_gun/createTargets.js | 4 +- .../Toybox/ping_pong_gun/pingPongGun.js | 4 +- .../Toybox/ping_pong_gun/wallTarget.js | 2 +- .../Toybox/pistol/createPistol.js | 4 +- .../DomainContent/Toybox/pistol/pistol.js | 6 +- .../Toybox/spray_paint/sprayPaintCan.js | 4 +- .../DomainContent/Toybox/targetsResetter.js | 4 +- 11 files changed, 98 insertions(+), 103 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/basketballsResetter.js b/unpublishedScripts/DomainContent/Toybox/basketballsResetter.js index 76cc4e8331..580453bf24 100644 --- a/unpublishedScripts/DomainContent/Toybox/basketballsResetter.js +++ b/unpublishedScripts/DomainContent/Toybox/basketballsResetter.js @@ -6,7 +6,6 @@ // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; (function() { @@ -42,8 +41,8 @@ var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; createBasketballs: function() { var NUMBER_OF_BALLS = 4; var DIAMETER = 0.30; - var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx"; - var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav"; + var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; + var basketballCollisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav"; var position = { x: 542.86, diff --git a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js index a1010b4dd7..ec1bd94d4c 100644 --- a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js +++ b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js @@ -60,7 +60,6 @@ MasterReset = function() { var resetKey = "resetMe"; - var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; var shouldDeleteOnEndScript = false; @@ -168,7 +167,7 @@ } function createRaveStick(position) { - var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx"; var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0); var stick = Entities.addEntity({ type: "Model", @@ -258,7 +257,7 @@ alphaSpread: 0.1, alphaStart: 0.1, alphaFinish: 0.1, - textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png", + textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png", emitterShouldTrail: false, userData: JSON.stringify({ resetMe: { @@ -270,7 +269,7 @@ } function createGun(position) { - var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx"; var pistol = Entities.addEntity({ type: 'Model', @@ -279,7 +278,7 @@ position: position, restitution: 0, damping: 0.5, - collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav", dimensions: { x: 0.05, y: 0.23, @@ -343,8 +342,8 @@ var SCRIPT_URL = Script.resolvePath('bow.js'); var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27); - var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx"; - var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj"; + var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx"; + var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj"; var BOW_DIMENSIONS = { x: 0.04, @@ -496,7 +495,7 @@ type: "ParticleEffect", name: "fire", animationSettings: animationSettings, - textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png", + textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png", position: { x: 551.45, y: 494.82, @@ -559,10 +558,10 @@ var DIAMETER = 0.30; var RESET_DISTANCE = 1; var MINIMUM_MOVE_LENGTH = 0.05; - var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx"; - var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav"; - var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx"; - var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj"; + var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; + var basketballCollisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav"; + var rackURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx"; + var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj"; var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0); @@ -638,7 +637,7 @@ z: 0 }, dynamic: true, - collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav', + collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav', collisionless: false, modelURL: basketballURL, userData: JSON.stringify({ @@ -733,8 +732,8 @@ function createTargets() { - var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx'; - var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj'; + var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx'; + var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj'; var MINIMUM_MOVE_LENGTH = 0.05; var RESET_DISTANCE = 0.5; @@ -813,8 +812,8 @@ function createCat(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx"; - var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx"; + var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx"; var animationSettings = JSON.stringify({ running: true }); @@ -850,7 +849,7 @@ } function createFlashlight(position) { - var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx"; var flashlight = Entities.addEntity({ type: "Model", @@ -864,7 +863,7 @@ z: 0.08 }, dynamic: true, - collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav", gravity: { x: 0, y: -3.5, @@ -915,7 +914,7 @@ } function createLights() { - var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx"; var rotation = { @@ -1163,8 +1162,8 @@ function createDice() { var diceProps = { type: "Model", - modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx", - collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav", name: "dice", position: { x: 541.61, @@ -1211,7 +1210,7 @@ } function createGates() { - var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx'; + var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx'; var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0); var gate = Entities.addEntity({ @@ -1252,9 +1251,9 @@ function createPingPongBallGun() { - var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx'; - var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj'; - var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav'; + var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx'; + var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj'; + var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav'; var position = { x: 548.6, y: 495.4, @@ -1320,8 +1319,8 @@ } function createWand(position) { - var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx'; - var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj'; + var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx'; + var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj'; var wand = Entities.addEntity({ name: 'Bubble Wand', @@ -1381,7 +1380,7 @@ function createBasketBall(position) { - var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; var entity = Entities.addEntity({ type: "Model", @@ -1407,7 +1406,7 @@ y: -0.01, z: 0 }, - collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav", userData: JSON.stringify({ resetMe: { resetMe: true @@ -1421,7 +1420,7 @@ } function createDoll(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx"; var naturalDimensions = { x: 1.63, @@ -1462,7 +1461,7 @@ function createSprayCan(position) { - var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx"; var entity = Entities.addEntity({ type: "Model", @@ -1476,7 +1475,7 @@ z: 0.07 }, dynamic: true, - collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav", shapeType: 'box', restitution: 0, gravity: { @@ -1502,7 +1501,7 @@ } function createPottedPlant(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx"; var entity = Entities.addEntity({ type: "Model", @@ -1540,8 +1539,8 @@ function createCombinedArmChair(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx"; - var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx"; + var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj"; var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0); @@ -1583,8 +1582,8 @@ } function createBlocks(position) { - var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/"; - var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav"; + var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky"; + var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav"; var NUM_BLOCKS_PER_COLOR = 4; var i, j; diff --git a/unpublishedScripts/DomainContent/Toybox/masterReset.js b/unpublishedScripts/DomainContent/Toybox/masterReset.js index 4820aa6292..1460536e7d 100644 --- a/unpublishedScripts/DomainContent/Toybox/masterReset.js +++ b/unpublishedScripts/DomainContent/Toybox/masterReset.js @@ -20,11 +20,11 @@ var catScriptURL = Script.resolvePath("cat/cat.js"); var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js'); var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js'); var wandScriptURL = Script.resolvePath("bubblewand/wand.js"); -var dollScriptURL = Script.resolvePath("doll.js"); +var dollScriptURL = Script.resolvePath("doll/doll.js"); var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js"); -var bowScriptURL = Script.resolvePath("toybox/bow/bow.js"); +var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js'); +var bowScriptURL = Script.resolvePath('bow/bow.js'); var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js"); -var targetsScriptURL = Script.resolvePath('toybox/ping_pong_gun/wallTarget.js'); var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js'); var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js'); @@ -32,7 +32,6 @@ var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js'); MasterReset = function() { var resetKey = "resetMe"; - var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; var shouldDeleteOnEndScript = false; @@ -148,7 +147,7 @@ MasterReset = function() { } function createRaveStick(position) { - var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx"; var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0); var stick = Entities.addEntity({ type: "Model", @@ -243,7 +242,7 @@ MasterReset = function() { alphaSpread: 0.1, alphaStart: 0.1, alphaFinish: 0.1, - textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png", + textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png", emitterShouldTrail: false, userData: JSON.stringify({ resetMe: { @@ -254,7 +253,8 @@ MasterReset = function() { } function createGun(position) { - var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx"; + var pistol = Entities.addEntity({ type: 'Model', @@ -281,7 +281,7 @@ MasterReset = function() { restitution: 0, dynamic: true, damping: 0.5, - collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav", userData: JSON.stringify({ "wearable": { "joints": { @@ -327,9 +327,8 @@ MasterReset = function() { var SCRIPT_URL = Script.resolvePath('bow.js'); var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27); - var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx"; - var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj"; - + var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx"; + var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj"; var BOW_DIMENSIONS = { x: 0.04, y: 1.3, @@ -480,7 +479,7 @@ MasterReset = function() { type: "ParticleEffect", name: "fire", animationSettings: animationSettings, - textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png", + textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png", position: { x: 551.45, y: 494.82, @@ -544,10 +543,10 @@ MasterReset = function() { var DIAMETER = 0.30; var RESET_DISTANCE = 1; var MINIMUM_MOVE_LENGTH = 0.05; - var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx"; - var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav"; - var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx"; - var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj"; + var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; + var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav"; + var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx"; + var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj"; var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0); @@ -624,7 +623,7 @@ MasterReset = function() { z: 0 }, dynamic: true, - collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav', + collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav', collisionless: false, modelURL: basketballURL, userData: JSON.stringify({ @@ -721,8 +720,8 @@ MasterReset = function() { function createTargets() { - var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx'; - var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj'; + var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx'; + var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj'; var MINIMUM_MOVE_LENGTH = 0.05; var RESET_DISTANCE = 0.5; @@ -801,8 +800,8 @@ MasterReset = function() { function createCat(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx"; - var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx"; + var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx"; var animationSettings = JSON.stringify({ running: true }); @@ -838,7 +837,7 @@ MasterReset = function() { } function createFlashlight(position) { - var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx"; var flashlight = Entities.addEntity({ type: "Model", @@ -852,7 +851,7 @@ MasterReset = function() { z: 0.08 }, dynamic: true, - collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav", gravity: { x: 0, y: -3.5, @@ -903,8 +902,7 @@ MasterReset = function() { } function createLights() { - var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx"; - + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx"; var rotation = { w: 0.63280689716339111, @@ -1151,8 +1149,8 @@ MasterReset = function() { function createDice() { var diceProps = { type: "Model", - modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx", - collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav", + modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav", name: "dice", position: { x: 541.61, @@ -1199,8 +1197,7 @@ MasterReset = function() { } function createGates() { - var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx'; - + var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx'; var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0); var gate = Entities.addEntity({ name: 'Front Door Fence', @@ -1239,10 +1236,9 @@ MasterReset = function() { } function createPingPongBallGun() { - var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx'; - var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj'; - - var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav'; + var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx'; + var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj'; + var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav'; var position = { x: 548.6, y: 495.4, @@ -1308,8 +1304,8 @@ MasterReset = function() { } function createWand(position) { - var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx'; - var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj'; + var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx'; + var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj'; var wand = Entities.addEntity({ name: 'Bubble Wand', @@ -1369,7 +1365,7 @@ MasterReset = function() { function createBasketBall(position) { - var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; var entity = Entities.addEntity({ type: "Model", @@ -1395,7 +1391,7 @@ MasterReset = function() { y: -0.01, z: 0 }, - collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav", userData: JSON.stringify({ resetMe: { resetMe: true @@ -1409,7 +1405,7 @@ MasterReset = function() { } function createDoll(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx"; var naturalDimensions = { x: 1.63, @@ -1450,7 +1446,8 @@ MasterReset = function() { function createSprayCan(position) { - var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx"; + + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx"; var entity = Entities.addEntity({ type: "Model", @@ -1464,7 +1461,7 @@ MasterReset = function() { z: 0.07 }, dynamic: true, - collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav", shapeType: 'box', gravity: { x: 0, @@ -1490,7 +1487,7 @@ MasterReset = function() { } function createPottedPlant(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx"; var entity = Entities.addEntity({ type: "Model", @@ -1528,8 +1525,8 @@ MasterReset = function() { function createCombinedArmChair(position) { - var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx"; - var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj"; + var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx"; + var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj"; var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0); @@ -1571,8 +1568,8 @@ MasterReset = function() { } function createBlocks(position) { - var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/"; - var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav"; + var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky"; + var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav"; var NUM_BLOCKS_PER_COLOR = 4; var i, j; diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createPingPongGun.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createPingPongGun.js index 467a05b5b6..5f0c00a7bc 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createPingPongGun.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createPingPongGun.js @@ -13,9 +13,9 @@ Script.include("../../libraries/utils.js"); var scriptURL = Script.resolvePath('pingPongGun.js'); -var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx' -var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj'; -var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav'; +var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx' +var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj'; +var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav'; var center = Vec3.sum(Vec3.sum(MyAvatar.position, { x: 0, y: 0.5, diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js index 2685599824..1dfe02e31c 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/createTargets.js @@ -14,8 +14,8 @@ Script.include("utils.js"); var scriptURL = Script.resolvePath('wallTarget.js'); -var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx'; -var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj'; +var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx'; +var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj'; var MINIMUM_MOVE_LENGTH = 0.05; var RESET_DISTANCE = 0.5; diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js index 24edbe8522..37c909cb6e 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/pingPongGun.js @@ -13,8 +13,8 @@ Script.include("utils.js"); - var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/ping_pong_gun/pong_sound.wav'; - var PING_PONG_BALL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_ball.fbx'; + var SHOOTING_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/pong_sound.wav'; + var PING_PONG_BALL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/ping_pong_ball.fbx'; function PingPongGun() { return; diff --git a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/wallTarget.js b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/wallTarget.js index 5aa46b1dc7..267faff4ed 100644 --- a/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/wallTarget.js +++ b/unpublishedScripts/DomainContent/Toybox/ping_pong_gun/wallTarget.js @@ -20,7 +20,7 @@ hasBecomeActive: false, preload: function(entityID) { this.entityID = entityID; - var SOUND_URL = "http://hifi-public.s3.amazonaws.com/sounds/Clay_Pigeon_02.L.wav"; + var SOUND_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Clay_Pigeon_02.L.wav"; this.hitSound = SoundCache.getSound(SOUND_URL); }, collisionWithEntity: function(me, otherEntity) { diff --git a/unpublishedScripts/DomainContent/Toybox/pistol/createPistol.js b/unpublishedScripts/DomainContent/Toybox/pistol/createPistol.js index 1608c2fa4b..c3069547cb 100644 --- a/unpublishedScripts/DomainContent/Toybox/pistol/createPistol.js +++ b/unpublishedScripts/DomainContent/Toybox/pistol/createPistol.js @@ -1,6 +1,6 @@ var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation()))); var scriptURL = Script.resolvePath('pistol.js'); -var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx"; +var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx"; var pistol = Entities.addEntity({ @@ -27,7 +27,7 @@ var pistol = Entities.addEntity({ }, restitution: 0, damping:0.5, - collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav", + collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav", userData: JSON.stringify({ grabbableKey: { invertSolidWhileHeld: true diff --git a/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js b/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js index 272da68bec..3371248474 100644 --- a/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js +++ b/unpublishedScripts/DomainContent/Toybox/pistol/pistol.js @@ -27,8 +27,8 @@ this.forceMultiplier = 1; this.laserLength = 100; - this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw"); - this.ricochetSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/Ricochet.L.wav"); + this.fireSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/GUN-SHOT2.raw"); + this.ricochetSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/Ricochet.L.wav"); this.playRichochetSoundChance = 0.1; this.fireVolume = 0.2; this.bulletForce = 10; @@ -216,7 +216,7 @@ "alphaStart": 0, "alphaFinish": 0, "additiveBlending": true, - "textures": "http://ericrius1.github.io/PartiArt/assets/star.png" + "textures": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/star.png" }); Script.setTimeout(function() { diff --git a/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js b/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js index 05d9b4efc5..9d906eaf42 100644 --- a/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js +++ b/unpublishedScripts/DomainContent/Toybox/spray_paint/sprayPaintCan.js @@ -15,7 +15,7 @@ Script.include("libraries/utils.js"); - this.spraySound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/sprayPaintSound.wav"); + this.spraySound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/spray_paint.wav"); var TIP_OFFSET_Z = 0.02; var TIP_OFFSET_Y = 0.08; @@ -63,7 +63,7 @@ name: "streamEffect", isEmitting: true, position: position, - textures: "https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png", + textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/smokeparticle.png", emitSpeed: 3, speedSpread: 0.02, emitAcceleration: ZERO_VEC, diff --git a/unpublishedScripts/DomainContent/Toybox/targetsResetter.js b/unpublishedScripts/DomainContent/Toybox/targetsResetter.js index 10ba968ac9..d8253fc48a 100644 --- a/unpublishedScripts/DomainContent/Toybox/targetsResetter.js +++ b/unpublishedScripts/DomainContent/Toybox/targetsResetter.js @@ -44,8 +44,8 @@ createTargets: function() { - var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx'; - var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj'; + var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx'; + var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj'; var MINIMUM_MOVE_LENGTH = 0.05; var RESET_DISTANCE = 0.5; From f73ef9b4a9502120e44a564f4113295d186f358e Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 18:03:38 -0700 Subject: [PATCH 26/34] cleanup --- unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js index ec1bd94d4c..061a942de9 100644 --- a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js +++ b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js @@ -559,8 +559,8 @@ var RESET_DISTANCE = 1; var MINIMUM_MOVE_LENGTH = 0.05; var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx"; - var basketballCollisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav"; - var rackURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx"; + var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav"; + var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx"; var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj"; var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0); From 9a7bebaaa2a12ba5dff7305c1e3ee88c973ad729 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 28 Apr 2016 18:04:04 -0700 Subject: [PATCH 27/34] Fix dangling reference into container --- libraries/networking/src/AssetClient.cpp | 138 +++++++++++++++++------ libraries/networking/src/AssetClient.h | 3 + 2 files changed, 107 insertions(+), 34 deletions(-) diff --git a/libraries/networking/src/AssetClient.cpp b/libraries/networking/src/AssetClient.cpp index 34ba5fc785..080b0c9b90 100644 --- a/libraries/networking/src/AssetClient.cpp +++ b/libraries/networking/src/AssetClient.cpp @@ -325,47 +325,117 @@ void AssetClient::handleAssetGetReply(QSharedPointer message, S // Check if we have any pending requests for this node auto messageMapIt = _pendingRequests.find(senderNode); - if (messageMapIt != _pendingRequests.end()) { + if (messageMapIt == _pendingRequests.end()) { + return; + } - // Found the node, get the MessageID -> Callback map - auto& messageCallbackMap = messageMapIt->second; - - // Check if we have this pending request - auto requestIt = messageCallbackMap.find(messageID); - if (requestIt != messageCallbackMap.end()) { - auto& callbacks = requestIt->second; - - // Store message in case we need to disconnect from it later. - callbacks.message = message; - - if (message->isComplete()) { - callbacks.completeCallback(true, error, message->readAll()); - messageCallbackMap.erase(requestIt); - } else { - connect(message.data(), &ReceivedMessage::progress, this, [this, length, message, &callbacks]() { - callbacks.progressCallback(message->getSize(), length); - }); - connect(message.data(), &ReceivedMessage::completed, this, [this, messageID, message, &messageCallbackMap, &callbacks]() { - if (message->failed()) { - callbacks.completeCallback(false, AssetServerError::NoError, QByteArray()); - } else { - callbacks.completeCallback(true, AssetServerError::NoError, message->readAll()); - } - - // We should never get to this point without the associated senderNode and messageID - // in our list of pending requests. If the senderNode had disconnected or the message - // had been canceled, we should have been disconnected from the ReceivedMessage - // signals and thus never had this lambda called. - messageCallbackMap.erase(messageID); - }); - } - } + // Found the node, get the MessageID -> Callback map + auto& messageCallbackMap = messageMapIt->second; + // Check if we have this pending request + auto requestIt = messageCallbackMap.find(messageID); + if (requestIt == messageCallbackMap.end()) { // Although the messageCallbackMap may now be empty, we won't delete the node until we have disconnected from // it to avoid constantly creating/deleting the map on subsequent requests. + return; + } + + auto& callbacks = requestIt->second; + + // Store message in case we need to disconnect from it later. + callbacks.message = message; + + if (message->isComplete()) { + callbacks.completeCallback(true, error, message->readAll()); + messageCallbackMap.erase(requestIt); + } else { + auto weakNode = senderNode.toWeakRef(); + + connect(message.data(), &ReceivedMessage::progress, this, [this, weakNode, messageID, length]() { + handleProgressCallback(weakNode, messageID, length); + }); + connect(message.data(), &ReceivedMessage::completed, this, [this, weakNode, messageID]() { + handleCompleteCallback(weakNode, messageID); + }); } } +void AssetClient::handleProgressCallback(const QWeakPointer& node, MessageID messageID, DataOffset length) { + auto senderNode = node.toStrongRef(); + + if (!senderNode) { + return; + } + + // Check if we have any pending requests for this node + auto messageMapIt = _pendingRequests.find(senderNode); + if (messageMapIt == _pendingRequests.end()) { + return; + } + + // Found the node, get the MessageID -> Callback map + auto& messageCallbackMap = messageMapIt->second; + + // Check if we have this pending request + auto requestIt = messageCallbackMap.find(messageID); + if (requestIt == messageCallbackMap.end()) { + return; + } + + auto& callbacks = requestIt->second; + auto& message = callbacks.message; + + if (!message) { + return; + } + + callbacks.progressCallback(message->getSize(), length); +} + +void AssetClient::handleCompleteCallback(const QWeakPointer& node, MessageID messageID) { + auto senderNode = node.toStrongRef(); + + if (!senderNode) { + return; + } + + // Check if we have any pending requests for this node + auto messageMapIt = _pendingRequests.find(senderNode); + if (messageMapIt == _pendingRequests.end()) { + return; + } + + // Found the node, get the MessageID -> Callback map + auto& messageCallbackMap = messageMapIt->second; + + // Check if we have this pending request + auto requestIt = messageCallbackMap.find(messageID); + if (requestIt == messageCallbackMap.end()) { + return; + } + + auto& callbacks = requestIt->second; + auto& message = callbacks.message; + + if (!message) { + return; + } + + + if (message->failed()) { + callbacks.completeCallback(false, AssetServerError::NoError, QByteArray()); + } else { + callbacks.completeCallback(true, AssetServerError::NoError, message->readAll()); + } + + // We should never get to this point without the associated senderNode and messageID + // in our list of pending requests. If the senderNode had disconnected or the message + // had been canceled, we should have been disconnected from the ReceivedMessage + // signals and thus never had this lambda called. + messageCallbackMap.erase(messageID); +} + + MessageID AssetClient::getAssetMapping(const AssetPath& path, MappingOperationCallback callback) { Q_ASSERT(QThread::currentThread() == thread()); diff --git a/libraries/networking/src/AssetClient.h b/libraries/networking/src/AssetClient.h index c0e95c0d1d..c5c9b5fa43 100644 --- a/libraries/networking/src/AssetClient.h +++ b/libraries/networking/src/AssetClient.h @@ -74,6 +74,9 @@ private slots: void handleAssetGetReply(QSharedPointer message, SharedNodePointer senderNode); void handleAssetUploadReply(QSharedPointer message, SharedNodePointer senderNode); + void handleProgressCallback(const QWeakPointer& node, MessageID messageID, DataOffset length); + void handleCompleteCallback(const QWeakPointer& node, MessageID messageID); + void handleNodeKilled(SharedNodePointer node); private: From 09981db83461bbadc3f56a78c03af743d3d13a4e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 28 Apr 2016 18:05:06 -0700 Subject: [PATCH 28/34] use a setting handle for UAL disabled to fix startup race --- libraries/networking/src/UserActivityLogger.cpp | 7 ++----- libraries/networking/src/UserActivityLogger.h | 6 ++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libraries/networking/src/UserActivityLogger.cpp b/libraries/networking/src/UserActivityLogger.cpp index 09cfc298bc..0d7690840d 100644 --- a/libraries/networking/src/UserActivityLogger.cpp +++ b/libraries/networking/src/UserActivityLogger.cpp @@ -25,15 +25,12 @@ UserActivityLogger& UserActivityLogger::getInstance() { return sharedInstance; } -UserActivityLogger::UserActivityLogger() : _disabled(false) { -} - void UserActivityLogger::disable(bool disable) { - _disabled = disable; + _disabled.set(disable); } void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCallbackParameters params) { - if (_disabled) { + if (_disabled.get()) { return; } diff --git a/libraries/networking/src/UserActivityLogger.h b/libraries/networking/src/UserActivityLogger.h index c48169d207..5c1cb03e3a 100644 --- a/libraries/networking/src/UserActivityLogger.h +++ b/libraries/networking/src/UserActivityLogger.h @@ -19,6 +19,8 @@ #include #include +#include + class UserActivityLogger : public QObject { Q_OBJECT @@ -44,8 +46,8 @@ private slots: void requestError(QNetworkReply& errorReply); private: - UserActivityLogger(); - bool _disabled; + UserActivityLogger() {}; + Setting::Handle _disabled { "UserActivityLoggerDisabled", false }; }; #endif // hifi_UserActivityLogger_h From d7d667c99b7c930626a7ef7fafd4bc6d8f4bc84e Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 18:17:38 -0700 Subject: [PATCH 29/34] add utils scripts --- unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js | 3 +++ .../DomainContent/Toybox/immediateClientReset.js | 2 +- unpublishedScripts/DomainContent/Toybox/masterReset.js | 4 ---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js index 061a942de9..039c350a4a 100644 --- a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js +++ b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js @@ -12,6 +12,9 @@ (function() { + var utilitiesScript = Script.resolvePath("libraries/utils.js"); + Script.include(utilitiesScript); + var _this; var gunScriptURL = Script.resolvePath("pistol/pistol.js"); diff --git a/unpublishedScripts/DomainContent/Toybox/immediateClientReset.js b/unpublishedScripts/DomainContent/Toybox/immediateClientReset.js index ee98234a26..1aa82d0249 100644 --- a/unpublishedScripts/DomainContent/Toybox/immediateClientReset.js +++ b/unpublishedScripts/DomainContent/Toybox/immediateClientReset.js @@ -6,8 +6,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */ +Script.include('libraries/utils.js'); var masterResetScript = Script.resolvePath("masterReset.js"); var hiddenEntityScriptURL = Script.resolvePath("hiddenEntityReset.js"); diff --git a/unpublishedScripts/DomainContent/Toybox/masterReset.js b/unpublishedScripts/DomainContent/Toybox/masterReset.js index 1460536e7d..c5fdfc1372 100644 --- a/unpublishedScripts/DomainContent/Toybox/masterReset.js +++ b/unpublishedScripts/DomainContent/Toybox/masterReset.js @@ -6,11 +6,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */ -//per script - -/*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLights */ var utilitiesScript = Script.resolvePath("libraries/utils.js"); Script.include(utilitiesScript); From 45bb91cb0bf8f7fbca1bb314485e6578df745d4e Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 18:20:20 -0700 Subject: [PATCH 30/34] planky --- unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js | 2 +- unpublishedScripts/DomainContent/Toybox/masterReset.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js index 039c350a4a..e2deec75ed 100644 --- a/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js +++ b/unpublishedScripts/DomainContent/Toybox/hiddenEntityReset.js @@ -1585,7 +1585,7 @@ } function createBlocks(position) { - var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky"; + var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/"; var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav"; var NUM_BLOCKS_PER_COLOR = 4; var i, j; diff --git a/unpublishedScripts/DomainContent/Toybox/masterReset.js b/unpublishedScripts/DomainContent/Toybox/masterReset.js index c5fdfc1372..4ad9cce401 100644 --- a/unpublishedScripts/DomainContent/Toybox/masterReset.js +++ b/unpublishedScripts/DomainContent/Toybox/masterReset.js @@ -1564,7 +1564,7 @@ MasterReset = function() { } function createBlocks(position) { - var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky"; + var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/"; var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav"; var NUM_BLOCKS_PER_COLOR = 4; var i, j; From 4fd6647d0bcd7efcc6c6299414c343447d33694c Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 28 Apr 2016 18:25:09 -0700 Subject: [PATCH 31/34] add rave stick entity script --- .../Toybox/flowArts/raveStickEntityScript.js | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 unpublishedScripts/DomainContent/Toybox/flowArts/raveStickEntityScript.js diff --git a/unpublishedScripts/DomainContent/Toybox/flowArts/raveStickEntityScript.js b/unpublishedScripts/DomainContent/Toybox/flowArts/raveStickEntityScript.js new file mode 100644 index 0000000000..03e15d66db --- /dev/null +++ b/unpublishedScripts/DomainContent/Toybox/flowArts/raveStickEntityScript.js @@ -0,0 +1,163 @@ +// raveStickEntityScript.js +// +// Script Type: Entity +// Created by Eric Levin on 12/16/15. +// Copyright 2015 High Fidelity, Inc. +// +// This entity script create light trails on a given object as it moves. +// 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 _this; + var LIFETIME = 6000; + var DRAWING_DEPTH = 0.8; + var LINE_DIMENSIONS = 100; + var MAX_POINTS_PER_LINE = 50; + var MIN_POINT_DISTANCE = 0.02; + var STROKE_WIDTH = 0.05 + var ugLSD = 35; + var RaveStick = function() { + _this = this; + this.colorPalette = [{ + red: 0, + green: 200, + blue: 40 + }, { + red: 200, + green: 10, + blue: 40 + }]; + var texture = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/trails.png"; + this.trail = Entities.addEntity({ + type: "PolyLine", + dimensions: { + x: LINE_DIMENSIONS, + y: LINE_DIMENSIONS, + z: LINE_DIMENSIONS + }, + color: { + red: 255, + green: 255, + blue: 255 + }, + textures: texture, + lifetime: LIFETIME + }); + + this.points = []; + this.normals = []; + this.strokeWidths = []; + }; + + RaveStick.prototype = { + isGrabbed: false, + + startNearGrab: function() { + this.trailBasePosition = Entities.getEntityProperties(this.entityID, "position").position; + Entities.editEntity(this.trail, { + position: this.trailBasePosition + }); + this.points = []; + this.normals = []; + this.strokeWidths = []; + this.setupEraseInterval(); + }, + + continueNearGrab: function() { + var props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]); + var forwardVec = Quat.getFront(Quat.multiply(props.rotation, Quat.fromPitchYawRollDegrees(-90, 0, 0))); + forwardVec = Vec3.normalize(forwardVec); + var forwardQuat = orientationOf(forwardVec); + var position = Vec3.sum(props.position, Vec3.multiply(Quat.getFront(props.rotation), 0.04)); + var localPoint = Vec3.subtract(position, this.trailBasePosition); + if (this.points.length >= 1 && Vec3.distance(localPoint, this.points[this.points.length - 1]) < MIN_POINT_DISTANCE) { + //Need a minimum distance to avoid binormal NANs + return; + } + if (this.points.length === MAX_POINTS_PER_LINE) { + this.points.shift(); + this.normals.shift(); + this.strokeWidths.shift(); + } + + this.points.push(localPoint); + var normal = Quat.getUp(props.rotation); + this.normals.push(normal); + this.strokeWidths.push(STROKE_WIDTH); + Entities.editEntity(this.trail, { + linePoints: this.points, + normals: this.normals, + strokeWidths: this.strokeWidths + }); + + + }, + + setupEraseInterval: function() { + this.trailEraseInterval = Script.setInterval(function() { + if (_this.points.length > 0) { + _this.points.shift(); + _this.normals.shift(); + _this.strokeWidths.shift(); + Entities.editEntity(_this.trail, { + linePoints: _this.points, + strokeWidths: _this.strokeWidths, + normals: _this.normals + }); + } + }, ugLSD); + }, + + releaseGrab: function() { + if (!this.trailEraseInterval) { + return; + } + Script.setTimeout(function() { + Script.clearInterval(_this.trailEraseInterval); + _this.trailEraseInterval = null; + }, 3000); + }, + + preload: function(entityID) { + this.entityID = entityID; + }, + + unload: function() { + Entities.deleteEntity(this.beam); + Entities.deleteEntity(this.trail); + if (this.trailEraseInterval) { + Script.clearInterval(this.trailEraseInterval); + } + } + }; + + orientationOf = function(vector) { + var Y_AXIS = { + x: 0, + y: 1, + z: 0 + }; + var X_AXIS = { + x: 1, + y: 0, + z: 0 + }; + + var theta = 0.0; + + var RAD_TO_DEG = 180.0 / Math.PI; + var direction, yaw, pitch; + direction = Vec3.normalize(vector); + yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS); + pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS); + return Quat.multiply(yaw, pitch); + } + + function computeNormal(p1, p2) { + return Vec3.normalize(Vec3.subtract(p2, p1)); + } + return new RaveStick(); +}); \ No newline at end of file From e61f8524c13e3e5dda705142e1f8833d8cfdc4c0 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Fri, 29 Apr 2016 11:01:19 -0700 Subject: [PATCH 32/34] update dice path --- scripts/tutorials/createDice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tutorials/createDice.js b/scripts/tutorials/createDice.js index 3d45d00bc8..73169b8273 100644 --- a/scripts/tutorials/createDice.js +++ b/scripts/tutorials/createDice.js @@ -31,7 +31,7 @@ var BUTTON_SIZE = 32; var PADDING = 3; //a helper library for creating toolbars -Script.include(["../default/libraries/toolBars.js"]); +Script.include(["../system/libraries/toolBars.js"]); var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.dice.toolbar", function(screenSize) { return { x: (screenSize.x / 2 - BUTTON_SIZE * 2 + PADDING), From fc82780512fc3dc4c8addc00f54c9426bcd7e4ae Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Fri, 29 Apr 2016 11:04:04 -0700 Subject: [PATCH 33/34] move toolbars to production --- scripts/tutorials/createDice.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/tutorials/createDice.js b/scripts/tutorials/createDice.js index 73169b8273..527735da57 100644 --- a/scripts/tutorials/createDice.js +++ b/scripts/tutorials/createDice.js @@ -31,7 +31,8 @@ var BUTTON_SIZE = 32; var PADDING = 3; //a helper library for creating toolbars -Script.include(["../system/libraries/toolBars.js"]); +Script.include("http://hifi-production.s3.amazonaws.com/tutorials/dice/toolBars.js"); + var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.dice.toolbar", function(screenSize) { return { x: (screenSize.x / 2 - BUTTON_SIZE * 2 + PADDING), From 6d9080162cb11b7beacb9d8844f3e0ec3add4370 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 29 Apr 2016 17:39:53 -0700 Subject: [PATCH 34/34] Make slots private method --- libraries/networking/src/AssetClient.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/AssetClient.h b/libraries/networking/src/AssetClient.h index c5c9b5fa43..f951be762d 100644 --- a/libraries/networking/src/AssetClient.h +++ b/libraries/networking/src/AssetClient.h @@ -74,9 +74,6 @@ private slots: void handleAssetGetReply(QSharedPointer message, SharedNodePointer senderNode); void handleAssetUploadReply(QSharedPointer message, SharedNodePointer senderNode); - void handleProgressCallback(const QWeakPointer& node, MessageID messageID, DataOffset length); - void handleCompleteCallback(const QWeakPointer& node, MessageID messageID); - void handleNodeKilled(SharedNodePointer node); private: @@ -96,6 +93,9 @@ private: bool cancelGetAssetRequest(MessageID id); bool cancelUploadAssetRequest(MessageID id); + void handleProgressCallback(const QWeakPointer& node, MessageID messageID, DataOffset length); + void handleCompleteCallback(const QWeakPointer& node, MessageID messageID); + struct GetAssetRequestData { QSharedPointer message; ReceivedAssetCallback completeCallback;