From 65e3652b9fb7b1e1c29158b789d11891b6f1ae71 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 5 Jun 2018 11:47:44 -0700 Subject: [PATCH 01/24] Personal space bubble is defaulted off for now. --- libraries/networking/src/NodeList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h index c5cf5e9524..348ea5bbc1 100644 --- a/libraries/networking/src/NodeList.h +++ b/libraries/networking/src/NodeList.h @@ -180,7 +180,7 @@ private: #if defined(Q_OS_ANDROID) Setting::Handle _ignoreRadiusEnabled { "IgnoreRadiusEnabled", false }; #else - Setting::Handle _ignoreRadiusEnabled { "IgnoreRadiusEnabled", true }; + Setting::Handle _ignoreRadiusEnabled { "IgnoreRadiusEnabled", false }; // False, until such time as it is made to work better. #endif #if (PR_BUILD || DEV_BUILD) From df4d81277f8e8cd5e6d32a43b1cabc725ab5b2d2 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 9 Jul 2018 16:59:32 -0700 Subject: [PATCH 02/24] clean up tablet material entities and don't show them in edit --- .../controllerModules/inEditMode.js | 26 ++++++++++++------- scripts/system/libraries/WebTablet.js | 20 ++++++++++++++ scripts/system/libraries/entityList.js | 9 +++++++ 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index a724c2037b..377167d7bf 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -10,7 +10,7 @@ /* global Script, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, makeRunningValues, Messages, makeDispatcherModuleParameters, HMD, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, - getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, Picks, makeLaserParams + getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, Picks, makeLaserParams, Entities */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); @@ -19,7 +19,7 @@ Script.include("/~/system/libraries/utils.js"); (function () { var MARGIN = 25; - + var TABLET_MATERIAL_ENTITY_NAME = 'Tablet-Material-Entity'; function InEditMode(hand) { this.hand = hand; this.triggerClicked = false; @@ -53,7 +53,7 @@ Script.include("/~/system/libraries/utils.js"); return (HMD.tabletScreenID && objectID === HMD.tabletScreenID) || (HMD.homeButtonID && objectID === HMD.homeButtonID); }; - + this.calculateNewReticlePosition = function(intersection) { var dims = Controller.getViewportDimensions(); this.reticleMaxX = dims.x - MARGIN; @@ -75,10 +75,12 @@ Script.include("/~/system/libraries/utils.js"); } } if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) { - Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "selectEntity", - entityID: this.selectedTarget.objectID - })); + if (!this.isTabletMaterialEntity(this.selectedTarget.objectID)) { + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "selectEntity", + entityID: this.selectedTarget.objectID + })); + } } else if (this.selectedTarget.type === Picks.INTERSECTED_OVERLAY) { Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ method: "selectOverlay", @@ -88,10 +90,16 @@ Script.include("/~/system/libraries/utils.js"); this.triggerClicked = true; } - + this.sendPointingAtData(controllerData); }; - + + + this.isTabletMaterialEntity = function(entityID) { + return ((entityID === HMD.homeButtonHighlightMaterialID) || + (entityID === HMD.homeButtonUnhighlightMaterialID)); + }; + this.sendPointingAtData = function(controllerData) { var rayPick = controllerData.rayPicks[this.hand]; var hudRayPick = controllerData.hudRayPicks[this.hand]; diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 532f58493f..1a3b635f80 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -30,6 +30,8 @@ var INCHES_TO_METERS = 1 / 39.3701; var NO_HANDS = -1; var DELAY_FOR_30HZ = 33; // milliseconds +var TABLET_MATERIAL_ENTITY_NAME = 'Tablet-Material-Entity'; + // will need to be recaclulated if dimensions of fbx model change. var TABLET_NATURAL_DIMENSIONS = {x: 32.083, y: 48.553, z: 2.269}; @@ -79,6 +81,21 @@ function calcSpawnInfo(hand, landscape) { }; } + +function cleanUpOldMaterialEntities() { + var avatarEntityData = MyAvatar.getAvatarEntityData(); + + for (var entityID in avatarEntityData) { + var entityName = Entities.getEntityProperties(entityID, ["name"]).name; + + if (entityName === TABLET_MATERIAL_ENTITY_NAME) { + Entities.deleteEntity(entityID); + } + } +} + +cleanUpOldMaterialEntities(); + /** * WebTablet * @param url [string] url of content to show on the tablet. @@ -134,6 +151,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) { } this.cleanUpOldTablets(); + cleanUpOldMaterialEntities(); this.tabletEntityID = Overlays.addOverlay("model", tabletProperties); @@ -180,6 +198,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) { this.homeButtonUnhighlightMaterial = Entities.addEntity({ type: "Material", + name: TABLET_MATERIAL_ENTITY_NAME, materialURL: "materialData", localPosition: { x: 0.0, y: 0.0, z: 0.0 }, priority: HIGH_PRIORITY, @@ -199,6 +218,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) { this.homeButtonHighlightMaterial = Entities.addEntity({ type: "Material", + name: TABLET_MATERIAL_ENTITY_NAME, materialURL: "materialData", localPosition: { x: 0.0, y: 0.0, z: 0.0 }, priority: LOW_PRIORITY, diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js index 06ad7d3e03..908c8400f1 100644 --- a/scripts/system/libraries/entityList.js +++ b/scripts/system/libraries/entityList.js @@ -70,6 +70,11 @@ EntityListTool = function(opts) { return value !== undefined ? value : ""; } + function filterEntity(entityID) { + return ((entityID === HMD.homeButtonHighlightMaterialID) || + (entityID === HMD.homeButtonUnhighlightMaterialID)); + } + that.sendUpdate = function() { var entities = []; @@ -80,6 +85,10 @@ EntityListTool = function(opts) { ids = Entities.findEntities(MyAvatar.position, searchRadius); } + ids = ids.filter(function(id) { + return !filterEntity(id); + }); + var cameraPosition = Camera.position; for (var i = 0; i < ids.length; i++) { var id = ids[i]; From 1cc95fbf76475495989b5a55ba8246376ceb311f Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 10 Jul 2018 11:05:41 -0700 Subject: [PATCH 03/24] better fix --- scripts/system/libraries/WebTablet.js | 10 ++++------ scripts/system/tablet-ui/tabletUI.js | 11 ++++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 1a3b635f80..f83f961438 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -82,19 +82,17 @@ function calcSpawnInfo(hand, landscape) { } -function cleanUpOldMaterialEntities() { +cleanUpOldMaterialEntities = function() { var avatarEntityData = MyAvatar.getAvatarEntityData(); - for (var entityID in avatarEntityData) { var entityName = Entities.getEntityProperties(entityID, ["name"]).name; - if (entityName === TABLET_MATERIAL_ENTITY_NAME) { + if (entityName === TABLET_MATERIAL_ENTITY_NAME && entityID !== HMD.homeButtonHighlightMaterialID && + entityID !== HMD.homeButtonUnhighlightMaterialID) { Entities.deleteEntity(entityID); } } -} - -cleanUpOldMaterialEntities(); +}; /** * WebTablet diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index 29dc457197..bd6a9c69d5 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -13,7 +13,7 @@ // /* global Script, HMD, WebTablet, UIWebTablet, UserActivityLogger, Settings, Entities, Messages, Tablet, Overlays, - MyAvatar, Menu, AvatarInputs, Vec3 */ + MyAvatar, Menu, AvatarInputs, Vec3, cleanUpOldMaterialEntities */ (function() { // BEGIN LOCAL_SCOPE var tabletRezzed = false; @@ -31,6 +31,14 @@ Script.include("../libraries/WebTablet.js"); + function cleanupMaterialEntities() { + if (Window.isPhysicsEnabled()) { + cleanUpOldMaterialEntities(); + return; + } + Script.setTimeout(cleanupMaterialEntities, 100); + } + function checkTablet() { if (gTablet === null) { gTablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); @@ -327,4 +335,5 @@ HMD.homeButtonHighlightMaterialID = null; HMD.homeButtonUnhighlightMaterialID = null; }); + Script.setTimeout(cleanupMaterialEntities, 100); }()); // END LOCAL_SCOPE From 41b08fcf40adfde5574888326f97607f80a24470 Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Tue, 10 Jul 2018 18:17:34 -0700 Subject: [PATCH 04/24] Validate user-supplied avatar height range before accepting --- domain-server/resources/web/settings/js/settings.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js index e67ea43158..3dd8fc99f8 100644 --- a/domain-server/resources/web/settings/js/settings.js +++ b/domain-server/resources/web/settings/js/settings.js @@ -1091,4 +1091,17 @@ $(document).ready(function(){ $('#settings_backup .panel-body').html(html); } + + function checkAvatarHeights() { + var minHeight = Settings.avatars.min_avatar_height; + var maxHeight = Settings.avatars.max_avatar_height; + if (maxHeight < minHeight) { + swal({ + type: 'error', + title: '', + text: "Maximum avatar height must not be less than minimum avatar height", + html: true + }, function(){swal.close();}); + } + } }); From 7455f9fc18ef9196e44d29fe4ac4f4a0ba3620ea Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Tue, 10 Jul 2018 18:25:43 -0700 Subject: [PATCH 05/24] Update the correct file this time --- .../resources/web/settings/js/settings.js | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js index 3dd8fc99f8..55ce21e956 100644 --- a/domain-server/resources/web/settings/js/settings.js +++ b/domain-server/resources/web/settings/js/settings.js @@ -58,7 +58,11 @@ $(document).ready(function(){ } Settings.handlePostSettings = function(formJSON) { - + + if (!checkAvatarHeights()) { + return false; + } + // check if we've set the basic http password if (formJSON["security"]) { @@ -1093,15 +1097,35 @@ $(document).ready(function(){ } function checkAvatarHeights() { - var minHeight = Settings.avatars.min_avatar_height; - var maxHeight = Settings.avatars.max_avatar_height; - if (maxHeight < minHeight) { - swal({ - type: 'error', - title: '', - text: "Maximum avatar height must not be less than minimum avatar height", - html: true - }, function(){swal.close();}); - } + var errorString = ''; + var minAllowedHeight = 0.009; + var maxAllowedHeight = 1755; + var currentForm = form2js('settings-form'); + var minHeight = currentForm.avatars.min_avatar_height; + var maxHeight = currentForm.avatars.max_avatar_height; + //var minHeight = Number($('input[name="avatars.min_avatar_height"]').attr('value')); + //var maxHeight = Number($('input[name="avatars.max_avatar_height"]').attr('value')); + + if (maxHeight < minHeight) { + errorString = 'Maximum avatar height must not be less than minimum avatar height
'; + }; + if (minHeight < minAllowedHeight) { + errorString += 'Minimum avatar height must not be less than ' + minAllowedHeight + '
'; + } + if (maxHeight > maxAllowedHeight) { + errorString += 'Maximum avatar height must not be greater than ' + maxAllowedHeight + '
'; + } + if (errorString.length > 0) { + swal({ + type: 'error', + title: '', + text: errorString, + html: true + }); + return false; + } else { + return true; + } + } }); From 09b7787bc9b2f9e3dae9e8f792045e6d93f84e28 Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Wed, 11 Jul 2018 10:27:17 -0700 Subject: [PATCH 06/24] Use jQuery correctly, other clean-up --- .../resources/web/settings/js/settings.js | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js index 55ce21e956..3888277c00 100644 --- a/domain-server/resources/web/settings/js/settings.js +++ b/domain-server/resources/web/settings/js/settings.js @@ -59,7 +59,7 @@ $(document).ready(function(){ Settings.handlePostSettings = function(formJSON) { - if (!checkAvatarHeights()) { + if (!verifyAvatarHeights()) { return false; } @@ -211,7 +211,7 @@ $(document).ready(function(){ swal({ title: '', type: 'error', - text: "There was a problem retreiving domain information from High Fidelity API.", + text: "There was a problem retrieving domain information from High Fidelity API.", confirmButtonText: 'Try again', showCancelButton: true, closeOnConfirm: false @@ -292,7 +292,7 @@ $(document).ready(function(){ swal({ title: 'Create new domain ID', type: 'input', - text: 'Enter a label this machine.

