mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Disable drawing pointer lasers while painting
This commit is contained in:
parent
2c02b42c96
commit
692fa52aca
2 changed files with 28 additions and 3 deletions
|
@ -480,6 +480,10 @@ var LASER_SEARCH_COLOR_XYZW = {x: 10 / 255, y: 10 / 255, z: 255 / 255, w: LASER_
|
|||
var LASER_TRIGGER_COLOR_XYZW = {x: 250 / 255, y: 10 / 255, z: 10 / 255, w: LASER_ALPHA};
|
||||
var SYSTEM_LASER_DIRECTION = {x: 0, y: 0, z: -1};
|
||||
var systemLaserOn = false;
|
||||
|
||||
var HIFI_POINTER_DISABLE_MESSAGE_CHANNEL = "Hifi-Pointer-Disable";
|
||||
var isPointerEnabled = true;
|
||||
|
||||
function clearSystemLaser() {
|
||||
if (!systemLaserOn) {
|
||||
return;
|
||||
|
@ -542,9 +546,8 @@ function update() {
|
|||
return off();
|
||||
}
|
||||
|
||||
|
||||
// If there's a HUD element at the (newly moved) reticle, just make it visible and bail.
|
||||
if (isPointingAtOverlay(hudPoint2d)) {
|
||||
if (isPointingAtOverlay(hudPoint2d) && isPointerEnabled) {
|
||||
if (HMD.active) {
|
||||
Reticle.depth = hudReticleDistance();
|
||||
|
||||
|
@ -579,9 +582,25 @@ function checkSettings() {
|
|||
}
|
||||
checkSettings();
|
||||
|
||||
// Enable/disable pointer.
|
||||
function handleMessages(channel, message, sender) {
|
||||
if (sender === MyAvatar.sessionUUID && channel === HIFI_POINTER_DISABLE_MESSAGE_CHANNEL) {
|
||||
var data = JSON.parse(message);
|
||||
if (data.pointerEnabled !== undefined) {
|
||||
print("pointerEnabled: " + data.pointerEnabled);
|
||||
isPointerEnabled = data.pointerEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Messages.subscribe(HIFI_POINTER_DISABLE_MESSAGE_CHANNEL);
|
||||
Messages.messageReceived.connect(handleMessages);
|
||||
|
||||
var settingsChecker = Script.setInterval(checkSettings, SETTINGS_CHANGE_RECHECK_INTERVAL);
|
||||
Script.update.connect(update);
|
||||
Script.scriptEnding.connect(function () {
|
||||
Messages.unsubscribe(HIFI_POINTER_DISABLE_MESSAGE_CHANNEL);
|
||||
Messages.messageReceived.disconnect(handleMessages);
|
||||
Script.clearInterval(settingsChecker);
|
||||
Script.update.disconnect(update);
|
||||
OffscreenFlags.navigationFocusDisabled = false;
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
CONTROLLER_MAPPING_NAME = "com.highfidelity.fingerPaint",
|
||||
isTabletDisplayed = false,
|
||||
HIFI_POINT_INDEX_MESSAGE_CHANNEL = "Hifi-Point-Index",
|
||||
HIFI_GRAB_DISABLE_MESSAGE_CHANNEL = "Hifi-Grab-Disable";
|
||||
HIFI_GRAB_DISABLE_MESSAGE_CHANNEL = "Hifi-Grab-Disable",
|
||||
HIFI_POINTER_DISABLE_MESSAGE_CHANNEL = "Hifi-Pointer-Disable";
|
||||
|
||||
function paintBrush(name) {
|
||||
// Paints in 3D.
|
||||
|
@ -318,6 +319,9 @@
|
|||
nearGrabEnabled: enabled,
|
||||
farGrabEnabled: enabled
|
||||
}));
|
||||
Messages.sendMessage(HIFI_POINTER_DISABLE_MESSAGE_CHANNEL, JSON.stringify({
|
||||
pointerEnabled: enabled
|
||||
}));
|
||||
Messages.sendMessage(HIFI_POINT_INDEX_MESSAGE_CHANNEL, JSON.stringify({
|
||||
pointIndex: !enabled
|
||||
}));
|
||||
|
@ -386,6 +390,7 @@
|
|||
// Messages channels for enabling/disabling other scripts' functions.
|
||||
Messages.subscribe(HIFI_POINT_INDEX_MESSAGE_CHANNEL);
|
||||
Messages.subscribe(HIFI_GRAB_DISABLE_MESSAGE_CHANNEL);
|
||||
Messages.subscribe(HIFI_POINTER_DISABLE_MESSAGE_CHANNEL);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
@ -418,6 +423,7 @@
|
|||
|
||||
Messages.unsubscribe(HIFI_POINT_INDEX_MESSAGE_CHANNEL);
|
||||
Messages.unsubscribe(HIFI_GRAB_DISABLE_MESSAGE_CHANNEL);
|
||||
Messages.unssubscribe(HIFI_POINTER_DISABLE_MESSAGE_CHANNEL);
|
||||
}
|
||||
|
||||
setUp();
|
||||
|
|
Loading…
Reference in a new issue