use a setting to decide which UI is enabled

This commit is contained in:
Seth Alves 2017-01-25 14:17:45 -08:00
parent f18094f565
commit 98f1664a46
12 changed files with 13 additions and 20 deletions

View file

@ -31,7 +31,7 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen
Q_PROPERTY(bool showTablet READ getShouldShowTablet) Q_PROPERTY(bool showTablet READ getShouldShowTablet)
Q_PROPERTY(QUuid tabletID READ getCurrentTableUIID WRITE setCurrentTabletUIID) Q_PROPERTY(QUuid tabletID READ getCurrentTableUIID WRITE setCurrentTabletUIID)
Q_PROPERTY(unsigned int homeButtonID READ getCurrentHomeButtonUUID WRITE setCurrentHomeButtonUUID) Q_PROPERTY(unsigned int homeButtonID READ getCurrentHomeButtonUUID WRITE setCurrentHomeButtonUUID)
Q_PROPERTY(bool hudUIEnabled READ getHUDUIEnabled WRITE setHUDUIEnabled);
public: public:
Q_INVOKABLE glm::vec3 calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction) const; Q_INVOKABLE glm::vec3 calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction) const;
@ -96,9 +96,6 @@ public:
void setCurrentHomeButtonUUID(unsigned int homeButtonID) { _homeButtonID = homeButtonID; } void setCurrentHomeButtonUUID(unsigned int homeButtonID) { _homeButtonID = homeButtonID; }
unsigned int getCurrentHomeButtonUUID() const { return _homeButtonID; } unsigned int getCurrentHomeButtonUUID() const { return _homeButtonID; }
bool getHUDUIEnabled() const { return _hudUIEnabled; }
void setHUDUIEnabled(bool value) { _hudUIEnabled = value; }
private: private:
bool _showTablet { false }; bool _showTablet { false };
QUuid _tabletUIID; // this is the entityID of the WebEntity which is part of (a child of) the tablet-ui. QUuid _tabletUIID; // this is the entityID of the WebEntity which is part of (a child of) the tablet-ui.
@ -114,8 +111,6 @@ private:
bool getHUDLookAtPosition3D(glm::vec3& result) const; bool getHUDLookAtPosition3D(glm::vec3& result) const;
glm::mat4 getWorldHMDMatrix() const; glm::mat4 getWorldHMDMatrix() const;
std::atomic<int> _showHandControllersCount { 0 }; std::atomic<int> _showHandControllersCount { 0 };
bool _hudUIEnabled;
}; };
#endif // hifi_HMDScriptingInterface_h #endif // hifi_HMDScriptingInterface_h

View file

