From 4b8176ed7716bf478261955e6904c90cca1d3479 Mon Sep 17 00:00:00 2001 From: Ada Date: Fri, 3 Jan 2025 22:24:24 +0100 Subject: [PATCH] Add Blendshape Buddy app. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Julian Groß --- applications/flex/blendshape_buddy.html | 93 +++++++++++++++++++++++++ applications/flex/blendshape_buddy.js | 49 +++++++++++++ applications/flex/flex-a.svg | 73 +++++++++++++++++++ applications/flex/flex-i.svg | 73 +++++++++++++++++++ applications/metadata.js | 9 +++ 5 files changed, 297 insertions(+) create mode 100644 applications/flex/blendshape_buddy.html create mode 100644 applications/flex/blendshape_buddy.js create mode 100644 applications/flex/flex-a.svg create mode 100644 applications/flex/flex-i.svg diff --git a/applications/flex/blendshape_buddy.html b/applications/flex/blendshape_buddy.html new file mode 100644 index 0000000..e125442 --- /dev/null +++ b/applications/flex/blendshape_buddy.html @@ -0,0 +1,93 @@ + + + + + Blendshape Buddy + + + + + +

Blendshape Buddy

+
+
+ + +
+ +
+ + + +

Presets

+
+
+ + + + + + + + + + + + + + + +
+
+ + + + diff --git a/applications/flex/blendshape_buddy.js b/applications/flex/blendshape_buddy.js new file mode 100644 index 0000000..cd42a67 --- /dev/null +++ b/applications/flex/blendshape_buddy.js @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: CC0-1.0 +// Blendshape Buddy, written by Ada 2025 +(() => { + "use strict"; + + const AppUi = Script.require("appUi"); + let tablet; + let ui; + + function A_Init() { + tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + ui = new AppUi({ + buttonName: "FLEX", + home: Script.resolvePath("blendshape_buddy.html"), + graphicsDirectory: Script.resolvePath("./"), + }); + + MyAvatar.hasScriptedBlendshapes = true; + } + + function A_UIEvent(event) { + event = JSON.parse(event); + + switch (event.flex) { + case "Smile": + MyAvatar.setBlendshape("MouthSmile_L", event.value); + MyAvatar.setBlendshape("MouthSmile_R", event.value); + break; + + case "Frown": + MyAvatar.setBlendshape("MouthFrown_L", event.value); + MyAvatar.setBlendshape("MouthFrown_R", event.value); + break; + + case "Blink": + MyAvatar.setBlendshape("EyeBlink_L", event.value); + MyAvatar.setBlendshape("EyeBlink_R", event.value); + MyAvatar.hasProceduralBlinkFaceMovement = !(event.value > 0.01); + break; + + default: + MyAvatar.setBlendshape(event.flex, event.value); + break; + } + } + + A_Init(); + tablet.webEventReceived.connect(A_UIEvent); +})(); diff --git a/applications/flex/flex-a.svg b/applications/flex/flex-a.svg new file mode 100644 index 0000000..0c2a070 --- /dev/null +++ b/applications/flex/flex-a.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/flex/flex-i.svg b/applications/flex/flex-i.svg new file mode 100644 index 0000000..91546e4 --- /dev/null +++ b/applications/flex/flex-i.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/metadata.js b/applications/metadata.js index feb807b..440211e 100644 --- a/applications/metadata.js +++ b/applications/metadata.js @@ -341,6 +341,15 @@ var metadata = { "applications": "jsfile": "voting/vote.js", "icon": "voting/img/icon_white.png", "caption": "VOTE" + }, + { + "isActive": true, + "directory": "flex", + "name": "Blendshape Buddy", + "description": "Control your blendshapes.", + "jsfile": "flex/blendshape_buddy.js", + "icon": "flex/flex-i.svg", + "caption": "FLEX" } ] }; \ No newline at end of file