mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
Add JSON file loading support.
This commit is contained in:
parent
3ebdc59071
commit
4b7f92f1d1
2 changed files with 34 additions and 2 deletions
|
@ -163,7 +163,7 @@ function sendNearbyUsers() {
|
||||||
|
|
||||||
function useItem(item) {
|
function useItem(item) {
|
||||||
|
|
||||||
//TODO: Add animation support for avatars, add JSON loading...?
|
//TODO: Add animation support for avatars...?
|
||||||
|
|
||||||
// Convert the item.type before checking it...
|
// Convert the item.type before checking it...
|
||||||
item.type = item.type.toUpperCase();
|
item.type = item.type.toUpperCase();
|
||||||
|
@ -191,6 +191,21 @@ function useItem(item) {
|
||||||
location.handleLookupString(item.url, true); // https://apidocs.vircadia.dev/location.html#.handleLookupString
|
location.handleLookupString(item.url, true); // https://apidocs.vircadia.dev/location.html#.handleLookupString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.type == "JSON") {
|
||||||
|
// https://apidocs.vircadia.dev/Clipboard.html#.importEntities
|
||||||
|
var jsonToLoad = item.url;
|
||||||
|
if (jsonToLoad) {
|
||||||
|
if (Clipboard.importEntities(jsonToLoad)) {
|
||||||
|
Clipboard.pasteEntities(
|
||||||
|
Vec3.sum(
|
||||||
|
MyAvatar.position,
|
||||||
|
Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item.type == "UNKNOWN") {
|
if (item.type == "UNKNOWN") {
|
||||||
// We don't know how to handle this yet.
|
// We don't know how to handle this yet.
|
||||||
Window.alert("Unknown item type, unable to use.");
|
Window.alert("Unknown item type, unable to use.");
|
||||||
|
|
|
@ -25,7 +25,7 @@ getIcon<!--
|
||||||
|
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
|
|
||||||
<v-btn color="primary" fab @click="sortInventory('top')">
|
<v-btn medium color="primary" fab @click="sortInventory('top')">
|
||||||
<v-icon>
|
<v-icon>
|
||||||
mdi-ab-testing
|
mdi-ab-testing
|
||||||
</v-icon>
|
</v-icon>
|
||||||
|
@ -868,6 +868,12 @@ export default {
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"name": "TEST",
|
"name": "TEST",
|
||||||
"url": "https://gooadfdagle.com/vr.js",
|
"url": "https://gooadfdagle.com/vr.js",
|
||||||
|
"uuid": "542rfwat4t5fsddf4354353",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "json",
|
||||||
|
"name": "TESTJSON",
|
||||||
|
"url": "https://gooadfdagle.com/vr.json",
|
||||||
"uuid": "542rfwat4t54354353",
|
"uuid": "542rfwat4t54354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -918,6 +924,10 @@ export default {
|
||||||
"icon": "mdi-earth",
|
"icon": "mdi-earth",
|
||||||
"color": "#0097A7", // cyan darken-2
|
"color": "#0097A7", // cyan darken-2
|
||||||
},
|
},
|
||||||
|
"json": {
|
||||||
|
"icon": "mdi-inbox-multiple",
|
||||||
|
"color": "#37474F", // blue-grey darken-3
|
||||||
|
},
|
||||||
"unknown": {
|
"unknown": {
|
||||||
"icon": "mdi-help",
|
"icon": "mdi-help",
|
||||||
"color": "grey",
|
"color": "grey",
|
||||||
|
@ -1074,6 +1084,10 @@ export default {
|
||||||
case ".fst":
|
case ".fst":
|
||||||
detectedItemType = "avatar";
|
detectedItemType = "avatar";
|
||||||
break;
|
break;
|
||||||
|
// JSON Cases
|
||||||
|
case ".json":
|
||||||
|
detectedItemType = "json";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detectedItemType == null) {
|
if (detectedItemType == null) {
|
||||||
|
@ -1099,6 +1113,9 @@ export default {
|
||||||
case "serverless":
|
case "serverless":
|
||||||
detectedItemType = "serverless";
|
detectedItemType = "serverless";
|
||||||
break;
|
break;
|
||||||
|
case "json":
|
||||||
|
detectedItemType = "json";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detectedItemType == null) {
|
if (detectedItemType == null) {
|
||||||
|
|
Loading…
Reference in a new issue