From c70f3844e10ba06eb1609bd50f5807a58f321212 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sun, 12 May 2024 21:42:24 -0400 Subject: [PATCH] This adds the application hmd3rdPerson This adds the application hmd3rdPerson --- applications/hmd3rdPerson/app-hmd3rdPerson.js | 112 ++++++++++++++++++ applications/hmd3rdPerson/icon_active.png | Bin 0 -> 1379 bytes .../hmd3rdPerson/icon_inactive_green.png | Bin 0 -> 1396 bytes .../hmd3rdPerson/icon_inactive_white.png | Bin 0 -> 1392 bytes applications/metadata.js | 9 ++ 5 files changed, 121 insertions(+) create mode 100644 applications/hmd3rdPerson/app-hmd3rdPerson.js create mode 100644 applications/hmd3rdPerson/icon_active.png create mode 100644 applications/hmd3rdPerson/icon_inactive_green.png create mode 100644 applications/hmd3rdPerson/icon_inactive_white.png diff --git a/applications/hmd3rdPerson/app-hmd3rdPerson.js b/applications/hmd3rdPerson/app-hmd3rdPerson.js new file mode 100644 index 0000000..3cceabb --- /dev/null +++ b/applications/hmd3rdPerson/app-hmd3rdPerson.js @@ -0,0 +1,112 @@ +// +// app-hmd3rdPerson.js +// +// Created by Alezia Kurdis, May 8th 2024. +// Copyright 2024 Overte e.V. +// +// This application add a button to switch to 3rd Person View in HDM (witout reseting the camera distance) +// +// 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 jsMainFileName = "app-hmd3rdPerson.js"; + var ROOT = Script.resolvePath('').split(jsMainFileName)[0]; + + var APP_ICON_INACTIVE = ROOT + "icon_inactive_white.png"; + var ICON_CAPTION_COLOR = "#FFFFFF"; + if (ROOT.substr(0, 4) !== "http") { + APP_ICON_INACTIVE = ROOT + "icon_inactive_green.png"; + ICON_CAPTION_COLOR = "#00FF00"; + } + var APP_ICON_ACTIVE = ROOT + "icon_active.png"; + var APP_SORT_ORDER = 4; + var APP_NAME = "3rd PERS"; + var appStatus = false; + + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + + var button = null; + + function clicked(){ + if (HMD.active) { + var colorCaption; + if (appStatus === true) { + setFirstPersonView(); + colorCaption = ICON_CAPTION_COLOR; + appStatus = false; + }else{ + setThirdPersonView(); + colorCaption = "#000000"; + appStatus = true; + } + + button.editProperties({ + "isActive": appStatus, + "captionColor": colorCaption + }); + } else { + Window.displayAnnouncement("This is only effective in HMD."); + } + } + + function displayChange(isHMDMode) { + print("Display mode changed"); + print("isHMD = " + isHMDMode); + print("HMD.active = " + HMD.active); + print("HMD.mounted = " + HMD.mounted); + if (isHMDMode) { + if (button === null) { + button = tablet.addButton({ + "text": APP_NAME, + "icon": APP_ICON_INACTIVE, + "activeIcon": APP_ICON_ACTIVE, + "captionColor": ICON_CAPTION_COLOR, + "sortOrder": APP_SORT_ORDER + }); + button.clicked.connect(clicked); + } + } else { + if (button !== null) { + button.clicked.disconnect(clicked); + tablet.removeButton(button); + button = null; + } + } + } + + function setFirstPersonView() { + Camera.mode = "first person look at"; + } + + function setThirdPersonView() { + Camera.mode = "third person"; + } + + HMD.displayModeChanged.connect(displayChange); + + function cleanup() { + if (appStatus) { + setFirstPersonView(); + } + if (HMD.active) { + button.clicked.disconnect(clicked); + tablet.removeButton(button); + button = null; + } + HMD.displayModeChanged.disconnect(displayChange); + } + + Script.scriptEnding.connect(cleanup); + + if (HMD.active) { + button = tablet.addButton({ + "text": APP_NAME, + "icon": APP_ICON_INACTIVE, + "activeIcon": APP_ICON_ACTIVE, + "captionColor": ICON_CAPTION_COLOR, + "sortOrder": APP_SORT_ORDER + }); + button.clicked.connect(clicked); + } +}()); diff --git a/applications/hmd3rdPerson/icon_active.png b/applications/hmd3rdPerson/icon_active.png new file mode 100644 index 0000000000000000000000000000000000000000..7c8f21d932b2de72b37d8deebe2c39f32ace96a0 GIT binary patch literal 1379 zcmV-p1)TbcP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ=*-1n}RCwBA{Qv(y!*Boq0mQ^GOaMRtu^@9885xy; zloFEAJt#&7#y~8H#6Jtf@1gpX(A2(%%Hz|IZVxtj1}yf$0Vq`g1Q3{jVIU|6i6h~1 zEC%gHQ{w^^N7oC($c_@kp{5*<`PlFoBzwVb2M8c~B&|>!Y)XJJ)Wc~o0e}Fal}GLo z;gNepn&k>g^*}5H#1&|A9k3V&2p|>$hNK}!AyQ}%FNmd%fi+)d0nOM0Ej(})<9Go;0I`r*x$S|LQn1FPF_sFB*yabQROK%mZn(_5ch61Q0c9c0u$~3e-uWckv4lK*MHS3m|}o&15J*0I?t? zk#Z~*UMI9K4I3E17`}vdS7%~re(XW(%Xc6p!A|7l2W>5sL(O;(>%&9kV0OdJLlT3V z0}w#S8F)9L(G5HUYySzzV;jsXConoQ6H7&`geC^>E&~J*6PB7Dly5+DcIi-|a zMkMTtL$5Mg*B9j2dr&!7G;?<&#S%>KJ?MZ0dI~v%D`^1)5DS)4s2t4^$n7X}!_kw- ze;jimpuUPRQ2rg1jogP8FaXRC0fJ}NsKo#P002ovPDHLkV1i899U1@t literal 0 HcmV?d00001 diff --git a/applications/hmd3rdPerson/icon_inactive_green.png b/applications/hmd3rdPerson/icon_inactive_green.png new file mode 100644 index 0000000000000000000000000000000000000000..d0df85f631fc1a0946b9f281e001fa9ac73350eb GIT binary patch literal 1396 zcmV-)1&jKLP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ=>PbXFRCwBA{Qv(y!*Boq0mQ^GOaMRtu^@9885os- zloFEAz5fjV@1dzN22z4ZLT7<$-eb`V0`GxxX9?&>u?L4d1G;_af&c-;07_ag%Q^uo}tJp;+Wx$TasXnt9+D0SF)# zB0}~amKYHv!opdgsHcHPumXSpBIJ=-z$ooRD?WD<;|OSxyc+5W@2M+P~&=L(?IRXR_ zP3sY;C9Bbr>U%20GN>3Ps1Tzfn56o3xIn#%6>sCbqu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l>n~SdzyaKxN>~l$9G+>Tu#r56YZ)nRpAGDfNn)JONX!5-Q_e+1o^QPp zo?5eKM!3J~KMbG477yFHbB1axR4ZOCHaId<&dH8>k?G1|$!5xu*`JOp{7QSH#9I@+ zbz&_SDUfiCab#si~klWqL zFMq@0=6HLu5XkrLTMGW1Tf!|3*kD zdSvFs`>YY|4@AGQVB1o^$CJ-v8)(xc3~CGfs!zvkb6L&V8%9PUc!>2rphd{OLee-a z8BrH?)EteYr?0V78vGKCXJSp0G={B@dwHduR#Mhm4waHR3MjCq_EXmTv`Mc=>VRYAK zq5YZ1w|IbKC-z?fBz`ujT5cXP%{Uv3>Gl z&hO@fHF4MTmnIJ_(M3kbZR8dc>oJfpCG;`Ep4g7_=xzN?CC8jES9L!h4shaSeoT%)HNvFz);N1hQ>f~t_6Zf!g2#QMDi(?*}rK`uwo zV!}<>U^gI)XR3J7gBIncS>fb_^g`U$<d^;gyOK$I81%?!$kr#F{ytuvWv<#x zwacS(9{M?M8pB;q(*vDl2E_H2X=atCH+Abw#p{XRl0}qC=~$Bb?$|t~_(@-wcMX9u s!2(>b$NtLgIQ&Rk^8*|bKYj|&>;}^fJNc}Fg(3g|!OkH5C2w)||C*IBKL7v# literal 0 HcmV?d00001 diff --git a/applications/metadata.js b/applications/metadata.js index e26114e..6507bad 100644 --- a/applications/metadata.js +++ b/applications/metadata.js @@ -332,6 +332,15 @@ var metadata = { "applications": "jsfile": "domainMapper/app-domainMapper.js", "icon": "domainMapper/icon_inactive_white.png", "caption": "DOMAP" + }, + { + "isActive": true, + "directory": "hmd3rdPerson", + "name": "HMD 3rd Person View", + "description": "This application adds a button on your tablet to toggle rapidly between 1st and 3rd person view in HMD. It also prevents the distance of the 3rd person camera to be reset as the 'View' menu does. This application is only visible in HMD. It can be useful for people who want to capture their avatar performance in HMD while they are in movement.", + "jsfile": "hmd3rdPerson/app-hmd3rdPerson.js", + "icon": "hmd3rdPerson/icon_inactive_white.png", + "caption": "3rd PERS" } ] }; \ No newline at end of file