From cba0b295e8f5ef8ca57e63dc30b8a611d24e66bc Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Mon, 23 Jan 2017 15:09:08 -0500 Subject: [PATCH 1/8] connect audio injector signal to scripting --- libraries/script-engine/src/ScriptAudioInjector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/script-engine/src/ScriptAudioInjector.cpp b/libraries/script-engine/src/ScriptAudioInjector.cpp index 2ec30ad4dd..c0ad2debd9 100644 --- a/libraries/script-engine/src/ScriptAudioInjector.cpp +++ b/libraries/script-engine/src/ScriptAudioInjector.cpp @@ -32,7 +32,7 @@ void injectorFromScriptValue(const QScriptValue& object, ScriptAudioInjector*& o ScriptAudioInjector::ScriptAudioInjector(AudioInjector* injector) : _injector(injector) { - + QObject::connect(injector, &AudioInjector::finished, this, &ScriptAudioInjector::finished); } ScriptAudioInjector::~ScriptAudioInjector() { From d108fabd0b9ff64165bcc8d3823546ae9690c458 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 23 Jan 2017 13:56:48 -0800 Subject: [PATCH 2/8] Update the name of the collision shapes used in edit.js properties Update the names to be consistent with what is shown on the add model dialog. --- scripts/system/html/entityProperties.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index 1de59ad135..63131bb155 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -328,13 +328,13 @@
From f6d5a59c8ae2b4a82259a846d7b15f3c537be53b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 23 Jan 2017 14:18:56 -0800 Subject: [PATCH 3/8] Fix width of edit.js dropdown to accomodate collision options --- scripts/system/html/css/edit-style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/html/css/edit-style.css b/scripts/system/html/css/edit-style.css index 91138e41ec..251d0a2d75 100644 --- a/scripts/system/html/css/edit-style.css +++ b/scripts/system/html/css/edit-style.css @@ -593,7 +593,7 @@ hr { .dropdown dl { font-family: FiraSans-SemiBold; font-size: 15px; - width: 172px; + width: 292px; height: 28px; padding: 0 28px 0 12px; color: #afafaf; @@ -645,7 +645,7 @@ hr { .dropdown li { list-style-type: none; padding: 3px 0 1px 12px; - width: 200px; + width: 320px; height: auto; font-family: FiraSans-SemiBold; font-size: 15px; From a1962e274d2cb6b41dcd51002f897bbbbc3bd670 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 23 Jan 2017 14:35:16 -0800 Subject: [PATCH 4/8] Fix rescale for 0.x values --- scripts/system/edit.js | 2 +- scripts/system/html/js/entityProperties.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index ad04c8b139..91e43ebb9a 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -1556,7 +1556,7 @@ var PropertiesTool = function (opts) { Camera.cameraEntity = selectionManager.selections[0]; } } else if (data.action === "rescaleDimensions") { - var multiplier = data.percentage / 100; + var multiplier = data.percentage / 100.0; if (selectionManager.hasSelection()) { selectionManager.saveProperties(); for (i = 0; i < selectionManager.selections.length; i++) { diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 4fe13196f3..3c155d83ea 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -1392,7 +1392,7 @@ function loaded() { EventBridge.emitWebEvent(JSON.stringify({ type: "action", action: "rescaleDimensions", - percentage: parseInt(elRescaleDimensionsPct.value), + percentage: parseFloat(elRescaleDimensionsPct.value), })); }); elReloadScriptButton.addEventListener("click", function() { From 3db8c5b4a77333e9f4e2d2972f23f81ec3159000 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 Jan 2017 16:36:04 -0800 Subject: [PATCH 5/8] Fix tilt on tablet for HMD users without hand controllers --- scripts/system/libraries/WebTablet.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 903065dd2e..6b18f06059 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -64,9 +64,10 @@ function calcSpawnInfo(hand, height) { } else { var front = Quat.getFront(Camera.orientation); finalPosition = Vec3.sum(Camera.position, Vec3.multiply(0.6, front)); + var orientation = Quat.lookAt({x: 0, y: 0, z: 0}, front, {x: 0, y: 1, z: 0}); return { position: finalPosition, - rotation: Quat.multiply(Camera.orientation, {x: 0, y: 1, z: 0, w: 0}) + rotation: Quat.multiply(orientation, {x: 0, y: 1, z: 0, w: 0}) }; } } From 0ab956a0c101e6a6a585559f2d66ed234d2c5f4c Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 Jan 2017 17:08:25 -0800 Subject: [PATCH 6/8] A and B buttons on oculus touch no longer trigger UI Nav events --- interface/resources/controllers/standard_navigation.json | 4 +--- interface/resources/controllers/xbox.json | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/resources/controllers/standard_navigation.json b/interface/resources/controllers/standard_navigation.json index 36cab8be8f..a557ba7b45 100644 --- a/interface/resources/controllers/standard_navigation.json +++ b/interface/resources/controllers/standard_navigation.json @@ -6,9 +6,7 @@ { "from": "Standard.DL", "to": "Actions.UiNavLateral", "filters": "invert" }, { "from": "Standard.DR", "to": "Actions.UiNavLateral" }, { "from": "Standard.LB", "to": "Actions.UiNavGroup","filters": "invert" }, - { "from": "Standard.RB", "to": "Actions.UiNavGroup" }, - { "from": [ "Standard.A", "Standard.X" ], "to": "Actions.UiNavSelect" }, - { "from": [ "Standard.B", "Standard.Y" ], "to": "Actions.UiNavBack" } + { "from": "Standard.RB", "to": "Actions.UiNavGroup" } ] } diff --git a/interface/resources/controllers/xbox.json b/interface/resources/controllers/xbox.json index 0b4a992fa7..08088f50d9 100644 --- a/interface/resources/controllers/xbox.json +++ b/interface/resources/controllers/xbox.json @@ -56,6 +56,9 @@ { "from": "GamePad.A", "to": "Standard.A" }, { "from": "GamePad.B", "to": "Standard.B" }, { "from": "GamePad.X", "to": "Standard.X" }, - { "from": "GamePad.Y", "to": "Standard.Y" } + { "from": "GamePad.Y", "to": "Standard.Y" }, + + { "from": [ "Standard.A", "Standard.X" ], "to": "Actions.UiNavSelect" }, + { "from": [ "Standard.B", "Standard.Y" ], "to": "Actions.UiNavBack" } ] } From e30d77eba18875ebaf482d447dd44e4e620a274c Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 Jan 2017 17:33:46 -0800 Subject: [PATCH 7/8] Tablet goto button now properly tracks address bar shown state --- scripts/system/goto.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/system/goto.js b/scripts/system/goto.js index 5059a27ce2..2051c2a9b0 100644 --- a/scripts/system/goto.js +++ b/scripts/system/goto.js @@ -14,7 +14,6 @@ (function() { // BEGIN LOCAL_SCOPE var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); -var isActive = false var button = tablet.addButton({ icon: "icons/tablet-icons/goto-i.svg", text:"GOTO" @@ -22,14 +21,13 @@ var button = tablet.addButton({ function onAddressBarShown(visible) { + button.editProperties({isActive: visible}); } function setActive(active) { isActive = active; } function onClicked(){ - setActive(!isActive); - button.editProperties({isActive: isActive}); DialogsManager.toggleAddressBar(); } button.clicked.connect(onClicked); From 432bb2711997d2a356904d26e5cb91eb461f1ccb Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 Jan 2017 18:34:59 -0800 Subject: [PATCH 8/8] The tablet Help button should be active if window is visible --- interface/src/scripting/MenuScriptingInterface.cpp | 7 +++++++ interface/src/scripting/MenuScriptingInterface.h | 1 + libraries/ui/src/OffscreenUi.cpp | 9 +++++++++ libraries/ui/src/OffscreenUi.h | 1 + libraries/ui/src/ui/Menu.cpp | 5 +++++ libraries/ui/src/ui/Menu.h | 1 + scripts/system/help.js | 10 ++++++++++ 7 files changed, 34 insertions(+) diff --git a/interface/src/scripting/MenuScriptingInterface.cpp b/interface/src/scripting/MenuScriptingInterface.cpp index 06f0f4acb5..cf186271d2 100644 --- a/interface/src/scripting/MenuScriptingInterface.cpp +++ b/interface/src/scripting/MenuScriptingInterface.cpp @@ -151,3 +151,10 @@ void MenuScriptingInterface::closeInfoView(const QString& path) { QMetaObject::invokeMethod(Menu::getInstance(), "closeInfoView", Q_ARG(const QString&, path)); } +bool MenuScriptingInterface::isInfoViewVisible(const QString& path) { + bool result; + QMetaObject::invokeMethod(Menu::getInstance(), "isInfoViewVisible", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(bool, result), Q_ARG(const QString&, path)); + return result; +} + diff --git a/interface/src/scripting/MenuScriptingInterface.h b/interface/src/scripting/MenuScriptingInterface.h index b1b4a75366..b9c29ccf08 100644 --- a/interface/src/scripting/MenuScriptingInterface.h +++ b/interface/src/scripting/MenuScriptingInterface.h @@ -183,6 +183,7 @@ public slots: void setMenuEnabled(const QString& menuName, bool isEnabled); void closeInfoView(const QString& path); + bool isInfoViewVisible(const QString& path); signals: /**jsdoc diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 918fb7b54a..7724a409f0 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -130,6 +130,15 @@ void OffscreenUi::hide(const QString& name) { } } +bool OffscreenUi::isVisible(const QString& name) { + QQuickItem* item = getRootItem()->findChild(name); + if (item) { + return QQmlProperty(item, OFFSCREEN_VISIBILITY_PROPERTY).read().toBool(); + } else { + return false; + } +} + class ModalDialogListener : public QObject { Q_OBJECT friend class OffscreenUi; diff --git a/libraries/ui/src/OffscreenUi.h b/libraries/ui/src/OffscreenUi.h index c648e2ec86..5813d0bfd2 100644 --- a/libraries/ui/src/OffscreenUi.h +++ b/libraries/ui/src/OffscreenUi.h @@ -40,6 +40,7 @@ public: void createDesktop(const QUrl& url); void show(const QUrl& url, const QString& name, std::function f = [](QQmlContext*, QObject*) {}); void hide(const QString& name); + bool isVisible(const QString& name); void toggle(const QUrl& url, const QString& name, std::function f = [](QQmlContext*, QObject*) {}); bool shouldSwallowShortcut(QEvent* event); bool navigationFocused(); diff --git a/libraries/ui/src/ui/Menu.cpp b/libraries/ui/src/ui/Menu.cpp index 364268830b..f68fff0204 100644 --- a/libraries/ui/src/ui/Menu.cpp +++ b/libraries/ui/src/ui/Menu.cpp @@ -261,6 +261,11 @@ void Menu::closeInfoView(const QString& path) { offscreenUi->hide(path); } +bool Menu::isInfoViewVisible(const QString& path) { + auto offscreenUi = DependencyManager::get(); + return offscreenUi->isVisible(path); +} + void Menu::triggerOption(const QString& menuOption) { QAction* action = _actionHash.value(menuOption); if (action) { diff --git a/libraries/ui/src/ui/Menu.h b/libraries/ui/src/ui/Menu.h index 32e916816e..9839bd1eb6 100644 --- a/libraries/ui/src/ui/Menu.h +++ b/libraries/ui/src/ui/Menu.h @@ -115,6 +115,7 @@ public slots: void toggleDeveloperMenus(); void toggleAdvancedMenus(); + bool isInfoViewVisible(const QString& path); void closeInfoView(const QString& path); void triggerOption(const QString& menuOption); diff --git a/scripts/system/help.js b/scripts/system/help.js index 1b6501c963..a83ac24595 100644 --- a/scripts/system/help.js +++ b/scripts/system/help.js @@ -53,7 +53,17 @@ button.clicked.connect(onClicked); + var POLL_RATE = 500; + var interval = Script.setInterval(function () { + var visible = Menu.isInfoViewVisible('InfoView_html/help.html'); + if (visible !== enabled) { + enabled = visible; + button.editProperties({isActive: enabled}); + } + }, POLL_RATE); + Script.scriptEnding.connect(function () { + Script.clearInterval(interval); tablet.removeButton(button); });