From 8879727d88c9e43759be1c83a9ef7bc43ad32282 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 30 Jan 2017 18:11:42 +0000 Subject: [PATCH 1/4] ability to grab tablet in edit mode --- scripts/system/controllers/handControllerGrab.js | 7 ++----- scripts/system/edit.js | 4 ---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 972d95e9e9..f4b760dbce 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -853,7 +853,7 @@ function MyController(hand) { }; this.setState = function(newState, reason) { - if (isInEditMode() && (newState !== STATE_OFF && + if ((isInEditMode() && this.grabbedEntity !== HMD.tabletID )&& (newState !== STATE_OFF && newState !== STATE_SEARCHING && newState !== STATE_OVERLAY_STYLUS_TOUCHING)) { return; @@ -1510,7 +1510,6 @@ function MyController(hand) { }; this.entityIsNearGrabbable = function(entityID, handPosition, maxDistance) { - if (!this.entityIsGrabbable(entityID)) { return false; } @@ -1703,7 +1702,7 @@ function MyController(hand) { }; this.isTablet = function (entityID) { - if (entityID === HMD.tabletID) { // XXX what's a better way to know this? + if (entityID === HMD.tabletID) { return true; } return false; @@ -2264,7 +2263,6 @@ function MyController(hand) { this.clearEquipHaptics(); this.shouldScale = false; - Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand); if (this.entityActivated) { @@ -2394,7 +2392,6 @@ function MyController(hand) { this.nearGrabbing = function(deltaTime, timestamp) { this.grabPointSphereOff(); - if (this.state == STATE_NEAR_GRABBING && (!this.triggerClicked && this.secondaryReleased())) { this.callEntityMethodOnGrabbed("releaseGrab"); this.setState(STATE_OFF, "trigger released"); diff --git a/scripts/system/edit.js b/scripts/system/edit.js index d49f7ad3c5..dccd097817 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -191,7 +191,6 @@ var toolBar = (function () { selectionManager.clearSelections(); entityListTool.sendUpdate(); selectionManager.setSelections([entityID]); - return entityID; } @@ -714,9 +713,6 @@ function mouseClickEvent(event) { toolBar.setActive(true); var pickRay = result.pickRay; var foundEntity = result.entityID; - if (foundEntity === HMD.tabletID) { - return; - } properties = Entities.getEntityProperties(foundEntity); if (isLocked(properties)) { if (wantDebug) { From 57a9d34cdafa15a1c02d9551758398910504d55a Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 30 Jan 2017 18:33:56 +0000 Subject: [PATCH 2/4] minimize git diff --- scripts/system/controllers/handControllerGrab.js | 3 +++ scripts/system/edit.js | 1 + 2 files changed, 4 insertions(+) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index f4b760dbce..2efafa504d 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1510,6 +1510,7 @@ function MyController(hand) { }; this.entityIsNearGrabbable = function(entityID, handPosition, maxDistance) { + if (!this.entityIsGrabbable(entityID)) { return false; } @@ -2263,6 +2264,7 @@ function MyController(hand) { this.clearEquipHaptics(); this.shouldScale = false; + Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand); if (this.entityActivated) { @@ -2392,6 +2394,7 @@ function MyController(hand) { this.nearGrabbing = function(deltaTime, timestamp) { this.grabPointSphereOff(); + if (this.state == STATE_NEAR_GRABBING && (!this.triggerClicked && this.secondaryReleased())) { this.callEntityMethodOnGrabbed("releaseGrab"); this.setState(STATE_OFF, "trigger released"); diff --git a/scripts/system/edit.js b/scripts/system/edit.js index dccd097817..8f9697b060 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -191,6 +191,7 @@ var toolBar = (function () { selectionManager.clearSelections(); entityListTool.sendUpdate(); selectionManager.setSelections([entityID]); + return entityID; } From b264d84385d50984af5eefb38e00352351982ef4 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 30 Jan 2017 18:38:02 +0000 Subject: [PATCH 3/4] minimize git diff --- scripts/system/controllers/handControllerGrab.js | 6 +++--- scripts/system/edit.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 2efafa504d..86820c990a 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1510,7 +1510,7 @@ function MyController(hand) { }; this.entityIsNearGrabbable = function(entityID, handPosition, maxDistance) { - + if (!this.entityIsGrabbable(entityID)) { return false; } @@ -2264,7 +2264,7 @@ function MyController(hand) { this.clearEquipHaptics(); this.shouldScale = false; - + Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand); if (this.entityActivated) { @@ -2394,7 +2394,7 @@ function MyController(hand) { this.nearGrabbing = function(deltaTime, timestamp) { this.grabPointSphereOff(); - + if (this.state == STATE_NEAR_GRABBING && (!this.triggerClicked && this.secondaryReleased())) { this.callEntityMethodOnGrabbed("releaseGrab"); this.setState(STATE_OFF, "trigger released"); diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 8f9697b060..40952e9de1 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -191,7 +191,7 @@ var toolBar = (function () { selectionManager.clearSelections(); entityListTool.sendUpdate(); selectionManager.setSelections([entityID]); - + return entityID; } From 7a4a76901571a764ebaeea1de036d88ed94dcc60 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 31 Jan 2017 16:53:57 +0000 Subject: [PATCH 4/4] fix more editing bugs --- scripts/system/edit.js | 3 +++ scripts/system/libraries/entitySelectionTool.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 40952e9de1..d49f7ad3c5 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -714,6 +714,9 @@ function mouseClickEvent(event) { toolBar.setActive(true); var pickRay = result.pickRay; var foundEntity = result.entityID; + if (foundEntity === HMD.tabletID) { + return; + } properties = Entities.getEntityProperties(foundEntity); if (isLocked(properties)) { if (wantDebug) { diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 2932417d25..b9bae72d14 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -1038,7 +1038,7 @@ SelectionDisplay = (function() { if (entityIntersection.intersects && (!overlayIntersection.intersects || (entityIntersection.distance < overlayIntersection.distance))) { - if (HMD.tabletID == entityIntersection.entityID) { + if (HMD.tabletID === entityIntersection.entityID) { return; }