mirror of
https://github.com/overte-org/community-apps.git
synced 2025-04-05 21:22:00 +02:00
Merge pull request #18 from kasenvr/feature/add-refresh-app
Feature/add refresh app
This commit is contained in:
commit
190b251fcf
11 changed files with 80 additions and 10 deletions
|
@ -61,6 +61,15 @@ var metadata = { "applications": [
|
|||
"jsfile": "radar/radar.js",
|
||||
"icon": "radar/assets/radar-i.svg",
|
||||
"caption": "RADAR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"isActive": true,
|
||||
"directory": "refresh-app",
|
||||
"name": "Refresh App",
|
||||
"description": "Add two buttons that refresh your avatar and attachments.",
|
||||
"jsfile": "refresh-app/refreshApp.js",
|
||||
"icon": "refresh-app/refresh-circle-w.png",
|
||||
"caption": "REFRESH"
|
||||
}
|
||||
]
|
||||
};
|
BIN
applications/refresh-app/refresh-circle-w.png
Normal file
BIN
applications/refresh-app/refresh-circle-w.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
61
applications/refresh-app/refreshApp.js
Normal file
61
applications/refresh-app/refreshApp.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* globals Vec3, Quat, Uuid, Camera, MyAvatar, Entities, Overlays, Script, Tablet, AvatarList, AvatarManager, Picks, PickType require ScriptDiscoveryService */
|
||||
//
|
||||
// refreshApp.js
|
||||
//
|
||||
// Created by KasenVR on 30 May 2020.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var APP_NAME = "Refresh App";
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
||||
var accountConvertIcon = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="white" d="M12 0L11.34 .03L15.15 3.84L16.5 2.5C19.75 4.07 22.09 7.24 22.45 11H23.95C23.44 4.84 18.29 0 12 0M12 4C10.07 4 8.5 5.57 8.5 7.5C8.5 9.43 10.07 11 12 11C13.93 11 15.5 9.43 15.5 7.5C15.5 5.57 13.93 4 12 4M.05 13C.56 19.16 5.71 24 12 24L12.66 23.97L8.85 20.16L7.5 21.5C4.25 19.94 1.91 16.76 1.55 13H.05M12 13C8.13 13 5 14.57 5 16.5V18H19V16.5C19 14.57 15.87 13 12 13Z" /></svg>';
|
||||
|
||||
var refreshIcon = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="white" d="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z" /></svg>';
|
||||
|
||||
var refreshAvatarButton = tablet.addButton({
|
||||
text: "RAvatar",
|
||||
icon: accountConvertIcon
|
||||
});
|
||||
|
||||
var refreshAttachmentsButton = tablet.addButton({
|
||||
text: "RAttach",
|
||||
icon: refreshIcon
|
||||
});
|
||||
|
||||
Script.scriptEnding.connect(function(){
|
||||
tablet.removeButton(refreshAvatarButton);
|
||||
tablet.removeButton(refreshAttachmentsButton);
|
||||
refreshAvatarButton = null;
|
||||
refreshAttachmentsButton = null;
|
||||
});
|
||||
|
||||
function refreshAvatar() {
|
||||
var modelURL = MyAvatar.getFullAvatarURLFromPreferences();
|
||||
modelURL = modelURL.split("?")[0] + "?" + new Date().getTime();
|
||||
MyAvatar.useFullAvatarURL(modelURL);
|
||||
console.log('Avatar refreshed: ' + modelURL);
|
||||
}
|
||||
|
||||
refreshAvatarButton.clicked.connect(refreshAvatar);
|
||||
|
||||
function refreshAttachments() {
|
||||
var data = MyAvatar.getAvatarEntityData(); // everything, including boxes which have no modelURL
|
||||
var attachmentAmount = 0;
|
||||
|
||||
for (var id in data) {
|
||||
var attachment = data[id];
|
||||
if (attachment.type.toString() === 'Model') {
|
||||
attachment.modelURL = attachment.modelURL.toString().split('?')[0] + '?' + Date.now();
|
||||
attachmentAmount++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(attachmentAmount + " attachments refreshed.");
|
||||
MyAvatar.setAvatarEntityData(data);
|
||||
}
|
||||
|
||||
refreshAttachmentsButton.clicked.connect(refreshAttachments);
|
|
@ -2,7 +2,7 @@
|
|||
// index.html
|
||||
//
|
||||
// Created by Keb Helion, February 2020.
|
||||
// Copyright 2020 Project Athena and contributors.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
// VERSION 1.0
|
||||
//
|
||||
// Created by Keb Helion, February 2020.
|
||||
// Copyright 2020 Project Athena and contributors.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
//
|
||||
// This script adds a "More Apps" selector to "Project Athena" to allow the user to add optional functionalities to the tablet.
|
||||
// This script adds a "More Apps" selector to Vircadia to allow the user to add optional functionalities to the tablet.
|
||||
// This application has been designed to work directly from the Github repository.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
styles.css
|
||||
|
||||
Created by Kalila L. on 23 Feb 2020.
|
||||
Copyright 2020 Project Athena and contributors.
|
||||
Copyright 2020 Vircadia contributors.
|
||||
|
||||
Distributed under the Apache License, Version 2.0.
|
||||
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// more.html
|
||||
//
|
||||
// Created by Keb Helion, February 2020.
|
||||
// Copyright 2020 Project Athena and contributors.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
//
|
||||
// App maintained in: https://github.com/kasenvr/community-apps
|
||||
// App copied to: https://github.com/kasenvr/project-athena
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
metadata_gen.css
|
||||
|
||||
Created by Kalila L. on 23 Feb 2020.
|
||||
Copyright 2020 Project Athena and contributors.
|
||||
Copyright 2020 Vircadia contributors.
|
||||
|
||||
Distributed under the Apache License, Version 2.0.
|
||||
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
styles.css
|
||||
|
||||
Created by Kalila L. on 23 Feb 2020.
|
||||
Copyright 2020 Project Athena and contributors.
|
||||
Copyright 2020 Vircadia contributors.
|
||||
|
||||
Distributed under the Apache License, Version 2.0.
|
||||
See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// index.html
|
||||
//
|
||||
// Created by Keb Helion, February 2020.
|
||||
// Copyright 2020 Project Athena and contributors.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// metadata_js_generator.html
|
||||
//
|
||||
// Created by Keb Helion, February 2020.
|
||||
// Copyright 2020 Project Athena and contributors.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
Loading…
Reference in a new issue