mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:19:06 +02:00
Function renaming; turn cam off when changing domains
This commit is contained in:
parent
383ef542a1
commit
6e9b083be1
2 changed files with 18 additions and 15 deletions
|
@ -188,7 +188,7 @@ Rectangle {
|
||||||
text: "Camera On";
|
text: "Camera On";
|
||||||
boxSize: 24;
|
boxSize: 24;
|
||||||
onClicked: {
|
onClicked: {
|
||||||
sendToScript({method: (checked ? 'enableSpectatorCamera' : 'disableSpectatorCamera')});
|
sendToScript({method: (checked ? 'spectatorCameraOn' : 'spectatorCameraOff')});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function Name: enableSpectatorCamera()
|
// Function Name: spectatorCameraOn()
|
||||||
//
|
//
|
||||||
// Relevant Variables:
|
// Relevant Variables:
|
||||||
// isUpdateRenderWired: Bool storing whether or not the camera's update
|
// isUpdateRenderWired: Bool storing whether or not the camera's update
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
// spawn the camera entity.
|
// spawn the camera entity.
|
||||||
//
|
//
|
||||||
var isUpdateRenderWired = false;
|
var isUpdateRenderWired = false;
|
||||||
function enableSpectatorCamera() {
|
function spectatorCameraOn() {
|
||||||
// Set the special texture size based on the window in which it will eventually be displayed.
|
// Set the special texture size based on the window in which it will eventually be displayed.
|
||||||
var size = Controller.getViewportDimensions(); // FIXME: Need a signal to hook into when the dimensions change.
|
var size = Controller.getViewportDimensions(); // FIXME: Need a signal to hook into when the dimensions change.
|
||||||
spectatorFrameRenderConfig.resetSize(size.x, size.y);
|
spectatorFrameRenderConfig.resetSize(size.x, size.y);
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function Name: disableSpectatorCamera()
|
// Function Name: spectatorCameraOff()
|
||||||
//
|
//
|
||||||
// Relevant Variables:
|
// Relevant Variables:
|
||||||
// None
|
// None
|
||||||
|
@ -127,20 +127,21 @@
|
||||||
// Call this function to shut down the spectator camera and
|
// Call this function to shut down the spectator camera and
|
||||||
// destroy the camera entity.
|
// destroy the camera entity.
|
||||||
//
|
//
|
||||||
function disableSpectatorCamera() {
|
function spectatorCameraOff() {
|
||||||
spectatorFrameRenderConfig.enabled = beginSpectatorFrameRenderConfig.enabled = false;
|
spectatorFrameRenderConfig.enabled = beginSpectatorFrameRenderConfig.enabled = false;
|
||||||
if (isUpdateRenderWired) {
|
if (isUpdateRenderWired) {
|
||||||
Script.update.disconnect(updateRenderFromCamera);
|
Script.update.disconnect(updateRenderFromCamera);
|
||||||
isUpdateRenderWired = false;
|
isUpdateRenderWired = false;
|
||||||
}
|
}
|
||||||
if (viewFinderOverlay) {
|
|
||||||
Overlays.deleteOverlay(viewFinderOverlay);
|
|
||||||
viewFinderOverlay = false;
|
|
||||||
}
|
|
||||||
if (camera) {
|
if (camera) {
|
||||||
Entities.deleteEntity(camera);
|
Entities.deleteEntity(camera);
|
||||||
camera = false;
|
print("ZACH FOX GOODBYE");
|
||||||
}
|
}
|
||||||
|
if (viewFinderOverlay) {
|
||||||
|
Overlays.deleteOverlay(viewFinderOverlay);
|
||||||
|
}
|
||||||
|
camera = false;
|
||||||
|
viewFinderOverlay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -167,6 +168,7 @@
|
||||||
});
|
});
|
||||||
button.clicked.connect(onTabletButtonClicked);
|
button.clicked.connect(onTabletButtonClicked);
|
||||||
tablet.screenChanged.connect(onTabletScreenChanged);
|
tablet.screenChanged.connect(onTabletScreenChanged);
|
||||||
|
Window.domainChanged.connect(spectatorCameraOff);
|
||||||
viewFinderOverlay = false;
|
viewFinderOverlay = false;
|
||||||
camera = false;
|
camera = false;
|
||||||
}
|
}
|
||||||
|
@ -280,11 +282,11 @@
|
||||||
//
|
//
|
||||||
function fromQml(message) {
|
function fromQml(message) {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'enableSpectatorCamera':
|
case 'spectatorCameraOn':
|
||||||
enableSpectatorCamera();
|
spectatorCameraOn();
|
||||||
break;
|
break;
|
||||||
case 'disableSpectatorCamera':
|
case 'spectatorCameraOff':
|
||||||
disableSpectatorCamera();
|
spectatorCameraOff();
|
||||||
break;
|
break;
|
||||||
case 'showHmdPreviewOnMonitor':
|
case 'showHmdPreviewOnMonitor':
|
||||||
print('FIXME: showHmdPreviewOnMonitor');
|
print('FIXME: showHmdPreviewOnMonitor');
|
||||||
|
@ -315,7 +317,8 @@
|
||||||
// shutdown() will be called when the script ends (i.e. is stopped).
|
// shutdown() will be called when the script ends (i.e. is stopped).
|
||||||
//
|
//
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
disableSpectatorCamera();
|
spectatorCameraOff();
|
||||||
|
Window.domainChanged.disconnect(spectatorCameraOff);
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
button.clicked.disconnect(onTabletButtonClicked);
|
button.clicked.disconnect(onTabletButtonClicked);
|
||||||
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
||||||
|
|
Loading…
Reference in a new issue