Communicate VR edit enabled state to hand controller script

This commit is contained in:
David Rowe 2017-06-30 12:11:06 +12:00
parent 84e11db772
commit a863e37eb5
4 changed files with 16 additions and 6 deletions

View file

@ -14,7 +14,7 @@
/* global getEntityCustomData, flatten, Xform, Script, Quat, Vec3, MyAvatar, Entities, Overlays, Settings,
Reticle, Controller, Camera, Messages, Mat4, getControllerWorldLocation, getGrabPointSphereOffset,
setGrabCommunications, Menu, HMD, isInEditMode, AvatarList */
setGrabCommunications, Menu, HMD, isInEditMode, isInVREditMode, AvatarList */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function() { // BEGIN LOCAL_SCOPE

View file

@ -228,7 +228,7 @@ var GRABBABLE_ENTITIES_MENU_CATEGORY = "Edit";
var GRABBABLE_ENTITIES_MENU_ITEM = "Create Entities As Grabbable";
var toolBar = (function () {
var EDIT_SETTING = "io.highfidelity.isEditting"; // for communication with other scripts
var EDIT_SETTING = "io.highfidelity.isEditing"; // for communication with other scripts
var that = {},
toolBar,
activeButton = null,

View file

@ -6,12 +6,16 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
// note: this constant is currently duplicated in edit.js
EDIT_SETTING = "io.highfidelity.isEditting";
isInEditMode = function isInEditMode() {
EDIT_SETTING = "io.highfidelity.isEditing"; // Note: This constant is duplicated in edit.js.
isInEditMode = function () {
return Settings.getValue(EDIT_SETTING);
};
VR_EDIT_SETTING = "io.highfidelity.isVREditing"; // Note: This constant is duplicated in vr-edit.js.
isInVREditMode = function () {
return HMD.active && Settings.getValue(VR_EDIT_SETTING);
}
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {

View file

@ -17,14 +17,20 @@
APP_ICON_ACTIVE = "icons/tablet-icons/edit-a.svg",
tablet,
button,
isAppActive = false;
isAppActive = false,
VR_EDIT_SETTING = "io.highfidelity.isVREditing"; // Note: This constant is duplicated in utils.js.
function onButtonClicked() {
isAppActive = !isAppActive;
Settings.setValue(VR_EDIT_SETTING, isAppActive);
button.editProperties({ isActive: isAppActive });
}
function setUp() {
Settings.setValue(VR_EDIT_SETTING, isAppActive);
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
if (!tablet) {
return;