diff --git a/interface/resources/qml/windows/Window.qml b/interface/resources/qml/windows/Window.qml index 20216ed7ae..a0ef73290a 100644 --- a/interface/resources/qml/windows/Window.qml +++ b/interface/resources/qml/windows/Window.qml @@ -313,6 +313,6 @@ Fadable { } } - onMouseEntered: console.log("Mouse entered " + window) - onMouseExited: console.log("Mouse exited " + window) + // onMouseEntered: console.log("Mouse entered " + window) + // onMouseExited: console.log("Mouse exited " + window) } diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 5f7556592e..f954f0d258 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -1,7 +1,6 @@ "use strict"; -// newEditEntities.js -// examples +// edit.js // // Created by Brad Hefta-Gaub on 10/2/14. // Persist toolbar by HRS 6/11/15. @@ -13,7 +12,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/* global Script, SelectionDisplay, LightOverlayManager, CameraManager, Grid, GridTool, EntityListTook, EntityListTool, Vec3, SelectionManager, Overlays, OverlayWebWindow, UserActivityLogger, Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */ +/* global Script, SelectionDisplay, LightOverlayManager, CameraManager, Grid, GridTool, EntityListTool, Vec3, SelectionManager, Overlays, OverlayWebWindow, UserActivityLogger, Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */ (function() { // BEGIN LOCAL_SCOPE @@ -208,27 +207,7 @@ var toolBar = (function () { var buttonHandlers = {}; // only used to tablet mode function addButton(name, image, handler) { - if (Settings.getValue("HUDUIEnabled")) { - var imageUrl = TOOLS_PATH + image; - var button = toolBar.addButton({ - objectName: name, - imageURL: imageUrl, - imageOffOut: 1, - imageOffIn: 2, - imageOnOut: 0, - imageOnIn: 2, - alpha: 0.9, - visible: true - }); - if (handler) { - button.clicked.connect(function () { - Script.setTimeout(handler, 100); - }); - } - return button; - } else { - buttonHandlers[name] = handler; - } + buttonHandlers[name] = handler; } var SHAPE_TYPE_NONE = 0; @@ -272,7 +251,6 @@ var toolBar = (function () { } function fromQml(message) { // messages are {method, params}, like json-rpc. See also sendToQml. - print("fromQml: " + JSON.stringify(message)); var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); tablet.popFromStack(); switch (message.method) { @@ -299,42 +277,24 @@ var toolBar = (function () { } }); - - if (Settings.getValue("HUDUIEnabled")) { - systemToolbar = Toolbars.getToolbar(SYSTEM_TOOLBAR); - activeButton = systemToolbar.addButton({ - objectName: EDIT_TOGGLE_BUTTON, - imageURL: TOOLS_PATH + "edit.svg", - visible: true, - alpha: 0.9, - defaultState: 1 - }); - systemToolbar.fromQml.connect(fromQml); - } else { - tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - activeButton = tablet.addButton({ - icon: "icons/tablet-icons/edit-i.svg", - activeIcon: "icons/tablet-icons/edit-a.svg", - text: "EDIT", - sortOrder: 10 - }); - tablet.screenChanged.connect(function (type, url) { - if (isActive && (type !== "QML" || url !== "Edit.qml")) { - that.toggle(); - } - }); - tablet.fromQml.connect(fromQml); - } + tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + activeButton = tablet.addButton({ + icon: "icons/tablet-icons/edit-i.svg", + activeIcon: "icons/tablet-icons/edit-a.svg", + text: "EDIT", + sortOrder: 10 + }); + tablet.screenChanged.connect(function (type, url) { + if (isActive && (type !== "QML" || url !== "Edit.qml")) { + that.toggle(); + } + }); + tablet.fromQml.connect(fromQml); activeButton.clicked.connect(function() { that.toggle(); }); - if (Settings.getValue("HUDUIEnabled")) { - toolBar = Toolbars.getToolbar(EDIT_TOOLBAR); - toolBar.writeProperty("shown", false); - } - addButton("openAssetBrowserButton", "assets-01.svg", function(){ Window.showAssetServer(); }); @@ -348,34 +308,9 @@ var toolBar = (function () { SHAPE_TYPES[SHAPE_TYPE_STATIC_MESH] = "Exact - All polygons"; var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_STATIC_MESH; - if (Settings.getValue("HUDUIEnabled")) { - // HUD-ui version of new-model dialog - var result = Window.customPrompt({ - textInput: { - label: "Model URL" - }, - comboBox: { - label: "Automatic Collisions", - index: SHAPE_TYPE_DEFAULT, - items: SHAPE_TYPES - }, - checkBox: { - label: "Dynamic", - checked: DYNAMIC_DEFAULT, - disableForItems: [ - SHAPE_TYPE_STATIC_MESH - ], - checkStateOnDisable: false, - warningOnDisable: "Models with automatic collisions set to 'Exact' cannot be dynamic" - } - }); - - handleNewModelDialogResult(result); - } else { - // tablet version of new-model dialog - var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - tablet.pushOntoStack("NewModelDialog.qml"); - } + // tablet version of new-model dialog + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + tablet.pushOntoStack("NewModelDialog.qml"); }); addButton("newCubeButton", "cube-01.svg", function () { @@ -497,11 +432,11 @@ var toolBar = (function () { entityListTool.clearEntityList(); }; - that.toggle = function () { that.setActive(!isActive); - if (Settings.getValue("HUDUIEnabled")) { - activeButton.editProperties({isActive: isActive}); + activeButton.editProperties({isActive: isActive}); + if (!isActive) { + tablet.gotoHomeScreen(); } }; @@ -532,10 +467,8 @@ var toolBar = (function () { cameraManager.disable(); selectionDisplay.triggerMapping.disable(); } else { - if (!Settings.getValue("HUDUIEnabled")) { - var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - tablet.loadQMLSource("Edit.qml"); - } + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + tablet.loadQMLSource("Edit.qml"); UserActivityLogger.enabledEdit(); entityListTool.setVisible(true); gridTool.setVisible(true); @@ -546,15 +479,6 @@ var toolBar = (function () { // everybody else to think that Interface has lost focus overall. fogbugzid:558 // Window.setFocus(); } - if (Settings.getValue("HUDUIEnabled")) { - // Sets visibility of tool buttons, excluding the power button - toolBar.writeProperty("shown", active); - var visible = toolBar.readProperty("visible"); - if (active && !visible) { - toolBar.writeProperty("shown", false); - toolBar.writeProperty("shown", true); - } - } lightOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_IN_EDIT_MODE)); Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE)); }; @@ -815,6 +739,12 @@ function mouseClickEvent(event) { orientation = MyAvatar.orientation; intersection = rayPlaneIntersection(pickRay, P, Quat.getFront(orientation)); + if (event.isShifted) { + particleExplorerTool.destroyWebView(); + } + if (properties.type !== "ParticleEffect") { + particleExplorerTool.destroyWebView(); + } if (!event.isShifted) { selectionManager.setSelections([foundEntity]); @@ -1493,16 +1423,8 @@ var PropertiesTool = function (opts) { var that = {}; var webView = null; - if (Settings.getValue("HUDUIEnabled")) { - webView = new OverlayWebWindow({ - title: 'Entity Properties', - source: ENTITY_PROPERTIES_URL, - toolWindow: true - }); - } else { - webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - webView.setVisible = function(value) {}; - } + webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + webView.setVisible = function(value) {}; var visible = false; @@ -1924,18 +1846,7 @@ function selectParticleEntity(entityID) { selectedParticleEntity = entityID; particleExplorerTool.setActiveParticleEntity(entityID); - - if (Settings.getValue("HUDUIEnabled")) { - particleExplorerTool.webView.webEventReceived.connect(function (data) { - data = JSON.parse(data); - if (data.messageType === "page_loaded") { - particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData)); - } - }); - } else { - // in the tablet version, the page was loaded earlier - particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData)); - } + particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData)); } entityListTool.webView.webEventReceived.connect(function (data) { @@ -1949,7 +1860,7 @@ entityListTool.webView.webEventReceived.connect(function (data) { return; } // Destroy the old particles web view first - selectParticleEntity(ids[0]) + selectParticleEntity(ids[0]); } else { selectedParticleEntity = 0; particleExplorerTool.destroyWebView(); diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js index 8ef028cdce..63ac33a1dd 100644 --- a/scripts/system/libraries/entityList.js +++ b/scripts/system/libraries/entityList.js @@ -1,18 +1,22 @@ -var ENTITY_LIST_HTML_URL = Script.resolvePath('../html/entityList.html'); +"use strict"; + +// entityList.js +// +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +/* global EntityListTool, Tablet, selectionManager, Entities, Camera, MyAvatar, Vec3, Menu, Messages, + cameraManager, MENU_EASE_ON_FOCUS, deleteSelectedEntities, toggleSelectedEntitiesLocked, toggleSelectedEntitiesVisible */ EntityListTool = function(opts) { var that = {}; var webView = null; - if (Settings.getValue("HUDUIEnabled")) { - var url = ENTITY_LIST_HTML_URL; - webView = new OverlayWebWindow({ - title: 'Entity List', source: url, toolWindow: true - }); - } else { - webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - webView.setVisible = function(value) {}; - } + webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + webView.setVisible = function(value) {}; var filterInView = false; var searchRadius = 100; @@ -30,7 +34,7 @@ EntityListTool = function(opts) { that.toggleVisible = function() { that.setVisible(!visible); - } + }; selectionManager.addEventListener(function() { var selectedIDs = []; @@ -49,7 +53,7 @@ EntityListTool = function(opts) { that.clearEntityList = function () { var data = { type: 'clearEntityList' - } + }; webView.emitScriptEvent(JSON.stringify(data)); }; @@ -91,8 +95,8 @@ EntityListTool = function(opts) { } var selectedIDs = []; - for (var i = 0; i < selectionManager.selections.length; i++) { - selectedIDs.push(selectionManager.selections[i].id); + for (var j = 0; j < selectionManager.selections.length; j++) { + selectedIDs.push(selectionManager.selections[j].id); } var data = { @@ -101,7 +105,7 @@ EntityListTool = function(opts) { selectedIDs: selectedIDs, }; webView.emitScriptEvent(JSON.stringify(data)); - } + }; webView.webEventReceived.connect(function(data) { data = JSON.parse(data); diff --git a/scripts/system/libraries/gridTool.js b/scripts/system/libraries/gridTool.js index 7176fd00a6..0290674a0f 100644 --- a/scripts/system/libraries/gridTool.js +++ b/scripts/system/libraries/gridTool.js @@ -229,15 +229,8 @@ GridTool = function(opts) { var listeners = []; var webView = null; - if (Settings.getValue("HUDUIEnabled")) { - var url = GRID_CONTROLS_HTML_URL; - webView = new OverlayWebWindow({ - title: 'Grid', source: url, toolWindow: true - }); - } else { - webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - webView.setVisible = function(value) {}; - } + webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + webView.setVisible = function(value) {}; horizontalGrid.addListener(function(data) { webView.emitScriptEvent(JSON.stringify(data)); diff --git a/scripts/system/particle_explorer/particleExplorer.js b/scripts/system/particle_explorer/particleExplorer.js index 44fa242435..e0987ecd09 100644 --- a/scripts/system/particle_explorer/particleExplorer.js +++ b/scripts/system/particle_explorer/particleExplorer.js @@ -32,6 +32,8 @@ var gui = null; var settings = new Settings(); var updateInterval; +var active = false; + var currentInputField; var storedController; //CHANGE TO WHITELIST @@ -363,6 +365,19 @@ function listenForSettingsUpdates() { } else { loadGUI(); } + if (!active) { + // gui.toggleHide(); + gui.closed = false; + } + active = true; + + } else if (data.messageType === "particle_close") { + // none of this seems to work. + // if (active) { + // gui.toggleHide(); + // } + active = false; + gui.closed = true; } }); } diff --git a/scripts/system/particle_explorer/particleExplorerTool.js b/scripts/system/particle_explorer/particleExplorerTool.js index 0be7c6b588..b3db475ab0 100644 --- a/scripts/system/particle_explorer/particleExplorerTool.js +++ b/scripts/system/particle_explorer/particleExplorerTool.js @@ -18,33 +18,21 @@ ParticleExplorerTool = function() { var that = {}; that.createWebView = function() { - if (Settings.getValue("HUDUIEnabled")) { - var url = PARTICLE_EXPLORER_HTML_URL; - that.webView = new OverlayWebWindow({ - title: 'Particle Explorer', - source: url, - toolWindow: true - }); - } else { - that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - that.webView.setVisible = function(value) {}; - } - - that.webView.setVisible(true); + 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; } - - if (Settings.getValue("HUDUIEnabled")) { - that.webView.close(); - that.webView = null; - } that.activeParticleEntity = 0; + + var messageData = { + messageType: "particle_close" + }; + that.webView.emitScriptEvent(JSON.stringify(messageData)); } that.webEventReceived = function(data) { @@ -58,9 +46,5 @@ ParticleExplorerTool = function() { that.activeParticleEntity = id; } - if (Settings.getValue("HUDUIEnabled")) { - that.createWebView(); - } - return that; }; diff --git a/scripts/system/tablet-users.js b/scripts/system/tablet-users.js index ce50c4686d..5edc8d17ec 100644 --- a/scripts/system/tablet-users.js +++ b/scripts/system/tablet-users.js @@ -49,7 +49,6 @@ } function onWebEventReceived(event) { - print("Script received a web event, its type is " + typeof event); if (typeof event === "string") { event = JSON.parse(event); }