From adee5e9ef7a544e201fadf3a5e75ff71aa8d0287 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 24 May 2018 17:54:53 -0700 Subject: [PATCH 01/26] fix crash --- interface/src/ui/overlays/Web3DOverlay.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index c678e3d2a2..8af818edc6 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -259,7 +259,6 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("Web3DOverlay", this); _webSurface->getSurfaceContext()->setContextProperty("Window", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("Reticle", qApp->getApplicationCompositor().getReticleInterface()); - _webSurface->getSurfaceContext()->setContextProperty("desktop", DependencyManager::get()->getDesktop()); _webSurface->getSurfaceContext()->setContextProperty("HiFiAbout", AboutUtil::getInstance()); // Override min fps for tablet UI, for silky smooth scrolling From 720b0a896323a309e71486d1bc0193e337aad3b3 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 25 May 2018 09:51:16 -0700 Subject: [PATCH 02/26] Adding fix for enabling saved front/back advanced controls. --- ...oggleAdvancedMovementForHandControllers.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js index a1b96ac607..78b074573f 100644 --- a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js +++ b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js @@ -171,4 +171,24 @@ Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL); Messages.messageReceived.connect(handleMessage); + function initializeControls() { + if(HMD.active) { + if (Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) { + if (MyAvatar.useAdvancedMovementControls) { + Controller.disableMapping(DRIVING_MAPPING_NAME); + } else { + Controller.enableMapping(DRIVING_MAPPING_NAME); + } + + if (MyAvatar.getFlyingEnabled()) { + Controller.disableMapping(FLYING_MAPPING_NAME); + } else { + Controller.enableMapping(FLYING_MAPPING_NAME); + } + }); + + } + } + + initializeControls(); }()); // END LOCAL_SCOPE From 68b18def2252f15f0e72fed81e2feb8e919ca6ac Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 25 May 2018 15:34:17 -0700 Subject: [PATCH 03/26] fix copy delete cut paste commands and menus --- interface/src/Menu.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index f55c389a1f..42618796a5 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -103,16 +103,32 @@ Menu::Menu() { editMenu->addSeparator(); // Edit > Cut - addActionToQMenuAndActionHash(editMenu, "Cut", Qt::CTRL | Qt::Key_X); + auto cutAction = addActionToQMenuAndActionHash(editMenu, "Cut", QKeySequence::Cut); + connect(cutAction, &QAction::triggered, [] { + QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_X, Qt::ControlModifier); + QCoreApplication::postEvent(QCoreApplication::instance(), keyEvent); + }); // Edit > Copy - addActionToQMenuAndActionHash(editMenu, "Copy", Qt::CTRL | Qt::Key_C); + auto copyAction = addActionToQMenuAndActionHash(editMenu, "Copy", QKeySequence::Copy); + connect(copyAction, &QAction::triggered, [] { + QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_C, Qt::ControlModifier); + QCoreApplication::postEvent(QCoreApplication::instance(), keyEvent); + }); // Edit > Paste - addActionToQMenuAndActionHash(editMenu, "Paste", Qt::CTRL | Qt::Key_V); + auto pasteAction = addActionToQMenuAndActionHash(editMenu, "Paste", QKeySequence::Paste); + connect(pasteAction, &QAction::triggered, [] { + QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_V, Qt::ControlModifier); + QCoreApplication::postEvent(QCoreApplication::instance(), keyEvent); + }); // Edit > Delete - addActionToQMenuAndActionHash(editMenu, "Delete", Qt::Key_Delete); + auto deleteAction =addActionToQMenuAndActionHash(editMenu, "Delete", QKeySequence::Delete); + connect(deleteAction, &QAction::triggered, [] { + QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Delete, Qt::ControlModifier); + QCoreApplication::postEvent(QCoreApplication::instance(), keyEvent); + }); editMenu->addSeparator(); From 3942f397d006fb3aefc72f7e4af1c660301c1ba7 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 29 May 2018 17:38:02 -0700 Subject: [PATCH 04/26] adding back reload scripts --- interface/src/AboutUtil.cpp | 16 ++++++++-------- interface/src/AboutUtil.h | 19 ++++++++----------- interface/src/Application.cpp | 8 +++++++- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/interface/src/AboutUtil.cpp b/interface/src/AboutUtil.cpp index 5179897443..43b4ac1ff4 100644 --- a/interface/src/AboutUtil.cpp +++ b/interface/src/AboutUtil.cpp @@ -20,9 +20,9 @@ #include AboutUtil::AboutUtil(QObject *parent) : QObject(parent) { - QLocale locale_; - m_DateConverted = QDate::fromString(BuildInfo::BUILD_TIME, "dd/MM/yyyy"). - toString(locale_.dateFormat(QLocale::ShortFormat)); + QLocale locale; + _dateConverted = QDate::fromString(BuildInfo::BUILD_TIME, "dd/MM/yyyy"). + toString(locale.dateFormat(QLocale::ShortFormat)); } AboutUtil *AboutUtil::getInstance() @@ -31,17 +31,17 @@ AboutUtil *AboutUtil::getInstance() return &instance; } -QString AboutUtil::buildDate() const +QString AboutUtil::getBuildDate() const { - return m_DateConverted; + return _dateConverted; } -QString AboutUtil::buildVersion() const +QString AboutUtil::getBuildVersion() const { return BuildInfo::VERSION; } -QString AboutUtil::qtVersion() const +QString AboutUtil::getQtVersion() const { return qVersion(); } @@ -49,7 +49,7 @@ QString AboutUtil::qtVersion() const void AboutUtil::openUrl(const QString& url) const { auto tabletScriptingInterface = DependencyManager::get(); - auto tablet = dynamic_cast(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); + auto tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"); auto hmd = DependencyManager::get(); auto offscreenUi = DependencyManager::get(); diff --git a/interface/src/AboutUtil.h b/interface/src/AboutUtil.h index 9b65b887b9..06c04cc9df 100644 --- a/interface/src/AboutUtil.h +++ b/interface/src/AboutUtil.h @@ -16,27 +16,24 @@ #include class AboutUtil : public QObject { - Q_OBJECT - Q_PROPERTY(QString buildDate READ buildDate CONSTANT) - Q_PROPERTY(QString buildVersion READ buildVersion CONSTANT) - Q_PROPERTY(QString qtVersion READ qtVersion CONSTANT) - - AboutUtil(QObject* parent = nullptr); + Q_PROPERTY(QString buildDate READ getBuildDate CONSTANT) + Q_PROPERTY(QString buildVersion READ getBuildVersion CONSTANT) + Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT) public: static AboutUtil* getInstance(); ~AboutUtil() {} - QString buildDate() const; - QString buildVersion() const; - QString qtVersion() const; + QString getBuildDate() const; + QString getBuildVersion() const; + QString getQtVersion() const; public slots: void openUrl(const QString &url) const; private: - - QString m_DateConverted; + AboutUtil(QObject* parent = nullptr); + QString _dateConverted; }; #endif // hifi_AboutUtil_h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6a102f418b..626ece9fe5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3642,7 +3642,6 @@ void Application::keyPressEvent(QKeyEvent* event) { _keysPressed.insert(event->key()); _controllerScriptingInterface->emitKeyPressEvent(event); // send events to any registered scripts - // if one of our scripts have asked to capture this event, then stop processing it if (_controllerScriptingInterface->isKeyCaptured(event)) { return; @@ -3727,6 +3726,13 @@ void Application::keyPressEvent(QKeyEvent* event) { } break; + case Qt::Key_R: + if (isMeta && !event->isAutoRepeat()) { + DependencyManager::get()->reloadAllScripts(); + DependencyManager::get()->clearCache(); + } + break; + case Qt::Key_Asterisk: Menu::getInstance()->triggerOption(MenuOption::DefaultSkybox); break; From 646b852aefa6d3c0643de54a4f6cab9d964b9c2d Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 29 May 2018 17:55:42 -0700 Subject: [PATCH 05/26] fix headers --- interface/src/AboutUtil.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/interface/src/AboutUtil.cpp b/interface/src/AboutUtil.cpp index 43b4ac1ff4..634e52b481 100644 --- a/interface/src/AboutUtil.cpp +++ b/interface/src/AboutUtil.cpp @@ -8,16 +8,18 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // + +#include "AboutUtil.h" #include #include -#include "AboutUtil.h" -#include "BuildInfo.h" #include +#include + +#include "BuildInfo.h" #include "DependencyManager.h" #include "scripting/HMDScriptingInterface.h" #include "Application.h" -#include AboutUtil::AboutUtil(QObject *parent) : QObject(parent) { QLocale locale; @@ -25,24 +27,20 @@ AboutUtil::AboutUtil(QObject *parent) : QObject(parent) { toString(locale.dateFormat(QLocale::ShortFormat)); } -AboutUtil *AboutUtil::getInstance() -{ +AboutUtil *AboutUtil::getInstance() { static AboutUtil instance; return &instance; } -QString AboutUtil::getBuildDate() const -{ +QString AboutUtil::getBuildDate() const { return _dateConverted; } -QString AboutUtil::getBuildVersion() const -{ +QString AboutUtil::getBuildVersion() const { return BuildInfo::VERSION; } -QString AboutUtil::getQtVersion() const -{ +QString AboutUtil::getQtVersion() const { return qVersion(); } From 19308c3a58bcbf8e3d6680fb6ad74463008ff318 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 30 May 2018 11:22:17 -0700 Subject: [PATCH 06/26] fixing typo in script file. --- .../toggleAdvancedMovementForHandControllers.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js index 78b074573f..92d079cff6 100644 --- a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js +++ b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js @@ -185,10 +185,9 @@ } else { Controller.enableMapping(FLYING_MAPPING_NAME); } - }); + } + } + } - } - } - - initializeControls(); + initializeControls(); }()); // END LOCAL_SCOPE From 6fa58fce1f22c1bd3efa838feff1566d41d00f2b Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 29 May 2018 16:42:09 -0300 Subject: [PATCH 07/26] Update Application.cpp Remove the mic bar for android --- interface/src/Application.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6a102f418b..b4372cf8c2 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3011,9 +3011,11 @@ void Application::onDesktopRootItemCreated(QQuickItem* rootItem) { auto surfaceContext = DependencyManager::get()->getSurfaceContext(); surfaceContext->setContextProperty("Stats", Stats::getInstance()); +#if !defined(Q_OS_ANDROID) auto offscreenUi = DependencyManager::get(); auto qml = PathUtils::qmlUrl("AvatarInputsBar.qml"); offscreenUi->show(qml, "AvatarInputsBar"); +#endif } void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) { From 3f696df3a50fc26e2f3c6ef6a4ca57d42d362d8f Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 29 May 2018 17:21:44 -0300 Subject: [PATCH 08/26] Show stats button only in debug mode. Add isDebugMode to Script public interface --- libraries/script-engine/src/ScriptEngine.cpp | 8 ++++++++ libraries/script-engine/src/ScriptEngine.h | 6 ++++++ scripts/+android/defaultScripts.js | 17 +++++++++++++++-- scripts/system/+android/stats.js | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 23ffbabe77..72860acbc5 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -237,6 +237,14 @@ QString ScriptEngine::getContext() const { return "unknown"; } +bool ScriptEngine::isDebugMode() const { +#if defined(DEBUG) + return true; +#else + return false; +#endif +} + ScriptEngine::~ScriptEngine() { auto scriptEngines = DependencyManager::get(); if (scriptEngines) { diff --git a/libraries/script-engine/src/ScriptEngine.h b/libraries/script-engine/src/ScriptEngine.h index 3001666b5d..c02a63ef3c 100644 --- a/libraries/script-engine/src/ScriptEngine.h +++ b/libraries/script-engine/src/ScriptEngine.h @@ -232,6 +232,12 @@ public: */ Q_INVOKABLE bool isClientScript() const { return _context == CLIENT_SCRIPT; } + /**jsdoc + * @function Script.isDebugMode + * @returns {boolean} + */ + Q_INVOKABLE bool isDebugMode() const; + /**jsdoc * @function Script.isEntityClientScript * @returns {boolean} diff --git a/scripts/+android/defaultScripts.js b/scripts/+android/defaultScripts.js index 98fbb4b1a7..8950af808d 100644 --- a/scripts/+android/defaultScripts.js +++ b/scripts/+android/defaultScripts.js @@ -16,8 +16,7 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/+android/touchscreenvirtualpad.js", "system/+android/actionbar.js", "system/+android/audio.js" , - "system/+android/modes.js", - "system/+android/stats.js"/*, + "system/+android/modes.js"/*, "system/away.js", "system/controllers/controllerDisplayManager.js", "system/controllers/handControllerGrabAndroid.js", @@ -33,6 +32,10 @@ var DEFAULT_SCRIPTS_COMBINED = [ "developer/debugging/debugAndroidMouse.js"*/ ]; +var DEBUG_SCRIPTS = [ + "system/+android/stats.js" +]; + var DEFAULT_SCRIPTS_SEPARATE = [ ]; // add a menu item for debugging @@ -70,6 +73,11 @@ function runDefaultsTogether() { for (var i in DEFAULT_SCRIPTS_COMBINED) { Script.include(DEFAULT_SCRIPTS_COMBINED[i]); } + if (Script.isDebugMode()) { + for (var i in DEBUG_SCRIPTS) { + Script.include(DEBUG_SCRIPTS[i]); + } + } loadSeparateDefaults(); } @@ -77,6 +85,11 @@ function runDefaultsSeparately() { for (var i in DEFAULT_SCRIPTS_COMBINED) { Script.load(DEFAULT_SCRIPTS_COMBINED[i]); } + if (Script.isDebugMode()) { + for (var i in DEBUG_SCRIPTS) { + Script.load(DEBUG_SCRIPTS[i]); + } + } loadSeparateDefaults(); } diff --git a/scripts/system/+android/stats.js b/scripts/system/+android/stats.js index a93bcb5794..0731684291 100644 --- a/scripts/system/+android/stats.js +++ b/scripts/system/+android/stats.js @@ -30,7 +30,7 @@ function init() { text: "STATS" }); statsButton.clicked.connect(function() { - Menu.triggerOption("Stats"); + Menu.triggerOption("Show Statistics"); }); } From 785c0b634d1e98117815e280ab45260177ff32bd Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Fri, 25 May 2018 17:42:41 -0300 Subject: [PATCH 09/26] Change gradle configuration to sign release apk. Remove Daydream intent from AndroidManifest --- android/app/build.gradle | 9 +++++++++ android/app/src/main/AndroidManifest.xml | 6 ------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 70f7c622a0..5f92417ba4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,6 +27,14 @@ android { '-DDISABLE_KTX_CACHE=OFF' } } + signingConfigs { + release { + storeFile file(HIFI_ANDROID_KEYSTORE) + storePassword HIFI_ANDROID_KEYSTORE_PASSWORD + keyAlias HIFI_ANDROID_KEY_ALIAS + keyPassword HIFI_ANDROID_KEY_PASSWORD + } + } } compileOptions { @@ -38,6 +46,7 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e105f5bccf..0b52046057 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -49,12 +49,6 @@ android:label="@string/app_name" android:launchMode="singleTop" > - - - - - - From a0274f8b4bac07ae45f70efcbc670202c0f14078 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 30 May 2018 12:43:44 -0300 Subject: [PATCH 10/26] Make APK release signature optional --- android/app/build.gradle | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5f92417ba4..46de9642d9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -29,10 +29,10 @@ android { } signingConfigs { release { - storeFile file(HIFI_ANDROID_KEYSTORE) - storePassword HIFI_ANDROID_KEYSTORE_PASSWORD - keyAlias HIFI_ANDROID_KEY_ALIAS - keyPassword HIFI_ANDROID_KEY_PASSWORD + storeFile project.hasProperty("HIFI_ANDROID_KEYSTORE") ? file(HIFI_ANDROID_KEYSTORE) : null + storePassword project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") ? HIFI_ANDROID_KEYSTORE_PASSWORD : '' + keyAlias project.hasProperty("HIFI_ANDROID_KEY_ALIAS") ? HIFI_ANDROID_KEY_ALIAS : '' + keyPassword project.hasProperty("HIFI_ANDROID_KEY_PASSWORD") ? HIFI_ANDROID_KEY_PASSWORD : '' } } } @@ -46,7 +46,10 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release + signingConfig project.hasProperty("HIFI_ANDROID_KEYSTORE") && + project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") && + project.hasProperty("HIFI_ANDROID_KEY_ALIAS") && + project.hasProperty("HIFI_ANDROID_KEY_PASSWORD")? signingConfigs.release : null } } From 8cdbf460db8590487ece33be01a93888d55842be Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 30 May 2018 13:36:02 -0700 Subject: [PATCH 11/26] adding back notifcations --- scripts/defaultScripts.js | 1 + scripts/system/notifications.js | 49 --------------------------------- 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index b0cbf0e246..59a51830be 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -23,6 +23,7 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/makeUserConnection.js", "system/tablet-goto.js", "system/marketplaces/marketplaces.js", + "system/notifications.js", "system/commerce/wallet.js", "system/edit.js", "system/dialTone.js", diff --git a/scripts/system/notifications.js b/scripts/system/notifications.js index a28f343ad3..0778e2a44b 100644 --- a/scripts/system/notifications.js +++ b/scripts/system/notifications.js @@ -79,11 +79,7 @@ var frame = 0; var ctrlIsPressed = false; var ready = true; - var MENU_NAME = 'Tools > Notifications'; - var PLAY_NOTIFICATION_SOUNDS_MENU_ITEM = "Play Notification Sounds"; var NOTIFICATION_MENU_ITEM_POST = " Notifications"; - var PLAY_NOTIFICATION_SOUNDS_SETTING = "play_notification_sounds"; - var PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE = "play_notification_sounds_type_"; var NOTIFICATIONS_MESSAGE_CHANNEL = "Hifi-Notifications"; var NotificationType = { @@ -401,11 +397,6 @@ alpha: backgroundAlpha }; - if (Menu.isOptionChecked(PLAY_NOTIFICATION_SOUNDS_MENU_ITEM) && - Menu.isOptionChecked(NotificationType.getMenuString(notificationType))) { - randomSounds.playRandom(); - } - return notify(noticeProperties, buttonProperties, height, imageProperties); } @@ -618,30 +609,6 @@ } } - function setup() { - var type; - Menu.addMenu(MENU_NAME); - var checked = Settings.getValue(PLAY_NOTIFICATION_SOUNDS_SETTING); - checked = checked === '' ? true : checked; - Menu.addMenuItem({ - menuName: MENU_NAME, - menuItemName: PLAY_NOTIFICATION_SOUNDS_MENU_ITEM, - isCheckable: true, - isChecked: Settings.getValue(PLAY_NOTIFICATION_SOUNDS_SETTING) - }); - Menu.addSeparator(MENU_NAME, "Play sounds for:"); - for (type in NotificationType.properties) { - checked = Settings.getValue(PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE + (parseInt(type, 10) + 1)); - checked = checked === '' ? true : checked; - Menu.addMenuItem({ - menuName: MENU_NAME, - menuItemName: NotificationType.properties[type].text + NOTIFICATION_MENU_ITEM_POST, - isCheckable: true, - isChecked: checked - }); - } - } - // When our script shuts down, we should clean up all of our overlays function scriptEnding() { var notificationIndex; @@ -649,27 +616,14 @@ Overlays.deleteOverlay(notifications[notificationIndex]); Overlays.deleteOverlay(buttons[notificationIndex]); } - Menu.removeMenu(MENU_NAME); Messages.unsubscribe(NOTIFICATIONS_MESSAGE_CHANNEL); } - function menuItemEvent(menuItem) { - if (menuItem === PLAY_NOTIFICATION_SOUNDS_MENU_ITEM) { - Settings.setValue(PLAY_NOTIFICATION_SOUNDS_SETTING, Menu.isOptionChecked(PLAY_NOTIFICATION_SOUNDS_MENU_ITEM)); - return; - } - var notificationType = NotificationType.getTypeFromMenuItem(menuItem); - if (notificationType !== notificationType.UNKNOWN) { - Settings.setValue(PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE + notificationType, Menu.isOptionChecked(menuItem)); - } - } - Controller.keyPressEvent.connect(keyPressEvent); Controller.mousePressEvent.connect(mousePressEvent); Controller.keyReleaseEvent.connect(keyReleaseEvent); Script.update.connect(update); Script.scriptEnding.connect(scriptEnding); - Menu.menuItemEvent.connect(menuItemEvent); Window.domainConnectionRefused.connect(onDomainConnectionRefused); Window.stillSnapshotTaken.connect(onSnapshotTaken); Window.snapshot360Taken.connect(onSnapshotTaken); @@ -684,7 +638,4 @@ Messages.subscribe(NOTIFICATIONS_MESSAGE_CHANNEL); Messages.messageReceived.connect(onMessageReceived); - - setup(); - }()); // END LOCAL_SCOPE From 03bad0265c3a4259eddc4d97a160440c693b887e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 31 May 2018 11:09:51 +1200 Subject: [PATCH 12/26] Fix properties not populating particle explorer tab --- scripts/system/edit.js | 11 +++----- .../particle_explorer/particleExplorerTool.js | 26 ++++++++++++++++--- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index f549c7dd85..9285023ed8 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -2366,22 +2366,19 @@ var selectedParticleEntity = 0; var selectedParticleEntityID = null; function selectParticleEntity(entityID) { - var properties = Entities.getEntityProperties(entityID); selectedParticleEntityID = entityID; + + var properties = Entities.getEntityProperties(entityID); if (properties.emitOrientation) { properties.emitOrientation = Quat.safeEulerAngles(properties.emitOrientation); } - var particleData = { - messageType: "particle_settings", - currentProperties: properties - }; + particleExplorerTool.destroyWebView(); particleExplorerTool.createWebView(); selectedParticleEntity = entityID; particleExplorerTool.setActiveParticleEntity(entityID); - - particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData)); + particleExplorerTool.setActiveParticleProperties(properties); // Switch to particle explorer var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); diff --git a/scripts/system/particle_explorer/particleExplorerTool.js b/scripts/system/particle_explorer/particleExplorerTool.js index d85fc169b1..016691e2b6 100644 --- a/scripts/system/particle_explorer/particleExplorerTool.js +++ b/scripts/system/particle_explorer/particleExplorerTool.js @@ -16,37 +16,55 @@ var PARTICLE_EXPLORER_HTML_URL = Script.resolvePath('particleExplorer.html'); ParticleExplorerTool = function() { var that = {}; + that.activeParticleEntity = 0; + that.activeParticleProperties = {}; + that.createWebView = function() { that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); that.webView.setVisible = function(value) {}; that.webView.webEventReceived.connect(that.webEventReceived); - } + }; that.destroyWebView = function() { if (!that.webView) { return; } that.activeParticleEntity = 0; + that.activeParticleProperties = {}; var messageData = { messageType: "particle_close" }; that.webView.emitScriptEvent(JSON.stringify(messageData)); + }; + + function sendActiveParticleProperies() { + that.webView.emitScriptEvent(JSON.stringify({ + messageType: "particle_settings", + currentProperties: that.activeParticleProperties + })); } that.webEventReceived = function(data) { - var data = JSON.parse(data); + data = JSON.parse(data); if (data.messageType === "settings_update") { if (data.updatedSettings.emitOrientation) { data.updatedSettings.emitOrientation = Quat.fromVec3Degrees(data.updatedSettings.emitOrientation); } Entities.editEntity(that.activeParticleEntity, data.updatedSettings); + } else if (data.messageType === "page_loaded") { + sendActiveParticleProperies(); } - } + }; that.setActiveParticleEntity = function(id) { that.activeParticleEntity = id; - } + }; + + that.setActiveParticleProperties = function(properties) { + that.activeParticleProperties = properties; + sendActiveParticleProperies(); + }; return that; }; From 4efdba738283a58b7619bb001a18029c4fb4cb38 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 31 May 2018 11:10:54 +1200 Subject: [PATCH 13/26] Remove redundant variable --- scripts/system/edit.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 9285023ed8..05f5e3cb19 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -2362,7 +2362,6 @@ var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace"); var propertiesTool = new PropertiesTool(); var particleExplorerTool = new ParticleExplorerTool(); -var selectedParticleEntity = 0; var selectedParticleEntityID = null; function selectParticleEntity(entityID) { @@ -2376,7 +2375,6 @@ function selectParticleEntity(entityID) { particleExplorerTool.destroyWebView(); particleExplorerTool.createWebView(); - selectedParticleEntity = entityID; particleExplorerTool.setActiveParticleEntity(entityID); particleExplorerTool.setActiveParticleProperties(properties); @@ -2401,13 +2399,13 @@ entityListTool.webView.webEventReceived.connect(function (data) { var ids = data.entityIds; if (ids.length === 1) { if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") { - if (JSON.stringify(selectedParticleEntity) === JSON.stringify(ids[0])) { + if (JSON.stringify(selectedParticleEntityID) === JSON.stringify(ids[0])) { // This particle entity is already selected, so return return; } // Destroy the old particles web view first } else { - selectedParticleEntity = 0; + selectedParticleEntityID = 0; particleExplorerTool.destroyWebView(); } } From f99b2dd23fd1e0bc81b0d3afa1494f323ba4dac8 Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Thu, 31 May 2018 16:02:41 -0300 Subject: [PATCH 14/26] Android - Fix joystick and view control bug that makes it bounce --- .../src/input-plugins/TouchscreenVirtualPadDevice.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp index 8d63b82911..32194e1b84 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp @@ -350,6 +350,8 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { if (idxMoveStartingPointCandidate != -1) { _moveCurrentTouchId = tPoints[idxMoveStartingPointCandidate].id(); _unusedTouches.erase(_moveCurrentTouchId); + thisPoint.x = tPoints[idxMoveStartingPointCandidate].pos().x(); + thisPoint.y = tPoints[idxMoveStartingPointCandidate].pos().y(); moveTouchBegin(thisPoint); } else { moveTouchEnd(); @@ -359,6 +361,8 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { if (idxViewStartingPointCandidate != -1) { _viewCurrentTouchId = tPoints[idxViewStartingPointCandidate].id(); _unusedTouches.erase(_viewCurrentTouchId); + thisPoint.x = tPoints[idxViewStartingPointCandidate].pos().x(); + thisPoint.y = tPoints[idxViewStartingPointCandidate].pos().y(); viewTouchBegin(thisPoint); } else { viewTouchEnd(); @@ -368,6 +372,8 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { if (idxJumpStartingPointCandidate != -1) { _jumpCurrentTouchId = tPoints[idxJumpStartingPointCandidate].id(); _unusedTouches.erase(_jumpCurrentTouchId); + thisPoint.x = tPoints[idxJumpStartingPointCandidate].pos().x(); + thisPoint.y = tPoints[idxJumpStartingPointCandidate].pos().y(); jumpTouchBegin(thisPoint); } else { if (_jumpHasValidTouch) { @@ -424,6 +430,7 @@ void TouchscreenVirtualPadDevice::moveTouchBegin(glm::vec2 touchPoint) { } else { _moveRefTouchPoint = touchPoint; } + _moveCurrentTouchPoint = touchPoint; _moveHasValidTouch = true; } } From 146f871bec463dcb62f621c741c4eabe36888167 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 1 Jun 2018 09:39:39 +1200 Subject: [PATCH 15/26] Don't modify function parameter --- scripts/system/particle_explorer/particleExplorerTool.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/particle_explorer/particleExplorerTool.js b/scripts/system/particle_explorer/particleExplorerTool.js index 016691e2b6..0543cfc56b 100644 --- a/scripts/system/particle_explorer/particleExplorerTool.js +++ b/scripts/system/particle_explorer/particleExplorerTool.js @@ -45,8 +45,8 @@ ParticleExplorerTool = function() { })); } - that.webEventReceived = function(data) { - data = JSON.parse(data); + that.webEventReceived = function(message) { + var data = JSON.parse(message); if (data.messageType === "settings_update") { if (data.updatedSettings.emitOrientation) { data.updatedSettings.emitOrientation = Quat.fromVec3Degrees(data.updatedSettings.emitOrientation); From 1a128abdfd098625914db983b817d28186425c08 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 31 May 2018 15:05:33 -0700 Subject: [PATCH 16/26] adding alternate solution. --- ...oggleAdvancedMovementForHandControllers.js | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js index 92d079cff6..92f72f8724 100644 --- a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js +++ b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js @@ -28,7 +28,7 @@ var isDisabled = false; var previousFlyingState = MyAvatar.getFlyingEnabled(); - var previousDrivingState = MyAvatar.useAdvancedMovementControls; + var previousDrivingState = false; function rotate180() { var newOrientation = Quat.multiply(MyAvatar.orientation, Quat.angleAxis(180, { @@ -100,7 +100,7 @@ Controller.enableMapping(DRIVING_MAPPING_NAME); } - if (MyAvatar.getFyingEnabled()) { + if (MyAvatar.getFlyingEnabled()) { Controller.disableMapping(FLYING_MAPPING_NAME); } else { Controller.enableMapping(FLYING_MAPPING_NAME); @@ -171,23 +171,4 @@ Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL); Messages.messageReceived.connect(handleMessage); - function initializeControls() { - if(HMD.active) { - if (Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) { - if (MyAvatar.useAdvancedMovementControls) { - Controller.disableMapping(DRIVING_MAPPING_NAME); - } else { - Controller.enableMapping(DRIVING_MAPPING_NAME); - } - - if (MyAvatar.getFlyingEnabled()) { - Controller.disableMapping(FLYING_MAPPING_NAME); - } else { - Controller.enableMapping(FLYING_MAPPING_NAME); - } - } - } - } - - initializeControls(); }()); // END LOCAL_SCOPE From 89c4b1ecdd65747b15b993fe627bcad0e4b880dc Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Fri, 1 Jun 2018 15:00:00 -0300 Subject: [PATCH 17/26] Workaround for android buffer corruption issue --- .../hifiinterface/InterfaceActivity.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java index 2165339918..e850ec639b 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java @@ -20,6 +20,9 @@ import android.os.Vibrator; import android.view.HapticFeedbackConstants; import android.view.WindowManager; import android.util.Log; + +import org.qtproject.qt5.android.QtLayout; +import org.qtproject.qt5.android.QtSurface; import org.qtproject.qt5.android.bindings.QtActivity; /*import com.google.vr.cardboard.DisplaySynchronizer; @@ -31,6 +34,9 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.view.View; +import android.widget.FrameLayout; + +import java.lang.reflect.Field; public class InterfaceActivity extends QtActivity { @@ -134,6 +140,7 @@ public class InterfaceActivity extends QtActivity { protected void onResume() { super.onResume(); nativeEnterForeground(); + surfacesWorkaround(); //gvrApi.resumeTracking(); } @@ -158,6 +165,31 @@ public class InterfaceActivity extends QtActivity { Log.w("[VR]", "Portrait detected but not in VR mode. Should not happen"); } } + surfacesWorkaround(); + } + + private void surfacesWorkaround() { + FrameLayout fl = findViewById(android.R.id.content); + QtLayout qtLayout = (QtLayout) fl.getChildAt(0); + QtSurface s1 = (QtSurface) qtLayout.getChildAt(0); + QtSurface s2 = (QtSurface) qtLayout.getChildAt(1); + Integer subLayer1 = 0; + Integer subLayer2 = 0; + try { + Field f = s1.getClass().getSuperclass().getDeclaredField("mSubLayer"); + f.setAccessible(true); + subLayer1 = (Integer) f.get(s1); + subLayer2 = (Integer) f.get(s2); + if (subLayer1 < subLayer2) { + s1.setVisibility(View.VISIBLE); + s2.setVisibility(View.INVISIBLE); + } else { + s1.setVisibility(View.INVISIBLE); + s2.setVisibility(View.VISIBLE); + } + } catch (ReflectiveOperationException e) { + Log.e(TAG, "Workaround failed"); + } } public void openUrlInAndroidWebView(String urlString) { From 61953d0070b60d8f0a71748ead97b2cccd0e0204 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Fri, 1 Jun 2018 15:48:57 -0300 Subject: [PATCH 18/26] Fix NullPointerException introduced with the workaround --- .../hifiinterface/InterfaceActivity.java | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java index e850ec639b..da938ab85b 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java @@ -170,25 +170,29 @@ public class InterfaceActivity extends QtActivity { private void surfacesWorkaround() { FrameLayout fl = findViewById(android.R.id.content); - QtLayout qtLayout = (QtLayout) fl.getChildAt(0); - QtSurface s1 = (QtSurface) qtLayout.getChildAt(0); - QtSurface s2 = (QtSurface) qtLayout.getChildAt(1); - Integer subLayer1 = 0; - Integer subLayer2 = 0; - try { - Field f = s1.getClass().getSuperclass().getDeclaredField("mSubLayer"); - f.setAccessible(true); - subLayer1 = (Integer) f.get(s1); - subLayer2 = (Integer) f.get(s2); - if (subLayer1 < subLayer2) { - s1.setVisibility(View.VISIBLE); - s2.setVisibility(View.INVISIBLE); - } else { - s1.setVisibility(View.INVISIBLE); - s2.setVisibility(View.VISIBLE); + if (fl.getChildCount() > 0) { + QtLayout qtLayout = (QtLayout) fl.getChildAt(0); + if (qtLayout.getChildCount() > 1) { + QtSurface s1 = (QtSurface) qtLayout.getChildAt(0); + QtSurface s2 = (QtSurface) qtLayout.getChildAt(1); + Integer subLayer1 = 0; + Integer subLayer2 = 0; + try { + Field f = s1.getClass().getSuperclass().getDeclaredField("mSubLayer"); + f.setAccessible(true); + subLayer1 = (Integer) f.get(s1); + subLayer2 = (Integer) f.get(s2); + if (subLayer1 < subLayer2) { + s1.setVisibility(View.VISIBLE); + s2.setVisibility(View.INVISIBLE); + } else { + s1.setVisibility(View.INVISIBLE); + s2.setVisibility(View.VISIBLE); + } + } catch (ReflectiveOperationException e) { + Log.e(TAG, "Workaround failed"); + } } - } catch (ReflectiveOperationException e) { - Log.e(TAG, "Workaround failed"); } } From 44027f74fc4558b4d67f546af70d3f9611590f3b Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Fri, 1 Jun 2018 17:11:14 -0300 Subject: [PATCH 19/26] Workaround for android < Oreo --- .../io/highfidelity/hifiinterface/InterfaceActivity.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java index da938ab85b..28acc77609 100644 --- a/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java +++ b/android/app/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java @@ -14,6 +14,7 @@ package io.highfidelity.hifiinterface; import android.content.Intent; import android.content.res.AssetManager; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Vibrator; @@ -178,7 +179,13 @@ public class InterfaceActivity extends QtActivity { Integer subLayer1 = 0; Integer subLayer2 = 0; try { - Field f = s1.getClass().getSuperclass().getDeclaredField("mSubLayer"); + String field; + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + field = "mSubLayer"; + } else { + field = "mWindowType"; + } + Field f = s1.getClass().getSuperclass().getDeclaredField(field); f.setAccessible(true); subLayer1 = (Integer) f.get(s1); subLayer2 = (Integer) f.get(s2); From 606b6d8947b87f646166d4cd8c0630dc65933330 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 4 Jun 2018 09:16:39 -0700 Subject: [PATCH 20/26] fix code standard issue --- interface/src/Menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 42618796a5..e9de94ac57 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -124,7 +124,7 @@ Menu::Menu() { }); // Edit > Delete - auto deleteAction =addActionToQMenuAndActionHash(editMenu, "Delete", QKeySequence::Delete); + auto deleteAction = addActionToQMenuAndActionHash(editMenu, "Delete", QKeySequence::Delete); connect(deleteAction, &QAction::triggered, [] { QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Delete, Qt::ControlModifier); QCoreApplication::postEvent(QCoreApplication::instance(), keyEvent); From f87775c269475158c10c7c28b59025324b1a6dde Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 4 Jun 2018 14:39:48 -0700 Subject: [PATCH 21/26] Update serverless content to v2 --- cmake/externals/serverless-content/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/externals/serverless-content/CMakeLists.txt b/cmake/externals/serverless-content/CMakeLists.txt index aa1c59a86b..81b82e8651 100644 --- a/cmake/externals/serverless-content/CMakeLists.txt +++ b/cmake/externals/serverless-content/CMakeLists.txt @@ -4,8 +4,8 @@ set(EXTERNAL_NAME serverless-content) ExternalProject_Add( ${EXTERNAL_NAME} - URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC68.zip - URL_MD5 a068f74d4045e257cfa7926fe6e38ad5 + URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC68-v2.zip + URL_MD5 f7d290471baf7f5694c147217b8fc548 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" From 9b91f7bb5af849d3b2a359ab6285d803473de04e Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 6 Jun 2018 03:43:27 +0300 Subject: [PATCH 22/26] FB15569 - Debug default scripts no longer on developer menu --- scripts/defaultScripts.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 59a51830be..045dff1295 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -57,7 +57,6 @@ if (Menu.menuExists(MENU_CATEGORY) && !Menu.menuItemExists(MENU_CATEGORY, MENU_I menuItemName: MENU_ITEM, isCheckable: true, isChecked: previousSetting, - grouping: "Advanced" }); } From da92ff993f76f961923895b39d62f26390396316 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 6 Jun 2018 03:52:22 +0300 Subject: [PATCH 23/26] terminate thread if it didn't complete during MAX_SCRIPT_QUITTING_TIME --- libraries/script-engine/src/ScriptEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 72860acbc5..8e329c9c07 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -419,7 +419,7 @@ void ScriptEngine::waitTillDoneRunning() { // Wait for the scripting thread to stop running, as // flooding it with aborts/exceptions will persist it longer static const auto MAX_SCRIPT_QUITTING_TIME = 0.5 * MSECS_PER_SECOND; - if (workerThread->wait(MAX_SCRIPT_QUITTING_TIME)) { + if (!workerThread->wait(MAX_SCRIPT_QUITTING_TIME)) { workerThread->terminate(); } } From 83e1db14cffb882c440b47f6f792249b2e1786ea Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 7 Jun 2018 18:56:23 -0700 Subject: [PATCH 24/26] Set UAL default value earlier to be caught by crashpad --- interface/src/Application.cpp | 10 +--------- interface/src/main.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 7ae34e2f51..60d5cf20f3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1443,17 +1443,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo // add firstRun flag from settings to launch event Setting::Handle firstRun { Settings::firstRun, true }; - // once the settings have been loaded, check if we need to flip the default for UserActivityLogger - auto& userActivityLogger = UserActivityLogger::getInstance(); - if (!userActivityLogger.isDisabledSettingSet()) { - // the user activity logger is opt-out for Interface - // but it's defaulted to disabled for other targets - // so we need to enable it here if it has never been disabled by the user - userActivityLogger.disable(false); - } - QString machineFingerPrint = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint()); + auto& userActivityLogger = UserActivityLogger::getInstance(); if (userActivityLogger.isEnabled()) { // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. // The value will be 0 if the user blew away settings this session, which is both a feature and a bug. diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 22db128f7e..cd8c052d63 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -81,6 +81,13 @@ int main(int argc, const char* argv[]) { // Instance UserActivityLogger now that the settings are loaded auto& ual = UserActivityLogger::getInstance(); + // once the settings have been loaded, check if we need to flip the default for UserActivityLogger + if (!ual.isDisabledSettingSet()) { + // the user activity logger is opt-out for Interface + // but it's defaulted to disabled for other targets + // so we need to enable it here if it has never been disabled by the user + ual.disable(false); + } qDebug() << "UserActivityLogger is enabled:" << ual.isEnabled(); if (ual.isEnabled()) { From a2399ea1f637a798a80aaa788a753d7936d73e1e Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 8 Jun 2018 16:07:01 -0700 Subject: [PATCH 25/26] keep small masses from introducing NaN into bullet's calculations --- libraries/physics/src/PhysicsEngine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 83ffa21a55..1a258c0fc3 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -105,6 +105,10 @@ void PhysicsEngine::addObjectToDynamicsWorld(ObjectMotionState* motionState) { } case MOTION_TYPE_DYNAMIC: { mass = motionState->getMass(); + if (mass != mass || mass < 1.0f) { + qCDebug(physics) << "mass is too low, setting to 1.0 Kg --" << mass; + mass = 1.0f; + } btCollisionShape* shape = const_cast(motionState->getShape()); assert(shape); shape->calculateLocalInertia(mass, inertia); From d31ee52d794b811f193af54583d32afb9b57bc89 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 12 Jun 2018 03:51:55 -0700 Subject: [PATCH 26/26] revert PR-13162 from RC68 --- interface/src/avatar/AvatarMotionState.cpp | 47 +++++-------------- interface/src/avatar/AvatarMotionState.h | 6 --- .../src/avatars-renderer/Avatar.cpp | 14 +++--- libraries/physics/src/ObjectMotionState.h | 2 +- 4 files changed, 19 insertions(+), 50 deletions(-) diff --git a/interface/src/avatar/AvatarMotionState.cpp b/interface/src/avatar/AvatarMotionState.cpp index beb7e34439..900c1c0a11 100644 --- a/interface/src/avatar/AvatarMotionState.cpp +++ b/interface/src/avatar/AvatarMotionState.cpp @@ -21,17 +21,6 @@ AvatarMotionState::AvatarMotionState(AvatarSharedPointer avatar, const btCollisi _type = MOTIONSTATE_TYPE_AVATAR; } -void AvatarMotionState::handleEasyChanges(uint32_t& flags) { - ObjectMotionState::handleEasyChanges(flags); - if (flags & Simulation::DIRTY_PHYSICS_ACTIVATION && !_body->isActive()) { - _body->activate(); - } -} - -bool AvatarMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine) { - return ObjectMotionState::handleHardAndEasyChanges(flags, engine); -} - AvatarMotionState::~AvatarMotionState() { assert(_avatar); _avatar = nullptr; @@ -57,9 +46,6 @@ PhysicsMotionType AvatarMotionState::computePhysicsMotionType() const { const btCollisionShape* AvatarMotionState::computeNewShape() { ShapeInfo shapeInfo; std::static_pointer_cast(_avatar)->computeShapeInfo(shapeInfo); - glm::vec3 halfExtents = shapeInfo.getHalfExtents(); - halfExtents.y = 0.0f; - _diameter = 2.0f * glm::length(halfExtents); return getShapeManager()->getShape(shapeInfo); } @@ -74,31 +60,25 @@ void AvatarMotionState::getWorldTransform(btTransform& worldTrans) const { worldTrans.setRotation(glmToBullet(getObjectRotation())); if (_body) { _body->setLinearVelocity(glmToBullet(getObjectLinearVelocity())); - _body->setAngularVelocity(glmToBullet(getObjectAngularVelocity())); + _body->setAngularVelocity(glmToBullet(getObjectLinearVelocity())); } } // virtual void AvatarMotionState::setWorldTransform(const btTransform& worldTrans) { + // HACK: The PhysicsEngine does not actually move OTHER avatars -- instead it slaves their local RigidBody to the transform + // as specified by a remote simulation. However, to give the remote simulation time to respond to our own objects we tie + // the other avatar's body to its true position with a simple spring. This is a HACK that will have to be improved later. const float SPRING_TIMESCALE = 0.5f; float tau = PHYSICS_ENGINE_FIXED_SUBSTEP / SPRING_TIMESCALE; btVector3 currentPosition = worldTrans.getOrigin(); - btVector3 offsetToTarget = glmToBullet(getObjectPosition()) - currentPosition; - float distance = offsetToTarget.length(); - if ((1.0f - tau) * distance > _diameter) { - // the avatar body is far from its target --> slam position - btTransform newTransform; - newTransform.setOrigin(currentPosition + offsetToTarget); - newTransform.setRotation(glmToBullet(getObjectRotation())); - _body->setWorldTransform(newTransform); - _body->setLinearVelocity(glmToBullet(getObjectLinearVelocity())); - _body->setAngularVelocity(glmToBullet(getObjectAngularVelocity())); - } else { - // the avatar body is near its target --> slam velocity - btVector3 velocity = glmToBullet(getObjectLinearVelocity()) + (1.0f / SPRING_TIMESCALE) * offsetToTarget; - _body->setLinearVelocity(velocity); - _body->setAngularVelocity(glmToBullet(getObjectAngularVelocity())); - } + btVector3 targetPosition = glmToBullet(getObjectPosition()); + btTransform newTransform; + newTransform.setOrigin((1.0f - tau) * currentPosition + tau * targetPosition); + newTransform.setRotation(glmToBullet(getObjectRotation())); + _body->setWorldTransform(newTransform); + _body->setLinearVelocity(glmToBullet(getObjectLinearVelocity())); + _body->setAngularVelocity(glmToBullet(getObjectLinearVelocity())); } // These pure virtual methods must be implemented for each MotionState type @@ -165,8 +145,3 @@ void AvatarMotionState::computeCollisionGroupAndMask(int16_t& group, int16_t& ma mask = Physics::getDefaultCollisionMask(group); } -// virtual -float AvatarMotionState::getMass() const { - return std::static_pointer_cast(_avatar)->computeMass(); -} - diff --git a/interface/src/avatar/AvatarMotionState.h b/interface/src/avatar/AvatarMotionState.h index 73fb853312..90bd2a60ac 100644 --- a/interface/src/avatar/AvatarMotionState.h +++ b/interface/src/avatar/AvatarMotionState.h @@ -23,9 +23,6 @@ class AvatarMotionState : public ObjectMotionState { public: AvatarMotionState(AvatarSharedPointer avatar, const btCollisionShape* shape); - virtual void handleEasyChanges(uint32_t& flags) override; - virtual bool handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine) override; - virtual PhysicsMotionType getMotionType() const override { return _motionType; } virtual uint32_t getIncomingDirtyFlags() override; @@ -67,8 +64,6 @@ public: virtual void computeCollisionGroupAndMask(int16_t& group, int16_t& mask) const override; - virtual float getMass() const override; - friend class AvatarManager; friend class Avatar; @@ -81,7 +76,6 @@ protected: virtual const btCollisionShape* computeNewShape() override; AvatarSharedPointer _avatar; - float _diameter { 0.0f }; uint32_t _dirtyFlags; }; diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index da829b23e4..048b8b1633 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -799,6 +799,7 @@ bool Avatar::shouldRenderHead(const RenderArgs* renderArgs) const { return true; } +// virtual void Avatar::simulateAttachments(float deltaTime) { assert(_attachmentModels.size() == _attachmentModelsTexturesLoaded.size()); PerformanceTimer perfTimer("attachments"); @@ -1481,14 +1482,12 @@ void Avatar::updateDisplayNameAlpha(bool showDisplayName) { } } +// virtual void Avatar::computeShapeInfo(ShapeInfo& shapeInfo) { float uniformScale = getModelScale(); - float radius = uniformScale * _skeletonModel->getBoundingCapsuleRadius(); - float height = uniformScale * _skeletonModel->getBoundingCapsuleHeight(); - shapeInfo.setCapsuleY(radius, 0.5f * height); - - glm::vec3 offset = uniformScale * _skeletonModel->getBoundingCapsuleOffset(); - shapeInfo.setOffset(offset); + shapeInfo.setCapsuleY(uniformScale * _skeletonModel->getBoundingCapsuleRadius(), + 0.5f * uniformScale * _skeletonModel->getBoundingCapsuleHeight()); + shapeInfo.setOffset(uniformScale * _skeletonModel->getBoundingCapsuleOffset()); } void Avatar::getCapsule(glm::vec3& start, glm::vec3& end, float& radius) { @@ -1511,8 +1510,9 @@ float Avatar::computeMass() { return _density * TWO_PI * radius * radius * (glm::length(end - start) + 2.0f * radius / 3.0f); } +// virtual void Avatar::rebuildCollisionShape() { - addPhysicsFlags(Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS); + addPhysicsFlags(Simulation::DIRTY_SHAPE); } void Avatar::setPhysicsCallback(AvatarPhysicsCallback cb) { diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index e1cf5a4285..fbda9366fc 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -111,7 +111,7 @@ public: virtual PhysicsMotionType getMotionType() const { return _motionType; } void setMass(float mass); - virtual float getMass() const; + float getMass() const; void setBodyLinearVelocity(const glm::vec3& velocity) const; void setBodyAngularVelocity(const glm::vec3& velocity) const;