From ca2d22a19208088454425a3bf2e501de5b101ddd Mon Sep 17 00:00:00 2001 From: Menithal Date: Tue, 12 Sep 2017 21:22:40 +0300 Subject: [PATCH] Updated Scripts --- .../resources/icons/tablet-icons/clap-a.svg | 64 +++++----- .../resources/icons/tablet-icons/clap-i.svg | 66 ++++++----- .../marketplace/clap/clapApp.js | 6 +- .../marketplace/clap/icons/clap-a.svg | 112 ++++++++++++++++++ .../clap/icons/clap-black-icon.svg | 104 ---------------- .../marketplace/clap/icons/clap-i.svg | 112 ++++++++++++++++++ .../clap/icons/clap-white-icon.svg | 104 ---------------- .../marketplace/clap/scripts/ClapDebugger.js | 10 -- .../marketplace/clap/scripts/ClapEngine.js | 41 ++++--- 9 files changed, 324 insertions(+), 295 deletions(-) create mode 100644 unpublishedScripts/marketplace/clap/icons/clap-a.svg delete mode 100644 unpublishedScripts/marketplace/clap/icons/clap-black-icon.svg create mode 100644 unpublishedScripts/marketplace/clap/icons/clap-i.svg delete mode 100644 unpublishedScripts/marketplace/clap/icons/clap-white-icon.svg diff --git a/interface/resources/icons/tablet-icons/clap-a.svg b/interface/resources/icons/tablet-icons/clap-a.svg index 10a8e3ea98..60df3e0795 100644 --- a/interface/resources/icons/tablet-icons/clap-a.svg +++ b/interface/resources/icons/tablet-icons/clap-a.svg @@ -9,13 +9,13 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" - viewBox="0 0 210 297" + width="225pt" + height="225pt" + viewBox="0 0 79.374998 79.374998" version="1.1" id="svg8" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" - sodipodi:docname="ClapBlack.svg"> + sodipodi:docname="clap-a.svg"> + inkscape:window-maximized="1" + inkscape:pagecheckerboard="true" + units="pt" /> @@ -51,7 +53,8 @@ + id="layer1" + transform="translate(0,-217.62501)"> + d="m 287.04656,288.04665 23.71378,9.0592 c 0,0 0.39967,-4.79605 4.5296,-6.92762 4.12992,-2.13158 7.40168,-15.99614 7.40168,-15.99614 l 2.5266,-9.92668 4.1934,-9.24819 c 0,0 -1.13082,-3.82467 -4.67519,-0.19524 -8.8408,9.05294 -3.51813,14.25651 -8.14833,14.16202 -3.77977,-0.75596 -0.13245,-10.86933 0.26722,-16.16497 0.26644,-3.06413 0.69941,-12.98928 0.29974,-18.85112 -0.39966,-5.86184 -0.93256,-6.66118 -2.66446,-6.52795 -1.73191,0.13322 -2.93093,0.93257 -4.39638,9.05919 -1.46546,8.12664 -3.33058,15.72038 -3.06414,18.91774 0.26644,3.19737 -4.36307,0.64443 -2.89762,-5.48385 1.46546,-6.12827 4.82299,-19.49577 4.95621,-21.36089 0.13322,-1.86512 -0.52548,-5.99423 -3.45641,-1.46464 -2.93091,4.52961 -8.39307,31.77464 -8.39307,31.77464 0,0 -4.61911,1.35544 4.75249,-29.62183 0.37058,-1.22492 -1.2231,-1.82036 -2.02245,-0.35491 -0.79933,1.46547 -2.93556,6.41177 -3.60169,9.47592 -0.66612,3.06413 -4.12526,18.76747 -5.99039,20.76582 -1.86514,1.99836 -0.77914,-1.64516 2.43172,-19.62594 -3.46015,-8.7099 -7.6029,16.6051 -8.29355,25.75422 -1.73191,11.05755 2.66446,14.65459 2.53124,22.78122 z" + style="fill:#000000;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + d="m 326.28601,276.79194 4.85752,2.59518 c 0,0 5.99506,0.26645 7.86018,1.19902 1.86513,0.93256 14.52136,-19.31742 14.52136,-19.31742 0,0 -1.59867,-0.39967 -3.19735,-5.32893 -1.59868,-4.92926 -7.59374,-19.98353 -9.45888,-23.44734 -1.86513,-3.46381 -2.53124,-4.66283 -3.4638,-7.46051 -0.93257,-2.7977 -2.13159,-5.0625 -3.73027,-0.13323 -1.59868,4.92927 -1.66343,10.45537 -0.46441,13.91919 1.38613,5.18454 3.8952,15.07683 1.97631,17.7369 -3.13067,-0.0635 -4.1718,-8.94257 -4.84078,-11.98701 l -10.45574,-8.48036 -1.15458,18.13553 c 0,0 3.30736,-4.0697 9.65298,-5.19422 4.51067,-0.79933 2.81751,6.4678 1.21188,14.09965 -1.34794,6.40707 -3.31442,13.66355 -3.31442,13.66355 z" + style="fill:#000000;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + d="m 291.74698,236.36722 c 0,0 -1.36535,-0.56172 -0.0701,-3.22296 1.29528,-2.66125 3.72103,-1.62503 4.12138,-1.41306 -1.04349,0.50764 -3.37926,4.82292 -4.05132,4.63602 z" + style="fill:#000000;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + d="m 278.60514,277.01718 c 0,0 -0.98806,-8.05217 1.36702,-17.09567 5.11868,-12.29479 -7.76345,3.61446 -1.36702,17.09567 z" + style="fill:#000000;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="ccc" /> + d="m 283.64252,261.72126 c 0,-0.0431 -1.44898,3.96362 -0.80247,9.53246 0.42679,3.67631 0.64575,8.36037 1.90705,11.72782 3.10143,7.14376 -8.41694,-7.43352 -1.10458,-21.26028 z" + style="fill:#000000;stroke:#000000;stroke-width:0.11350404px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="cscc" /> + d="m 318.12446,294.21149 c 0,0 6.68844,-4.71017 9.13772,-13.37686 -5.91279,4.63412 -6.77642,9.57974 -9.13772,13.37686 z" + style="fill:#000000;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="ccc" /> + d="m 344.21877,231.00112 c 0,0 1.60041,9.36884 7.07841,21.7522 5.35526,12.10587 4.05178,-4.80879 -7.07841,-21.7522 z" + style="fill:#000000;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="csc" /> + d="m 349.44951,230.90023 c -0.11119,-0.0477 0.96041,8.99393 4.75948,15.37263 1.48524,4.17497 3.73499,-6.08181 -4.75948,-15.37263 z" + style="fill:#000000;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="ccc" /> diff --git a/interface/resources/icons/tablet-icons/clap-i.svg b/interface/resources/icons/tablet-icons/clap-i.svg index 3e4ecb0b64..fbd9ed0f9c 100644 --- a/interface/resources/icons/tablet-icons/clap-i.svg +++ b/interface/resources/icons/tablet-icons/clap-i.svg @@ -9,13 +9,13 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" - viewBox="0 0 210 297" + width="225pt" + height="225pt" + viewBox="0 0 79.374998 79.374998" version="1.1" id="svg8" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" - sodipodi:docname="ClapWhite.svg"> + sodipodi:docname="clap-i.svg"> + inkscape:window-maximized="1" + inkscape:pagecheckerboard="true" + units="pt" /> @@ -51,54 +53,60 @@ + id="layer1" + transform="translate(0,-217.62501)"> + style="fill:#000000"> + d="m 287.04656,288.04665 23.71378,9.0592 c 0,0 0.39967,-4.79605 4.5296,-6.92762 4.12992,-2.13158 7.40168,-15.99614 7.40168,-15.99614 l 2.5266,-9.92668 4.1934,-9.24819 c 0,0 -1.13082,-3.82467 -4.67519,-0.19524 -8.8408,9.05294 -3.51813,14.25651 -8.14833,14.16202 -3.77977,-0.75596 -0.13245,-10.86933 0.26722,-16.16497 0.26644,-3.06413 0.69941,-12.98928 0.29974,-18.85112 -0.39966,-5.86184 -0.93256,-6.66118 -2.66446,-6.52795 -1.73191,0.13322 -2.93093,0.93257 -4.39638,9.05919 -1.46546,8.12664 -3.33058,15.72038 -3.06414,18.91774 0.26644,3.19737 -4.36307,0.64443 -2.89762,-5.48385 1.46546,-6.12827 4.82299,-19.49577 4.95621,-21.36089 0.13322,-1.86512 -0.52548,-5.99423 -3.45641,-1.46464 -2.93091,4.52961 -8.39307,31.77464 -8.39307,31.77464 0,0 -4.61911,1.35544 4.75249,-29.62183 0.37058,-1.22492 -1.2231,-1.82036 -2.02245,-0.35491 -0.79933,1.46547 -2.93556,6.41177 -3.60169,9.47592 -0.66612,3.06413 -4.12526,18.76747 -5.99039,20.76582 -1.86514,1.99836 -0.77914,-1.64516 2.43172,-19.62594 -3.46015,-8.7099 -7.6029,16.6051 -8.29355,25.75422 -1.73191,11.05755 2.66446,14.65459 2.53124,22.78122 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + d="m 326.28601,276.79194 4.85752,2.59518 c 0,0 5.99506,0.26645 7.86018,1.19902 1.86513,0.93256 14.52136,-19.31742 14.52136,-19.31742 0,0 -1.59867,-0.39967 -3.19735,-5.32893 -1.59868,-4.92926 -7.59374,-19.98353 -9.45888,-23.44734 -1.86513,-3.46381 -2.53124,-4.66283 -3.4638,-7.46051 -0.93257,-2.7977 -2.13159,-5.0625 -3.73027,-0.13323 -1.59868,4.92927 -1.66343,10.45537 -0.46441,13.91919 1.38613,5.18454 3.8952,15.07683 1.97631,17.7369 -3.13067,-0.0635 -4.1718,-8.94257 -4.84078,-11.98701 l -10.45574,-8.48036 -1.15458,18.13553 c 0,0 3.30736,-4.0697 9.65298,-5.19422 4.51067,-0.79933 2.81751,6.4678 1.21188,14.09965 -1.34794,6.40707 -3.31442,13.66355 -3.31442,13.66355 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + d="m 291.74698,236.36722 c 0,0 -1.36535,-0.56172 -0.0701,-3.22296 1.29528,-2.66125 3.72103,-1.62503 4.12138,-1.41306 -1.04349,0.50764 -3.37926,4.82292 -4.05132,4.63602 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + d="m 278.60514,277.01718 c 0,0 -0.98806,-8.05217 1.36702,-17.09567 5.11868,-12.29479 -7.76345,3.61446 -1.36702,17.09567 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="ccc" /> + d="m 283.64252,261.72126 c 0,-0.0431 -1.44898,3.96362 -0.80247,9.53246 0.42679,3.67631 0.64575,8.36037 1.90705,11.72782 3.10143,7.14376 -8.41694,-7.43352 -1.10458,-21.26028 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.11350404px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="cscc" /> + d="m 318.12446,294.21149 c 0,0 6.68844,-4.71017 9.13772,-13.37686 -5.91279,4.63412 -6.77642,9.57974 -9.13772,13.37686 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="ccc" /> + d="m 344.21877,231.00112 c 0,0 1.60041,9.36884 7.07841,21.7522 5.35526,12.10587 4.05178,-4.80879 -7.07841,-21.7522 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="csc" /> + d="m 349.44951,230.90023 c -0.11119,-0.0477 0.96041,8.99393 4.75948,15.37263 1.48524,4.17497 3.73499,-6.08181 -4.75948,-15.37263 z" + style="fill:#ffffff;stroke:#000000;stroke-width:0.09325644px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + sodipodi:nodetypes="ccc" /> diff --git a/unpublishedScripts/marketplace/clap/clapApp.js b/unpublishedScripts/marketplace/clap/clapApp.js index a32937d6dd..294a7171b3 100644 --- a/unpublishedScripts/marketplace/clap/clapApp.js +++ b/unpublishedScripts/marketplace/clap/clapApp.js @@ -15,12 +15,12 @@ // Load up engine var APP_NAME = "CLAP"; -var ClapEngine = Script.require(Script.resolvePath("scripts/ClapEngine.js?v6")); +var ClapEngine = Script.require(Script.resolvePath("scripts/ClapEngine.js?v9")); var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); // Define Menu -var blackIcon = Script.resolvePath("icons/tablet-icons/clap-a.svg"); -var whiteIcon =Script.resolvePath("icons/tablet-icons/clap-i.svg"); +var blackIcon = Script.resolvePath("http://mpassets.highfidelity.com/797180be-1d5d-4465-816e-fada92aa727a-v1/icons/clap-a.svg?foxv2"); +var whiteIcon = Script.resolvePath("http://mpassets.highfidelity.com/797180be-1d5d-4465-816e-fada92aa727a-v1/icons/clap-i.svg?foxv2"); var isActive = true; var activeButton = tablet.addButton({ diff --git a/unpublishedScripts/marketplace/clap/icons/clap-a.svg b/unpublishedScripts/marketplace/clap/icons/clap-a.svg new file mode 100644 index 0000000000..60df3e0795 --- /dev/null +++ b/unpublishedScripts/marketplace/clap/icons/clap-a.svg @@ -0,0 +1,112 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/unpublishedScripts/marketplace/clap/icons/clap-black-icon.svg b/unpublishedScripts/marketplace/clap/icons/clap-black-icon.svg deleted file mode 100644 index 10a8e3ea98..0000000000 --- a/unpublishedScripts/marketplace/clap/icons/clap-black-icon.svg +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/unpublishedScripts/marketplace/clap/icons/clap-i.svg b/unpublishedScripts/marketplace/clap/icons/clap-i.svg new file mode 100644 index 0000000000..fbd9ed0f9c --- /dev/null +++ b/unpublishedScripts/marketplace/clap/icons/clap-i.svg @@ -0,0 +1,112 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/unpublishedScripts/marketplace/clap/icons/clap-white-icon.svg b/unpublishedScripts/marketplace/clap/icons/clap-white-icon.svg deleted file mode 100644 index 3e4ecb0b64..0000000000 --- a/unpublishedScripts/marketplace/clap/icons/clap-white-icon.svg +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/unpublishedScripts/marketplace/clap/scripts/ClapDebugger.js b/unpublishedScripts/marketplace/clap/scripts/ClapDebugger.js index 247664c157..04a3ebc4af 100644 --- a/unpublishedScripts/marketplace/clap/scripts/ClapDebugger.js +++ b/unpublishedScripts/marketplace/clap/scripts/ClapDebugger.js @@ -42,7 +42,6 @@ module.exports = { Overlays.deleteOverlay(DEBUG_LEFT_HAND); Overlays.deleteOverlay(DEBUG_CLAP_LEFT); Overlays.deleteOverlay(DEBUG_CLAP_RIGHT); - Overlays.deleteOverlay(DEBUG_CLAP); Overlays.deleteOverlay(DEBUG_CLAP_DIRECTION); }, @@ -141,15 +140,6 @@ module.exports = { } }); - DEBUG_CLAP = Overlays.addOverlay("sphere", { - position: MyAvatar.position, - color: DEBUG_VOLUME, - scale: { - x: 0.05, - y: 0.05, - z: 0.05 - } - }); DEBUG_CLAP_DIRECTION = Overlays.addOverlay("line3d", { color: DEBUG_VOLUME, diff --git a/unpublishedScripts/marketplace/clap/scripts/ClapEngine.js b/unpublishedScripts/marketplace/clap/scripts/ClapEngine.js index f36aa9716b..96dd05713e 100644 --- a/unpublishedScripts/marketplace/clap/scripts/ClapEngine.js +++ b/unpublishedScripts/marketplace/clap/scripts/ClapEngine.js @@ -17,12 +17,12 @@ var DEG_TO_RAD = Math.PI / 180; // If angle is closer to 0 from 25 degrees, then "clap" can happen; var COS_OF_TOLERANCE = Math.cos(25 * DEG_TO_RAD); - +var DISTANCE = 0.3; var CONTROL_MAP_PACKAGE = "com.highfidelity.avatar.clap.active"; var CLAP_MENU = "Clap"; var ENABLE_PARTICLE_MENU = "Enable Clap Particles"; -var ENABLE_DEBUG_MENU = "Enable Clap Debug"; +var ENABLE_DEBUG_MENU = "Enable Claping Helper"; var sounds = [ "clap1.wav", @@ -34,9 +34,9 @@ var sounds = [ ]; -var ClapParticle = Script.require(Script.resolvePath("../entities/ClapParticle.json?V2")); -var ClapAnimation = Script.require(Script.resolvePath("../animations/ClapAnimation.json?V2")); -var ClapDebugger = Script.require(Script.resolvePath("ClapDebugger.js?V2")); +var ClapParticle = Script.require(Script.resolvePath("../entities/ClapParticle.json?V3")); +var ClapAnimation = Script.require(Script.resolvePath("../animations/ClapAnimation.json?V3")); +var ClapDebugger = Script.require(Script.resolvePath("ClapDebugger.js?V3")); var settingDebug = false; var settingParticlesOn = true; @@ -190,7 +190,7 @@ function update(dt) { var angularVelocity = Vec3.length(Vec3.subtract(leftHand.angularVelocity, rightHand.angularVelocity)); var velocity = Vec3.length(Vec3.subtract(leftHand.velocity, rightHand.velocity)); - if (matchTolerance && distance < 0.3 && !animClap) { + if (matchTolerance && distance < DISTANCE && !animClap) { if (settingDebug) { ClapDebugger.debugClapLine(leftHandPositionOffset, rightHandPositionOffset, true); } @@ -202,7 +202,7 @@ function update(dt) { Script.clearTimeout(animThrottle); animThrottle = false; } - } else if (animClap && distance > 0.3) { + } else if (animClap && distance > DISTANCE) { if (settingDebug) { ClapDebugger.debugClapLine(leftHandPositionOffset, rightHandPositionOffset, false); } @@ -213,14 +213,14 @@ function update(dt) { }, 500); } - if (distance < 0.22 && matchTolerance && !clapOn) { + if (distance < DISTANCE && matchTolerance && !clapOn) { clapOn = true; var midClap = Vec3.mix(rightHandPositionOffset, leftHandPositionOffset, 0.5); var volume = velocity / 2 + angularVelocity / 5; clap(volume, midClap, Quat.lookAtSimple(rightHandPositionOffset, leftHandPositionOffset)); - } else if (distance > 0.22 && !matchTolerance) { + } else if (distance > DISTANCE && !matchTolerance) { clapOn = false; } } @@ -240,13 +240,20 @@ module.exports = { isChecked: settingParticlesOn }); } - if (!Menu.menuItemExists(CLAP_MENU, ENABLE_DEBUG_MENU)) { - Menu.addMenuItem({ - menuName: CLAP_MENU, - menuItemName: ENABLE_DEBUG_MENU, - isCheckable: true, - isChecked: settingDebug - }); + if (HMD.active) { + if (!Menu.menuItemExists(CLAP_MENU, ENABLE_DEBUG_MENU)) { + Menu.addMenuItem({ + menuName: CLAP_MENU, + menuItemName: ENABLE_DEBUG_MENU, + isCheckable: true, + isChecked: settingDebug + }); + } + } else { + ClapDebugger.disableDebug(); + if (Menu.menuItemExists(CLAP_MENU, ENABLE_DEBUG_MENU)) { + Menu.removeMenuItem(CLAP_MENU, ENABLE_DEBUG_MENU); + } } @@ -312,7 +319,7 @@ module.exports = { try { Script.update.disconnect(update); } catch (e) { - print("Script.update connection did not exist on disconnection. Skipping") + print("Script.update connection did not exist on disconnection. Skipping"); } } };