mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 01:12:48 +02:00
Merge pull request #14276 from ctrlaltdavid/M19345
Make create apps not grab tablet if editing an entity with hand
This commit is contained in:
commit
1e9faa7754
9 changed files with 186 additions and 57 deletions
|
@ -424,9 +424,19 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
}
|
||||
};
|
||||
|
||||
this.leftBlacklistTabletIDs = [];
|
||||
this.rightBlacklistTabletIDs = [];
|
||||
|
||||
this.setLeftBlacklist = function () {
|
||||
Pointers.setIgnoreItems(_this.leftPointer, _this.blacklist.concat(_this.leftBlacklistTabletIDs));
|
||||
};
|
||||
this.setRightBlacklist = function () {
|
||||
Pointers.setIgnoreItems(_this.rightPointer, _this.blacklist.concat(_this.rightBlacklistTabletIDs));
|
||||
};
|
||||
|
||||
this.setBlacklist = function() {
|
||||
Pointers.setIgnoreItems(_this.leftPointer, this.blacklist);
|
||||
Pointers.setIgnoreItems(_this.rightPointer, this.blacklist);
|
||||
_this.setLeftBlacklist();
|
||||
_this.setRightBlacklist();
|
||||
};
|
||||
|
||||
var MAPPING_NAME = "com.highfidelity.controllerDispatcher";
|
||||
|
@ -490,7 +500,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE,
|
||||
enabled: true
|
||||
});
|
||||
this.handleHandMessage = function(channel, data, sender) {
|
||||
this.handleMessage = function (channel, data, sender) {
|
||||
var message;
|
||||
if (sender === MyAvatar.sessionUUID) {
|
||||
try {
|
||||
|
@ -511,6 +521,18 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
_this.setBlacklist();
|
||||
}
|
||||
}
|
||||
|
||||
if (action === "tablet") {
|
||||
var tabletIDs = message.blacklist
|
||||
? [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID, HMD.homeButtonHighlightID] : [];
|
||||
if (message.hand === LEFT_HAND) {
|
||||
_this.leftBlacklistTabletIDs = tabletIDs;
|
||||
_this.setLeftBlacklist();
|
||||
} else {
|
||||
_this.rightBlacklistTabletIDs = tabletIDs;
|
||||
_this.setRightBlacklist();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print("WARNING: handControllerGrab.js -- error parsing message: " + data);
|
||||
|
@ -550,7 +572,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
|
||||
var controllerDispatcher = new ControllerDispatcher();
|
||||
Messages.subscribe('Hifi-Hand-RayPick-Blacklist');
|
||||
Messages.messageReceived.connect(controllerDispatcher.handleHandMessage);
|
||||
Messages.messageReceived.connect(controllerDispatcher.handleMessage);
|
||||
|
||||
Script.scriptEnding.connect(controllerDispatcher.cleanup);
|
||||
Script.setTimeout(controllerDispatcher.update, BASIC_TIMER_INTERVAL_MS);
|
||||
}());
|
||||
|
|
|
@ -48,6 +48,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
function FarActionGrabEntity(hand) {
|
||||
this.hand = hand;
|
||||
this.grabbing = false;
|
||||
this.grabbedThingID = null;
|
||||
this.targetObject = null;
|
||||
this.actionID = null; // action this script created...
|
||||
|
@ -151,6 +152,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
|
||||
this.previousRoomControllerPosition = roomControllerPosition;
|
||||
this.grabbing = true;
|
||||
};
|
||||
|
||||
this.continueDistanceHolding = function(controllerData) {
|
||||
|
@ -246,6 +248,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.grabbedThingID = null;
|
||||
this.targetObject = null;
|
||||
this.potentialEntityWithContextOverlay = false;
|
||||
this.grabbing = false;
|
||||
};
|
||||
|
||||
this.updateRecommendedArea = function() {
|
||||
|
@ -357,8 +360,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
};
|
||||
|
||||
this.run = function (controllerData) {
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
|
||||
this.notPointingAtEntity(controllerData) || this.targetIsNull()) {
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE || this.targetIsNull()) {
|
||||
this.endFarGrabAction();
|
||||
Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity",
|
||||
this.highlightedEntity);
|
||||
|
@ -375,10 +377,12 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.hand === RIGHT_HAND ? "RightScaleAvatar" : "LeftScaleAvatar",
|
||||
this.hand === RIGHT_HAND ? "RightFarTriggerEntity" : "LeftFarTriggerEntity",
|
||||
this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity",
|
||||
this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity",
|
||||
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay",
|
||||
this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight"
|
||||
this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity"
|
||||
];
|
||||
if (!this.grabbing) {
|
||||
nearGrabNames.push(this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay");
|
||||
nearGrabNames.push(this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight");
|
||||
}
|
||||
|
||||
var nearGrabReadiness = [];
|
||||
for (var i = 0; i < nearGrabNames.length; i++) {
|
||||
|
|
|
@ -47,6 +47,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
function FarParentGrabEntity(hand) {
|
||||
this.hand = hand;
|
||||
this.grabbing = false;
|
||||
this.targetEntityID = null;
|
||||
this.targetObject = null;
|
||||
this.previouslyUnhooked = {};
|
||||
|
@ -455,8 +456,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
};
|
||||
|
||||
this.run = function (controllerData) {
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE ||
|
||||
this.notPointingAtEntity(controllerData) || this.targetIsNull()) {
|
||||
if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE || this.targetIsNull()) {
|
||||
this.endFarParentGrab(controllerData);
|
||||
Selection.removeFromSelectedItemsList(DISPATCHER_HOVERING_LIST, "entity", this.highlightedEntity);
|
||||
this.highlightedEntity = null;
|
||||
|
@ -472,10 +472,12 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.hand === RIGHT_HAND ? "RightScaleAvatar" : "LeftScaleAvatar",
|
||||
this.hand === RIGHT_HAND ? "RightFarTriggerEntity" : "LeftFarTriggerEntity",
|
||||
this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity",
|
||||
this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity",
|
||||
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay",
|
||||
this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight"
|
||||
this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity"
|
||||
];
|
||||
if (!this.grabbing) {
|
||||
nearGrabNames.push(this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay");
|
||||
nearGrabNames.push(this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight");
|
||||
}
|
||||
|
||||
var nearGrabReadiness = [];
|
||||
for (var i = 0; i < nearGrabNames.length; i++) {
|
||||
|
@ -485,11 +487,10 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
}
|
||||
|
||||
if (this.targetEntityID) {
|
||||
// if we are doing a distance grab and the object or tablet gets close enough to the controller,
|
||||
// if we are doing a distance grab and the object gets close enough to the controller,
|
||||
// stop the far-grab so the near-grab or equip can take over.
|
||||
for (var k = 0; k < nearGrabReadiness.length; k++) {
|
||||
if (nearGrabReadiness[k].active && (nearGrabReadiness[k].targets[0] === this.targetEntityID ||
|
||||
HMD.tabletID && nearGrabReadiness[k].targets[0] === HMD.tabletID)) {
|
||||
if (nearGrabReadiness[k].active && (nearGrabReadiness[k].targets[0] === this.targetEntityID)) {
|
||||
this.endFarParentGrab(controllerData);
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.getTargetProps = function (controllerData) {
|
||||
var targetEntity = controllerData.rayPicks[this.hand].objectID;
|
||||
if (targetEntity) {
|
||||
if (targetEntity && controllerData.rayPicks[this.hand].type === RayPick.INTERSECTED_ENTITY) {
|
||||
var targetProperties = Entities.getEntityProperties(targetEntity, DISPATCHER_PROPERTIES);
|
||||
if (entityWantsFarTrigger(targetProperties)) {
|
||||
return targetProperties;
|
||||
|
|
|
@ -20,6 +20,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
var MARGIN = 25;
|
||||
function InEditMode(hand) {
|
||||
this.hand = hand;
|
||||
this.isEditing = false;
|
||||
this.triggerClicked = false;
|
||||
this.selectedTarget = null;
|
||||
this.reticleMinX = MARGIN;
|
||||
|
@ -62,25 +63,27 @@ Script.include("/~/system/libraries/utils.js");
|
|||
return point2d;
|
||||
};
|
||||
|
||||
this.ENTITY_TOOL_UPDATES_CHANNEL = "entityToolUpdates";
|
||||
|
||||
this.sendPickData = function(controllerData) {
|
||||
if (controllerData.triggerClicks[this.hand]) {
|
||||
var hand = this.hand === RIGHT_HAND ? Controller.Standard.RightHand : Controller.Standard.LeftHand;
|
||||
if (!this.triggerClicked) {
|
||||
this.selectedTarget = controllerData.rayPicks[this.hand];
|
||||
if (!this.selectedTarget.intersects) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
Messages.sendLocalMessage(this.ENTITY_TOOL_UPDATES_CHANNEL, JSON.stringify({
|
||||
method: "clearSelection",
|
||||
hand: hand
|
||||
}));
|
||||
} else {
|
||||
if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
Messages.sendLocalMessage(this.ENTITY_TOOL_UPDATES_CHANNEL, JSON.stringify({
|
||||
method: "selectEntity",
|
||||
entityID: this.selectedTarget.objectID,
|
||||
hand: hand
|
||||
}));
|
||||
} else if (this.selectedTarget.type === Picks.INTERSECTED_OVERLAY) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
Messages.sendLocalMessage(this.ENTITY_TOOL_UPDATES_CHANNEL, JSON.stringify({
|
||||
method: "selectOverlay",
|
||||
overlayID: this.selectedTarget.objectID,
|
||||
hand: hand
|
||||
|
@ -102,7 +105,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
var desktopWindow = Window.isPointOnDesktopWindow(point2d);
|
||||
var tablet = this.pointingAtTablet(rayPick.objectID);
|
||||
var rightHand = this.hand === RIGHT_HAND;
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
Messages.sendLocalMessage(this.ENTITY_TOOL_UPDATES_CHANNEL, JSON.stringify({
|
||||
method: "pointingAt",
|
||||
desktopWindow: desktopWindow,
|
||||
tablet: tablet,
|
||||
|
@ -110,6 +113,10 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}));
|
||||
};
|
||||
|
||||
this.runModule = function() {
|
||||
return makeRunningValues(true, [], []);
|
||||
};
|
||||
|
||||
this.exitModule = function() {
|
||||
return makeRunningValues(false, [], []);
|
||||
};
|
||||
|
@ -120,13 +127,15 @@ Script.include("/~/system/libraries/utils.js");
|
|||
this.triggerClicked = false;
|
||||
}
|
||||
Messages.sendLocalMessage('Hifi-unhighlight-all', '');
|
||||
return makeRunningValues(true, [], []);
|
||||
return this.runModule();
|
||||
}
|
||||
this.triggerClicked = false;
|
||||
return makeRunningValues(false, [], []);
|
||||
return this.exitModule();
|
||||
};
|
||||
|
||||
this.run = function(controllerData) {
|
||||
|
||||
// Tablet stylus.
|
||||
var tabletStylusInput = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightTabletStylusInput" : "LeftTabletStylusInput");
|
||||
if (tabletStylusInput) {
|
||||
|
@ -136,6 +145,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}
|
||||
}
|
||||
|
||||
// Tablet surface.
|
||||
var webLaser = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightWebSurfaceLaserInput" : "LeftWebSurfaceLaserInput");
|
||||
if (webLaser) {
|
||||
|
@ -147,6 +157,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}
|
||||
}
|
||||
|
||||
// HUD overlay.
|
||||
if (!controllerData.triggerClicks[this.hand]) { // Don't grab if trigger pressed when laser starts intersecting.
|
||||
var hudLaser = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHudOverlayPointer" : "LeftHudOverlayPointer");
|
||||
|
@ -168,6 +179,7 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}
|
||||
}
|
||||
|
||||
// Teleport.
|
||||
var teleport = getEnabledModuleByName(this.hand === RIGHT_HAND ? "RightTeleporter" : "LeftTeleporter");
|
||||
if (teleport) {
|
||||
var teleportReady = teleport.isReady(controllerData);
|
||||
|
@ -176,8 +188,6 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}
|
||||
}
|
||||
|
||||
var stopRunning = false;
|
||||
|
||||
if ((controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0)) {
|
||||
var stopRunning = false;
|
||||
controllerData.nearbyOverlayIDs[this.hand].forEach(function(overlayID) {
|
||||
|
@ -203,6 +213,37 @@ Script.include("/~/system/libraries/utils.js");
|
|||
enableDispatcherModule("LeftHandInEditMode", leftHandInEditMode);
|
||||
enableDispatcherModule("RightHandInEditMode", rightHandInEditMode);
|
||||
|
||||
var INEDIT_STATUS_CHANNEL = "Hifi-InEdit-Status";
|
||||
var HAND_RAYPICK_BLACKLIST_CHANNEL = "Hifi-Hand-RayPick-Blacklist";
|
||||
this.handleMessage = function (channel, data, sender) {
|
||||
if (channel === INEDIT_STATUS_CHANNEL && sender === MyAvatar.sessionUUID) {
|
||||
var message;
|
||||
|
||||
try {
|
||||
message = JSON.parse(data);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (message.method) {
|
||||
case "editing":
|
||||
if (message.hand === LEFT_HAND) {
|
||||
leftHandInEditMode.isEditing = message.editing;
|
||||
} else {
|
||||
rightHandInEditMode.isEditing = message.editing;
|
||||
}
|
||||
Messages.sendLocalMessage(HAND_RAYPICK_BLACKLIST_CHANNEL, JSON.stringify({
|
||||
action: "tablet",
|
||||
hand: message.hand,
|
||||
blacklist: message.editing
|
||||
}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
Messages.subscribe(INEDIT_STATUS_CHANNEL);
|
||||
Messages.messageReceived.connect(this.handleMessage);
|
||||
|
||||
function cleanup() {
|
||||
disableDispatcherModule("LeftHandInEditMode");
|
||||
disableDispatcherModule("RightHandInEditMode");
|
||||
|
|
|
@ -18,7 +18,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
|
||||
function InVREditMode(hand) {
|
||||
this.hand = hand;
|
||||
this.disableModules = false;
|
||||
this.isAppActive = false;
|
||||
this.isEditing = false;
|
||||
this.running = false;
|
||||
var NO_HAND_LASER = -1; // Invalid hand parameter so that standard laser is not displayed.
|
||||
this.parameters = makeDispatcherModuleParameters(
|
||||
|
@ -66,7 +67,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
};
|
||||
|
||||
this.isReady = function (controllerData) {
|
||||
if (this.disableModules) {
|
||||
if (this.isAppActive) {
|
||||
return makeRunningValues(true, [], []);
|
||||
}
|
||||
return makeRunningValues(false, [], []);
|
||||
|
@ -74,14 +75,13 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
|
||||
this.run = function (controllerData) {
|
||||
// Default behavior if disabling is not enabled.
|
||||
if (!this.disableModules) {
|
||||
if (!this.isAppActive) {
|
||||
return this.exitModule();
|
||||
}
|
||||
|
||||
// Tablet stylus.
|
||||
var tabletStylusInput = getEnabledModuleByName(this.hand === RIGHT_HAND ?
|
||||
"RightTabletStylusInput" :
|
||||
"LeftTabletStylusInput");
|
||||
var tabletStylusInput = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightTabletStylusInput" : "LeftTabletStylusInput");
|
||||
if (tabletStylusInput) {
|
||||
var tabletReady = tabletStylusInput.isReady(controllerData);
|
||||
if (tabletReady.active) {
|
||||
|
@ -90,9 +90,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
}
|
||||
|
||||
// Tablet surface.
|
||||
var overlayLaser = getEnabledModuleByName(this.hand === RIGHT_HAND ?
|
||||
"RightWebSurfaceLaserInput" :
|
||||
"LeftWebSurfaceLaserInput");
|
||||
var overlayLaser = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightWebSurfaceLaserInput" : "LeftWebSurfaceLaserInput");
|
||||
if (overlayLaser) {
|
||||
var overlayLaserReady = overlayLaser.isReady(controllerData);
|
||||
var target = controllerData.rayPicks[this.hand].objectID;
|
||||
|
@ -114,8 +113,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
// HUD overlay.
|
||||
if (!controllerData.triggerClicks[this.hand]) {
|
||||
var hudLaser = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHudOverlayPointer"
|
||||
: "LeftHudOverlayPointer");
|
||||
? "RightHudOverlayPointer" : "LeftHudOverlayPointer");
|
||||
if (hudLaser) {
|
||||
var hudLaserReady = hudLaser.isReady(controllerData);
|
||||
if (hudLaserReady.active) {
|
||||
|
@ -125,9 +123,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
}
|
||||
|
||||
// Teleport.
|
||||
var teleporter = getEnabledModuleByName(this.hand === RIGHT_HAND ?
|
||||
"RightTeleporter" :
|
||||
"LeftTeleporter");
|
||||
var teleporter = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightTeleporter" : "LeftTeleporter");
|
||||
if (teleporter) {
|
||||
var teleporterReady = teleporter.isReady(controllerData);
|
||||
if (teleporterReady.active) {
|
||||
|
@ -145,19 +142,39 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
enableDispatcherModule("LeftHandInVREditMode", leftHandInVREditMode);
|
||||
enableDispatcherModule("RightHandInVREditMode", rightHandInVREditMode);
|
||||
|
||||
var INVREDIT_DISABLER_MESSAGE_CHANNEL = "Hifi-InVREdit-Disabler";
|
||||
this.handleMessage = function (channel, message, sender) {
|
||||
if (sender === MyAvatar.sessionUUID && channel === INVREDIT_DISABLER_MESSAGE_CHANNEL) {
|
||||
if (message === "both") {
|
||||
leftHandInVREditMode.disableModules = true;
|
||||
rightHandInVREditMode.disableModules = true;
|
||||
} else if (message === "none") {
|
||||
leftHandInVREditMode.disableModules = false;
|
||||
rightHandInVREditMode.disableModules = false;
|
||||
var INVREDIT_STATUS_CHANNEL = "Hifi-InVREdit-Status";
|
||||
var HAND_RAYPICK_BLACKLIST_CHANNEL = "Hifi-Hand-RayPick-Blacklist";
|
||||
this.handleMessage = function (channel, data, sender) {
|
||||
if (channel === INVREDIT_STATUS_CHANNEL && sender === MyAvatar.sessionUUID) {
|
||||
var message;
|
||||
|
||||
try {
|
||||
message = JSON.parse(data);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (message.method) {
|
||||
case "active":
|
||||
leftHandInVREditMode.isAppActive = message.active;
|
||||
rightHandInVREditMode.isAppActive = message.active;
|
||||
break;
|
||||
case "editing":
|
||||
if (message.hand === LEFT_HAND) {
|
||||
leftHandInVREditMode.isEditing = message.editing;
|
||||
} else {
|
||||
rightHandInVREditMode.isEditing = message.editing;
|
||||
}
|
||||
Messages.sendLocalMessage(HAND_RAYPICK_BLACKLIST_CHANNEL, JSON.stringify({
|
||||
action: "tablet",
|
||||
hand: message.hand,
|
||||
blacklist: message.editing
|
||||
}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
Messages.subscribe(INVREDIT_DISABLER_MESSAGE_CHANNEL);
|
||||
Messages.subscribe(INVREDIT_STATUS_CHANNEL);
|
||||
Messages.messageReceived.connect(this.handleMessage);
|
||||
|
||||
this.cleanup = function () {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
/* global Script, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex,
|
||||
enableDispatcherModule, disableDispatcherModule, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION,
|
||||
makeDispatcherModuleParameters, Overlays, makeRunningValues, Vec3, resizeTablet, getTabletWidthFromSettings,
|
||||
NEAR_GRAB_RADIUS, HMD, Uuid
|
||||
NEAR_GRAB_RADIUS, HMD, Uuid, getEnabledModuleByName
|
||||
*/
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
@ -176,10 +176,23 @@ Script.include("/~/system/libraries/utils.js");
|
|||
return null;
|
||||
};
|
||||
|
||||
this.isEditing = function () {
|
||||
var inEditModeModule = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHandInEditMode" : "LeftHandInEditMode");
|
||||
if (inEditModeModule && inEditModeModule.isEditing) {
|
||||
return true;
|
||||
}
|
||||
var inVREditModeModule = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHandInVREditMode" : "LeftHandInVREditMode");
|
||||
if (inVREditModeModule && inVREditModeModule.isEditing) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.isReady = function (controllerData) {
|
||||
if ((controllerData.triggerClicks[this.hand] === 0 &&
|
||||
controllerData.secondaryValues[this.hand] === 0)) {
|
||||
if ((controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0)
|
||||
|| this.isEditing()) {
|
||||
this.robbed = false;
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
@ -202,7 +215,8 @@ Script.include("/~/system/libraries/utils.js");
|
|||
};
|
||||
|
||||
this.run = function (controllerData) {
|
||||
if ((controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0) || !this.isGrabbedThingVisible()) {
|
||||
if ((controllerData.triggerClicks[this.hand] === 0 && controllerData.secondaryValues[this.hand] === 0)
|
||||
|| this.isEditing() || !this.isGrabbedThingVisible()) {
|
||||
this.endNearParentingGrabOverlay();
|
||||
this.robbed = false;
|
||||
return makeRunningValues(false, [], []);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//
|
||||
|
||||
/* global LEFT_HAND, RIGHT_HAND, makeDispatcherModuleParameters, makeRunningValues, enableDispatcherModule,
|
||||
* disableDispatcherModule */
|
||||
* disableDispatcherModule, getEnabledModuleByName */
|
||||
|
||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||
|
||||
|
@ -66,12 +66,26 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
100
|
||||
);
|
||||
|
||||
this.isEditing = function () {
|
||||
var inEditModeModule = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHandInEditMode" : "LeftHandInEditMode");
|
||||
if (inEditModeModule && inEditModeModule.isEditing) {
|
||||
return true;
|
||||
}
|
||||
var inVREditModeModule = getEnabledModuleByName(this.hand === RIGHT_HAND
|
||||
? "RightHandInVREditMode" : "LeftHandInVREditMode");
|
||||
if (inVREditModeModule && inVREditModeModule.isEditing) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.isNearTablet = function (controllerData) {
|
||||
return HMD.tabletID && controllerData.nearbyOverlayIDs[this.hand].indexOf(HMD.tabletID) !== -1;
|
||||
};
|
||||
|
||||
this.isReady = function (controllerData) {
|
||||
if (this.isNearTablet(controllerData)) {
|
||||
if (!this.isEditing() && this.isNearTablet(controllerData)) {
|
||||
return makeRunningValues(true, [], []);
|
||||
}
|
||||
setTabletNearGrabbable(this.hand, false);
|
||||
|
@ -79,7 +93,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
};
|
||||
|
||||
this.run = function (controllerData) {
|
||||
if (!this.isNearTablet(controllerData)) {
|
||||
if (this.isEditing() || !this.isNearTablet(controllerData)) {
|
||||
setTabletNearGrabbable(this.hand, false);
|
||||
return makeRunningValues(false, [], []);
|
||||
}
|
||||
|
|
|
@ -639,6 +639,8 @@ SelectionDisplay = (function() {
|
|||
ROLL: 2
|
||||
};
|
||||
|
||||
const INEDIT_STATUS_CHANNEL = "Hifi-InEdit-Status";
|
||||
|
||||
/**
|
||||
* The current space mode, this could have been a forced space mode since we do not support multi selection while in
|
||||
* local space mode.
|
||||
|
@ -985,6 +987,7 @@ SelectionDisplay = (function() {
|
|||
that.triggerPressMapping = Controller.newMapping(Script.resolvePath('') + '-press');
|
||||
that.triggeredHand = NO_HAND;
|
||||
that.pressedHand = NO_HAND;
|
||||
that.editingHand = NO_HAND;
|
||||
that.triggered = function() {
|
||||
return that.triggeredHand !== NO_HAND;
|
||||
};
|
||||
|
@ -1117,6 +1120,12 @@ SelectionDisplay = (function() {
|
|||
activeTool = hitTool;
|
||||
that.clearDebugPickPlane();
|
||||
if (activeTool.onBegin) {
|
||||
that.editingHand = that.triggeredHand;
|
||||
Messages.sendLocalMessage(INEDIT_STATUS_CHANNEL, JSON.stringify({
|
||||
method: "editing",
|
||||
hand: that.editingHand === Controller.Standard.LeftHand ? LEFT_HAND : RIGHT_HAND,
|
||||
editing: true
|
||||
}));
|
||||
activeTool.onBegin(event, pickRay, results);
|
||||
} else {
|
||||
print("ERROR: entitySelectionTool.mousePressEvent - ActiveTool(" + activeTool.mode + ") missing onBegin");
|
||||
|
@ -1265,6 +1274,12 @@ SelectionDisplay = (function() {
|
|||
if (wantDebug) {
|
||||
print(" Triggering ActiveTool(" + activeTool.mode + ")'s onEnd");
|
||||
}
|
||||
Messages.sendLocalMessage(INEDIT_STATUS_CHANNEL, JSON.stringify({
|
||||
method: "editing",
|
||||
hand: that.editingHand === Controller.Standard.LeftHand ? LEFT_HAND : RIGHT_HAND,
|
||||
editing: false
|
||||
}));
|
||||
that.editingHand = NO_HAND;
|
||||
activeTool.onEnd(event);
|
||||
} else if (wantDebug) {
|
||||
print(" ActiveTool(" + activeTool.mode + ")'s missing onEnd");
|
||||
|
|
Loading…
Reference in a new issue