mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 22:36:57 +02:00
only have one instance of photobooth at a time
This commit is contained in:
parent
27b619030d
commit
0e8d008b8c
1 changed files with 13 additions and 8 deletions
|
@ -14,15 +14,21 @@
|
||||||
var PHOTOBOOTH_WINDOW_HTML_URL = Script.resolvePath("./html/photobooth.html");
|
var PHOTOBOOTH_WINDOW_HTML_URL = Script.resolvePath("./html/photobooth.html");
|
||||||
var PHOTOBOOTH_SETUP_JSON_URL = Script.resolvePath("./photoboothSetup.json");
|
var PHOTOBOOTH_SETUP_JSON_URL = Script.resolvePath("./photoboothSetup.json");
|
||||||
var MODEL_BOUNDING_BOX_DIMENSIONS = {x: 1.0174,y: 1.1925,z: 1.0165};
|
var MODEL_BOUNDING_BOX_DIMENSIONS = {x: 1.0174,y: 1.1925,z: 1.0165};
|
||||||
|
var PhotoBooth = {};
|
||||||
|
var photoboothCreated = false;
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var button = tablet.addButton({
|
var button = tablet.addButton({
|
||||||
icon: "icons/tablet-icons/snap-i.svg",
|
icon: "icons/tablet-icons/snap-i.svg",
|
||||||
text: "PHOTOBOOTH"
|
text: "TOP MODEL"
|
||||||
});
|
});
|
||||||
|
|
||||||
function onClicked() {
|
function onClicked() {
|
||||||
tablet.gotoWebScreen(PHOTOBOOTH_WINDOW_HTML_URL);
|
tablet.gotoWebScreen(PHOTOBOOTH_WINDOW_HTML_URL);
|
||||||
PhotoBooth.init();
|
// Initialise the photobooth if it wasn't created already
|
||||||
|
if (!photoboothCreated) {
|
||||||
|
PhotoBooth.init();
|
||||||
|
photoboothCreated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
tablet.webEventReceived.connect(onWebEventReceived);
|
tablet.webEventReceived.connect(onWebEventReceived);
|
||||||
|
@ -38,24 +44,23 @@
|
||||||
print("clicked picture button");
|
print("clicked picture button");
|
||||||
// // hide HUD tool bar
|
// // hide HUD tool bar
|
||||||
// toolbar.writeProperty("visible", false);
|
// toolbar.writeProperty("visible", false);
|
||||||
// hide tablet
|
|
||||||
HMD.closeTablet();
|
|
||||||
// hide Overlays (such as Running Scripts or other Dialog UI)
|
// hide Overlays (such as Running Scripts or other Dialog UI)
|
||||||
Menu.setIsOptionChecked("Overlays", false);
|
Menu.setIsOptionChecked("Overlays", false);
|
||||||
// hide mouse cursor
|
// hide mouse cursor
|
||||||
Reticle.visible = false;
|
Reticle.visible = false;
|
||||||
|
// hide tablet
|
||||||
|
HMD.closeTablet();
|
||||||
// // giving a delay here before snapshotting so that there is time to hide other UIs
|
// // giving a delay here before snapshotting so that there is time to hide other UIs
|
||||||
// void WindowScriptingInterface::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio)
|
// void WindowScriptingInterface::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio)
|
||||||
Script.setTimeout(function () {
|
Script.setTimeout(function () {
|
||||||
Window.takeSnapshot(false, false, 1.91);
|
Window.takeSnapshot(false, false, 1.91);
|
||||||
// show hidden items after snapshot is taken
|
// show hidden items after snapshot is taken
|
||||||
// issue: currently there's no way to show tablet via a script command. user will have to manually open tablet again
|
// issue: currently there's no way to show tablet via a script command. user will have to manually open tablet again
|
||||||
// toolbar.writeProperty("visible", true);
|
|
||||||
Menu.setIsOptionChecked("Overlays", true);
|
|
||||||
// issue: somehow we don't need to reset cursor to visible in script and the mouse still returns after snapshot
|
// issue: somehow we don't need to reset cursor to visible in script and the mouse still returns after snapshot
|
||||||
// Reticle.visible = true;
|
// Reticle.visible = true;
|
||||||
|
// toolbar.writeProperty("visible", true);
|
||||||
|
Menu.setIsOptionChecked("Overlays", true);
|
||||||
}, SNAPSHOT_DELAY);
|
}, SNAPSHOT_DELAY);
|
||||||
|
|
||||||
} else if (event.type === "onClickReloadModelButton") {
|
} else if (event.type === "onClickReloadModelButton") {
|
||||||
print("clicked reload model button " + event.data.value);
|
print("clicked reload model button " + event.data.value);
|
||||||
PhotoBooth.changeModel(event.data.value);
|
PhotoBooth.changeModel(event.data.value);
|
||||||
|
@ -75,7 +80,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var PhotoBooth = {};
|
|
||||||
PhotoBooth.init = function () {
|
PhotoBooth.init = function () {
|
||||||
var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL);
|
var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL);
|
||||||
var frontFactor = 10;
|
var frontFactor = 10;
|
||||||
|
@ -163,6 +167,7 @@
|
||||||
Entities.deleteEntity(id);
|
Entities.deleteEntity(id);
|
||||||
});
|
});
|
||||||
Entities.deleteEntity(this.modelEntityID);
|
Entities.deleteEntity(this.modelEntityID);
|
||||||
|
photoboothCreated = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
|
|
Loading…
Reference in a new issue