mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
Merge branch 'master' into loginInitiative2
This commit is contained in:
commit
e266532888
38 changed files with 816 additions and 241 deletions
|
@ -216,7 +216,7 @@ void Agent::requestScript() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure this is not a script request for the file scheme
|
// make sure this is not a script request for the file scheme
|
||||||
if (scriptURL.scheme() == URL_SCHEME_FILE) {
|
if (scriptURL.scheme() == HIFI_URL_SCHEME_FILE) {
|
||||||
qWarning() << "Cannot load script for Agent from local filesystem.";
|
qWarning() << "Cannot load script for Agent from local filesystem.";
|
||||||
scriptRequestFinished();
|
scriptRequestFinished();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -55,6 +55,7 @@ Rectangle {
|
||||||
property bool isInstalled;
|
property bool isInstalled;
|
||||||
property bool isUpdating;
|
property bool isUpdating;
|
||||||
property string baseAppURL;
|
property string baseAppURL;
|
||||||
|
property int currentUpdatesPage: 1;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -156,8 +157,14 @@ Rectangle {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.availableUpdatesReceived = true;
|
|
||||||
refreshBuyUI();
|
if (result.data.updates.length === 0 || root.isUpdating) {
|
||||||
|
root.availableUpdatesReceived = true;
|
||||||
|
refreshBuyUI();
|
||||||
|
} else {
|
||||||
|
root.currentUpdatesPage++;
|
||||||
|
Commerce.getAvailableUpdates(root.itemId, currentUpdatesPage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +183,7 @@ Rectangle {
|
||||||
root.ownershipStatusReceived = false;
|
root.ownershipStatusReceived = false;
|
||||||
Commerce.alreadyOwned(root.itemId);
|
Commerce.alreadyOwned(root.itemId);
|
||||||
root.availableUpdatesReceived = false;
|
root.availableUpdatesReceived = false;
|
||||||
|
root.currentUpdatesPage = 1;
|
||||||
Commerce.getAvailableUpdates(root.itemId);
|
Commerce.getAvailableUpdates(root.itemId);
|
||||||
itemPreviewImage.source = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
itemPreviewImage.source = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
||||||
}
|
}
|
||||||
|
@ -1181,6 +1189,7 @@ Rectangle {
|
||||||
root.ownershipStatusReceived = false;
|
root.ownershipStatusReceived = false;
|
||||||
Commerce.alreadyOwned(root.itemId);
|
Commerce.alreadyOwned(root.itemId);
|
||||||
root.availableUpdatesReceived = false;
|
root.availableUpdatesReceived = false;
|
||||||
|
root.currentUpdatesPage = 1;
|
||||||
Commerce.getAvailableUpdates(root.itemId);
|
Commerce.getAvailableUpdates(root.itemId);
|
||||||
root.balanceReceived = false;
|
root.balanceReceived = false;
|
||||||
Commerce.balance();
|
Commerce.balance();
|
||||||
|
|
|
@ -29,7 +29,6 @@ Item {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
Commerce.balance();
|
Commerce.balance();
|
||||||
transactionHistoryModel.getFirstPage();
|
transactionHistoryModel.getFirstPage();
|
||||||
Commerce.getAvailableUpdates();
|
|
||||||
} else {
|
} else {
|
||||||
refreshTimer.stop();
|
refreshTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
314
interface/resources/qml/hifi/tts/TTS.qml
Normal file
314
interface/resources/qml/hifi/tts/TTS.qml
Normal file
|
@ -0,0 +1,314 @@
|
||||||
|
//
|
||||||
|
// TTS.qml
|
||||||
|
//
|
||||||
|
// TTS App
|
||||||
|
//
|
||||||
|
// Created by Zach Fox on 2018-10-10
|
||||||
|
// Copyright 2018 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
|
||||||
|
//
|
||||||
|
|
||||||
|
import Hifi 1.0 as Hifi
|
||||||
|
import QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
import "qrc:////qml//styles-uit" as HifiStylesUit
|
||||||
|
import "qrc:////qml//controls-uit" as HifiControlsUit
|
||||||
|
import "qrc:////qml//controls" as HifiControls
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
HifiStylesUit.HifiConstants { id: hifi; }
|
||||||
|
|
||||||
|
id: root;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.darkGray;
|
||||||
|
property bool keyboardRaised: false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TITLE BAR START
|
||||||
|
//
|
||||||
|
Item {
|
||||||
|
id: titleBarContainer;
|
||||||
|
// Size
|
||||||
|
width: root.width;
|
||||||
|
height: 50;
|
||||||
|
// Anchors
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.top: parent.top;
|
||||||
|
|
||||||
|
// Title bar text
|
||||||
|
HifiStylesUit.RalewaySemiBold {
|
||||||
|
id: titleBarText;
|
||||||
|
text: "Text-to-Speech";
|
||||||
|
// Text size
|
||||||
|
size: hifi.fontSizes.overlayTitle;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
width: paintedWidth;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.lightGrayText;
|
||||||
|
// Alignment
|
||||||
|
horizontalAlignment: Text.AlignHLeft;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Separator
|
||||||
|
HifiControlsUit.Separator {
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// TITLE BAR END
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: tagButtonContainer;
|
||||||
|
anchors.top: titleBarContainer.bottom;
|
||||||
|
anchors.topMargin: 2;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: 70;
|
||||||
|
|
||||||
|
HifiStylesUit.RalewaySemiBold {
|
||||||
|
id: tagButtonTitle;
|
||||||
|
text: "Insert Tag:";
|
||||||
|
// Text size
|
||||||
|
size: 18;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: 35;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.lightGrayText;
|
||||||
|
// Alignment
|
||||||
|
horizontalAlignment: Text.AlignHCenter;
|
||||||
|
verticalAlignment: Text.AlignVCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: pitch10Button;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.none;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.top: tagButtonTitle.bottom;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 3;
|
||||||
|
width: parent.width/6 - 6;
|
||||||
|
height: 30;
|
||||||
|
text: "Pitch 10";
|
||||||
|
onClicked: {
|
||||||
|
messageToSpeak.insert(messageToSpeak.cursorPosition, "<pitch absmiddle='10'/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: pitch0Button;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.none;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.top: tagButtonTitle.bottom;
|
||||||
|
anchors.left: pitch10Button.right;
|
||||||
|
anchors.leftMargin: 6;
|
||||||
|
width: parent.width/6 - anchors.leftMargin;
|
||||||
|
height: 30;
|
||||||
|
text: "Pitch 0";
|
||||||
|
onClicked: {
|
||||||
|
messageToSpeak.insert(messageToSpeak.cursorPosition, "<pitch absmiddle='0'/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: pitchNeg10Button;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.none;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.top: tagButtonTitle.bottom;
|
||||||
|
anchors.left: pitch0Button.right;
|
||||||
|
anchors.leftMargin: 6;
|
||||||
|
width: parent.width/6 - anchors.leftMargin;
|
||||||
|
height: 30;
|
||||||
|
text: "Pitch -10";
|
||||||
|
onClicked: {
|
||||||
|
messageToSpeak.insert(messageToSpeak.cursorPosition, "<pitch absmiddle='-10'/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: speed5Button;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.none;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.top: tagButtonTitle.bottom;
|
||||||
|
anchors.left: pitchNeg10Button.right;
|
||||||
|
anchors.leftMargin: 6;
|
||||||
|
width: parent.width/6 - anchors.leftMargin;
|
||||||
|
height: 30;
|
||||||
|
text: "Speed 5";
|
||||||
|
onClicked: {
|
||||||
|
messageToSpeak.insert(messageToSpeak.cursorPosition, "<rate absspeed='5'/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: speed0Button;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.none;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.top: tagButtonTitle.bottom;
|
||||||
|
anchors.left: speed5Button.right;
|
||||||
|
anchors.leftMargin: 6;
|
||||||
|
width: parent.width/6 - anchors.leftMargin;
|
||||||
|
height: 30;
|
||||||
|
text: "Speed 0";
|
||||||
|
onClicked: {
|
||||||
|
messageToSpeak.insert(messageToSpeak.cursorPosition, "<rate absspeed='0'/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: speedNeg10Button;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.none;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.top: tagButtonTitle.bottom;
|
||||||
|
anchors.left: speed0Button.right;
|
||||||
|
anchors.leftMargin: 6;
|
||||||
|
width: parent.width/6 - anchors.leftMargin;
|
||||||
|
height: 30;
|
||||||
|
text: "Speed -10";
|
||||||
|
onClicked: {
|
||||||
|
messageToSpeak.insert(messageToSpeak.cursorPosition, "<rate absspeed='-10'/>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.top: tagButtonContainer.bottom;
|
||||||
|
anchors.topMargin: 8;
|
||||||
|
anchors.bottom: keyboardContainer.top;
|
||||||
|
anchors.bottomMargin: 16;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
|
||||||
|
TextArea {
|
||||||
|
id: messageToSpeak;
|
||||||
|
font.family: "Fira Sans SemiBold";
|
||||||
|
font.pixelSize: 20;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.bottom: speakButton.top;
|
||||||
|
anchors.bottomMargin: 8;
|
||||||
|
// Style
|
||||||
|
background: Rectangle {
|
||||||
|
anchors.fill: parent;
|
||||||
|
color: parent.activeFocus ? hifi.colors.black : hifi.colors.baseGrayShadow;
|
||||||
|
border.width: parent.activeFocus ? 1 : 0;
|
||||||
|
border.color: parent.activeFocus ? hifi.colors.primaryHighlight : hifi.colors.textFieldLightBackground;
|
||||||
|
}
|
||||||
|
color: hifi.colors.white;
|
||||||
|
textFormat: TextEdit.PlainText;
|
||||||
|
wrapMode: TextEdit.Wrap;
|
||||||
|
activeFocusOnPress: true;
|
||||||
|
activeFocusOnTab: true;
|
||||||
|
Keys.onPressed: {
|
||||||
|
if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) {
|
||||||
|
TextToSpeech.speakText(messageToSpeak.text, 480, 10, 24000, 16, true);
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiStylesUit.FiraSansRegular {
|
||||||
|
text: "<i>Input Text to Speak...</i>";
|
||||||
|
size: 20;
|
||||||
|
anchors.fill: parent;
|
||||||
|
anchors.topMargin: 4;
|
||||||
|
anchors.leftMargin: 4;
|
||||||
|
color: hifi.colors.lightGrayText;
|
||||||
|
visible: !parent.activeFocus && messageToSpeak.text === "";
|
||||||
|
verticalAlignment: Text.AlignTop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: speakButton;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.blue;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
width: 215;
|
||||||
|
height: 40;
|
||||||
|
text: "Speak";
|
||||||
|
onClicked: {
|
||||||
|
TextToSpeech.speakText(messageToSpeak.text, 480, 10, 24000, 16, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: clearButton;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.white;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.right: speakButton.left;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
width: 100;
|
||||||
|
height: 40;
|
||||||
|
text: "Clear";
|
||||||
|
onClicked: {
|
||||||
|
messageToSpeak.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Button {
|
||||||
|
id: stopButton;
|
||||||
|
focusPolicy: Qt.NoFocus;
|
||||||
|
color: hifi.buttons.red;
|
||||||
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
|
anchors.right: clearButton.left;
|
||||||
|
anchors.rightMargin: 16;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
width: 100;
|
||||||
|
height: 40;
|
||||||
|
text: "Stop Last";
|
||||||
|
onClicked: {
|
||||||
|
TextToSpeech.stopLastSpeech();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: keyboardContainer;
|
||||||
|
z: 998;
|
||||||
|
visible: keyboard.raised;
|
||||||
|
property bool punctuationMode: false;
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom;
|
||||||
|
left: parent.left;
|
||||||
|
right: parent.right;
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.Keyboard {
|
||||||
|
id: keyboard;
|
||||||
|
raised: HMD.mounted && root.keyboardRaised;
|
||||||
|
numeric: parent.punctuationMode;
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom;
|
||||||
|
left: parent.left;
|
||||||
|
right: parent.right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -186,6 +186,7 @@
|
||||||
#include "scripting/RatesScriptingInterface.h"
|
#include "scripting/RatesScriptingInterface.h"
|
||||||
#include "scripting/SelectionScriptingInterface.h"
|
#include "scripting/SelectionScriptingInterface.h"
|
||||||
#include "scripting/WalletScriptingInterface.h"
|
#include "scripting/WalletScriptingInterface.h"
|
||||||
|
#include "scripting/TTSScriptingInterface.h"
|
||||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||||
#include "SpeechRecognizer.h"
|
#include "SpeechRecognizer.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -536,11 +537,11 @@ bool isDomainURL(QUrl url) {
|
||||||
if (url.scheme() == URL_SCHEME_HIFI) {
|
if (url.scheme() == URL_SCHEME_HIFI) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (url.scheme() != URL_SCHEME_FILE) {
|
if (url.scheme() != HIFI_URL_SCHEME_FILE) {
|
||||||
// TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can
|
// TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can
|
||||||
// be loaded over http(s)
|
// be loaded over http(s)
|
||||||
// && url.scheme() != URL_SCHEME_HTTP &&
|
// && url.scheme() != HIFI_URL_SCHEME_HTTP &&
|
||||||
// url.scheme() != URL_SCHEME_HTTPS
|
// url.scheme() != HIFI_URL_SCHEME_HTTPS
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (url.path().endsWith(".json", Qt::CaseInsensitive) ||
|
if (url.path().endsWith(".json", Qt::CaseInsensitive) ||
|
||||||
|
@ -951,6 +952,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
DependencyManager::set<Ledger>();
|
DependencyManager::set<Ledger>();
|
||||||
DependencyManager::set<Wallet>();
|
DependencyManager::set<Wallet>();
|
||||||
DependencyManager::set<WalletScriptingInterface>();
|
DependencyManager::set<WalletScriptingInterface>();
|
||||||
|
DependencyManager::set<TTSScriptingInterface>();
|
||||||
|
|
||||||
DependencyManager::set<FadeEffect>();
|
DependencyManager::set<FadeEffect>();
|
||||||
DependencyManager::set<ResourceRequestObserver>();
|
DependencyManager::set<ResourceRequestObserver>();
|
||||||
|
@ -1036,8 +1038,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
|
|
||||||
// If the URL scheme is http(s) or ftp, then use as is, else - treat it as a local file
|
// If the URL scheme is http(s) or ftp, then use as is, else - treat it as a local file
|
||||||
// This is done so as not break previous command line scripts
|
// This is done so as not break previous command line scripts
|
||||||
if (testScriptPath.left(URL_SCHEME_HTTP.length()) == URL_SCHEME_HTTP ||
|
if (testScriptPath.left(HIFI_URL_SCHEME_HTTP.length()) == HIFI_URL_SCHEME_HTTP ||
|
||||||
testScriptPath.left(URL_SCHEME_FTP.length()) == URL_SCHEME_FTP) {
|
testScriptPath.left(HIFI_URL_SCHEME_FTP.length()) == HIFI_URL_SCHEME_FTP) {
|
||||||
|
|
||||||
setProperty(hifi::properties::TEST, QUrl::fromUserInput(testScriptPath));
|
setProperty(hifi::properties::TEST, QUrl::fromUserInput(testScriptPath));
|
||||||
} else if (QFileInfo(testScriptPath).exists()) {
|
} else if (QFileInfo(testScriptPath).exists()) {
|
||||||
|
@ -2903,7 +2905,7 @@ void Application::initializeUi() {
|
||||||
LoginDialog::registerType();
|
LoginDialog::registerType();
|
||||||
Tooltip::registerType();
|
Tooltip::registerType();
|
||||||
UpdateDialog::registerType();
|
UpdateDialog::registerType();
|
||||||
QmlContextCallback callback = [](QQmlContext* context) {
|
QmlContextCallback commerceCallback = [](QQmlContext* context) {
|
||||||
context->setContextProperty("Commerce", new QmlCommerce());
|
context->setContextProperty("Commerce", new QmlCommerce());
|
||||||
};
|
};
|
||||||
OffscreenQmlSurface::addWhitelistContextHandler({
|
OffscreenQmlSurface::addWhitelistContextHandler({
|
||||||
|
@ -2929,7 +2931,13 @@ void Application::initializeUi() {
|
||||||
QUrl{ "hifi/dialogs/security/SecurityImageChange.qml" },
|
QUrl{ "hifi/dialogs/security/SecurityImageChange.qml" },
|
||||||
QUrl{ "hifi/dialogs/security/SecurityImageModel.qml" },
|
QUrl{ "hifi/dialogs/security/SecurityImageModel.qml" },
|
||||||
QUrl{ "hifi/dialogs/security/SecurityImageSelection.qml" },
|
QUrl{ "hifi/dialogs/security/SecurityImageSelection.qml" },
|
||||||
}, callback);
|
}, commerceCallback);
|
||||||
|
QmlContextCallback ttsCallback = [](QQmlContext* context) {
|
||||||
|
context->setContextProperty("TextToSpeech", DependencyManager::get<TTSScriptingInterface>().data());
|
||||||
|
};
|
||||||
|
OffscreenQmlSurface::addWhitelistContextHandler({
|
||||||
|
QUrl{ "hifi/tts/TTS.qml" }
|
||||||
|
}, ttsCallback);
|
||||||
qmlRegisterType<ResourceImageItem>("Hifi", 1, 0, "ResourceImageItem");
|
qmlRegisterType<ResourceImageItem>("Hifi", 1, 0, "ResourceImageItem");
|
||||||
qmlRegisterType<Preference>("Hifi", 1, 0, "Preference");
|
qmlRegisterType<Preference>("Hifi", 1, 0, "Preference");
|
||||||
qmlRegisterType<WebBrowserSuggestionsEngine>("HifiWeb", 1, 0, "WebBrowserSuggestionsEngine");
|
qmlRegisterType<WebBrowserSuggestionsEngine>("HifiWeb", 1, 0, "WebBrowserSuggestionsEngine");
|
||||||
|
|
|
@ -122,8 +122,8 @@ void ATPAssetMigrator::loadEntityServerFile() {
|
||||||
QUrl migrationURL = QUrl(migrationURLString);
|
QUrl migrationURL = QUrl(migrationURLString);
|
||||||
|
|
||||||
if (!_ignoredUrls.contains(migrationURL)
|
if (!_ignoredUrls.contains(migrationURL)
|
||||||
&& (migrationURL.scheme() == URL_SCHEME_HTTP || migrationURL.scheme() == URL_SCHEME_HTTPS
|
&& (migrationURL.scheme() == HIFI_URL_SCHEME_HTTP || migrationURL.scheme() == HIFI_URL_SCHEME_HTTPS
|
||||||
|| migrationURL.scheme() == URL_SCHEME_FILE || migrationURL.scheme() == URL_SCHEME_FTP)) {
|
|| migrationURL.scheme() == HIFI_URL_SCHEME_FILE || migrationURL.scheme() == HIFI_URL_SCHEME_FTP)) {
|
||||||
|
|
||||||
if (_pendingReplacements.contains(migrationURL)) {
|
if (_pendingReplacements.contains(migrationURL)) {
|
||||||
// we already have a request out for this asset, just store the QJsonValueRef
|
// we already have a request out for this asset, just store the QJsonValueRef
|
||||||
|
|
|
@ -454,7 +454,7 @@ void Ledger::alreadyOwned(const QString& marketplaceId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ledger::getAvailableUpdates(const QString& itemId) {
|
void Ledger::getAvailableUpdates(const QString& itemId, const int& pageNumber, const int& itemsPerPage) {
|
||||||
auto wallet = DependencyManager::get<Wallet>();
|
auto wallet = DependencyManager::get<Wallet>();
|
||||||
QString endpoint = "available_updates";
|
QString endpoint = "available_updates";
|
||||||
QJsonObject request;
|
QJsonObject request;
|
||||||
|
@ -462,6 +462,8 @@ void Ledger::getAvailableUpdates(const QString& itemId) {
|
||||||
if (!itemId.isEmpty()) {
|
if (!itemId.isEmpty()) {
|
||||||
request["marketplace_item_id"] = itemId;
|
request["marketplace_item_id"] = itemId;
|
||||||
}
|
}
|
||||||
|
request["per_page"] = itemsPerPage;
|
||||||
|
request["page"] = pageNumber;
|
||||||
send(endpoint, "availableUpdatesSuccess", "availableUpdatesFailure", QNetworkAccessManager::PutOperation, AccountManagerAuth::Required, request);
|
send(endpoint, "availableUpdatesSuccess", "availableUpdatesFailure", QNetworkAccessManager::PutOperation, AccountManagerAuth::Required, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
void transferAssetToNode(const QString& hfc_key, const QString& nodeID, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
void transferAssetToNode(const QString& hfc_key, const QString& nodeID, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
||||||
void transferAssetToUsername(const QString& hfc_key, const QString& username, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
void transferAssetToUsername(const QString& hfc_key, const QString& username, const QString& certificateID, const int& amount, const QString& optionalMessage);
|
||||||
void alreadyOwned(const QString& marketplaceId);
|
void alreadyOwned(const QString& marketplaceId);
|
||||||
void getAvailableUpdates(const QString& itemId = "");
|
void getAvailableUpdates(const QString& itemId = "", const int& pageNumber = 1, const int& itemsPerPage = 10);
|
||||||
void updateItem(const QString& hfc_key, const QString& certificate_id);
|
void updateItem(const QString& hfc_key, const QString& certificate_id);
|
||||||
|
|
||||||
enum CertificateStatus {
|
enum CertificateStatus {
|
||||||
|
|
|
@ -441,9 +441,9 @@ bool QmlCommerce::openApp(const QString& itemHref) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCommerce::getAvailableUpdates(const QString& itemId) {
|
void QmlCommerce::getAvailableUpdates(const QString& itemId, const int& pageNumber, const int& itemsPerPage) {
|
||||||
auto ledger = DependencyManager::get<Ledger>();
|
auto ledger = DependencyManager::get<Ledger>();
|
||||||
ledger->getAvailableUpdates(itemId);
|
ledger->getAvailableUpdates(itemId, pageNumber, itemsPerPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCommerce::updateItem(const QString& certificateId) {
|
void QmlCommerce::updateItem(const QString& certificateId) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ protected:
|
||||||
Q_INVOKABLE bool uninstallApp(const QString& appHref);
|
Q_INVOKABLE bool uninstallApp(const QString& appHref);
|
||||||
Q_INVOKABLE bool openApp(const QString& appHref);
|
Q_INVOKABLE bool openApp(const QString& appHref);
|
||||||
|
|
||||||
Q_INVOKABLE void getAvailableUpdates(const QString& itemId = "");
|
Q_INVOKABLE void getAvailableUpdates(const QString& itemId = "", const int& pageNumber = 1, const int& itemsPerPage = 10);
|
||||||
Q_INVOKABLE void updateItem(const QString& certificateId);
|
Q_INVOKABLE void updateItem(const QString& certificateId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
163
interface/src/scripting/TTSScriptingInterface.cpp
Normal file
163
interface/src/scripting/TTSScriptingInterface.cpp
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
//
|
||||||
|
// TTSScriptingInterface.cpp
|
||||||
|
// libraries/audio-client/src/scripting
|
||||||
|
//
|
||||||
|
// Created by Zach Fox on 2018-10-10.
|
||||||
|
// Copyright 2018 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
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "TTSScriptingInterface.h"
|
||||||
|
#include "avatar/AvatarManager.h"
|
||||||
|
|
||||||
|
TTSScriptingInterface::TTSScriptingInterface() {
|
||||||
|
#ifdef WIN32
|
||||||
|
//
|
||||||
|
// Create text to speech engine
|
||||||
|
//
|
||||||
|
HRESULT hr = m_tts.CoCreateInstance(CLSID_SpVoice);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Text-to-speech engine creation failed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get token corresponding to default voice
|
||||||
|
//
|
||||||
|
hr = SpGetDefaultTokenFromCategoryId(SPCAT_VOICES, &m_voiceToken, FALSE);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Can't get default voice token.";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set default voice
|
||||||
|
//
|
||||||
|
hr = m_tts->SetVoice(m_voiceToken);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Can't set default voice.";
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastSoundAudioInjectorUpdateTimer.setSingleShot(true);
|
||||||
|
connect(&_lastSoundAudioInjectorUpdateTimer, &QTimer::timeout, this, &TTSScriptingInterface::updateLastSoundAudioInjector);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
TTSScriptingInterface::~TTSScriptingInterface() {
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
class ReleaseOnExit {
|
||||||
|
public:
|
||||||
|
ReleaseOnExit(IUnknown* p) : m_p(p) {}
|
||||||
|
~ReleaseOnExit() {
|
||||||
|
if (m_p) {
|
||||||
|
m_p->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
IUnknown* m_p;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const int INJECTOR_INTERVAL_MS = 100;
|
||||||
|
void TTSScriptingInterface::updateLastSoundAudioInjector() {
|
||||||
|
if (_lastSoundAudioInjector) {
|
||||||
|
AudioInjectorOptions options;
|
||||||
|
options.position = DependencyManager::get<AvatarManager>()->getMyAvatarPosition();
|
||||||
|
_lastSoundAudioInjector->setOptions(options);
|
||||||
|
_lastSoundAudioInjectorUpdateTimer.start(INJECTOR_INTERVAL_MS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTSScriptingInterface::speakText(const QString& textToSpeak) {
|
||||||
|
#ifdef WIN32
|
||||||
|
WAVEFORMATEX fmt;
|
||||||
|
fmt.wFormatTag = WAVE_FORMAT_PCM;
|
||||||
|
fmt.nSamplesPerSec = AudioConstants::SAMPLE_RATE;
|
||||||
|
fmt.wBitsPerSample = 16;
|
||||||
|
fmt.nChannels = 1;
|
||||||
|
fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8;
|
||||||
|
fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign;
|
||||||
|
fmt.cbSize = 0;
|
||||||
|
|
||||||
|
IStream* pStream = NULL;
|
||||||
|
|
||||||
|
ISpStream* pSpStream = nullptr;
|
||||||
|
HRESULT hr = CoCreateInstance(CLSID_SpStream, nullptr, CLSCTX_ALL, __uuidof(ISpStream), (void**)&pSpStream);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "CoCreateInstance failed.";
|
||||||
|
}
|
||||||
|
ReleaseOnExit rSpStream(pSpStream);
|
||||||
|
|
||||||
|
pStream = SHCreateMemStream(NULL, 0);
|
||||||
|
if (nullptr == pStream) {
|
||||||
|
qDebug() << "SHCreateMemStream failed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pSpStream->SetBaseStream(pStream, SPDFID_WaveFormatEx, &fmt);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Can't set base stream.";
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = m_tts->SetOutput(pSpStream, true);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Can't set output stream.";
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseOnExit rStream(pStream);
|
||||||
|
|
||||||
|
ULONG streamNumber;
|
||||||
|
hr = m_tts->Speak(reinterpret_cast<LPCWSTR>(textToSpeak.utf16()), SPF_IS_XML | SPF_ASYNC | SPF_PURGEBEFORESPEAK,
|
||||||
|
&streamNumber);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Speak failed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tts->WaitUntilDone(-1);
|
||||||
|
|
||||||
|
hr = pSpStream->GetBaseStream(&pStream);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Couldn't get base stream.";
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IStream_Reset(pStream);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Couldn't reset stream.";
|
||||||
|
}
|
||||||
|
|
||||||
|
ULARGE_INTEGER StreamSize;
|
||||||
|
StreamSize.LowPart = 0;
|
||||||
|
hr = IStream_Size(pStream, &StreamSize);
|
||||||
|
|
||||||
|
DWORD dwSize = StreamSize.QuadPart;
|
||||||
|
_lastSoundByteArray.resize(dwSize);
|
||||||
|
|
||||||
|
hr = IStream_Read(pStream, _lastSoundByteArray.data(), dwSize);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qDebug() << "Couldn't read from stream.";
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioInjectorOptions options;
|
||||||
|
options.position = DependencyManager::get<AvatarManager>()->getMyAvatarPosition();
|
||||||
|
|
||||||
|
if (_lastSoundAudioInjector) {
|
||||||
|
_lastSoundAudioInjector->stop();
|
||||||
|
_lastSoundAudioInjectorUpdateTimer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastSoundAudioInjector = AudioInjector::playSoundAndDelete(_lastSoundByteArray, options);
|
||||||
|
|
||||||
|
_lastSoundAudioInjectorUpdateTimer.start(INJECTOR_INTERVAL_MS);
|
||||||
|
#else
|
||||||
|
qDebug() << "Text-to-Speech isn't currently supported on non-Windows platforms.";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTSScriptingInterface::stopLastSpeech() {
|
||||||
|
if (_lastSoundAudioInjector) {
|
||||||
|
_lastSoundAudioInjector->stop();
|
||||||
|
_lastSoundAudioInjector = NULL;
|
||||||
|
}
|
||||||
|
}
|
88
interface/src/scripting/TTSScriptingInterface.h
Normal file
88
interface/src/scripting/TTSScriptingInterface.h
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
// TTSScriptingInterface.h
|
||||||
|
// libraries/audio-client/src/scripting
|
||||||
|
//
|
||||||
|
// Created by Zach Fox on 2018-10-10.
|
||||||
|
// Copyright 2018 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
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_SpeechScriptingInterface_h
|
||||||
|
#define hifi_SpeechScriptingInterface_h
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <DependencyManager.h>
|
||||||
|
#ifdef WIN32
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <sapi.h> // SAPI
|
||||||
|
#include <sphelper.h> // SAPI Helper
|
||||||
|
#endif
|
||||||
|
#include <AudioInjector.h>
|
||||||
|
#include <AudioConstants.h>
|
||||||
|
|
||||||
|
class TTSScriptingInterface : public QObject, public Dependency {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TTSScriptingInterface();
|
||||||
|
~TTSScriptingInterface();
|
||||||
|
|
||||||
|
Q_INVOKABLE void speakText(const QString& textToSpeak);
|
||||||
|
Q_INVOKABLE void stopLastSpeech();
|
||||||
|
|
||||||
|
private:
|
||||||
|
#ifdef WIN32
|
||||||
|
class CComAutoInit {
|
||||||
|
public:
|
||||||
|
// Initializes COM using CoInitialize.
|
||||||
|
// On failure, signals error using AtlThrow.
|
||||||
|
CComAutoInit() {
|
||||||
|
HRESULT hr = ::CoInitialize(NULL);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
ATLTRACE(TEXT("CoInitialize() failed in CComAutoInit constructor (hr=0x%08X).\n"), hr);
|
||||||
|
AtlThrow(hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initializes COM using CoInitializeEx.
|
||||||
|
// On failure, signals error using AtlThrow.
|
||||||
|
explicit CComAutoInit(__in DWORD dwCoInit) {
|
||||||
|
HRESULT hr = ::CoInitializeEx(NULL, dwCoInit);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
ATLTRACE(TEXT("CoInitializeEx() failed in CComAutoInit constructor (hr=0x%08X).\n"), hr);
|
||||||
|
AtlThrow(hr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uninitializes COM using CoUninitialize.
|
||||||
|
~CComAutoInit() { ::CoUninitialize(); }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ban copy
|
||||||
|
//
|
||||||
|
private:
|
||||||
|
CComAutoInit(const CComAutoInit&);
|
||||||
|
};
|
||||||
|
|
||||||
|
// COM initialization and cleanup (must precede other COM related data members)
|
||||||
|
CComAutoInit m_comInit;
|
||||||
|
|
||||||
|
// Text to speech engine
|
||||||
|
CComPtr<ISpVoice> m_tts;
|
||||||
|
|
||||||
|
// Default voice token
|
||||||
|
CComPtr<ISpObjectToken> m_voiceToken;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QByteArray _lastSoundByteArray;
|
||||||
|
AudioInjectorPointer _lastSoundAudioInjector;
|
||||||
|
QTimer _lastSoundAudioInjectorUpdateTimer;
|
||||||
|
void updateLastSoundAudioInjector();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_SpeechScriptingInterface_h
|
|
@ -290,6 +290,7 @@ void Base3DOverlay::locationChanged(bool tellPhysics) {
|
||||||
notifyRenderVariableChange();
|
notifyRenderVariableChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Overlays shouldn't be deleted when their parents are
|
||||||
void Base3DOverlay::parentDeleted() {
|
void Base3DOverlay::parentDeleted() {
|
||||||
qApp->getOverlays().deleteOverlay(getOverlayID());
|
qApp->getOverlays().deleteOverlay(getOverlayID());
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,6 @@ public:
|
||||||
void setIsGrabbable(bool value) { _isGrabbable = value; }
|
void setIsGrabbable(bool value) { _isGrabbable = value; }
|
||||||
virtual void setIsVisibleInSecondaryCamera(bool value) { _isVisibleInSecondaryCamera = value; }
|
virtual void setIsVisibleInSecondaryCamera(bool value) { _isVisibleInSecondaryCamera = value; }
|
||||||
|
|
||||||
virtual AABox getBounds() const override = 0;
|
|
||||||
|
|
||||||
void update(float deltatime) override;
|
void update(float deltatime) override;
|
||||||
|
|
||||||
void notifyRenderVariableChange() const;
|
void notifyRenderVariableChange() const;
|
||||||
|
|
|
@ -60,6 +60,8 @@ ModelOverlay::ModelOverlay(const ModelOverlay* modelOverlay) :
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelOverlay::update(float deltatime) {
|
void ModelOverlay::update(float deltatime) {
|
||||||
|
Base3DOverlay::update(deltatime);
|
||||||
|
|
||||||
if (_updateModel) {
|
if (_updateModel) {
|
||||||
_updateModel = false;
|
_updateModel = false;
|
||||||
_model->setSnapModelToCenter(true);
|
_model->setSnapModelToCenter(true);
|
||||||
|
|
|
@ -247,7 +247,7 @@ void Overlay::removeMaterial(graphics::MaterialPointer material, const std::stri
|
||||||
}
|
}
|
||||||
|
|
||||||
render::ItemKey Overlay::getKey() {
|
render::ItemKey Overlay::getKey() {
|
||||||
auto builder = render::ItemKey::Builder().withTypeShape();
|
auto builder = render::ItemKey::Builder().withTypeShape().withTypeMeta();
|
||||||
|
|
||||||
builder.withViewSpace();
|
builder.withViewSpace();
|
||||||
builder.withLayer(render::hifi::LAYER_2D);
|
builder.withLayer(render::hifi::LAYER_2D);
|
||||||
|
|
|
@ -20,11 +20,9 @@ Volume3DOverlay::Volume3DOverlay(const Volume3DOverlay* volume3DOverlay) :
|
||||||
}
|
}
|
||||||
|
|
||||||
AABox Volume3DOverlay::getBounds() const {
|
AABox Volume3DOverlay::getBounds() const {
|
||||||
auto extents = Extents{_localBoundingBox};
|
AABox bounds = _localBoundingBox;
|
||||||
extents.rotate(getWorldOrientation());
|
bounds.transform(getTransform());
|
||||||
extents.shiftBy(getWorldPosition());
|
return bounds;
|
||||||
|
|
||||||
return AABox(extents);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Volume3DOverlay::setDimensions(const glm::vec3& value) {
|
void Volume3DOverlay::setDimensions(const glm::vec3& value) {
|
||||||
|
@ -49,15 +47,7 @@ void Volume3DOverlay::setProperties(const QVariantMap& properties) {
|
||||||
glm::vec3 scale = vec3FromVariant(dimensions);
|
glm::vec3 scale = vec3FromVariant(dimensions);
|
||||||
// don't allow a zero or negative dimension component to reach the renderTransform
|
// don't allow a zero or negative dimension component to reach the renderTransform
|
||||||
const float MIN_DIMENSION = 0.0001f;
|
const float MIN_DIMENSION = 0.0001f;
|
||||||
if (scale.x < MIN_DIMENSION) {
|
scale = glm::max(scale, MIN_DIMENSION);
|
||||||
scale.x = MIN_DIMENSION;
|
|
||||||
}
|
|
||||||
if (scale.y < MIN_DIMENSION) {
|
|
||||||
scale.y = MIN_DIMENSION;
|
|
||||||
}
|
|
||||||
if (scale.z < MIN_DIMENSION) {
|
|
||||||
scale.z = MIN_DIMENSION;
|
|
||||||
}
|
|
||||||
setDimensions(scale);
|
setDimensions(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ public:
|
||||||
virtual AABox getBounds() const override;
|
virtual AABox getBounds() const override;
|
||||||
|
|
||||||
const glm::vec3& getDimensions() const { return _localBoundingBox.getDimensions(); }
|
const glm::vec3& getDimensions() const { return _localBoundingBox.getDimensions(); }
|
||||||
void setDimensions(float value) { setDimensions(glm::vec3(value)); }
|
|
||||||
void setDimensions(const glm::vec3& value);
|
void setDimensions(const glm::vec3& value);
|
||||||
|
|
||||||
void setProperties(const QVariantMap& properties) override;
|
void setProperties(const QVariantMap& properties) override;
|
||||||
|
@ -37,7 +36,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Centered local bounding box
|
// Centered local bounding box
|
||||||
AABox _localBoundingBox{ vec3(0.0f), 1.0f };
|
AABox _localBoundingBox { vec3(-0.5), 1.0f };
|
||||||
|
|
||||||
Transform evalRenderTransform() override;
|
Transform evalRenderTransform() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ WebEntityRenderer::ContentType WebEntityRenderer::getContentType(const QString&
|
||||||
|
|
||||||
const QUrl url(urlString);
|
const QUrl url(urlString);
|
||||||
auto scheme = url.scheme();
|
auto scheme = url.scheme();
|
||||||
if (scheme == URL_SCHEME_ABOUT || scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS ||
|
if (scheme == HIFI_URL_SCHEME_ABOUT || scheme == HIFI_URL_SCHEME_HTTP || scheme == HIFI_URL_SCHEME_HTTPS ||
|
||||||
urlString.toLower().endsWith(".htm") || urlString.toLower().endsWith(".html")) {
|
urlString.toLower().endsWith(".htm") || urlString.toLower().endsWith(".html")) {
|
||||||
return ContentType::HtmlContent;
|
return ContentType::HtmlContent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ void EntityEditFilters::addFilter(EntityItemID entityID, QString filterURL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following should be abstracted out for use in Agent.cpp (and maybe later AvatarMixer.cpp)
|
// The following should be abstracted out for use in Agent.cpp (and maybe later AvatarMixer.cpp)
|
||||||
if (scriptURL.scheme().isEmpty() || (scriptURL.scheme() == URL_SCHEME_FILE)) {
|
if (scriptURL.scheme().isEmpty() || (scriptURL.scheme() == HIFI_URL_SCHEME_FILE)) {
|
||||||
qWarning() << "Cannot load script from local filesystem, because assignment may be on a different computer.";
|
qWarning() << "Cannot load script from local filesystem, because assignment may be on a different computer.";
|
||||||
scriptRequestFinished(entityID);
|
scriptRequestFinished(entityID);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2767,9 +2767,11 @@ bool EntityTree::readFromMap(QVariantMap& map) {
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QUuid& cloneOriginID = entity->getCloneOriginID();
|
if (entity) {
|
||||||
if (!cloneOriginID.isNull()) {
|
const QUuid& cloneOriginID = entity->getCloneOriginID();
|
||||||
cloneIDs[cloneOriginID].push_back(entity->getEntityItemID());
|
if (!cloneOriginID.isNull()) {
|
||||||
|
cloneIDs[cloneOriginID].push_back(entity->getEntityItemID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ _maxNumPixels(100)
|
||||||
|
|
||||||
static bool isLocalUrl(const QUrl& url) {
|
static bool isLocalUrl(const QUrl& url) {
|
||||||
auto scheme = url.scheme();
|
auto scheme = url.scheme();
|
||||||
return (scheme == URL_SCHEME_FILE || scheme == URL_SCHEME_QRC || scheme == RESOURCE_SCHEME);
|
return (scheme == HIFI_URL_SCHEME_FILE || scheme == URL_SCHEME_QRC || scheme == RESOURCE_SCHEME);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkTexture::NetworkTexture(const QUrl& url, image::TextureUsage::Type type, const QByteArray& content, int maxNumPixels) :
|
NetworkTexture::NetworkTexture(const QUrl& url, image::TextureUsage::Type type, const QByteArray& content, int maxNumPixels) :
|
||||||
|
@ -503,7 +503,7 @@ void NetworkTexture::handleLocalRequestCompleted() {
|
||||||
void NetworkTexture::makeLocalRequest() {
|
void NetworkTexture::makeLocalRequest() {
|
||||||
const QString scheme = _activeUrl.scheme();
|
const QString scheme = _activeUrl.scheme();
|
||||||
QString path;
|
QString path;
|
||||||
if (scheme == URL_SCHEME_FILE) {
|
if (scheme == HIFI_URL_SCHEME_FILE) {
|
||||||
path = PathUtils::expandToLocalDataAbsolutePath(_activeUrl).toLocalFile();
|
path = PathUtils::expandToLocalDataAbsolutePath(_activeUrl).toLocalFile();
|
||||||
} else {
|
} else {
|
||||||
path = ":" + _activeUrl.path();
|
path = ":" + _activeUrl.path();
|
||||||
|
|
|
@ -155,12 +155,12 @@ void AddressManager::goForward() {
|
||||||
void AddressManager::storeCurrentAddress() {
|
void AddressManager::storeCurrentAddress() {
|
||||||
auto url = currentAddress();
|
auto url = currentAddress();
|
||||||
|
|
||||||
if (url.scheme() == URL_SCHEME_FILE ||
|
if (url.scheme() == HIFI_URL_SCHEME_FILE ||
|
||||||
(url.scheme() == URL_SCHEME_HIFI && !url.host().isEmpty())) {
|
(url.scheme() == URL_SCHEME_HIFI && !url.host().isEmpty())) {
|
||||||
// TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can
|
// TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can
|
||||||
// be loaded over http(s)
|
// be loaded over http(s)
|
||||||
// url.scheme() == URL_SCHEME_HTTP ||
|
// url.scheme() == HIFI_URL_SCHEME_HTTP ||
|
||||||
// url.scheme() == URL_SCHEME_HTTPS ||
|
// url.scheme() == HIFI_URL_SCHEME_HTTPS ||
|
||||||
bool isInErrorState = DependencyManager::get<NodeList>()->getDomainHandler().isInErrorState();
|
bool isInErrorState = DependencyManager::get<NodeList>()->getDomainHandler().isInErrorState();
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
if (isInErrorState) {
|
if (isInErrorState) {
|
||||||
|
@ -331,11 +331,11 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
||||||
emit lookupResultsFinished();
|
emit lookupResultsFinished();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (lookupUrl.scheme() == URL_SCHEME_FILE) {
|
} else if (lookupUrl.scheme() == HIFI_URL_SCHEME_FILE) {
|
||||||
// TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can
|
// TODO -- once Octree::readFromURL no-longer takes over the main event-loop, serverless-domain urls can
|
||||||
// be loaded over http(s)
|
// be loaded over http(s)
|
||||||
// lookupUrl.scheme() == URL_SCHEME_HTTP ||
|
// lookupUrl.scheme() == URL_SCHEME_HTTP ||
|
||||||
// lookupUrl.scheme() == URL_SCHEME_HTTPS ||
|
// lookupUrl.scheme() == HIFI_URL_SCHEME_HTTPS ||
|
||||||
// TODO once a file can return a connection refusal if there were to be some kind of load error, we'd
|
// TODO once a file can return a connection refusal if there were to be some kind of load error, we'd
|
||||||
// need to store the previous domain tried in _lastVisitedURL. For now , do not store it.
|
// need to store the previous domain tried in _lastVisitedURL. For now , do not store it.
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
|
||||||
_sockAddr.clear();
|
_sockAddr.clear();
|
||||||
|
|
||||||
// if this is a file URL we need to see if it has a ~ for us to expand
|
// if this is a file URL we need to see if it has a ~ for us to expand
|
||||||
if (domainURL.scheme() == URL_SCHEME_FILE) {
|
if (domainURL.scheme() == HIFI_URL_SCHEME_FILE) {
|
||||||
domainURL = PathUtils::expandToLocalDataAbsolutePath(domainURL);
|
domainURL = PathUtils::expandToLocalDataAbsolutePath(domainURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,14 @@ namespace NetworkingConstants {
|
||||||
QUrl METAVERSE_SERVER_URL();
|
QUrl METAVERSE_SERVER_URL();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString URL_SCHEME_ABOUT = "about";
|
const QString HIFI_URL_SCHEME_ABOUT = "about";
|
||||||
const QString URL_SCHEME_HIFI = "hifi";
|
const QString URL_SCHEME_HIFI = "hifi";
|
||||||
const QString URL_SCHEME_HIFIAPP = "hifiapp";
|
const QString URL_SCHEME_HIFIAPP = "hifiapp";
|
||||||
const QString URL_SCHEME_QRC = "qrc";
|
const QString URL_SCHEME_QRC = "qrc";
|
||||||
const QString URL_SCHEME_FILE = "file";
|
const QString HIFI_URL_SCHEME_FILE = "file";
|
||||||
const QString URL_SCHEME_HTTP = "http";
|
const QString HIFI_URL_SCHEME_HTTP = "http";
|
||||||
const QString URL_SCHEME_HTTPS = "https";
|
const QString HIFI_URL_SCHEME_HTTPS = "https";
|
||||||
const QString URL_SCHEME_FTP = "ftp";
|
const QString HIFI_URL_SCHEME_FTP = "ftp";
|
||||||
const QString URL_SCHEME_ATP = "atp";
|
const QString URL_SCHEME_ATP = "atp";
|
||||||
|
|
||||||
#endif // hifi_NetworkingConstants_h
|
#endif // hifi_NetworkingConstants_h
|
||||||
|
|
|
@ -118,7 +118,7 @@ QSharedPointer<Resource> ResourceCacheSharedItems::getHighestPendingRequest() {
|
||||||
|
|
||||||
// Check load priority
|
// Check load priority
|
||||||
float priority = resource->getLoadPriority();
|
float priority = resource->getLoadPriority();
|
||||||
bool isFile = resource->getURL().scheme() == URL_SCHEME_FILE;
|
bool isFile = resource->getURL().scheme() == HIFI_URL_SCHEME_FILE;
|
||||||
if (priority >= highestPriority && (isFile || !currentHighestIsFile)) {
|
if (priority >= highestPriority && (isFile || !currentHighestIsFile)) {
|
||||||
highestPriority = priority;
|
highestPriority = priority;
|
||||||
highestIndex = i;
|
highestIndex = i;
|
||||||
|
|
|
@ -82,10 +82,10 @@ const QSet<QString>& getKnownUrls() {
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [] {
|
std::call_once(once, [] {
|
||||||
knownUrls.insert(URL_SCHEME_QRC);
|
knownUrls.insert(URL_SCHEME_QRC);
|
||||||
knownUrls.insert(URL_SCHEME_FILE);
|
knownUrls.insert(HIFI_URL_SCHEME_FILE);
|
||||||
knownUrls.insert(URL_SCHEME_HTTP);
|
knownUrls.insert(HIFI_URL_SCHEME_HTTP);
|
||||||
knownUrls.insert(URL_SCHEME_HTTPS);
|
knownUrls.insert(HIFI_URL_SCHEME_HTTPS);
|
||||||
knownUrls.insert(URL_SCHEME_FTP);
|
knownUrls.insert(HIFI_URL_SCHEME_FTP);
|
||||||
knownUrls.insert(URL_SCHEME_ATP);
|
knownUrls.insert(URL_SCHEME_ATP);
|
||||||
});
|
});
|
||||||
return knownUrls;
|
return knownUrls;
|
||||||
|
@ -97,7 +97,7 @@ QUrl ResourceManager::normalizeURL(const QUrl& originalUrl) {
|
||||||
if (!getKnownUrls().contains(scheme)) {
|
if (!getKnownUrls().contains(scheme)) {
|
||||||
// check the degenerative file case: on windows we can often have urls of the form c:/filename
|
// check the degenerative file case: on windows we can often have urls of the form c:/filename
|
||||||
// this checks for and works around that case.
|
// this checks for and works around that case.
|
||||||
QUrl urlWithFileScheme{ URL_SCHEME_FILE + ":///" + url.toString() };
|
QUrl urlWithFileScheme{ HIFI_URL_SCHEME_FILE + ":///" + url.toString() };
|
||||||
if (!urlWithFileScheme.toLocalFile().isEmpty()) {
|
if (!urlWithFileScheme.toLocalFile().isEmpty()) {
|
||||||
return urlWithFileScheme;
|
return urlWithFileScheme;
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,9 @@ ResourceRequest* ResourceManager::createResourceRequest(
|
||||||
|
|
||||||
ResourceRequest* request = nullptr;
|
ResourceRequest* request = nullptr;
|
||||||
|
|
||||||
if (scheme == URL_SCHEME_FILE || scheme == URL_SCHEME_QRC) {
|
if (scheme == HIFI_URL_SCHEME_FILE || scheme == URL_SCHEME_QRC) {
|
||||||
request = new FileResourceRequest(normalizedURL, isObservable, callerId, extra);
|
request = new FileResourceRequest(normalizedURL, isObservable, callerId, extra);
|
||||||
} else if (scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS || scheme == URL_SCHEME_FTP) {
|
} else if (scheme == HIFI_URL_SCHEME_HTTP || scheme == HIFI_URL_SCHEME_HTTPS || scheme == HIFI_URL_SCHEME_FTP) {
|
||||||
request = new HTTPResourceRequest(normalizedURL, isObservable, callerId, extra);
|
request = new HTTPResourceRequest(normalizedURL, isObservable, callerId, extra);
|
||||||
} else if (scheme == URL_SCHEME_ATP) {
|
} else if (scheme == URL_SCHEME_ATP) {
|
||||||
if (!_atpSupportEnabled) {
|
if (!_atpSupportEnabled) {
|
||||||
|
@ -149,10 +149,10 @@ ResourceRequest* ResourceManager::createResourceRequest(
|
||||||
|
|
||||||
bool ResourceManager::resourceExists(const QUrl& url) {
|
bool ResourceManager::resourceExists(const QUrl& url) {
|
||||||
auto scheme = url.scheme();
|
auto scheme = url.scheme();
|
||||||
if (scheme == URL_SCHEME_FILE) {
|
if (scheme == HIFI_URL_SCHEME_FILE) {
|
||||||
QFileInfo file{ url.toString() };
|
QFileInfo file{ url.toString() };
|
||||||
return file.exists();
|
return file.exists();
|
||||||
} else if (scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS || scheme == URL_SCHEME_FTP) {
|
} else if (scheme == HIFI_URL_SCHEME_HTTP || scheme == HIFI_URL_SCHEME_HTTPS || scheme == HIFI_URL_SCHEME_FTP) {
|
||||||
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
auto& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest request{ url };
|
QNetworkRequest request{ url };
|
||||||
|
|
||||||
|
|
|
@ -305,15 +305,16 @@ bool ObjectMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine*
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (_shape == newShape) {
|
|
||||||
// the shape didn't actually change, so we clear the DIRTY_SHAPE flag
|
|
||||||
flags &= ~Simulation::DIRTY_SHAPE;
|
|
||||||
// and clear the reference we just created
|
|
||||||
getShapeManager()->releaseShape(_shape);
|
|
||||||
} else {
|
} else {
|
||||||
_body->setCollisionShape(const_cast<btCollisionShape*>(newShape));
|
if (_shape == newShape) {
|
||||||
setShape(newShape);
|
// the shape didn't actually change, so we clear the DIRTY_SHAPE flag
|
||||||
|
flags &= ~Simulation::DIRTY_SHAPE;
|
||||||
|
// and clear the reference we just created
|
||||||
|
getShapeManager()->releaseShape(_shape);
|
||||||
|
} else {
|
||||||
|
_body->setCollisionShape(const_cast<btCollisionShape*>(newShape));
|
||||||
|
setShape(newShape);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags & EASY_DIRTY_PHYSICS_FLAGS) {
|
if (flags & EASY_DIRTY_PHYSICS_FLAGS) {
|
||||||
|
|
|
@ -289,6 +289,12 @@ void PhysicsEngine::processTransaction(PhysicsEngine::Transaction& transaction)
|
||||||
bumpAndPruneContacts(object);
|
bumpAndPruneContacts(object);
|
||||||
btRigidBody* body = object->getRigidBody();
|
btRigidBody* body = object->getRigidBody();
|
||||||
if (body) {
|
if (body) {
|
||||||
|
if (body->isStaticObject() && _activeStaticBodies.size() > 0) {
|
||||||
|
std::set<btRigidBody*>::iterator itr = _activeStaticBodies.find(body);
|
||||||
|
if (itr != _activeStaticBodies.end()) {
|
||||||
|
_activeStaticBodies.erase(itr);
|
||||||
|
}
|
||||||
|
}
|
||||||
removeDynamicsForBody(body);
|
removeDynamicsForBody(body);
|
||||||
_dynamicsWorld->removeRigidBody(body);
|
_dynamicsWorld->removeRigidBody(body);
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ void CullSpatialSelection::run(const RenderContextPointer& renderContext,
|
||||||
if (!srcFilter.selectsNothing()) {
|
if (!srcFilter.selectsNothing()) {
|
||||||
auto filter = render::ItemFilter::Builder(srcFilter).withoutSubMetaCulled().build();
|
auto filter = render::ItemFilter::Builder(srcFilter).withoutSubMetaCulled().build();
|
||||||
|
|
||||||
// Now get the bound, and
|
// Now get the bound, and
|
||||||
// filter individually against the _filter
|
// filter individually against the _filter
|
||||||
// visibility cull if partially selected ( octree cell contianing it was partial)
|
// visibility cull if partially selected ( octree cell contianing it was partial)
|
||||||
// distance cull if was a subcell item ( octree cell is way bigger than the item bound itself, so now need to test per item)
|
// distance cull if was a subcell item ( octree cell is way bigger than the item bound itself, so now need to test per item)
|
||||||
|
|
|
@ -279,11 +279,27 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Separator {}
|
Separator {}
|
||||||
HifiControls.Button {
|
Row {
|
||||||
text: "Engine"
|
HifiControls.Button {
|
||||||
// activeFocusOnPress: false
|
text: "Engine"
|
||||||
onClicked: {
|
// activeFocusOnPress: false
|
||||||
sendToScript({method: "openEngineView"});
|
onClicked: {
|
||||||
|
sendToScript({method: "openEngineView"});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HifiControls.Button {
|
||||||
|
text: "LOD"
|
||||||
|
// activeFocusOnPress: false
|
||||||
|
onClicked: {
|
||||||
|
sendToScript({method: "openEngineLODView"});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HifiControls.Button {
|
||||||
|
text: "Cull"
|
||||||
|
// activeFocusOnPress: false
|
||||||
|
onClicked: {
|
||||||
|
sendToScript({method: "openCullInspectorView"});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,122 +11,131 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var TABLET_BUTTON_NAME = "LUCI";
|
var AppUi = Script.require('appUi');
|
||||||
var QMLAPP_URL = Script.resolvePath("./deferredLighting.qml");
|
|
||||||
var ICON_URL = Script.resolvePath("../../../system/assets/images/luci-i.svg");
|
|
||||||
var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/luci-a.svg");
|
|
||||||
|
|
||||||
|
|
||||||
var onLuciScreen = false;
|
|
||||||
|
|
||||||
function onClicked() {
|
|
||||||
if (onLuciScreen) {
|
|
||||||
tablet.gotoHomeScreen();
|
|
||||||
} else {
|
|
||||||
tablet.loadQMLSource(QMLAPP_URL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
|
||||||
var button = tablet.addButton({
|
|
||||||
text: TABLET_BUTTON_NAME,
|
|
||||||
icon: ICON_URL,
|
|
||||||
activeIcon: ACTIVE_ICON_URL
|
|
||||||
});
|
|
||||||
|
|
||||||
var hasEventBridge = false;
|
|
||||||
|
|
||||||
function wireEventBridge(on) {
|
|
||||||
if (!tablet) {
|
|
||||||
print("Warning in wireEventBridge(): 'tablet' undefined!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (on) {
|
|
||||||
if (!hasEventBridge) {
|
|
||||||
tablet.fromQml.connect(fromQml);
|
|
||||||
hasEventBridge = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (hasEventBridge) {
|
|
||||||
tablet.fromQml.disconnect(fromQml);
|
|
||||||
hasEventBridge = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
|
||||||
if (url === QMLAPP_URL) {
|
|
||||||
onLuciScreen = true;
|
|
||||||
} else {
|
|
||||||
onLuciScreen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.editProperties({isActive: onLuciScreen});
|
|
||||||
wireEventBridge(onLuciScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
|
||||||
tablet.screenChanged.connect(onScreenChanged);
|
|
||||||
|
|
||||||
var moveDebugCursor = false;
|
var moveDebugCursor = false;
|
||||||
Controller.mousePressEvent.connect(function (e) {
|
var onMousePressEvent = function (e) {
|
||||||
if (e.isMiddleButton) {
|
if (e.isMiddleButton) {
|
||||||
moveDebugCursor = true;
|
moveDebugCursor = true;
|
||||||
setDebugCursor(e.x, e.y);
|
setDebugCursor(e.x, e.y);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
Controller.mouseReleaseEvent.connect(function() { moveDebugCursor = false; });
|
Controller.mousePressEvent.connect(onMousePressEvent);
|
||||||
Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); });
|
|
||||||
|
|
||||||
|
var onMouseReleaseEvent = function () {
|
||||||
|
moveDebugCursor = false;
|
||||||
|
};
|
||||||
|
Controller.mouseReleaseEvent.connect(onMouseReleaseEvent);
|
||||||
|
|
||||||
|
var onMouseMoveEvent = function (e) {
|
||||||
|
if (moveDebugCursor) {
|
||||||
|
setDebugCursor(e.x, e.y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Controller.mouseMoveEvent.connect(onMouseMoveEvent);
|
||||||
|
|
||||||
function setDebugCursor(x, y) {
|
function setDebugCursor(x, y) {
|
||||||
nx = 2.0 * (x / Window.innerWidth) - 1.0;
|
var nx = 2.0 * (x / Window.innerWidth) - 1.0;
|
||||||
ny = 1.0 - 2.0 * ((y) / (Window.innerHeight));
|
var ny = 1.0 - 2.0 * ((y) / (Window.innerHeight));
|
||||||
|
|
||||||
Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 };
|
Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Page(title, qmlurl, width, height) {
|
||||||
|
this.title = title;
|
||||||
|
this.qml = qmlurl;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
this.window;
|
||||||
|
|
||||||
|
print("Page: New Page:" + JSON.stringify(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
Page.prototype.killView = function () {
|
||||||
|
print("Page: Kill window for page:" + JSON.stringify(this));
|
||||||
|
if (this.window) {
|
||||||
|
print("Page: Kill window for page:" + this.title);
|
||||||
|
//this.window.closed.disconnect(function () {
|
||||||
|
// this.killView();
|
||||||
|
//});
|
||||||
|
this.window.close();
|
||||||
|
this.window = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Page.prototype.createView = function () {
|
||||||
|
var that = this;
|
||||||
|
if (!this.window) {
|
||||||
|
print("Page: New window for page:" + this.title);
|
||||||
|
this.window = Desktop.createWindow(Script.resolvePath(this.qml), {
|
||||||
|
title: this.title,
|
||||||
|
presentationMode: Desktop.PresentationMode.NATIVE,
|
||||||
|
size: {x: this.width, y: this.height}
|
||||||
|
});
|
||||||
|
this.window.closed.connect(function () {
|
||||||
|
that.killView();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var Pages = function () {
|
||||||
|
this._pages = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
Pages.prototype.addPage = function (command, title, qmlurl, width, height) {
|
||||||
|
this._pages[command] = new Page(title, qmlurl, width, height);
|
||||||
|
};
|
||||||
|
|
||||||
|
Pages.prototype.open = function (command) {
|
||||||
|
print("Pages: command = " + command);
|
||||||
|
if (!this._pages[command]) {
|
||||||
|
print("Pages: unknown command = " + command);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._pages[command].createView();
|
||||||
|
};
|
||||||
|
|
||||||
|
Pages.prototype.clear = function () {
|
||||||
|
for (var p in this._pages) {
|
||||||
|
print("Pages: kill page: " + p);
|
||||||
|
this._pages[p].killView();
|
||||||
|
delete this._pages[p];
|
||||||
|
}
|
||||||
|
this._pages = {};
|
||||||
|
};
|
||||||
|
var pages = new Pages();
|
||||||
|
|
||||||
|
pages.addPage('openEngineView', 'Render Engine', 'engineInspector.qml', 300, 400);
|
||||||
|
pages.addPage('openEngineLODView', 'Render LOD', 'lod.qml', 300, 400);
|
||||||
|
pages.addPage('openCullInspectorView', 'Cull Inspector', 'culling.qml', 300, 400);
|
||||||
|
|
||||||
function fromQml(message) {
|
function fromQml(message) {
|
||||||
switch (message.method) {
|
if (pages.open(message.method)) {
|
||||||
case "openEngineView":
|
return;
|
||||||
openEngineTaskView();
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ui;
|
||||||
var engineInspectorView = null
|
function startup() {
|
||||||
function openEngineTaskView() {
|
ui = new AppUi({
|
||||||
if (engineInspectorView == null) {
|
buttonName: "LUCI",
|
||||||
var qml = Script.resolvePath('engineInspector.qml');
|
home: Script.resolvePath("deferredLighting.qml"),
|
||||||
var window = new OverlayWindow({
|
additionalAppScreens: Script.resolvePath("engineInspector.qml"),
|
||||||
title: 'Render Engine',
|
onMessage: fromQml,
|
||||||
source: qml,
|
normalButton: Script.resolvePath("../../../system/assets/images/luci-i.svg"),
|
||||||
width: 300,
|
activeButton: Script.resolvePath("../../../system/assets/images/luci-a.svg")
|
||||||
height: 400
|
});
|
||||||
});
|
|
||||||
window.setPosition(200, 50);
|
|
||||||
engineInspectorView = window
|
|
||||||
window.closed.connect(function() { engineInspectorView = null; });
|
|
||||||
} else {
|
|
||||||
engineInspectorView.setPosition(200, 50);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
startup();
|
||||||
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
if (onLuciScreen) {
|
Controller.mousePressEvent.disconnect(onMousePressEvent);
|
||||||
tablet.gotoHomeScreen();
|
Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent);
|
||||||
}
|
Controller.mouseMoveEvent.disconnect(onMouseMoveEvent);
|
||||||
button.clicked.disconnect(onClicked);
|
pages.clear();
|
||||||
tablet.screenChanged.disconnect(onScreenChanged);
|
// killEngineInspectorView();
|
||||||
tablet.removeButton(button);
|
// killCullInspectorView();
|
||||||
|
// killEngineLODWindow();
|
||||||
if (engineInspectorView !== null) {
|
|
||||||
engineInspectorView.close()
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -196,12 +196,6 @@
|
||||||
"particleRadius": {
|
"particleRadius": {
|
||||||
"tooltip": "The size of each particle."
|
"tooltip": "The size of each particle."
|
||||||
},
|
},
|
||||||
"radiusStart": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"radiusFinish": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"radiusSpread": {
|
"radiusSpread": {
|
||||||
"tooltip": "The spread in size that each particle is given, resulting in a variety of sizes."
|
"tooltip": "The spread in size that each particle is given, resulting in a variety of sizes."
|
||||||
},
|
},
|
||||||
|
@ -215,12 +209,6 @@
|
||||||
"alpha": {
|
"alpha": {
|
||||||
"tooltip": "The alpha of each particle."
|
"tooltip": "The alpha of each particle."
|
||||||
},
|
},
|
||||||
"alphaStart": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"alphaFinish": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"alphaSpread": {
|
"alphaSpread": {
|
||||||
"tooltip": "The spread in alpha that each particle is given, resulting in a variety of alphas."
|
"tooltip": "The spread in alpha that each particle is given, resulting in a variety of alphas."
|
||||||
},
|
},
|
||||||
|
@ -233,12 +221,6 @@
|
||||||
"particleSpin": {
|
"particleSpin": {
|
||||||
"tooltip": "The spin of each particle in the system."
|
"tooltip": "The spin of each particle in the system."
|
||||||
},
|
},
|
||||||
"spinStart": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"spinFinish": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"spinSpread": {
|
"spinSpread": {
|
||||||
"tooltip": "The spread in spin that each particle is given, resulting in a variety of spins."
|
"tooltip": "The spread in spin that each particle is given, resulting in a variety of spins."
|
||||||
},
|
},
|
||||||
|
@ -248,15 +230,9 @@
|
||||||
"polarStart": {
|
"polarStart": {
|
||||||
"tooltip": "The angle in deg at which particles are emitted. Starts in the entity's -z direction, and rotates around its y axis."
|
"tooltip": "The angle in deg at which particles are emitted. Starts in the entity's -z direction, and rotates around its y axis."
|
||||||
},
|
},
|
||||||
"polarFinish": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"azimuthStart": {
|
"azimuthStart": {
|
||||||
"tooltip": "The angle in deg at which particles are emitted. Starts in the entity's -z direction, and rotates around its y axis."
|
"tooltip": "The angle in deg at which particles are emitted. Starts in the entity's -z direction, and rotates around its y axis."
|
||||||
},
|
},
|
||||||
"azimuthFinish": {
|
|
||||||
"tooltip": ""
|
|
||||||
},
|
|
||||||
"lightColor": {
|
"lightColor": {
|
||||||
"tooltip": "The color of the light emitted.",
|
"tooltip": "The color of the light emitted.",
|
||||||
"jsPropertyName": "color"
|
"jsPropertyName": "color"
|
||||||
|
|
|
@ -278,7 +278,7 @@ const DEFAULT_ENTITY_PROPERTIES = {
|
||||||
All: {
|
All: {
|
||||||
description: "",
|
description: "",
|
||||||
rotation: { x: 0, y: 0, z: 0, w: 1 },
|
rotation: { x: 0, y: 0, z: 0, w: 1 },
|
||||||
collidesWith: "static,dynamic,kinematic,otherAvatar",
|
collidesWith: "static,dynamic,kinematic,otherAvatar,myAvatar",
|
||||||
collisionSoundURL: "",
|
collisionSoundURL: "",
|
||||||
cloneable: false,
|
cloneable: false,
|
||||||
ignoreIK: true,
|
ignoreIK: true,
|
||||||
|
@ -484,23 +484,28 @@ var toolBar = (function () {
|
||||||
originalProperties[key] = newProperties[key];
|
originalProperties[key] = newProperties[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function createNewEntity(properties) {
|
function createNewEntity(requestedProperties) {
|
||||||
var dimensions = properties.dimensions ? properties.dimensions : DEFAULT_DIMENSIONS;
|
var dimensions = requestedProperties.dimensions ? requestedProperties.dimensions : DEFAULT_DIMENSIONS;
|
||||||
var position = getPositionToCreateEntity();
|
var position = getPositionToCreateEntity();
|
||||||
var entityID = null;
|
var entityID = null;
|
||||||
|
|
||||||
|
var properties = {};
|
||||||
|
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.All);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.All);
|
||||||
|
|
||||||
var type = properties.type;
|
var type = requestedProperties.type;
|
||||||
if (type == "Box" || type == "Sphere") {
|
if (type == "Box" || type == "Sphere") {
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Shape);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Shape);
|
||||||
} else if (type == "Image") {
|
} else if (type == "Image") {
|
||||||
properties.type = "Model";
|
requestedProperties.type = "Model";
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Image);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES.Image);
|
||||||
} else {
|
} else {
|
||||||
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES[type]);
|
applyProperties(properties, DEFAULT_ENTITY_PROPERTIES[type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We apply the requested properties first so that they take priority over any default properties.
|
||||||
|
applyProperties(properties, requestedProperties);
|
||||||
|
|
||||||
|
|
||||||
if (position !== null && position !== undefined) {
|
if (position !== null && position !== undefined) {
|
||||||
var direction;
|
var direction;
|
||||||
|
@ -845,41 +850,18 @@ var toolBar = (function () {
|
||||||
addButton("newCubeButton", function () {
|
addButton("newCubeButton", function () {
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Box",
|
type: "Box",
|
||||||
dimensions: DEFAULT_DIMENSIONS,
|
|
||||||
color: {
|
|
||||||
red: 255,
|
|
||||||
green: 0,
|
|
||||||
blue: 0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
addButton("newSphereButton", function () {
|
addButton("newSphereButton", function () {
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Sphere",
|
type: "Sphere",
|
||||||
dimensions: DEFAULT_DIMENSIONS,
|
|
||||||
color: {
|
|
||||||
red: 255,
|
|
||||||
green: 0,
|
|
||||||
blue: 0
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
addButton("newLightButton", function () {
|
addButton("newLightButton", function () {
|
||||||
createNewEntity({
|
createNewEntity({
|
||||||
type: "Light",
|
type: "Light",
|
||||||
isSpotlight: false,
|
|
||||||
color: {
|
|
||||||
red: 150,
|
|
||||||
green: 150,
|
|
||||||
blue: 150
|
|
||||||
},
|
|
||||||
constantAttenuation: 1,
|
|
||||||
linearAttenuation: 0,
|
|
||||||
quadraticAttenuation: 0,
|
|
||||||
exponent: 0,
|
|
||||||
cutoff: 180 // in degrees
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2490,6 +2472,13 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HMD.displayModeChanged.connect(function() {
|
||||||
|
emitScriptEvent({
|
||||||
|
type: 'hmdActiveChanged',
|
||||||
|
hmdActive: HMD.active,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
createToolsWindow.webEventReceived.addListener(this, onWebEventReceived);
|
createToolsWindow.webEventReceived.addListener(this, onWebEventReceived);
|
||||||
|
|
||||||
webView.webEventReceived.connect(onWebEventReceived);
|
webView.webEventReceived.connect(onWebEventReceived);
|
||||||
|
|
|
@ -1598,7 +1598,7 @@ input.rename-entity {
|
||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.createAppTooltip {
|
.create-app-tooltip {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: #6a6a6a;
|
background: #6a6a6a;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
|
@ -1607,17 +1607,16 @@ input.rename-entity {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.createAppTooltip .createAppTooltipDescription {
|
.create-app-tooltip .create-app-tooltip-description {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.createAppTooltip .createAppTooltipJSAttribute {
|
.create-app-tooltip .create-app-tooltip-js-attribute {
|
||||||
font-family: Raleway-SemiBold;
|
font-family: Raleway-SemiBold;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,15 +58,15 @@ CreateAppTooltip.prototype = {
|
||||||
if (!TOOLTIP_DEBUG) {
|
if (!TOOLTIP_DEBUG) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tooltipData = {tooltip: 'PLEASE SET THIS TOOLTIP'};
|
tooltipData = { tooltip: 'PLEASE SET THIS TOOLTIP' };
|
||||||
}
|
}
|
||||||
|
|
||||||
let elementRect = element.getBoundingClientRect();
|
let elementRect = element.getBoundingClientRect();
|
||||||
let elTip = document.createElement("div");
|
let elTip = document.createElement("div");
|
||||||
elTip.className = "createAppTooltip";
|
elTip.className = "create-app-tooltip";
|
||||||
|
|
||||||
let elTipDescription = document.createElement("div");
|
let elTipDescription = document.createElement("div");
|
||||||
elTipDescription.className = "createAppTooltipDescription";
|
elTipDescription.className = "create-app-tooltip-description";
|
||||||
elTipDescription.innerText = tooltipData.tooltip;
|
elTipDescription.innerText = tooltipData.tooltip;
|
||||||
elTip.appendChild(elTipDescription);
|
elTip.appendChild(elTipDescription);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ CreateAppTooltip.prototype = {
|
||||||
|
|
||||||
if (!tooltipData.skipJSProperty) {
|
if (!tooltipData.skipJSProperty) {
|
||||||
let elTipJSAttribute = document.createElement("div");
|
let elTipJSAttribute = document.createElement("div");
|
||||||
elTipJSAttribute.className = "createAppTooltipJSAttribute";
|
elTipJSAttribute.className = "create-app-tooltip-js-attribute";
|
||||||
elTipJSAttribute.innerText = `JS Attribute: ${jsAttribute}`;
|
elTipJSAttribute.innerText = `JS Attribute: ${jsAttribute}`;
|
||||||
elTip.appendChild(elTipJSAttribute);
|
elTip.appendChild(elTipJSAttribute);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ CreateAppTooltip.prototype = {
|
||||||
// show above when otherwise out of bounds
|
// show above when otherwise out of bounds
|
||||||
elTip.style.top = elementTop - CREATE_APP_TOOLTIP_OFFSET - elTip.clientHeight;
|
elTip.style.top = elementTop - CREATE_APP_TOOLTIP_OFFSET - elTip.clientHeight;
|
||||||
} else {
|
} else {
|
||||||
// show tooltip on below by default
|
// show tooltip below by default
|
||||||
elTip.style.top = desiredTooltipTop;
|
elTip.style.top = desiredTooltipTop;
|
||||||
}
|
}
|
||||||
if ((window.innerWidth + window.pageXOffset) < (desiredTooltipLeft + elTip.clientWidth)) {
|
if ((window.innerWidth + window.pageXOffset) < (desiredTooltipLeft + elTip.clientWidth)) {
|
||||||
|
|
|
@ -3165,8 +3165,13 @@ function loaded() {
|
||||||
} else if (data.type === 'tooltipsReply') {
|
} else if (data.type === 'tooltipsReply') {
|
||||||
createAppTooltip.setIsEnabled(!data.hmdActive);
|
createAppTooltip.setIsEnabled(!data.hmdActive);
|
||||||
createAppTooltip.setTooltipData(data.tooltips);
|
createAppTooltip.setTooltipData(data.tooltips);
|
||||||
|
} else if (data.type === 'hmdActiveChanged') {
|
||||||
|
createAppTooltip.setIsEnabled(!data.hmdActive);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Request tooltips as soon as we can process a reply:
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'tooltipsRequest' }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server Script Status
|
// Server Script Status
|
||||||
|
@ -3397,6 +3402,5 @@ function loaded() {
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'propertiesPageReady' }));
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'propertiesPageReady' }));
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'tooltipsRequest' }));
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ void TestRunner::runInterfaceWithTestScript() {
|
||||||
QString testScript =
|
QString testScript =
|
||||||
QString("https://raw.githubusercontent.com/") + _user + "/hifi_tests/" + _branch + "/tests/testRecursive.js";
|
QString("https://raw.githubusercontent.com/") + _user + "/hifi_tests/" + _branch + "/tests/testRecursive.js";
|
||||||
|
|
||||||
QString commandLine = exeFile + " --url " + url + " --no-updater --no-login" + " --testScript " + testScript +
|
QString commandLine = exeFile + " --url " + url + " --no-updater --no-login-suggestion" + " --testScript " + testScript +
|
||||||
" quitWhenFinished --testResultsLocation " + snapshotFolder;
|
" quitWhenFinished --testResultsLocation " + snapshotFolder;
|
||||||
|
|
||||||
interfaceWorker->setCommandLine(commandLine);
|
interfaceWorker->setCommandLine(commandLine);
|
||||||
|
|
Loading…
Reference in a new issue