Merge pull request #9482 from sethalves/tablet-ui-merge-upstream

Tablet ui merge upstream
This commit is contained in:
Seth Alves 2017-01-23 14:42:38 -08:00 committed by GitHub
commit 613a88925d
12 changed files with 89 additions and 106 deletions

View file

@ -38,10 +38,10 @@ set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${INSTALL_DIR}/lib CACHE FILEPATH "Location
if (APPLE) if (APPLE)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libquazip5.1.0.0.dylib CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libquazip5.1.0.0.dylib CACHE FILEPATH "Location of QuaZip release library")
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libquazip5.1.0.0.dylib CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libquazip5d.1.0.0.dylib CACHE FILEPATH "Location of QuaZip release library")
elseif (WIN32) elseif (WIN32)
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/quazip5.lib CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/quazip5.lib CACHE FILEPATH "Location of QuaZip release library")
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/quazip5.lib CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/quazip5d.lib CACHE FILEPATH "Location of QuaZip release library")
else () else ()
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libquazip5.so CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libquazip5.so CACHE FILEPATH "Location of QuaZip release library")
set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libquazip5.so CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libquazip5.so CACHE FILEPATH "Location of QuaZip release library")

View file

@ -12,7 +12,7 @@
<div id="setup-sidebar" class="hidden-xs" data-spy="affix" data-offset-top="55" data-clampedwidth="#setup-sidebar-col"> <div id="setup-sidebar" class="hidden-xs" data-spy="affix" data-offset-top="55" data-clampedwidth="#setup-sidebar-col">
<script id="list-group-template" type="text/template"> <script id="list-group-template" type="text/template">
<% _.each(descriptions, function(group){ %> <% _.each(descriptions, function(group){ %>
<% panelID = group.name ? group.name : group.label %> <% panelID = group.name ? group.name : group.html_id %>
<li> <li>
<a href="#<%- panelID %>" class="list-group-item"> <a href="#<%- panelID %>" class="list-group-item">
<span class="badge"></span> <span class="badge"></span>

View file

@ -19,7 +19,7 @@ Item {
SoundEffect { SoundEffect {
id: buttonClickSound id: buttonClickSound
source: "../../../sounds/button-click.wav" source: "../../../sounds/Gamemaster-Audio-button-click.wav"
} }
function playButtonClickSound() { function playButtonClickSound() {

View file

@ -9,9 +9,13 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#include "AudioInjectorOptions.h"
#include <QScriptValueIterator>
#include <RegisteredMetaTypes.h> #include <RegisteredMetaTypes.h>
#include "AudioInjectorOptions.h" #include "AudioLogging.h"
AudioInjectorOptions::AudioInjectorOptions() : AudioInjectorOptions::AudioInjectorOptions() :
position(0.0f, 0.0f, 0.0f), position(0.0f, 0.0f, 0.0f),
@ -22,7 +26,7 @@ AudioInjectorOptions::AudioInjectorOptions() :
ambisonic(false), ambisonic(false),
ignorePenumbra(false), ignorePenumbra(false),
localOnly(false), localOnly(false),
secondOffset(0.0) secondOffset(0.0f)
{ {
} }
@ -40,31 +44,51 @@ QScriptValue injectorOptionsToScriptValue(QScriptEngine* engine, const AudioInje
} }
void injectorOptionsFromScriptValue(const QScriptValue& object, AudioInjectorOptions& injectorOptions) { void injectorOptionsFromScriptValue(const QScriptValue& object, AudioInjectorOptions& injectorOptions) {
if (object.property("position").isValid()) { if (!object.isObject()) {
vec3FromScriptValue(object.property("position"), injectorOptions.position); qWarning() << "Audio injector options is not an object.";
return;
} }
if (object.property("volume").isValid()) { QScriptValueIterator it(object);
injectorOptions.volume = object.property("volume").toNumber(); while (it.hasNext()) {
} it.next();
if (object.property("loop").isValid()) { if (it.name() == "position") {
injectorOptions.loop = object.property("loop").toBool(); vec3FromScriptValue(object.property("position"), injectorOptions.position);
} } else if (it.name() == "orientation") {
quatFromScriptValue(object.property("orientation"), injectorOptions.orientation);
if (object.property("orientation").isValid()) { } else if (it.name() == "volume") {
quatFromScriptValue(object.property("orientation"), injectorOptions.orientation); if (it.value().isNumber()) {
} injectorOptions.volume = it.value().toNumber();
} else {
if (object.property("ignorePenumbra").isValid()) { qCWarning(audio) << "Audio injector options: volume is not a number";
injectorOptions.ignorePenumbra = object.property("ignorePenumbra").toBool(); }
} } else if (it.name() == "loop") {
if (it.value().isBool()) {
if (object.property("localOnly").isValid()) { injectorOptions.loop = it.value().toBool();
injectorOptions.localOnly = object.property("localOnly").toBool(); } else {
} qCWarning(audio) << "Audio injector options: loop is not a boolean";
}
if (object.property("secondOffset").isValid()) { } else if (it.name() == "ignorePenumbra") {
injectorOptions.secondOffset = object.property("secondOffset").toNumber(); if (it.value().isBool()) {
injectorOptions.ignorePenumbra = it.value().toBool();
} else {
qCWarning(audio) << "Audio injector options: ignorePenumbra is not a boolean";
}
} else if (it.name() == "localOnly") {
if (it.value().isBool()) {
injectorOptions.localOnly = it.value().toBool();
} else {
qCWarning(audio) << "Audio injector options: localOnly is not a boolean";
}
} else if (it.name() == "secondOffset") {
if (it.value().isNumber()) {
injectorOptions.secondOffset = it.value().toNumber();
} else {
qCWarning(audio) << "Audio injector options: secondOffset is not a number";
}
} else {
qCWarning(audio) << "Unknown audio injector option:" << it.name();
}
} }
} }

View file

@ -268,7 +268,8 @@ void RenderableWebEntityItem::loadSourceURL() {
if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") { if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data()); tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system",
_webSurface->getRootItem(), _webSurface.data());
} }
} }
_webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition())); _webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition()));
@ -276,19 +277,17 @@ void RenderableWebEntityItem::loadSourceURL() {
void RenderableWebEntityItem::setSourceUrl(const QString& value) { void RenderableWebEntityItem::setSourceUrl(const QString& value) {
if (_sourceUrl != value) { auto valueBeforeSuperclassSet = _sourceUrl;
qCDebug(entities) << "Setting web entity source URL to " << value; WebEntityItem::setSourceUrl(value);
_sourceUrl = value; if (_sourceUrl != valueBeforeSuperclassSet && _webSurface) {
if (_webSurface) { AbstractViewStateInterface::instance()->postLambdaEvent([this] {
AbstractViewStateInterface::instance()->postLambdaEvent([this] { loadSourceURL();
loadSourceURL(); if (_contentType == htmlContent) {
if (_contentType == htmlContent) { _webSurface->getRootItem()->setProperty("url", _sourceUrl);
_webSurface->getRootItem()->setProperty("url", _sourceUrl); }
} });
});
}
} }
} }

View file

@ -125,7 +125,14 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g
void WebEntityItem::setSourceUrl(const QString& value) { void WebEntityItem::setSourceUrl(const QString& value) {
if (_sourceUrl != value) { if (_sourceUrl != value) {
_sourceUrl = value; auto newURL = QUrl::fromUserInput(value);
if (newURL.isValid()) {
_sourceUrl = newURL.toDisplayString();
qCDebug(entities) << "Changed web entity source URL to " << _sourceUrl;
} else {
qCDebug(entities) << "Clearing web entity source URL since" << value << "cannot be parsed to a valid URL.";
}
} }
} }

View file

@ -43,8 +43,6 @@ var DEFAULT_GRABBABLE_DATA = {
var ACTION_TTL = 10; // seconds var ACTION_TTL = 10; // seconds
var enabled = true;
function getTag() { function getTag() {
return "grab-" + MyAvatar.sessionUUID; return "grab-" + MyAvatar.sessionUUID;
} }
@ -319,7 +317,7 @@ Grabber.prototype.computeNewGrabPlane = function() {
}; };
Grabber.prototype.pressEvent = function(event) { Grabber.prototype.pressEvent = function(event) {
if (!enabled) { if (isInEditMode()) {
return; return;
} }
@ -573,31 +571,10 @@ function keyReleaseEvent(event) {
grabber.keyReleaseEvent(event); grabber.keyReleaseEvent(event);
} }
function editEvent(channel, message, sender, localOnly) {
if (channel != "edit-events") {
return;
}
if (sender != MyAvatar.sessionUUID) {
return;
}
if (!localOnly) {
return;
}
try {
var data = JSON.parse(message);
if ("enabled" in data) {
enabled = !data.enabled;
}
} catch(e) {
}
}
Controller.mousePressEvent.connect(pressEvent); Controller.mousePressEvent.connect(pressEvent);
Controller.mouseMoveEvent.connect(moveEvent); Controller.mouseMoveEvent.connect(moveEvent);
Controller.mouseReleaseEvent.connect(releaseEvent); Controller.mouseReleaseEvent.connect(releaseEvent);
Controller.keyPressEvent.connect(keyPressEvent); Controller.keyPressEvent.connect(keyPressEvent);
Controller.keyReleaseEvent.connect(keyReleaseEvent); Controller.keyReleaseEvent.connect(keyReleaseEvent);
Messages.subscribe("edit-events");
Messages.messageReceived.connect(editEvent);
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE

View file

@ -63,6 +63,7 @@ var EQUIP_SPHERE_SCALE_FACTOR = 0.65;
var WEB_DISPLAY_STYLUS_DISTANCE = 0.5; var WEB_DISPLAY_STYLUS_DISTANCE = 0.5;
var WEB_STYLUS_LENGTH = 0.2; var WEB_STYLUS_LENGTH = 0.2;
var WEB_TOUCH_Y_OFFSET = 0.05; // how far forward (or back with a negative number) to slide stylus in hand var WEB_TOUCH_Y_OFFSET = 0.05; // how far forward (or back with a negative number) to slide stylus in hand
var WEB_TOUCH_TOO_CLOSE = 0.04; // if the stylus is pushed far though the web surface, don't consider it touching
// //
// distant manipulation // distant manipulation
@ -472,11 +473,9 @@ function storeAttachPointForHotspotInSettings(hotspot, hand, offsetPosition, off
// If another script is managing the reticle (as is done by HandControllerPointer), we should not be setting it here, // If another script is managing the reticle (as is done by HandControllerPointer), we should not be setting it here,
// and we should not be showing lasers when someone else is using the Reticle to indicate a 2D minor mode. // and we should not be showing lasers when someone else is using the Reticle to indicate a 2D minor mode.
var EXTERNALLY_MANAGED_2D_MINOR_MODE = true; var EXTERNALLY_MANAGED_2D_MINOR_MODE = true;
var EDIT_SETTING = "io.highfidelity.isEditting";
function isEditing() { function isEditing() {
var actualSettingValue = Settings.getValue(EDIT_SETTING) === "false" ? false : !!Settings.getValue(EDIT_SETTING); return EXTERNALLY_MANAGED_2D_MINOR_MODE && isInEditMode();
return EXTERNALLY_MANAGED_2D_MINOR_MODE && actualSettingValue;
} }
function isIn2DMode() { function isIn2DMode() {
@ -849,6 +848,9 @@ function MyController(hand) {
}; };
this.setState = function(newState, reason) { this.setState = function(newState, reason) {
if (isInEditMode() && newState !== STATE_OFF && newState !== STATE_SEARCHING) {
return;
}
setGrabCommunications((newState === STATE_DISTANCE_HOLDING) || (newState === STATE_NEAR_GRABBING)); setGrabCommunications((newState === STATE_DISTANCE_HOLDING) || (newState === STATE_NEAR_GRABBING));
if (WANT_DEBUG || WANT_DEBUG_STATE) { if (WANT_DEBUG || WANT_DEBUG_STATE) {
var oldStateName = stateToName(this.state); var oldStateName = stateToName(this.state);
@ -1169,7 +1171,8 @@ function MyController(hand) {
if (nearWeb) { if (nearWeb) {
this.showStylus(); this.showStylus();
var rayPickInfo = this.calcRayPickInfo(this.hand); var rayPickInfo = this.calcRayPickInfo(this.hand);
if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) { if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET &&
rayPickInfo.distance > WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_TOO_CLOSE) {
this.handleStylusOnHomeButton(rayPickInfo); this.handleStylusOnHomeButton(rayPickInfo);
if (this.handleStylusOnWebEntity(rayPickInfo)) { if (this.handleStylusOnWebEntity(rayPickInfo)) {
return; return;

View file

@ -425,7 +425,6 @@ var toolBar = (function () {
}); });
}); });
that.setActive(false); that.setActive(false);
} }
@ -440,6 +439,7 @@ var toolBar = (function () {
}; };
that.setActive = function (active) { that.setActive = function (active) {
Settings.setValue(EDIT_SETTING, active);
if (active === isActive) { if (active === isActive) {
return; return;
} }
@ -451,7 +451,6 @@ var toolBar = (function () {
enabled: active enabled: active
})); }));
isActive = active; isActive = active;
Settings.setValue(EDIT_SETTING, active);
if (!isActive) { if (!isActive) {
entityListTool.setVisible(false); entityListTool.setVisible(false);
gridTool.setVisible(false); gridTool.setVisible(false);

View file

@ -6,6 +6,12 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
// note: this constant is currently duplicated in edit.js
EDIT_SETTING = "io.highfidelity.isEditting";
isInEditMode = function isInEditMode() {
return Settings.getValue(EDIT_SETTING) === "false" ? false : !!Settings.getValue(EDIT_SETTING);
};
if (!Function.prototype.bind) { if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) { Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') { if (typeof this !== 'function') {

View file

@ -1,32 +0,0 @@
//
// HomeButton.js
//
// Created by Dante Ruiz on 12/6/2016
// Copyright 2016 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
//
(function(){
_this = this;
this.preload = function(entityID) {
print(entityID);
this.entityID = entityID;
}
this.clickDownOnEntity = function(entityID, mouseEvent) {
Messages.sendLocalMessage("home", _this.entityID);
}
this.startNearTrigger = function() {
Messages.sendLocalMessage("home", _this.entityID);
}
this.startFarTrigger = function() {
Messages.sendLocalMessage("home", _this.entityID);
}
});