This will help you identify which domain ID belongs to which machine.

', + text: 'Enter a label for this machine.

This will help you identify which domain ID belongs to which machine.

', showCancelButton: true, confirmButtonText: "Create", closeOnConfirm: false, @@ -673,7 +673,7 @@ $(document).ready(function(){ var spinner = createDomainSpinner(); $('#' + Settings.PLACES_TABLE_ID).after($(spinner)); - var errorEl = createDomainLoadingError("There was an error retreiving your places."); + var errorEl = createDomainLoadingError("There was an error retrieving your places."); $("#" + Settings.PLACES_TABLE_ID).after(errorEl); // do we have a domain ID? @@ -1096,25 +1096,31 @@ $(document).ready(function(){ $('#settings_backup .panel-body').html(html); } - function checkAvatarHeights() { + function verifyAvatarHeights() { var errorString = ''; var minAllowedHeight = 0.009; var maxAllowedHeight = 1755; - var currentForm = form2js('settings-form'); - var minHeight = currentForm.avatars.min_avatar_height; - var maxHeight = currentForm.avatars.max_avatar_height; - //var minHeight = Number($('input[name="avatars.min_avatar_height"]').attr('value')); - //var maxHeight = Number($('input[name="avatars.max_avatar_height"]').attr('value')); - + var alertCss = { backgroundColor: '#ffa0a0' }; + var minHeightElement = $('input[name="avatars.min_avatar_height"]'); + var maxHeightElement = $('input[name="avatars.max_avatar_height"]'); + + var minHeight = Number(minHeightElement.val()); + var maxHeight = Number(maxHeightElement.val()); + if (maxHeight < minHeight) { - errorString = 'Maximum avatar height must not be less than minimum avatar height
'; + errorString = 'Maximum avatar height must not be less than minimum avatar height
'; + minHeightElement.css(alertCss); + maxHeightElement.css(alertCss); }; if (minHeight < minAllowedHeight) { - errorString += 'Minimum avatar height must not be less than ' + minAllowedHeight + '
'; + errorString += 'Minimum avatar height must not be less than ' + minAllowedHeight + '
'; + minHeightElement.css(alertCss); } if (maxHeight > maxAllowedHeight) { - errorString += 'Maximum avatar height must not be greater than ' + maxAllowedHeight + '
'; + errorString += 'Maximum avatar height must not be greater than ' + maxAllowedHeight + '
'; + maxHeightElement.css(alertCss); } + if (errorString.length > 0) { swal({ type: 'error', @@ -1124,7 +1130,7 @@ $(document).ready(function(){ }); return false; } else { - return true; + return true; } } From beb878f10ef519d64f0534a417bd1fc0c324384a Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Wed, 11 Jul 2018 10:33:42 -0700 Subject: [PATCH 07/24] Update avatar field description --- domain-server/resources/describe-settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 83dd633d22..07f1eb7e5e 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -1223,7 +1223,7 @@ "name": "max_avatar_height", "type": "double", "label": "Maximum Avatar Height (meters)", - "help": "Limits the scale of avatars in your domain. Cannot be greater than 1755.", + "help": "Limits the height of avatars in your domain. Cannot be greater than 1755.", "placeholder": 5.2, "default": 5.2 }, From 64b18ee5b9aa3ae4b2bd0fb8fda2bc13ddfb41f4 Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Wed, 18 Jul 2018 13:11:20 -0700 Subject: [PATCH 08/24] Change sys-tray Sandbox menu item from Go Home to Visit Sandbox --- server-console/src/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index dbbe699325..92ebdbf36c 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -405,7 +405,7 @@ LogWindow.prototype = { } }; -function goHomeClicked() { +function visitSandboxClicked() { if (interfacePath) { startInterface('hifi://localhost'); } else { @@ -439,8 +439,8 @@ var labels = { } }, goHome: { - label: 'Go Home', - click: goHomeClicked, + label: 'Visit Sandbox', + click: visitSandboxClicked, enabled: false }, quit: { From 965c35292c36a06df8cebcb879d2833220346ec0 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 19 Jul 2018 10:40:16 -0700 Subject: [PATCH 09/24] put back old-style avatar-attachments menu-item --- interface/src/Menu.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 8524c40262..130c2c0b89 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -275,6 +275,13 @@ Menu::Menu() { QString("hifi/tablet/TabletGraphicsPreferences.qml"), "GraphicsPreferencesDialog"); }); + // Settings > Attachments... + action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Attachments); + connect(action, &QAction::triggered, [] { + qApp->showDialog(QString("hifi/dialogs/AttachmentsDialog.qml"), + QString("hifi/tablet/TabletAttachmentsDialog.qml"), "AttachmentsDialog"); + }); + // Settings > Developer Menu addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus())); From a99f9310da11a5e60141c65da91e64351181067f Mon Sep 17 00:00:00 2001 From: MuteTab Date: Thu, 19 Jul 2018 12:41:24 -0700 Subject: [PATCH 10/24] Add first-run checks for flying settings. --- interface/src/Application.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 311c08b858..a1d4a1e8e2 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4838,7 +4838,13 @@ void Application::loadSettings() { } } - isFirstPerson = (qApp->isHMDMode()); + isFirstPerson = (qApp->isHMDMode()) + + // Flying should be disabled by default in HMD mode on first run, and it + // should be enabled by default in desktop mode, always. + auto myAvatar = getMyAvatar(); + myAvatar->setFlyingEnabled((isFirstPerson)?false:true); + } else { // if this is not the first run, the camera will be initialized differently depending on user settings From 63089df2dd64b2b4bd1c43422762a9dc26aa9ee0 Mon Sep 17 00:00:00 2001 From: MuteTab Date: Thu, 19 Jul 2018 12:42:45 -0700 Subject: [PATCH 11/24] Re-added missing semi-colon. --- interface/src/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a1d4a1e8e2..216ec9ac42 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4838,7 +4838,7 @@ void Application::loadSettings() { } } - isFirstPerson = (qApp->isHMDMode()) + isFirstPerson = (qApp->isHMDMode()); // Flying should be disabled by default in HMD mode on first run, and it // should be enabled by default in desktop mode, always. From 25b558e6b44ee1f6bca523d17feba84035d1c87f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 19 Jul 2018 12:56:18 -0700 Subject: [PATCH 12/24] Fix xz guides not showing when translating with Shift --- .../system/libraries/entitySelectionTool.js | 111 +++++++++++++++++- 1 file changed, 106 insertions(+), 5 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 96a3b2b015..5656ba68af 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -616,6 +616,40 @@ SelectionDisplay = (function() { dashed: false }); + var xRailOverlay = Overlays.addOverlay("line3d", { + visible: false, + start: Vec3.ZERO, + end: Vec3.ZERO, + color: { + red: 255, + green: 0, + blue: 0 + }, + ignoreRayIntersection: true // always ignore this + }); + var yRailOverlay = Overlays.addOverlay("line3d", { + visible: false, + start: Vec3.ZERO, + end: Vec3.ZERO, + color: { + red: 0, + green: 255, + blue: 0 + }, + ignoreRayIntersection: true // always ignore this + }); + var zRailOverlay = Overlays.addOverlay("line3d", { + visible: false, + start: Vec3.ZERO, + end: Vec3.ZERO, + color: { + red: 0, + green: 0, + blue: 255 + }, + ignoreRayIntersection: true // always ignore this +}); + var allOverlays = [ handleTranslateXCone, handleTranslateXCylinder, @@ -656,7 +690,11 @@ SelectionDisplay = (function() { handleScaleFLEdge, handleCloner, selectionBox, - iconSelectionBox + iconSelectionBox, + xRailOverlay, + yRailOverlay, + zRailOverlay + ]; var maximumHandleInAllOverlays = handleCloner; @@ -873,11 +911,14 @@ SelectionDisplay = (function() { }; // FUNCTION: MOUSE MOVE EVENT + var lastMouseEvent = null; that.mouseMoveEvent = function(event) { + print("Got mouse move event", JSON.stringify(event)); var wantDebug = false; if (wantDebug) { print("=============== eST::MouseMoveEvent BEG ======================="); } + lastMouseEvent = event; if (activeTool) { if (wantDebug) { print(" Trigger ActiveTool(" + activeTool.mode + ")'s onMove"); @@ -999,19 +1040,35 @@ SelectionDisplay = (function() { }; // Control key remains active only while key is held down - that.keyReleaseEvent = function(key) { - if (key.key === CTRL_KEY_CODE) { + that.keyReleaseEvent = function(event) { + if (event.key === CTRL_KEY_CODE) { ctrlPressed = false; that.updateActiveRotateRing(); } + if (activeTool && lastMouseEvent !== null) { + lastMouseEvent.isShifted = event.isShifted; + lastMouseEvent.isMeta = event.isMeta; + lastMouseEvent.isControl = event.isControl; + lastMouseEvent.isAlt = event.isAlt; + activeTool.onMove(lastMouseEvent); + SelectionManager._update(); + } }; // Triggers notification on specific key driven events - that.keyPressEvent = function(key) { - if (key.key === CTRL_KEY_CODE) { + that.keyPressEvent = function(event) { + if (event.key === CTRL_KEY_CODE) { ctrlPressed = true; that.updateActiveRotateRing(); } + if (activeTool && lastMouseEvent !== null) { + lastMouseEvent.isShifted = event.isShifted; + lastMouseEvent.isMeta = event.isMeta; + lastMouseEvent.isControl = event.isControl; + lastMouseEvent.isAlt = event.isAlt; + activeTool.onMove(lastMouseEvent); + SelectionManager._update(); + } }; // NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these: @@ -1705,6 +1762,14 @@ SelectionDisplay = (function() { }, onEnd: function(event, reason) { pushCommandForSelections(duplicatedEntityIDs); + if (isConstrained) { + Overlays.editOverlay(xRailOverlay, { + visible: false + }); + Overlays.editOverlay(zRailOverlay, { + visible: false + }); + } }, elevation: function(origin, intersection) { return (origin.y - intersection.y) / Vec3.distance(origin, intersection); @@ -1768,10 +1833,46 @@ SelectionDisplay = (function() { vector.x = 0; } if (!isConstrained) { + var xStart = Vec3.sum(startPosition, { + x: -10000, + y: 0, + z: 0 + }); + var xEnd = Vec3.sum(startPosition, { + x: 10000, + y: 0, + z: 0 + }); + var zStart = Vec3.sum(startPosition, { + x: 0, + y: 0, + z: -10000 + }); + var zEnd = Vec3.sum(startPosition, { + x: 0, + y: 0, + z: 10000 + }); + Overlays.editOverlay(xRailOverlay, { + start: xStart, + end: xEnd, + visible: true + }); + Overlays.editOverlay(zRailOverlay, { + start: zStart, + end: zEnd, + visible: true + }); isConstrained = true; } } else { if (isConstrained) { + Overlays.editOverlay(xRailOverlay, { + visible: false + }); + Overlays.editOverlay(zRailOverlay, { + visible: false + }); isConstrained = false; } } From b70b4244475f66a4c409d6cbbb33c7296a7dcb91 Mon Sep 17 00:00:00 2001 From: MuteTab Date: Thu, 19 Jul 2018 14:27:49 -0700 Subject: [PATCH 13/24] Added new menu classification for VR vs non-VR movement. --- interface/src/ui/PreferencesDialog.cpp | 52 ++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index d0fe92ea00..16b4b270f3 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -266,20 +266,15 @@ void setupPreferences() { preferences->addPreference(new SliderPreference(FACE_TRACKING, "Eye Deflection", getter, setter)); } - static const QString MOVEMENT{ "VR Movement" }; + static const QString MOVEMENT{ "Movement" }; { static const QString movementsControlChannel = QStringLiteral("Hifi-Advanced-Movement-Disabler"); auto getter = [=]()->bool { return myAvatar->useAdvancedMovementControls(); }; auto setter = [=](bool value) { myAvatar->setUseAdvancedMovementControls(value); }; preferences->addPreference(new CheckPreference(MOVEMENT, - QStringLiteral("Advanced movement for hand controllers"), - getter, setter)); - } - { - auto getter = [=]()->bool { return myAvatar->getFlyingEnabled(); }; - auto setter = [=](bool value) { myAvatar->setFlyingEnabled(value); }; - preferences->addPreference(new CheckPreference(MOVEMENT, "Flying & jumping", getter, setter)); + QStringLiteral("Advanced movement for hand controllers"), + getter, setter)); } { auto getter = [=]()->int { return myAvatar->getSnapTurn() ? 0 : 1; }; @@ -307,6 +302,47 @@ void setupPreferences() { preferences->addPreference(preference); } + static const QString VR_MOVEMENT{ "VR Movement" }; + { + + static const QString movementsControlChannel = QStringLiteral("Hifi-Advanced-Movement-Disabler"); + auto getter = [=]()->bool { return myAvatar->useAdvancedMovementControls(); }; + auto setter = [=](bool value) { myAvatar->setUseAdvancedMovementControls(value); }; + preferences->addPreference(new CheckPreference(VR_MOVEMENT, + QStringLiteral("Advanced movement for hand controllers"), + getter, setter)); + } + { + auto getter = [=]()->bool { return myAvatar->getFlyingEnabled(); }; + auto setter = [=](bool value) { myAvatar->setFlyingEnabled(value); }; + preferences->addPreference(new CheckPreference(VR_MOVEMENT, "Flying", getter, setter)); + } + { + auto getter = [=]()->int { return myAvatar->getSnapTurn() ? 0 : 1; }; + auto setter = [=](int value) { myAvatar->setSnapTurn(value == 0); }; + auto preference = new RadioButtonsPreference(VR_MOVEMENT, "Snap turn / Smooth turn", getter, setter); + QStringList items; + items << "Snap turn" << "Smooth turn"; + preference->setItems(items); + preferences->addPreference(preference); + } + { + auto getter = [=]()->float { return myAvatar->getUserHeight(); }; + auto setter = [=](float value) { myAvatar->setUserHeight(value); }; + auto preference = new SpinnerPreference(VR_MOVEMENT, "User real-world height (meters)", getter, setter); + preference->setMin(1.0f); + preference->setMax(2.2f); + preference->setDecimals(3); + preference->setStep(0.001f); + preferences->addPreference(preference); + } + { + auto preference = new ButtonPreference(VR_MOVEMENT, "RESET SENSORS", [] { + qApp->resetSensors(); + }); + preferences->addPreference(preference); + } + static const QString AVATAR_CAMERA{ "Mouse Sensitivity" }; { auto getter = [=]()->float { return myAvatar->getPitchSpeed(); }; From 97e5d65592033d752d95915e09729f88f1939659 Mon Sep 17 00:00:00 2001 From: MuteTab Date: Thu, 19 Jul 2018 14:30:06 -0700 Subject: [PATCH 14/24] Added conditional check for VR vs non-VR menu. --- interface/resources/qml/hifi/tablet/ControllerSettings.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/ControllerSettings.qml b/interface/resources/qml/hifi/tablet/ControllerSettings.qml index 135c1379e2..0a45feb61f 100644 --- a/interface/resources/qml/hifi/tablet/ControllerSettings.qml +++ b/interface/resources/qml/hifi/tablet/ControllerSettings.qml @@ -299,7 +299,7 @@ Item { anchors.fill: stackView id: controllerPrefereneces objectName: "TabletControllerPreferences" - showCategories: ["VR Movement", "Game Controller", "Sixense Controllers", "Perception Neuron", "Leap Motion"] + showCategories: [( (HMD.active) ? "VR Movement" : "Movement"), "Game Controller", "Sixense Controllers", "Perception Neuron", "Leap Motion"] categoryProperties: { "VR Movement" : { "User real-world height (meters)" : { "anchors.right" : "undefined" }, From 3080539b63952024e1dcf496a6d0e5ba509d724e Mon Sep 17 00:00:00 2001 From: MuteTab Date: Thu, 19 Jul 2018 14:40:20 -0700 Subject: [PATCH 15/24] Make getFlyingEnabled() always true when in desktop. --- interface/src/avatar/MyAvatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index fd121055a1..91be9ec4cc 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2837,7 +2837,8 @@ bool MyAvatar::isInAir() { bool MyAvatar::getFlyingEnabled() { // May return true even if client is not allowed to fly in the zone. - return _enableFlying; + // Should always return true if in desktop mode. + return (qApp->isHMDMode()) ? _enableFlying : true; } // Public interface for targetscale From 8d65e14193374c26e20c8f22064409412711ebd4 Mon Sep 17 00:00:00 2001 From: MuteTab Date: Thu, 19 Jul 2018 14:43:46 -0700 Subject: [PATCH 16/24] Remove one change, turned out to be unnecessary. --- interface/src/avatar/MyAvatar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 91be9ec4cc..69625d403f 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2822,6 +2822,7 @@ void MyAvatar::setFlyingEnabled(bool enabled) { return; } + // Flying should always be enabled for desktop users, preference may be set for HMD. _enableFlying = enabled; } @@ -2837,8 +2838,7 @@ bool MyAvatar::isInAir() { bool MyAvatar::getFlyingEnabled() { // May return true even if client is not allowed to fly in the zone. - // Should always return true if in desktop mode. - return (qApp->isHMDMode()) ? _enableFlying : true; + return _enableFlying; } // Public interface for targetscale From dfcf47e8ee0e64b9e394a773bcf35f622f348785 Mon Sep 17 00:00:00 2001 From: MuteTab Date: Thu, 19 Jul 2018 14:44:32 -0700 Subject: [PATCH 17/24] Removed useless comment. --- interface/src/avatar/MyAvatar.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 69625d403f..fd121055a1 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2822,7 +2822,6 @@ void MyAvatar::setFlyingEnabled(bool enabled) { return; } - // Flying should always be enabled for desktop users, preference may be set for HMD. _enableFlying = enabled; } From 3108d650de08209360d339665bae5bfcf40735b6 Mon Sep 17 00:00:00 2001 From: r3tk0n <39922250+r3tk0n@users.noreply.github.com> Date: Fri, 20 Jul 2018 08:29:11 -0700 Subject: [PATCH 18/24] Restore original menu string for flying Restore the original menu string for flying as it apparently *does* effect jumping. --- interface/src/ui/PreferencesDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 16b4b270f3..135b59a152 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -315,7 +315,7 @@ void setupPreferences() { { auto getter = [=]()->bool { return myAvatar->getFlyingEnabled(); }; auto setter = [=](bool value) { myAvatar->setFlyingEnabled(value); }; - preferences->addPreference(new CheckPreference(VR_MOVEMENT, "Flying", getter, setter)); + preferences->addPreference(new CheckPreference(VR_MOVEMENT, "Flying & jumping", getter, setter)); } { auto getter = [=]()->int { return myAvatar->getSnapTurn() ? 0 : 1; }; From ce3922a3c1e7bc52e8ea24ddda584235eea56709 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Fri, 20 Jul 2018 11:23:02 -0700 Subject: [PATCH 19/24] fix avatarEntities undefined crash --- scripts/system/avatarapp.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/system/avatarapp.js b/scripts/system/avatarapp.js index f692128fa3..1f07813d46 100644 --- a/scripts/system/avatarapp.js +++ b/scripts/system/avatarapp.js @@ -159,13 +159,12 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See for(var bookmarkName in message.data.bookmarks) { var bookmark = message.data.bookmarks[bookmarkName]; - if (!bookmark.avatarEntites) { // ensure avatarEntites always exist - bookmark.avatarEntites = []; - } - bookmark.avatarEntites.forEach(function(avatarEntity) { - avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation) - }) + if (bookmark.avatarEntites) { + bookmark.avatarEntites.forEach(function(avatarEntity) { + avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation) + }); + } } sendToQml(message) From 32122a7c1f6908bbe7c383b80aa7be4292f32973 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 20 Jul 2018 11:37:42 -0700 Subject: [PATCH 20/24] Replace magic numbers with RAIL_AXIS_LENGTH --- scripts/system/libraries/entitySelectionTool.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 5656ba68af..0eac5e8a7e 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -381,6 +381,8 @@ SelectionDisplay = (function() { var CTRL_KEY_CODE = 16777249; + var RAIL_AXIS_LENGTH = 10000; + var TRANSLATE_DIRECTION = { X: 0, Y: 1, @@ -1834,24 +1836,24 @@ SelectionDisplay = (function() { } if (!isConstrained) { var xStart = Vec3.sum(startPosition, { - x: -10000, + x: -RAIL_AXIS_LENGTH, y: 0, z: 0 }); var xEnd = Vec3.sum(startPosition, { - x: 10000, + x: RAIL_AXIS_LENGTH, y: 0, z: 0 }); var zStart = Vec3.sum(startPosition, { x: 0, y: 0, - z: -10000 + z: -RAIL_AXIS_LENGTH }); var zEnd = Vec3.sum(startPosition, { x: 0, y: 0, - z: 10000 + z: RAIL_AXIS_LENGTH }); Overlays.editOverlay(xRailOverlay, { start: xStart, From ae26c5fe9a283d24c36061d45679d5da23132592 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 20 Jul 2018 11:38:02 -0700 Subject: [PATCH 21/24] Remove extraneous logging --- scripts/system/libraries/entitySelectionTool.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 0eac5e8a7e..6956c7010f 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -915,7 +915,6 @@ SelectionDisplay = (function() { // FUNCTION: MOUSE MOVE EVENT var lastMouseEvent = null; that.mouseMoveEvent = function(event) { - print("Got mouse move event", JSON.stringify(event)); var wantDebug = false; if (wantDebug) { print("=============== eST::MouseMoveEvent BEG ======================="); From 9bf6cff5cd9a2cdf31f8781c34b9a046eaafe361 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Fri, 20 Jul 2018 12:27:51 -0700 Subject: [PATCH 22/24] fix indent isssues --- scripts/system/avatarapp.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/system/avatarapp.js b/scripts/system/avatarapp.js index 1f07813d46..2162b78721 100644 --- a/scripts/system/avatarapp.js +++ b/scripts/system/avatarapp.js @@ -160,11 +160,11 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See for(var bookmarkName in message.data.bookmarks) { var bookmark = message.data.bookmarks[bookmarkName]; - if (bookmark.avatarEntites) { - bookmark.avatarEntites.forEach(function(avatarEntity) { - avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation) - }); - } + if (bookmark.avatarEntites) { + bookmark.avatarEntites.forEach(function(avatarEntity) { + avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation); + }); + } } sendToQml(message) From bc91affa708b8cbddd95d5b95af9bc0bd8dd4d56 Mon Sep 17 00:00:00 2001 From: r3tk0n Date: Fri, 20 Jul 2018 15:13:44 -0700 Subject: [PATCH 23/24] Bring this PR inline with RC70.1 PR. --- interface/src/Application.cpp | 5 +++-- interface/src/avatar/MyAvatar.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 216ec9ac42..ae212e933d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4841,9 +4841,10 @@ void Application::loadSettings() { isFirstPerson = (qApp->isHMDMode()); // Flying should be disabled by default in HMD mode on first run, and it - // should be enabled by default in desktop mode, always. + // should be enabled by default in desktop mode. + auto myAvatar = getMyAvatar(); - myAvatar->setFlyingEnabled((isFirstPerson)?false:true); + myAvatar->setFlyingEnabled(!isFirstPerson); } else { // if this is not the first run, the camera will be initialized differently depending on user settings diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index fd121055a1..6a3ae91dd6 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1281,7 +1281,8 @@ void MyAvatar::loadData() { settings.remove("avatarEntityData"); } setAvatarEntityDataChanged(true); - setFlyingEnabled(settings.value("enabledFlying").toBool()); + Setting::Handle firstRunVal { Settings::firstRun, true }; + setFlyingEnabled(firstRunVal.get() ? getFlyingEnabled() : settings.value("enabledFlying").toBool()); setDisplayName(settings.value("displayName").toString()); setCollisionSoundURL(settings.value("collisionSoundURL", DEFAULT_AVATAR_COLLISION_SOUND_URL).toString()); setSnapTurn(settings.value("useSnapTurn", _useSnapTurn).toBool()); From f06c57a1f4417196f241a27a7922dda9298c3ac8 Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Mon, 23 Jul 2018 15:51:54 -0300 Subject: [PATCH 24/24] Android - fix crash when returning from domains to Home when attempting to detach when not necessary --- android/app/src/main/cpp/native.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/cpp/native.cpp b/android/app/src/main/cpp/native.cpp index 42124bf154..82fd86b3dd 100644 --- a/android/app/src/main/cpp/native.cpp +++ b/android/app/src/main/cpp/native.cpp @@ -162,7 +162,19 @@ JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCrea jvmArgs.version = JNI_VERSION_1_6; // choose your JNI version jvmArgs.name = NULL; // you might want to give the java thread a name jvmArgs.group = NULL; // you might want to assign the java thread to a ThreadGroup - jvm->AttachCurrentThread(reinterpret_cast(&myNewEnv), &jvmArgs); + + int attachedHere = 0; // know if detaching at the end is necessary + jint res = jvm->GetEnv((void**)&myNewEnv, JNI_VERSION_1_6); // checks if current env needs attaching or it is already attached + if (JNI_OK != res) { + qDebug() << "[JCRASH] GetEnv env not attached yet, attaching now.."; + res = jvm->AttachCurrentThread(reinterpret_cast(&myNewEnv), &jvmArgs); + if (JNI_OK != res) { + qDebug() << "[JCRASH] Failed to AttachCurrentThread, ErrorCode = " << res; + return; + } else { + attachedHere = 1; + } + } QAndroidJniObject string = QAndroidJniObject::fromString(a); jboolean jBackToScene = (jboolean) backToScene; @@ -175,7 +187,9 @@ JNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCrea myNewEnv->CallObjectMethod(hashmap, mapClassPut, QAndroidJniObject::fromString("url").object(), jArg.object()); } __interfaceActivity.callMethod("openAndroidActivity", "(Ljava/lang/String;ZLjava/util/HashMap;)V", string.object(), jBackToScene, hashmap); - jvm->DetachCurrentThread(); + if (attachedHere) { + jvm->DetachCurrentThread(); + } }); QObject::connect(&AndroidHelper::instance(), &AndroidHelper::hapticFeedbackRequested, [](int duration) {