@ -43,8 +43,6 @@ var DEFAULT_SCRIPTS = [
var MENU_CATEGORY = "Developer"; var MENU_CATEGORY = "Developer";
var MENU_ITEM = "Debug defaultScripts.js"; var MENU_ITEM = "Debug defaultScripts.js";
HMD.hudUIEnabled = true;
var SETTINGS_KEY = '_debugDefaultScriptsIsChecked'; var SETTINGS_KEY = '_debugDefaultScriptsIsChecked';
var previousSetting = Settings.getValue(SETTINGS_KEY); var previousSetting = Settings.getValue(SETTINGS_KEY);

View file

@ -165,7 +165,7 @@
// Setup the bubble button // Setup the bubble button
var buttonName = "BUBBLE"; var buttonName = "BUBBLE";
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolbar.addButton({ button = toolbar.addButton({
objectName: 'bubble', objectName: 'bubble',

View file

@ -237,7 +237,7 @@ var toolBar = (function () {
}); });
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
systemToolbar = Toolbars.getToolbar(SYSTEM_TOOLBAR); systemToolbar = Toolbars.getToolbar(SYSTEM_TOOLBAR);
activeButton = systemToolbar.addButton({ activeButton = systemToolbar.addButton({
objectName: EDIT_TOGGLE_BUTTON, objectName: EDIT_TOGGLE_BUTTON,

View file

@ -27,7 +27,7 @@ function onClicked(){
DialogsManager.toggleAddressBar(); DialogsManager.toggleAddressBar();
} }
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolBar.addButton({ button = toolBar.addButton({
objectName: buttonName, objectName: buttonName,

View file

@ -18,7 +18,7 @@
var buttonName = "HELP"; var buttonName = "HELP";
var toolBar = null; var toolBar = null;
var tablet = null; var tablet = null;
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolBar.addButton({ button = toolBar.addButton({
objectName: buttonName, objectName: buttonName,

View file

@ -40,7 +40,7 @@ var button;
var toolBar = null; var toolBar = null;
var tablet = null; var tablet = null;
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
} else { } else {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
@ -50,7 +50,7 @@ if (HMD.hudUIEnabled) {
// Disable them in hmd. // Disable them in hmd.
var desktopOnlyViews = ['Mirror', 'Independent Mode', 'Entity Mode']; var desktopOnlyViews = ['Mirror', 'Independent Mode', 'Entity Mode'];
function onHmdChanged(isHmd) { function onHmdChanged(isHmd) {
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
button.writeProperty('buttonState', isHmd ? 0 : 1); button.writeProperty('buttonState', isHmd ? 0 : 1);
button.writeProperty('defaultState', isHmd ? 0 : 1); button.writeProperty('defaultState', isHmd ? 0 : 1);
button.writeProperty('hoverState', isHmd ? 2 : 3); button.writeProperty('hoverState', isHmd ? 2 : 3);
@ -78,7 +78,7 @@ function onClicked(){
Menu.setIsOptionChecked(isDesktop ? headset : desktopMenuItemName, true); Menu.setIsOptionChecked(isDesktop ? headset : desktopMenuItemName, true);
} }
if (headset) { if (headset) {
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
button = toolBar.addButton({ button = toolBar.addButton({
objectName: "hmdToggle", objectName: "hmdToggle",
imageURL: Script.resolvePath("assets/images/tools/switch.svg"), imageURL: Script.resolvePath("assets/images/tools/switch.svg"),

View file

@ -112,7 +112,7 @@ function toggleMarketplace() {
var tablet = null; var tablet = null;
var toolBar = null; var toolBar = null;
var marketplaceButton = null; var marketplaceButton = null;
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
marketplaceWindow = new OverlayWebWindow({ marketplaceWindow = new OverlayWebWindow({
title: "Marketplace", title: "Marketplace",
source: "about:blank", source: "about:blank",

View file

@ -26,7 +26,7 @@ function onClicked(){
Menu.setIsOptionChecked(menuItem, !Menu.isOptionChecked(menuItem)); Menu.setIsOptionChecked(menuItem, !Menu.isOptionChecked(menuItem));
} }
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolBar.addButton({ button = toolBar.addButton({
objectName: buttonName, objectName: buttonName,

View file

@ -481,7 +481,7 @@ var button;
var buttonName = "PAL"; var buttonName = "PAL";
var tablet = null; var tablet = null;
var toolBar = null; var toolBar = null;
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolBar.addButton({ button = toolBar.addButton({
objectName: buttonName, objectName: buttonName,

View file

@ -22,7 +22,7 @@ var buttonName = "SNAP";
var tablet = null; var tablet = null;
var toolBar = null; var toolBar = null;
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolBar.addButton({ button = toolBar.addButton({
objectName: buttonName, objectName: buttonName,

View file

@ -20,7 +20,7 @@ var tablet = null;
var MENU_ITEM = "Users Online"; var MENU_ITEM = "Users Online";
if (HMD.hudUIEnabled) { if (Settings.getValue("HUDUIEnabled")) {
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolBar.addButton({ button = toolBar.addButton({
objectName: buttonName, objectName: buttonName,