mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 18:55:01 +02:00
Make Create and Shapes lasers ignore tablet while editing
This commit is contained in:
parent
eb8c6c8974
commit
44efd18882
3 changed files with 29 additions and 26 deletions
|
@ -12,7 +12,7 @@
|
|||
LEFT_HAND, RIGHT_HAND, NEAR_GRAB_PICK_RADIUS, DEFAULT_SEARCH_SPHERE_DISTANCE, DISPATCHER_PROPERTIES,
|
||||
getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Picks, PickType, Pointers,
|
||||
PointerManager, getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Picks, PickType, Pointers,
|
||||
PointerManager, print, Selection, DISPATCHER_HOVERING_LIST, DISPATCHER_HOVERING_STYLE
|
||||
PointerManager, print, Selection, DISPATCHER_HOVERING_LIST, DISPATCHER_HOVERING_STYLE, HIFI_EDIT_MANIPULATION_CHANNEL
|
||||
*/
|
||||
|
||||
controllerDispatcherPlugins = {};
|
||||
|
@ -427,9 +427,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";
|
||||
|
@ -493,7 +503,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 {
|
||||
|
@ -514,6 +524,17 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
_this.setBlacklist();
|
||||
}
|
||||
}
|
||||
} else if (channel === HIFI_EDIT_MANIPULATION_CHANNEL) {
|
||||
message = JSON.parse(data);
|
||||
var tabletIDs = message.action === "startEdit" ?
|
||||
[HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID, HMD.homeButtonHighlightID] : [];
|
||||
if (message.hand === Controller.Standard.LeftHand) {
|
||||
_this.leftBlacklistTabletIDs = tabletIDs;
|
||||
_this.setLeftBlacklist();
|
||||
} else if (message.hand === Controller.Standard.RightHand) {
|
||||
_this.rightBlacklistTabletIDs = tabletIDs;
|
||||
_this.setRightBlacklist();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
print("WARNING: handControllerGrab.js -- error parsing message: " + data);
|
||||
|
@ -554,7 +575,9 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
|
||||
var controllerDispatcher = new ControllerDispatcher();
|
||||
Messages.subscribe('Hifi-Hand-RayPick-Blacklist');
|
||||
Messages.messageReceived.connect(controllerDispatcher.handleHandMessage);
|
||||
Messages.subscribe(HIFI_EDIT_MANIPULATION_CHANNEL);
|
||||
Messages.messageReceived.connect(controllerDispatcher.handleMessage);
|
||||
|
||||
Script.scriptEnding.connect(controllerDispatcher.cleanup);
|
||||
Script.setTimeout(controllerDispatcher.update, BASIC_TIMER_INTERVAL_MS);
|
||||
}());
|
||||
|
|
|
@ -20,7 +20,6 @@ Script.include("/~/system/libraries/utils.js");
|
|||
var MARGIN = 25;
|
||||
function InEditMode(hand) {
|
||||
this.hand = hand;
|
||||
this.running = false;
|
||||
this.triggerClicked = false;
|
||||
this.selectedTarget = null;
|
||||
this.reticleMinX = MARGIN;
|
||||
|
@ -114,26 +113,10 @@ Script.include("/~/system/libraries/utils.js");
|
|||
};
|
||||
|
||||
this.runModule = function() {
|
||||
if (!this.running) {
|
||||
Messages.sendLocalMessage(this.ENTITY_TOOL_UPDATES_CHANNEL, JSON.stringify({
|
||||
method: "moduleRunning",
|
||||
hand: this.hand,
|
||||
running: true
|
||||
}));
|
||||
this.running = true;
|
||||
}
|
||||
return makeRunningValues(true, [], []);
|
||||
};
|
||||
|
||||
this.exitModule = function() {
|
||||
if (this.running) {
|
||||
Messages.sendLocalMessage(this.ENTITY_TOOL_UPDATES_CHANNEL, JSON.stringify({
|
||||
method: "moduleRunning",
|
||||
hand: this.hand,
|
||||
running: false
|
||||
}));
|
||||
this.running = false;
|
||||
}
|
||||
return makeRunningValues(false, [], []);
|
||||
};
|
||||
|
||||
|
|
|
@ -58,10 +58,7 @@ SelectionManager = (function() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (messageParsed.method === "moduleRunning") {
|
||||
// Terminate any current laser or mouse action.
|
||||
SelectionDisplay.mouseReleaseEvent({});
|
||||
} else if (messageParsed.method === "selectEntity") {
|
||||
if (messageParsed.method === "selectEntity") {
|
||||
if (!SelectionDisplay.triggered() || SelectionDisplay.triggeredHand === messageParsed.hand) {
|
||||
if (wantDebug) {
|
||||
print("setting selection to " + messageParsed.entityID);
|
||||
|
|
Loading…
Reference in a new issue