diff --git a/interface/resources/icons/load-script.svg b/interface/resources/icons/load-script.svg
deleted file mode 100644
index 21be61c321..0000000000
--- a/interface/resources/icons/load-script.svg
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
diff --git a/interface/resources/icons/new-script.svg b/interface/resources/icons/new-script.svg
deleted file mode 100644
index f68fcfa967..0000000000
--- a/interface/resources/icons/new-script.svg
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
diff --git a/interface/resources/icons/save-script.svg b/interface/resources/icons/save-script.svg
deleted file mode 100644
index 04d41b8302..0000000000
--- a/interface/resources/icons/save-script.svg
+++ /dev/null
@@ -1,674 +0,0 @@
-
-
-
-
diff --git a/interface/resources/icons/start-script.svg b/interface/resources/icons/start-script.svg
deleted file mode 100644
index 994eb61efe..0000000000
--- a/interface/resources/icons/start-script.svg
+++ /dev/null
@@ -1,550 +0,0 @@
-
-
-
-
diff --git a/interface/resources/icons/stop-script.svg b/interface/resources/icons/stop-script.svg
deleted file mode 100644
index 31cdcee749..0000000000
--- a/interface/resources/icons/stop-script.svg
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
-
-
diff --git a/interface/resources/qml/Stats.qml b/interface/resources/qml/Stats.qml
index 564c74b526..6f131d0473 100644
--- a/interface/resources/qml/Stats.qml
+++ b/interface/resources/qml/Stats.qml
@@ -198,7 +198,7 @@ Item {
}
StatText {
visible: root.expanded;
- text: "Audio Out Mic: " + root.audioMicOutboundPPS + " pps, " +
+ text: "Audio Out Mic: " + root.audioOutboundPPS + " pps, " +
"Silent: " + root.audioSilentOutboundPPS + " pps";
}
StatText {
diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp
index 02fe2a2dd3..4b274906e7 100644
--- a/interface/src/Application.cpp
+++ b/interface/src/Application.cpp
@@ -2745,8 +2745,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
case Qt::Key_S:
if (isShifted && isMeta && !isOption) {
Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings);
- } else if (isOption && !isShifted && !isMeta) {
- Menu::getInstance()->triggerOption(MenuOption::ScriptEditor);
} else if (!isOption && !isShifted && isMeta) {
takeSnapshot(true);
}
diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp
index aeea7e0c60..a48ee4e7db 100644
--- a/interface/src/Menu.cpp
+++ b/interface/src/Menu.cpp
@@ -117,11 +117,6 @@ Menu::Menu() {
scriptEngines.data(), SLOT(reloadAllScripts()),
QAction::NoRole, UNSPECIFIED_POSITION, "Advanced");
- // Edit > Scripts Editor... [advanced]
- addActionToQMenuAndActionHash(editMenu, MenuOption::ScriptEditor, Qt::ALT | Qt::Key_S,
- dialogsManager.data(), SLOT(showScriptEditor()),
- QAction::NoRole, UNSPECIFIED_POSITION, "Advanced");
-
// Edit > Console... [advanced]
addActionToQMenuAndActionHash(editMenu, MenuOption::Console, Qt::CTRL | Qt::ALT | Qt::Key_J,
DependencyManager::get().data(),
diff --git a/interface/src/Menu.h b/interface/src/Menu.h
index a0beb25762..b4eaf56758 100644
--- a/interface/src/Menu.h
+++ b/interface/src/Menu.h
@@ -166,7 +166,6 @@ namespace MenuOption {
const QString RunningScripts = "Running Scripts...";
const QString RunClientScriptTests = "Run Client Script Tests";
const QString RunTimingTests = "Run Timing Tests";
- const QString ScriptEditor = "Script Editor...";
const QString ScriptedMotorControl = "Enable Scripted Motor Control";
const QString SendWrongDSConnectVersion = "Send wrong DS connect version";
const QString SendWrongProtocolVersion = "Send wrong protocol version";
diff --git a/interface/src/ui/DialogsManager.cpp b/interface/src/ui/DialogsManager.cpp
index 70ffc5ece9..f1d6f585d7 100644
--- a/interface/src/ui/DialogsManager.cpp
+++ b/interface/src/ui/DialogsManager.cpp
@@ -26,7 +26,6 @@
#include "LoginDialog.h"
#include "OctreeStatsDialog.h"
#include "PreferencesDialog.h"
-#include "ScriptEditorWindow.h"
#include "UpdateDialog.h"
template
@@ -120,12 +119,6 @@ void DialogsManager::hmdToolsClosed() {
}
}
-void DialogsManager::showScriptEditor() {
- maybeCreateDialog(_scriptEditor);
- _scriptEditor->show();
- _scriptEditor->raise();
-}
-
void DialogsManager::showTestingResults() {
if (!_testingDialog) {
_testingDialog = new TestingDialog(qApp->getWindow());
diff --git a/interface/src/ui/DialogsManager.h b/interface/src/ui/DialogsManager.h
index 5f50b49d94..608195aca7 100644
--- a/interface/src/ui/DialogsManager.h
+++ b/interface/src/ui/DialogsManager.h
@@ -50,7 +50,6 @@ public slots:
void octreeStatsDetails();
void lodTools();
void hmdTools(bool showTools);
- void showScriptEditor();
void showDomainConnectionDialog();
void showTestingResults();
@@ -78,7 +77,6 @@ private:
QPointer _hmdToolsDialog;
QPointer _lodToolsDialog;
QPointer _octreeStatsDialog;
- QPointer _scriptEditor;
QPointer _testingDialog;
QPointer _domainConnectionDialog;
};
diff --git a/interface/src/ui/ScriptEditBox.cpp b/interface/src/ui/ScriptEditBox.cpp
deleted file mode 100644
index 2aea225b17..0000000000
--- a/interface/src/ui/ScriptEditBox.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// ScriptEditBox.cpp
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/30/14.
-// 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
-//
-
-#include "ScriptEditBox.h"
-
-#include
-#include
-
-#include "ScriptLineNumberArea.h"
-
-ScriptEditBox::ScriptEditBox(QWidget* parent) :
- QPlainTextEdit(parent)
-{
- _scriptLineNumberArea = new ScriptLineNumberArea(this);
-
- connect(this, &ScriptEditBox::blockCountChanged, this, &ScriptEditBox::updateLineNumberAreaWidth);
- connect(this, &ScriptEditBox::updateRequest, this, &ScriptEditBox::updateLineNumberArea);
- connect(this, &ScriptEditBox::cursorPositionChanged, this, &ScriptEditBox::highlightCurrentLine);
-
- updateLineNumberAreaWidth(0);
- highlightCurrentLine();
-}
-
-int ScriptEditBox::lineNumberAreaWidth() {
- int digits = 1;
- const int SPACER_PIXELS = 3;
- const int BASE_TEN = 10;
- int max = qMax(1, blockCount());
- while (max >= BASE_TEN) {
- max /= BASE_TEN;
- digits++;
- }
- return SPACER_PIXELS + fontMetrics().width(QLatin1Char('H')) * digits;
-}
-
-void ScriptEditBox::updateLineNumberAreaWidth(int blockCount) {
- setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
-}
-
-void ScriptEditBox::updateLineNumberArea(const QRect& rect, int deltaY) {
- if (deltaY) {
- _scriptLineNumberArea->scroll(0, deltaY);
- } else {
- _scriptLineNumberArea->update(0, rect.y(), _scriptLineNumberArea->width(), rect.height());
- }
-
- if (rect.contains(viewport()->rect())) {
- updateLineNumberAreaWidth(0);
- }
-}
-
-void ScriptEditBox::resizeEvent(QResizeEvent* event) {
- QPlainTextEdit::resizeEvent(event);
-
- QRect localContentsRect = contentsRect();
- _scriptLineNumberArea->setGeometry(QRect(localContentsRect.left(), localContentsRect.top(), lineNumberAreaWidth(),
- localContentsRect.height()));
-}
-
-void ScriptEditBox::highlightCurrentLine() {
- QList extraSelections;
-
- if (!isReadOnly()) {
- QTextEdit::ExtraSelection selection;
-
- QColor lineColor = QColor(Qt::gray).lighter();
-
- selection.format.setBackground(lineColor);
- selection.format.setProperty(QTextFormat::FullWidthSelection, true);
- selection.cursor = textCursor();
- selection.cursor.clearSelection();
- extraSelections.append(selection);
- }
-
- setExtraSelections(extraSelections);
-}
-
-void ScriptEditBox::lineNumberAreaPaintEvent(QPaintEvent* event)
-{
- QPainter painter(_scriptLineNumberArea);
- painter.fillRect(event->rect(), Qt::lightGray);
- QTextBlock block = firstVisibleBlock();
- int blockNumber = block.blockNumber();
- int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();
- int bottom = top + (int) blockBoundingRect(block).height();
-
- while (block.isValid() && top <= event->rect().bottom()) {
- if (block.isVisible() && bottom >= event->rect().top()) {
- QFont font = painter.font();
- font.setBold(this->textCursor().blockNumber() == block.blockNumber());
- painter.setFont(font);
- QString number = QString::number(blockNumber + 1);
- painter.setPen(Qt::black);
- painter.drawText(0, top, _scriptLineNumberArea->width(), fontMetrics().height(),
- Qt::AlignRight, number);
- }
-
- block = block.next();
- top = bottom;
- bottom = top + (int) blockBoundingRect(block).height();
- blockNumber++;
- }
-}
diff --git a/interface/src/ui/ScriptEditBox.h b/interface/src/ui/ScriptEditBox.h
deleted file mode 100644
index 0b037db16a..0000000000
--- a/interface/src/ui/ScriptEditBox.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// ScriptEditBox.h
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/30/14.
-// 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
-//
-
-#ifndef hifi_ScriptEditBox_h
-#define hifi_ScriptEditBox_h
-
-#include
-
-class ScriptEditBox : public QPlainTextEdit {
- Q_OBJECT
-
-public:
- ScriptEditBox(QWidget* parent = NULL);
-
- void lineNumberAreaPaintEvent(QPaintEvent* event);
- int lineNumberAreaWidth();
-
-protected:
- void resizeEvent(QResizeEvent* event) override;
-
-private slots:
- void updateLineNumberAreaWidth(int blockCount);
- void highlightCurrentLine();
- void updateLineNumberArea(const QRect& rect, int deltaY);
-
-private:
- QWidget* _scriptLineNumberArea;
-};
-
-#endif // hifi_ScriptEditBox_h
diff --git a/interface/src/ui/ScriptEditorWidget.cpp b/interface/src/ui/ScriptEditorWidget.cpp
deleted file mode 100644
index ada6b11355..0000000000
--- a/interface/src/ui/ScriptEditorWidget.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-//
-// ScriptEditorWidget.cpp
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/14/14.
-// 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
-//
-
-#include "ui_scriptEditorWidget.h"
-#include "ScriptEditorWidget.h"
-#include "ScriptEditorWindow.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "Application.h"
-#include "ScriptHighlighting.h"
-
-ScriptEditorWidget::ScriptEditorWidget() :
- _scriptEditorWidgetUI(new Ui::ScriptEditorWidget),
- _scriptEngine(NULL),
- _isRestarting(false),
- _isReloading(false)
-{
- setAttribute(Qt::WA_DeleteOnClose);
-
- _scriptEditorWidgetUI->setupUi(this);
-
- connect(_scriptEditorWidgetUI->scriptEdit->document(), &QTextDocument::modificationChanged, this,
- &ScriptEditorWidget::scriptModified);
- connect(_scriptEditorWidgetUI->scriptEdit->document(), &QTextDocument::contentsChanged, this,
- &ScriptEditorWidget::onScriptModified);
-
- // remove the title bar (see the Qt docs on setTitleBarWidget)
- setTitleBarWidget(new QWidget());
- QFontMetrics fm(_scriptEditorWidgetUI->scriptEdit->font());
- _scriptEditorWidgetUI->scriptEdit->setTabStopWidth(fm.width('0') * 4);
- // We create a new ScriptHighligting QObject and provide it with a parent so this is NOT a memory leak.
- new ScriptHighlighting(_scriptEditorWidgetUI->scriptEdit->document());
- QTimer::singleShot(0, _scriptEditorWidgetUI->scriptEdit, SLOT(setFocus()));
-
- _console = new JSConsole(this);
- _console->setFixedHeight(CONSOLE_HEIGHT);
- _scriptEditorWidgetUI->verticalLayout->addWidget(_console);
- connect(_scriptEditorWidgetUI->clearButton, &QPushButton::clicked, _console, &JSConsole::clear);
-}
-
-ScriptEditorWidget::~ScriptEditorWidget() {
- delete _scriptEditorWidgetUI;
- delete _console;
-}
-
-void ScriptEditorWidget::onScriptModified() {
- if(_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isModified() && isRunning() && !_isReloading) {
- _isRestarting = true;
- setRunning(false);
- // Script is restarted once current script instance finishes.
- }
-}
-
-void ScriptEditorWidget::onScriptFinished(const QString& scriptPath) {
- _scriptEngine = NULL;
- _console->setScriptEngine(NULL);
- if (_isRestarting) {
- _isRestarting = false;
- setRunning(true);
- }
-}
-
-bool ScriptEditorWidget::isModified() {
- return _scriptEditorWidgetUI->scriptEdit->document()->isModified();
-}
-
-bool ScriptEditorWidget::isRunning() {
- return (_scriptEngine != NULL) ? _scriptEngine->isRunning() : false;
-}
-
-bool ScriptEditorWidget::setRunning(bool run) {
- if (run && isModified() && !save()) {
- return false;
- }
-
- if (_scriptEngine != NULL) {
- disconnect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
- disconnect(_scriptEngine, &ScriptEngine::update, this, &ScriptEditorWidget::onScriptModified);
- disconnect(_scriptEngine, &ScriptEngine::finished, this, &ScriptEditorWidget::onScriptFinished);
- }
-
- auto scriptEngines = DependencyManager::get();
- if (run) {
- const QString& scriptURLString = QUrl(_currentScript).toString();
- // Reload script so that an out of date copy is not retrieved from the cache
- _scriptEngine = scriptEngines->loadScript(scriptURLString, true, true, false, true);
- connect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
- connect(_scriptEngine, &ScriptEngine::update, this, &ScriptEditorWidget::onScriptModified);
- connect(_scriptEngine, &ScriptEngine::finished, this, &ScriptEditorWidget::onScriptFinished);
- } else {
- connect(_scriptEngine, &ScriptEngine::finished, this, &ScriptEditorWidget::onScriptFinished);
- const QString& scriptURLString = QUrl(_currentScript).toString();
- scriptEngines->stopScript(scriptURLString);
- _scriptEngine = NULL;
- }
- _console->setScriptEngine(_scriptEngine);
- return true;
-}
-
-bool ScriptEditorWidget::saveFile(const QString &scriptPath) {
- QFile file(scriptPath);
- if (!file.open(QFile::WriteOnly | QFile::Text)) {
- OffscreenUi::warning(this, tr("Interface"), tr("Cannot write script %1:\n%2.").arg(scriptPath)
- .arg(file.errorString()));
- return false;
- }
-
- QTextStream out(&file);
- out << _scriptEditorWidgetUI->scriptEdit->toPlainText();
- file.close();
-
- setScriptFile(scriptPath);
- return true;
-}
-
-void ScriptEditorWidget::loadFile(const QString& scriptPath) {
- QUrl url(scriptPath);
-
- // if the scheme length is one or lower, maybe they typed in a file, let's try
- const int WINDOWS_DRIVE_LETTER_SIZE = 1;
- if (url.scheme().size() <= WINDOWS_DRIVE_LETTER_SIZE) {
- QFile file(scriptPath);
- if (!file.open(QFile::ReadOnly | QFile::Text)) {
- OffscreenUi::warning(this, tr("Interface"), tr("Cannot read script %1:\n%2.").arg(scriptPath)
- .arg(file.errorString()));
- return;
- }
- QTextStream in(&file);
- _scriptEditorWidgetUI->scriptEdit->setPlainText(in.readAll());
- file.close();
- setScriptFile(scriptPath);
-
- if (_scriptEngine != NULL) {
- disconnect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
- disconnect(_scriptEngine, &ScriptEngine::update, this, &ScriptEditorWidget::onScriptModified);
- disconnect(_scriptEngine, &ScriptEngine::finished, this, &ScriptEditorWidget::onScriptFinished);
- }
- } else {
- QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
- QNetworkRequest networkRequest = QNetworkRequest(url);
- networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
- networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
- QNetworkReply* reply = networkAccessManager.get(networkRequest);
- qDebug() << "Downloading included script at" << scriptPath;
- QEventLoop loop;
- QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
- loop.exec();
- _scriptEditorWidgetUI->scriptEdit->setPlainText(reply->readAll());
- delete reply;
-
- if (!saveAs()) {
- static_cast(this->parent()->parent()->parent())->terminateCurrentTab();
- }
- }
- const QString& scriptURLString = QUrl(_currentScript).toString();
- _scriptEngine = DependencyManager::get()->getScriptEngine(scriptURLString);
- if (_scriptEngine != NULL) {
- connect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
- connect(_scriptEngine, &ScriptEngine::update, this, &ScriptEditorWidget::onScriptModified);
- connect(_scriptEngine, &ScriptEngine::finished, this, &ScriptEditorWidget::onScriptFinished);
- }
- _console->setScriptEngine(_scriptEngine);
-}
-
-bool ScriptEditorWidget::save() {
- return _currentScript.isEmpty() ? saveAs() : saveFile(_currentScript);
-}
-
-bool ScriptEditorWidget::saveAs() {
- auto scriptEngines = DependencyManager::get();
- QString fileName = QFileDialog::getSaveFileName(this, tr("Save script"),
- qApp->getPreviousScriptLocation(),
- tr("JavaScript Files (*.js)"));
- if (!fileName.isEmpty()) {
- qApp->setPreviousScriptLocation(fileName);
- return saveFile(fileName);
- } else {
- return false;
- }
-}
-
-void ScriptEditorWidget::setScriptFile(const QString& scriptPath) {
- _currentScript = scriptPath;
- _currentScriptModified = QFileInfo(_currentScript).lastModified();
- _scriptEditorWidgetUI->scriptEdit->document()->setModified(false);
- setWindowModified(false);
-
- emit scriptnameChanged();
-}
-
-bool ScriptEditorWidget::questionSave() {
- if (_scriptEditorWidgetUI->scriptEdit->document()->isModified()) {
- QMessageBox::StandardButton button = OffscreenUi::warning(this, tr("Interface"),
- tr("The script has been modified.\nDo you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard |
- QMessageBox::Cancel, QMessageBox::Save);
- return button == QMessageBox::Save ? save() : (button == QMessageBox::Discard);
- }
- return true;
-}
-
-void ScriptEditorWidget::onWindowActivated() {
- if (!_isReloading) {
- _isReloading = true;
-
- QDateTime fileStamp = QFileInfo(_currentScript).lastModified();
- if (fileStamp > _currentScriptModified) {
- bool doReload = false;
- auto window = static_cast(this->parent()->parent()->parent());
- window->inModalDialog = true;
- if (window->autoReloadScripts()
- || OffscreenUi::question(this, tr("Reload Script"),
- tr("The following file has been modified outside of the Interface editor:") + "\n" + _currentScript + "\n"
- + (isModified()
- ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")
- : tr("Do you want to reload it?")),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- doReload = true;
- }
- window->inModalDialog = false;
- if (doReload) {
- loadFile(_currentScript);
- if (_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isRunning()) {
- _isRestarting = true;
- setRunning(false);
- // Script is restarted once current script instance finishes.
- }
- } else {
- _currentScriptModified = fileStamp; // Asked and answered. Don't ask again until the external file is changed again.
- }
- }
- _isReloading = false;
- }
-}
diff --git a/interface/src/ui/ScriptEditorWidget.h b/interface/src/ui/ScriptEditorWidget.h
deleted file mode 100644
index f53fd7b718..0000000000
--- a/interface/src/ui/ScriptEditorWidget.h
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// ScriptEditorWidget.h
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/14/14.
-// 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
-//
-
-#ifndef hifi_ScriptEditorWidget_h
-#define hifi_ScriptEditorWidget_h
-
-#include
-
-#include "JSConsole.h"
-#include "ScriptEngine.h"
-
-namespace Ui {
- class ScriptEditorWidget;
-}
-
-class ScriptEditorWidget : public QDockWidget {
- Q_OBJECT
-
-public:
- ScriptEditorWidget();
- ~ScriptEditorWidget();
-
- bool isModified();
- bool isRunning();
- bool setRunning(bool run);
- bool saveFile(const QString& scriptPath);
- void loadFile(const QString& scriptPath);
- void setScriptFile(const QString& scriptPath);
- bool save();
- bool saveAs();
- bool questionSave();
- const QString getScriptName() const { return _currentScript; };
-
-signals:
- void runningStateChanged();
- void scriptnameChanged();
- void scriptModified();
-
-public slots:
- void onWindowActivated();
-
-private slots:
- void onScriptModified();
- void onScriptFinished(const QString& scriptName);
-
-private:
- JSConsole* _console;
- Ui::ScriptEditorWidget* _scriptEditorWidgetUI;
- ScriptEngine* _scriptEngine;
- QString _currentScript;
- QDateTime _currentScriptModified;
- bool _isRestarting;
- bool _isReloading;
-};
-
-#endif // hifi_ScriptEditorWidget_h
diff --git a/interface/src/ui/ScriptEditorWindow.cpp b/interface/src/ui/ScriptEditorWindow.cpp
deleted file mode 100644
index 58abd23979..0000000000
--- a/interface/src/ui/ScriptEditorWindow.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-//
-// ScriptEditorWindow.cpp
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/14/14.
-// 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
-//
-
-#include
-
-#include "ui_scriptEditorWindow.h"
-#include "ScriptEditorWindow.h"
-#include "ScriptEditorWidget.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include "Application.h"
-#include "PathUtils.h"
-
-ScriptEditorWindow::ScriptEditorWindow(QWidget* parent) :
- QWidget(parent),
- _ScriptEditorWindowUI(new Ui::ScriptEditorWindow),
- _loadMenu(new QMenu),
- _saveMenu(new QMenu)
-{
- setAttribute(Qt::WA_DeleteOnClose);
-
- _ScriptEditorWindowUI->setupUi(this);
-
- this->setWindowFlags(Qt::Tool);
- addScriptEditorWidget("New script");
- connect(_loadMenu, &QMenu::aboutToShow, this, &ScriptEditorWindow::loadMenuAboutToShow);
- _ScriptEditorWindowUI->loadButton->setMenu(_loadMenu);
-
- _saveMenu->addAction("Save as..", this, SLOT(saveScriptAsClicked()), Qt::CTRL | Qt::SHIFT | Qt::Key_S);
-
- _ScriptEditorWindowUI->saveButton->setMenu(_saveMenu);
-
- connect(new QShortcut(QKeySequence("Ctrl+N"), this), &QShortcut::activated, this, &ScriptEditorWindow::newScriptClicked);
- connect(new QShortcut(QKeySequence("Ctrl+S"), this), &QShortcut::activated, this,&ScriptEditorWindow::saveScriptClicked);
- connect(new QShortcut(QKeySequence("Ctrl+O"), this), &QShortcut::activated, this, &ScriptEditorWindow::loadScriptClicked);
- connect(new QShortcut(QKeySequence("F5"), this), &QShortcut::activated, this, &ScriptEditorWindow::toggleRunScriptClicked);
-
- _ScriptEditorWindowUI->loadButton->setIcon(QIcon(QPixmap(PathUtils::resourcesPath() + "icons/load-script.svg")));
- _ScriptEditorWindowUI->newButton->setIcon(QIcon(QPixmap(PathUtils::resourcesPath() + "icons/new-script.svg")));
- _ScriptEditorWindowUI->saveButton->setIcon(QIcon(QPixmap(PathUtils::resourcesPath() + "icons/save-script.svg")));
- _ScriptEditorWindowUI->toggleRunButton->setIcon(QIcon(QPixmap(PathUtils::resourcesPath() + "icons/start-script.svg")));
-}
-
-ScriptEditorWindow::~ScriptEditorWindow() {
- delete _ScriptEditorWindowUI;
-}
-
-void ScriptEditorWindow::setRunningState(bool run) {
- if (_ScriptEditorWindowUI->tabWidget->currentIndex() != -1) {
- static_cast(_ScriptEditorWindowUI->tabWidget->currentWidget())->setRunning(run);
- }
- this->updateButtons();
-}
-
-void ScriptEditorWindow::updateButtons() {
- bool isRunning = _ScriptEditorWindowUI->tabWidget->currentIndex() != -1 &&
- static_cast(_ScriptEditorWindowUI->tabWidget->currentWidget())->isRunning();
- _ScriptEditorWindowUI->toggleRunButton->setEnabled(_ScriptEditorWindowUI->tabWidget->currentIndex() != -1);
- _ScriptEditorWindowUI->toggleRunButton->setIcon(QIcon(QPixmap(PathUtils::resourcesPath() + ((isRunning ?
- "icons/stop-script.svg" : "icons/start-script.svg")))));
-}
-
-void ScriptEditorWindow::loadScriptMenu(const QString& scriptName) {
- addScriptEditorWidget("loading...")->loadFile(scriptName);
- updateButtons();
-}
-
-void ScriptEditorWindow::loadScriptClicked() {
- QString scriptName = QFileDialog::getOpenFileName(this, tr("Interface"),
- qApp->getPreviousScriptLocation(),
- tr("JavaScript Files (*.js)"));
- if (!scriptName.isEmpty()) {
- qApp->setPreviousScriptLocation(scriptName);
- addScriptEditorWidget("loading...")->loadFile(scriptName);
- updateButtons();
- }
-}
-
-void ScriptEditorWindow::loadMenuAboutToShow() {
- _loadMenu->clear();
- QStringList runningScripts = DependencyManager::get()->getRunningScripts();
- if (runningScripts.count() > 0) {
- QSignalMapper* signalMapper = new QSignalMapper(this);
- foreach (const QString& runningScript, runningScripts) {
- QAction* runningScriptAction = new QAction(runningScript, _loadMenu);
- connect(runningScriptAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
- signalMapper->setMapping(runningScriptAction, runningScript);
- _loadMenu->addAction(runningScriptAction);
- }
- connect(signalMapper, SIGNAL(mapped(const QString &)), this, SLOT(loadScriptMenu(const QString&)));
- } else {
- QAction* naAction = new QAction("(no running scripts)", _loadMenu);
- naAction->setDisabled(true);
- _loadMenu->addAction(naAction);
- }
-}
-
-void ScriptEditorWindow::newScriptClicked() {
- addScriptEditorWidget(QString("New script"));
-}
-
-void ScriptEditorWindow::toggleRunScriptClicked() {
- this->setRunningState(!(_ScriptEditorWindowUI->tabWidget->currentIndex() !=-1
- && static_cast(_ScriptEditorWindowUI->tabWidget->currentWidget())->isRunning()));
-}
-
-void ScriptEditorWindow::saveScriptClicked() {
- if (_ScriptEditorWindowUI->tabWidget->currentIndex() != -1) {
- ScriptEditorWidget* currentScriptWidget = static_cast(_ScriptEditorWindowUI->tabWidget
- ->currentWidget());
- currentScriptWidget->save();
- }
-}
-
-void ScriptEditorWindow::saveScriptAsClicked() {
- if (_ScriptEditorWindowUI->tabWidget->currentIndex() != -1) {
- ScriptEditorWidget* currentScriptWidget = static_cast(_ScriptEditorWindowUI->tabWidget
- ->currentWidget());
- currentScriptWidget->saveAs();
- }
-}
-
-ScriptEditorWidget* ScriptEditorWindow::addScriptEditorWidget(QString title) {
- ScriptEditorWidget* newScriptEditorWidget = new ScriptEditorWidget();
- connect(newScriptEditorWidget, &ScriptEditorWidget::scriptnameChanged, this, &ScriptEditorWindow::updateScriptNameOrStatus);
- connect(newScriptEditorWidget, &ScriptEditorWidget::scriptModified, this, &ScriptEditorWindow::updateScriptNameOrStatus);
- connect(newScriptEditorWidget, &ScriptEditorWidget::runningStateChanged, this, &ScriptEditorWindow::updateButtons);
- connect(this, &ScriptEditorWindow::windowActivated, newScriptEditorWidget, &ScriptEditorWidget::onWindowActivated);
- _ScriptEditorWindowUI->tabWidget->addTab(newScriptEditorWidget, title);
- _ScriptEditorWindowUI->tabWidget->setCurrentWidget(newScriptEditorWidget);
- newScriptEditorWidget->setUpdatesEnabled(true);
- newScriptEditorWidget->adjustSize();
- return newScriptEditorWidget;
-}
-
-void ScriptEditorWindow::tabSwitched(int tabIndex) {
- this->updateButtons();
- if (_ScriptEditorWindowUI->tabWidget->currentIndex() != -1) {
- ScriptEditorWidget* currentScriptWidget = static_cast(_ScriptEditorWindowUI->tabWidget
- ->currentWidget());
- QString modifiedStar = (currentScriptWidget->isModified() ? "*" : "");
- if (currentScriptWidget->getScriptName().length() > 0) {
- this->setWindowTitle("Script Editor [" + currentScriptWidget->getScriptName() + modifiedStar + "]");
- } else {
- this->setWindowTitle("Script Editor [New script" + modifiedStar + "]");
- }
- } else {
- this->setWindowTitle("Script Editor");
- }
-}
-
-void ScriptEditorWindow::tabCloseRequested(int tabIndex) {
- if (ignoreCloseForModal(nullptr)) {
- return;
- }
- ScriptEditorWidget* closingScriptWidget = static_cast(_ScriptEditorWindowUI->tabWidget
- ->widget(tabIndex));
- if(closingScriptWidget->questionSave()) {
- _ScriptEditorWindowUI->tabWidget->removeTab(tabIndex);
- }
-}
-
-// If this operating system window causes a qml overlay modal dialog (which might not even be seen by the user), closing this window
-// will crash the code that was waiting on the dialog result. So that code whousl set inModalDialog to true while the question is up.
-// This code will not be necessary when switch out all operating system windows for qml overlays.
-bool ScriptEditorWindow::ignoreCloseForModal(QCloseEvent* event) {
- if (!inModalDialog) {
- return false;
- }
- // Deliberately not using OffscreenUi, so that the dialog is seen.
- QMessageBox::information(this, tr("Interface"), tr("There is a modal dialog that must be answered before closing."),
- QMessageBox::Discard, QMessageBox::Discard);
- if (event) {
- event->ignore(); // don't close
- }
- return true;
-}
-
-void ScriptEditorWindow::closeEvent(QCloseEvent *event) {
- if (ignoreCloseForModal(event)) {
- return;
- }
- bool unsaved_docs_warning = false;
- for (int i = 0; i < _ScriptEditorWindowUI->tabWidget->count(); i++){
- if(static_cast(_ScriptEditorWindowUI->tabWidget->widget(i))->isModified()){
- unsaved_docs_warning = true;
- break;
- }
- }
-
- if (!unsaved_docs_warning || QMessageBox::warning(this, tr("Interface"),
- tr("There are some unsaved scripts, are you sure you want to close the editor? Changes will be lost!"),
- QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel) == QMessageBox::Discard) {
- event->accept();
- } else {
- event->ignore();
- }
-}
-
-void ScriptEditorWindow::updateScriptNameOrStatus() {
- ScriptEditorWidget* source = static_cast(QObject::sender());
- QString modifiedStar = (source->isModified()? "*" : "");
- if (source->getScriptName().length() > 0) {
- for (int i = 0; i < _ScriptEditorWindowUI->tabWidget->count(); i++){
- if (_ScriptEditorWindowUI->tabWidget->widget(i) == source) {
- _ScriptEditorWindowUI->tabWidget->setTabText(i, modifiedStar + QFileInfo(source->getScriptName()).fileName());
- _ScriptEditorWindowUI->tabWidget->setTabToolTip(i, source->getScriptName());
- }
- }
- }
-
- if (_ScriptEditorWindowUI->tabWidget->currentWidget() == source) {
- if (source->getScriptName().length() > 0) {
- this->setWindowTitle("Script Editor [" + source->getScriptName() + modifiedStar + "]");
- } else {
- this->setWindowTitle("Script Editor [New script" + modifiedStar + "]");
- }
- }
-}
-
-void ScriptEditorWindow::terminateCurrentTab() {
- if (_ScriptEditorWindowUI->tabWidget->currentIndex() != -1) {
- _ScriptEditorWindowUI->tabWidget->removeTab(_ScriptEditorWindowUI->tabWidget->currentIndex());
- this->raise();
- }
-}
-
-bool ScriptEditorWindow::autoReloadScripts() {
- return _ScriptEditorWindowUI->autoReloadCheckBox->isChecked();
-}
-
-bool ScriptEditorWindow::event(QEvent* event) {
- if (event->type() == QEvent::WindowActivate) {
- emit windowActivated();
- }
- return QWidget::event(event);
-}
-
diff --git a/interface/src/ui/ScriptEditorWindow.h b/interface/src/ui/ScriptEditorWindow.h
deleted file mode 100644
index af9863d136..0000000000
--- a/interface/src/ui/ScriptEditorWindow.h
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// ScriptEditorWindow.h
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/14/14.
-// 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
-//
-
-#ifndef hifi_ScriptEditorWindow_h
-#define hifi_ScriptEditorWindow_h
-
-#include "ScriptEditorWidget.h"
-
-namespace Ui {
- class ScriptEditorWindow;
-}
-
-class ScriptEditorWindow : public QWidget {
- Q_OBJECT
-
-public:
- ScriptEditorWindow(QWidget* parent = nullptr);
- ~ScriptEditorWindow();
-
- void terminateCurrentTab();
- bool autoReloadScripts();
-
- bool inModalDialog { false };
- bool ignoreCloseForModal(QCloseEvent* event);
-
-signals:
- void windowActivated();
-
-protected:
- void closeEvent(QCloseEvent* event) override;
- virtual bool event(QEvent* event) override;
-
-private:
- Ui::ScriptEditorWindow* _ScriptEditorWindowUI;
- QMenu* _loadMenu;
- QMenu* _saveMenu;
-
- ScriptEditorWidget* addScriptEditorWidget(QString title);
- void setRunningState(bool run);
- void setScriptName(const QString& scriptName);
-
-private slots:
- void loadScriptMenu(const QString& scriptName);
- void loadScriptClicked();
- void newScriptClicked();
- void toggleRunScriptClicked();
- void saveScriptClicked();
- void saveScriptAsClicked();
- void loadMenuAboutToShow();
- void tabSwitched(int tabIndex);
- void tabCloseRequested(int tabIndex);
- void updateScriptNameOrStatus();
- void updateButtons();
-};
-
-#endif // hifi_ScriptEditorWindow_h
diff --git a/interface/src/ui/ScriptLineNumberArea.cpp b/interface/src/ui/ScriptLineNumberArea.cpp
deleted file mode 100644
index 6d7e9185ea..0000000000
--- a/interface/src/ui/ScriptLineNumberArea.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// ScriptLineNumberArea.cpp
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/30/14.
-// 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
-//
-
-#include "ScriptLineNumberArea.h"
-
-#include "ScriptEditBox.h"
-
-ScriptLineNumberArea::ScriptLineNumberArea(ScriptEditBox* scriptEditBox) :
- QWidget(scriptEditBox)
-{
- _scriptEditBox = scriptEditBox;
-}
-
-QSize ScriptLineNumberArea::sizeHint() const {
- return QSize(_scriptEditBox->lineNumberAreaWidth(), 0);
-}
-
-void ScriptLineNumberArea::paintEvent(QPaintEvent* event) {
- _scriptEditBox->lineNumberAreaPaintEvent(event);
-}
diff --git a/interface/src/ui/ScriptLineNumberArea.h b/interface/src/ui/ScriptLineNumberArea.h
deleted file mode 100644
index 77de8244ce..0000000000
--- a/interface/src/ui/ScriptLineNumberArea.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// ScriptLineNumberArea.h
-// interface/src/ui
-//
-// Created by Thijs Wenker on 4/30/14.
-// 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
-//
-
-#ifndef hifi_ScriptLineNumberArea_h
-#define hifi_ScriptLineNumberArea_h
-
-#include
-
-class ScriptEditBox;
-
-class ScriptLineNumberArea : public QWidget {
-
-public:
- ScriptLineNumberArea(ScriptEditBox* scriptEditBox);
- QSize sizeHint() const override;
-
-protected:
- void paintEvent(QPaintEvent* event) override;
-
-private:
- ScriptEditBox* _scriptEditBox;
-};
-
-#endif // hifi_ScriptLineNumberArea_h
diff --git a/interface/src/ui/ScriptsTableWidget.cpp b/interface/src/ui/ScriptsTableWidget.cpp
deleted file mode 100644
index 7b4f9e6b1f..0000000000
--- a/interface/src/ui/ScriptsTableWidget.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// ScriptsTableWidget.cpp
-// interface
-//
-// Created by Mohammed Nafees on 04/03/2014.
-// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
-//
-// Distributed under the Apache License, Version 2.0.
-// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
-//
-
-#include
-#include
-#include
-#include
-
-#include "ScriptsTableWidget.h"
-
-ScriptsTableWidget::ScriptsTableWidget(QWidget* parent) :
- QTableWidget(parent) {
- verticalHeader()->setVisible(false);
- horizontalHeader()->setVisible(false);
- setShowGrid(false);
- setSelectionMode(QAbstractItemView::NoSelection);
- setEditTriggers(QAbstractItemView::NoEditTriggers);
- setStyleSheet("QTableWidget { border: none; background: transparent; color: #333333; } QToolTip { color: #000000; background: #f9f6e4; padding: 2px; }");
- setToolTipDuration(200);
- setWordWrap(true);
- setGeometry(0, 0, parent->width(), parent->height());
-}
-
-void ScriptsTableWidget::paintEvent(QPaintEvent* event) {
- QPainter painter(viewport());
- painter.setPen(QColor::fromRgb(225, 225, 225)); // #e1e1e1
-
- int y = 0;
- for (int i = 0; i < rowCount(); i++) {
- painter.drawLine(5, rowHeight(i) + y, width(), rowHeight(i) + y);
- y += rowHeight(i);
- }
- painter.end();
-
- QTableWidget::paintEvent(event);
-}
-
-void ScriptsTableWidget::keyPressEvent(QKeyEvent* event) {
- // Ignore keys so they will propagate correctly
- event->ignore();
-}
diff --git a/interface/src/ui/ScriptsTableWidget.h b/interface/src/ui/ScriptsTableWidget.h
deleted file mode 100644
index f5e3407e97..0000000000
--- a/interface/src/ui/ScriptsTableWidget.h
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// ScriptsTableWidget.h
-// interface
-//
-// Created by Mohammed Nafees on 04/03/2014.
-// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
-//
-// 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__ScriptsTableWidget_h
-#define hifi__ScriptsTableWidget_h
-
-#include
-#include
-
-class ScriptsTableWidget : public QTableWidget {
- Q_OBJECT
-public:
- explicit ScriptsTableWidget(QWidget* parent);
-
-protected:
- virtual void paintEvent(QPaintEvent* event) override;
- virtual void keyPressEvent(QKeyEvent* event) override;
-};
-
-#endif // hifi__ScriptsTableWidget_h
diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp
index 923d9f642d..e8cd5409f0 100644
--- a/interface/src/ui/Stats.cpp
+++ b/interface/src/ui/Stats.cpp
@@ -220,10 +220,10 @@ void Stats::updateStats(bool force) {
STAT_UPDATE(audioMixerInPps, roundf(bandwidthRecorder->getAverageInputPacketsPerSecond(NodeType::AudioMixer)));
STAT_UPDATE(audioMixerOutKbps, roundf(bandwidthRecorder->getAverageOutputKilobitsPerSecond(NodeType::AudioMixer)));
STAT_UPDATE(audioMixerOutPps, roundf(bandwidthRecorder->getAverageOutputPacketsPerSecond(NodeType::AudioMixer)));
- STAT_UPDATE(audioMicOutboundPPS, audioClient->getMicAudioOutboundPPS());
- STAT_UPDATE(audioSilentOutboundPPS, audioClient->getSilentOutboundPPS());
STAT_UPDATE(audioAudioInboundPPS, audioClient->getAudioInboundPPS());
STAT_UPDATE(audioSilentInboundPPS, audioClient->getSilentInboundPPS());
+ STAT_UPDATE(audioOutboundPPS, audioClient->getAudioOutboundPPS());
+ STAT_UPDATE(audioSilentOutboundPPS, audioClient->getSilentOutboundPPS());
} else {
STAT_UPDATE(audioMixerKbps, -1);
STAT_UPDATE(audioMixerPps, -1);
@@ -231,7 +231,7 @@ void Stats::updateStats(bool force) {
STAT_UPDATE(audioMixerInPps, -1);
STAT_UPDATE(audioMixerOutKbps, -1);
STAT_UPDATE(audioMixerOutPps, -1);
- STAT_UPDATE(audioMicOutboundPPS, -1);
+ STAT_UPDATE(audioOutboundPPS, -1);
STAT_UPDATE(audioSilentOutboundPPS, -1);
STAT_UPDATE(audioAudioInboundPPS, -1);
STAT_UPDATE(audioSilentInboundPPS, -1);
diff --git a/interface/src/ui/Stats.h b/interface/src/ui/Stats.h
index 0ce113e0a0..964c94cd4d 100644
--- a/interface/src/ui/Stats.h
+++ b/interface/src/ui/Stats.h
@@ -77,7 +77,7 @@ class Stats : public QQuickItem {
STATS_PROPERTY(int, audioMixerOutPps, 0)
STATS_PROPERTY(int, audioMixerKbps, 0)
STATS_PROPERTY(int, audioMixerPps, 0)
- STATS_PROPERTY(int, audioMicOutboundPPS, 0)
+ STATS_PROPERTY(int, audioOutboundPPS, 0)
STATS_PROPERTY(int, audioSilentOutboundPPS, 0)
STATS_PROPERTY(int, audioAudioInboundPPS, 0)
STATS_PROPERTY(int, audioSilentInboundPPS, 0)
@@ -198,7 +198,7 @@ signals:
void audioMixerOutPpsChanged();
void audioMixerKbpsChanged();
void audioMixerPpsChanged();
- void audioMicOutboundPPSChanged();
+ void audioOutboundPPSChanged();
void audioSilentOutboundPPSChanged();
void audioAudioInboundPPSChanged();
void audioSilentInboundPPSChanged();
diff --git a/interface/ui/scriptEditorWidget.ui b/interface/ui/scriptEditorWidget.ui
deleted file mode 100644
index e2e538a595..0000000000
--- a/interface/ui/scriptEditorWidget.ui
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
- ScriptEditorWidget
-
-
-
- 0
- 0
- 691
- 549
-
-
-
-
- 0
- 0
-
-
-
-
- 690
- 328
-
-
-
- font-family: Helvetica, Arial, sans-serif;
-
-
- QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable
-
-
- Qt::NoDockWidgetArea
-
-
- Edit Script
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
- Courier
- -1
- 50
- false
- false
-
-
-
- font: 16px "Courier";
-
-
-
- -
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- font: 13px "Helvetica","Arial","sans-serif";
-
-
- Debug Log:
-
-
-
- -
-
-
-
- Helvetica,Arial,sans-serif
- -1
- 50
- false
- false
-
-
-
- font: 13px "Helvetica","Arial","sans-serif";
-
-
- Run on the fly (Careful: Any valid change made to the code will run immediately)
-
-
-
- -
-
-
- Clear
-
-
-
- 16
- 16
-
-
-
-
-
-
-
-
-
-
-
- ScriptEditBox
- QTextEdit
-
-
-
-
-
diff --git a/interface/ui/scriptEditorWindow.ui b/interface/ui/scriptEditorWindow.ui
deleted file mode 100644
index 1e50aaef0b..0000000000
--- a/interface/ui/scriptEditorWindow.ui
+++ /dev/null
@@ -1,324 +0,0 @@
-
-
- ScriptEditorWindow
-
-
- Qt::NonModal
-
-
-
- 0
- 0
- 780
- 717
-
-
-
-
- 400
- 250
-
-
-
- Script Editor
-
-
- font-family: Helvetica, Arial, sans-serif;
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- 3
-
-
- QLayout::SetNoConstraint
-
-
- 0
-
-
- 0
-
-
-
-
-
- New Script (Ctrl+N)
-
-
- New
-
-
-
- 32
- 32
-
-
-
-
- -
-
-
-
- 30
- 0
-
-
-
-
- 25
- 0
-
-
-
- Load Script (Ctrl+O)
-
-
- Load
-
-
-
- 32
- 32
-
-
-
- false
-
-
- QToolButton::MenuButtonPopup
-
-
- Qt::ToolButtonIconOnly
-
-
-
- -
-
-
-
- 30
- 0
-
-
-
-
- 32
- 0
-
-
-
- Qt::NoFocus
-
-
- Qt::NoContextMenu
-
-
- Save Script (Ctrl+S)
-
-
- Save
-
-
-
- 32
- 32
-
-
-
- 316
-
-
- QToolButton::MenuButtonPopup
-
-
-
- -
-
-
- Toggle Run Script (F5)
-
-
- Run/Stop
-
-
-
- 32
- 32
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- font: 13px "Helvetica","Arial","sans-serif";
-
-
- Automatically reload externally changed files
-
-
-
-
-
- -
-
-
- true
-
-
-
- 250
- 80
-
-
-
- QTabWidget::West
-
-
- QTabWidget::Triangular
-
-
- -1
-
-
- Qt::ElideNone
-
-
- true
-
-
- true
-
-
-
-
-
-
-
-
- saveButton
- clicked()
- ScriptEditorWindow
- saveScriptClicked()
-
-
- 236
- 10
-
-
- 199
- 264
-
-
-
-
- toggleRunButton
- clicked()
- ScriptEditorWindow
- toggleRunScriptClicked()
-
-
- 330
- 10
-
-
- 199
- 264
-
-
-
-
- newButton
- clicked()
- ScriptEditorWindow
- newScriptClicked()
-
-
- 58
- 10
-
-
- 199
- 264
-
-
-
-
- loadButton
- clicked()
- ScriptEditorWindow
- loadScriptClicked()
-
-
- 85
- 10
-
-
- 199
- 264
-
-
-
-
- tabWidget
- currentChanged(int)
- ScriptEditorWindow
- tabSwitched(int)
-
-
- 352
- 360
-
-
- 352
- 340
-
-
-
-
- tabWidget
- tabCloseRequested(int)
- ScriptEditorWindow
- tabCloseRequested(int)
-
-
- 352
- 360
-
-
- 352
- 340
-
-
-
-
-
diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp
index fa5d0d24d5..4a2de0a64b 100644
--- a/libraries/audio-client/src/AudioClient.cpp
+++ b/libraries/audio-client/src/AudioClient.cpp
@@ -184,7 +184,6 @@ AudioClient::AudioClient() :
_outgoingAvatarAudioSequenceNumber(0),
_audioOutputIODevice(_localInjectorsStream, _receivedAudioStream, this),
_stats(&_receivedAudioStream),
- _inputGate(),
_positionGetter(DEFAULT_POSITION_GETTER),
_orientationGetter(DEFAULT_ORIENTATION_GETTER) {
// avoid putting a lock in the device callback
@@ -971,14 +970,87 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
}
}
-void AudioClient::handleAudioInput() {
+void AudioClient::handleAudioInput(QByteArray& audioBuffer) {
+ if (_muted) {
+ _lastInputLoudness = 0.0f;
+ _timeSinceLastClip = 0.0f;
+ } else {
+ int16_t* samples = reinterpret_cast(audioBuffer.data());
+ int numSamples = audioBuffer.size() / sizeof(AudioConstants::SAMPLE_SIZE);
+ bool didClip = false;
+
+ bool shouldRemoveDCOffset = !_isPlayingBackRecording && !_isStereoInput;
+ if (shouldRemoveDCOffset) {
+ _noiseGate.removeDCOffset(samples, numSamples);
+ }
+
+ bool shouldNoiseGate = (_isPlayingBackRecording || !_isStereoInput) && _isNoiseGateEnabled;
+ if (shouldNoiseGate) {
+ _noiseGate.gateSamples(samples, numSamples);
+ _lastInputLoudness = _noiseGate.getLastLoudness();
+ didClip = _noiseGate.clippedInLastBlock();
+ } else {
+ float loudness = 0.0f;
+ for (int i = 0; i < numSamples; ++i) {
+ int16_t sample = std::abs(samples[i]);
+ loudness += (float)sample;
+ didClip = didClip ||
+ (sample > (AudioConstants::MAX_SAMPLE_VALUE * AudioNoiseGate::CLIPPING_THRESHOLD));
+ }
+ _lastInputLoudness = fabs(loudness / numSamples);
+ }
+
+ if (didClip) {
+ _timeSinceLastClip = 0.0f;
+ } else if (_timeSinceLastClip >= 0.0f) {
+ _timeSinceLastClip += (float)numSamples / (float)AudioConstants::SAMPLE_RATE;
+ }
+
+ emit inputReceived({ audioBuffer.data(), numSamples });
+
+ if (_noiseGate.openedInLastBlock()) {
+ emit noiseGateOpened();
+ } else if (_noiseGate.closedInLastBlock()) {
+ emit noiseGateClosed();
+ }
+ }
+
+ // the codec needs a flush frame before sending silent packets, so
+ // do not send one if the gate closed in this block (eventually this can be crossfaded).
+ auto packetType = _shouldEchoToServer ?
+ PacketType::MicrophoneAudioWithEcho : PacketType::MicrophoneAudioNoEcho;
+ if (_lastInputLoudness == 0.0f && !_noiseGate.closedInLastBlock()) {
+ packetType = PacketType::SilentAudioFrame;
+ _silentOutbound.increment();
+ } else {
+ _audioOutbound.increment();
+ }
+
+ Transform audioTransform;
+ audioTransform.setTranslation(_positionGetter());
+ audioTransform.setRotation(_orientationGetter());
+
+ QByteArray encodedBuffer;
+ if (_encoder) {
+ _encoder->encode(audioBuffer, encodedBuffer);
+ } else {
+ encodedBuffer = audioBuffer;
+ }
+
+ emitAudioPacket(encodedBuffer.data(), encodedBuffer.size(), _outgoingAvatarAudioSequenceNumber,
+ audioTransform, avatarBoundingBoxCorner, avatarBoundingBoxScale,
+ packetType, _selectedCodecName);
+ _stats.sentPacket();
+}
+
+void AudioClient::handleMicAudioInput() {
if (!_inputDevice || _isPlayingBackRecording) {
return;
}
// input samples required to produce exactly NETWORK_FRAME_SAMPLES of output
- const int inputSamplesRequired = (_inputToNetworkResampler ?
- _inputToNetworkResampler->getMinInput(AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL) :
+ const int inputSamplesRequired = (_inputToNetworkResampler ?
+ _inputToNetworkResampler->getMinInput(AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL) :
AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL) * _inputFormat.channelCount();
const auto inputAudioSamples = std::unique_ptr(new int16_t[inputSamplesRequired]);
@@ -1001,126 +1073,27 @@ void AudioClient::handleAudioInput() {
static int16_t networkAudioSamples[AudioConstants::NETWORK_FRAME_SAMPLES_STEREO];
while (_inputRingBuffer.samplesAvailable() >= inputSamplesRequired) {
-
- if (!_muted) {
-
-
- // Increment the time since the last clip
- if (_timeSinceLastClip >= 0.0f) {
- _timeSinceLastClip += (float)numNetworkSamples / (float)AudioConstants::SAMPLE_RATE;
- }
-
+ if (_muted) {
+ _inputRingBuffer.shiftReadPosition(inputSamplesRequired);
+ } else {
_inputRingBuffer.readSamples(inputAudioSamples.get(), inputSamplesRequired);
possibleResampling(_inputToNetworkResampler,
inputAudioSamples.get(), networkAudioSamples,
inputSamplesRequired, numNetworkSamples,
_inputFormat.channelCount(), _desiredInputFormat.channelCount());
-
- // Remove DC offset
- if (!_isStereoInput) {
- _inputGate.removeDCOffset(networkAudioSamples, numNetworkSamples);
- }
-
- // only impose the noise gate and perform tone injection if we are sending mono audio
- if (!_isStereoInput && _isNoiseGateEnabled) {
- _inputGate.gateSamples(networkAudioSamples, numNetworkSamples);
-
- // if we performed the noise gate we can get values from it instead of enumerating the samples again
- _lastInputLoudness = _inputGate.getLastLoudness();
-
- if (_inputGate.clippedInLastBlock()) {
- _timeSinceLastClip = 0.0f;
- }
-
- } else {
- float loudness = 0.0f;
-
- for (int i = 0; i < numNetworkSamples; i++) {
- int thisSample = std::abs(networkAudioSamples[i]);
- loudness += (float)thisSample;
-
- if (thisSample > (AudioConstants::MAX_SAMPLE_VALUE * AudioNoiseGate::CLIPPING_THRESHOLD)) {
- _timeSinceLastClip = 0.0f;
- }
- }
-
- _lastInputLoudness = fabs(loudness / numNetworkSamples);
- }
-
- emit inputReceived({ reinterpret_cast(networkAudioSamples), numNetworkBytes });
-
- if (_inputGate.openedInLastBlock()) {
- emit noiseGateOpened();
- } else if (_inputGate.closedInLastBlock()) {
- emit noiseGateClosed();
- }
-
- } else {
- // our input loudness is 0, since we're muted
- _lastInputLoudness = 0;
- _timeSinceLastClip = 0.0f;
-
- _inputRingBuffer.shiftReadPosition(inputSamplesRequired);
}
-
- auto packetType = _shouldEchoToServer ?
- PacketType::MicrophoneAudioWithEcho : PacketType::MicrophoneAudioNoEcho;
-
- // if the _inputGate closed in this last frame, then we don't actually want
- // to send a silent packet, instead, we want to go ahead and encode and send
- // the output from the input gate (eventually, this could be crossfaded)
- // and allow the codec to properly encode down to silent/zero. If we still
- // have _lastInputLoudness of 0 in our NEXT frame, we will send a silent packet
- if (_lastInputLoudness == 0 && !_inputGate.closedInLastBlock()) {
- packetType = PacketType::SilentAudioFrame;
- _silentOutbound.increment();
- } else {
- _micAudioOutbound.increment();
- }
-
- Transform audioTransform;
- audioTransform.setTranslation(_positionGetter());
- audioTransform.setRotation(_orientationGetter());
- // FIXME find a way to properly handle both playback audio and user audio concurrently
-
- QByteArray decodedBuffer(reinterpret_cast(networkAudioSamples), numNetworkBytes);
- QByteArray encodedBuffer;
- if (_encoder) {
- _encoder->encode(decodedBuffer, encodedBuffer);
- } else {
- encodedBuffer = decodedBuffer;
- }
-
- emitAudioPacket(encodedBuffer.constData(), encodedBuffer.size(), _outgoingAvatarAudioSequenceNumber,
- audioTransform, avatarBoundingBoxCorner, avatarBoundingBoxScale,
- packetType, _selectedCodecName);
- _stats.sentPacket();
-
int bytesInInputRingBuffer = _inputRingBuffer.samplesAvailable() * AudioConstants::SAMPLE_SIZE;
float msecsInInputRingBuffer = bytesInInputRingBuffer / (float)(_inputFormat.bytesForDuration(USECS_PER_MSEC));
_stats.updateInputMsUnplayed(msecsInInputRingBuffer);
+
+ QByteArray audioBuffer(reinterpret_cast(networkAudioSamples), numNetworkBytes);
+ handleAudioInput(audioBuffer);
}
}
-// FIXME - should this go through the noise gate and honor mute and echo?
void AudioClient::handleRecordedAudioInput(const QByteArray& audio) {
- Transform audioTransform;
- audioTransform.setTranslation(_positionGetter());
- audioTransform.setRotation(_orientationGetter());
-
- QByteArray encodedBuffer;
- if (_encoder) {
- _encoder->encode(audio, encodedBuffer);
- } else {
- encodedBuffer = audio;
- }
-
- _micAudioOutbound.increment();
-
- // FIXME check a flag to see if we should echo audio?
- emitAudioPacket(encodedBuffer.data(), encodedBuffer.size(), _outgoingAvatarAudioSequenceNumber,
- audioTransform, avatarBoundingBoxCorner, avatarBoundingBoxScale,
- PacketType::MicrophoneAudioWithEcho, _selectedCodecName);
+ QByteArray audioBuffer(audio);
+ handleAudioInput(audioBuffer);
}
void AudioClient::prepareLocalAudioInjectors() {
@@ -1434,7 +1407,7 @@ bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceIn
lock.unlock();
if (_inputDevice) {
- connect(_inputDevice, SIGNAL(readyRead()), this, SLOT(handleAudioInput()));
+ connect(_inputDevice, SIGNAL(readyRead()), this, SLOT(handleMicAudioInput()));
supportedFormat = true;
} else {
qCDebug(audioclient) << "Error starting audio input -" << _audioInput->error();
@@ -1540,12 +1513,39 @@ bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDevice
// setup our general output device for audio-mixer audio
_audioOutput = new QAudioOutput(outputDeviceInfo, _outputFormat, this);
- int osDefaultBufferSize = _audioOutput->bufferSize();
int deviceChannelCount = _outputFormat.channelCount();
- int deviceFrameSize = (AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * deviceChannelCount * _outputFormat.sampleRate()) / _desiredOutputFormat.sampleRate();
- int requestedSize = _sessionOutputBufferSizeFrames * deviceFrameSize * AudioConstants::SAMPLE_SIZE;
+ int frameSize = (AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * deviceChannelCount * _outputFormat.sampleRate()) / _desiredOutputFormat.sampleRate();
+ int requestedSize = _sessionOutputBufferSizeFrames * frameSize * AudioConstants::SAMPLE_SIZE;
_audioOutput->setBufferSize(requestedSize);
+ // initialize mix buffers on the _audioOutput thread to avoid races
+ connect(_audioOutput, &QAudioOutput::stateChanged, [&, frameSize, requestedSize](QAudio::State state) {
+ if (state == QAudio::ActiveState) {
+ // restrict device callback to _outputPeriod samples
+ _outputPeriod = (_audioOutput->periodSize() / AudioConstants::SAMPLE_SIZE) * 2;
+ _outputMixBuffer = new float[_outputPeriod];
+ _outputScratchBuffer = new int16_t[_outputPeriod];
+
+ // size local output mix buffer based on resampled network frame size
+ _networkPeriod = _localToOutputResampler->getMaxOutput(AudioConstants::NETWORK_FRAME_SAMPLES_STEREO);
+ _localOutputMixBuffer = new float[_networkPeriod];
+ int localPeriod = _outputPeriod * 2;
+ _localInjectorsStream.resizeForFrameSize(localPeriod);
+
+ int bufferSize = _audioOutput->bufferSize();
+ int bufferSamples = bufferSize / AudioConstants::SAMPLE_SIZE;
+ int bufferFrames = bufferSamples / (float)frameSize;
+ qCDebug(audioclient) << "frame (samples):" << frameSize;
+ qCDebug(audioclient) << "buffer (frames):" << bufferFrames;
+ qCDebug(audioclient) << "buffer (samples):" << bufferSamples;
+ qCDebug(audioclient) << "buffer (bytes):" << bufferSize;
+ qCDebug(audioclient) << "requested (bytes):" << requestedSize;
+ qCDebug(audioclient) << "period (samples):" << _outputPeriod;
+ qCDebug(audioclient) << "local buffer (samples):" << localPeriod;
+
+ disconnect(_audioOutput, &QAudioOutput::stateChanged, 0, 0);
+ }
+ });
connect(_audioOutput, &QAudioOutput::notify, this, &AudioClient::outputNotify);
_audioOutputIODevice.start();
@@ -1555,18 +1555,6 @@ bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDevice
_audioOutput->start(&_audioOutputIODevice);
lock.unlock();
- int periodSampleSize = _audioOutput->periodSize() / AudioConstants::SAMPLE_SIZE;
- // device callback is not restricted to periodSampleSize, so double the mix/scratch buffer sizes
- _outputPeriod = periodSampleSize * 2;
- _outputMixBuffer = new float[_outputPeriod];
- _outputScratchBuffer = new int16_t[_outputPeriod];
- _localOutputMixBuffer = new float[_outputPeriod];
- _localInjectorsStream.resizeForFrameSize(_outputPeriod * 2);
-
- qCDebug(audioclient) << "Output Buffer capacity in frames: " << _audioOutput->bufferSize() / AudioConstants::SAMPLE_SIZE / (float)deviceFrameSize <<
- "requested bytes:" << requestedSize << "actual bytes:" << _audioOutput->bufferSize() <<
- "os default:" << osDefaultBufferSize << "period size:" << _audioOutput->periodSize();
-
// setup a loopback audio output device
_loopbackAudioOutput = new QAudioOutput(outputDeviceInfo, _outputFormat, this);
diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h
index 7e9acc0586..139749e8e8 100644
--- a/libraries/audio-client/src/AudioClient.h
+++ b/libraries/audio-client/src/AudioClient.h
@@ -124,16 +124,16 @@ public:
void selectAudioFormat(const QString& selectedCodecName);
Q_INVOKABLE QString getSelectedAudioFormat() const { return _selectedCodecName; }
- Q_INVOKABLE bool getNoiseGateOpen() const { return _inputGate.isOpen(); }
- Q_INVOKABLE float getSilentOutboundPPS() const { return _silentOutbound.rate(); }
- Q_INVOKABLE float getMicAudioOutboundPPS() const { return _micAudioOutbound.rate(); }
+ Q_INVOKABLE bool getNoiseGateOpen() const { return _noiseGate.isOpen(); }
Q_INVOKABLE float getSilentInboundPPS() const { return _silentInbound.rate(); }
Q_INVOKABLE float getAudioInboundPPS() const { return _audioInbound.rate(); }
+ Q_INVOKABLE float getSilentOutboundPPS() const { return _silentOutbound.rate(); }
+ Q_INVOKABLE float getAudioOutboundPPS() const { return _audioOutbound.rate(); }
const MixedProcessedAudioStream& getReceivedAudioStream() const { return _receivedAudioStream; }
MixedProcessedAudioStream& getReceivedAudioStream() { return _receivedAudioStream; }
- float getLastInputLoudness() const { return glm::max(_lastInputLoudness - _inputGate.getMeasuredFloor(), 0.0f); }
+ float getLastInputLoudness() const { return glm::max(_lastInputLoudness - _noiseGate.getMeasuredFloor(), 0.0f); }
float getTimeSinceLastClip() const { return _timeSinceLastClip; }
float getAudioAverageInputLoudness() const { return _lastInputLoudness; }
@@ -180,7 +180,7 @@ public slots:
void handleMismatchAudioFormat(SharedNodePointer node, const QString& currentCodec, const QString& recievedCodec);
void sendDownstreamAudioStatsPacket() { _stats.publish(); }
- void handleAudioInput();
+ void handleMicAudioInput();
void handleRecordedAudioInput(const QByteArray& audio);
void reset();
void audioMixerKilled();
@@ -250,6 +250,7 @@ protected:
private:
void outputFormatChanged();
+ void handleAudioInput(QByteArray& audioBuffer);
bool mixLocalAudioInjectors(float* mixBuffer);
float azimuthForSource(const glm::vec3& relativePosition);
float gainForSource(float distance, float volume);
@@ -339,6 +340,7 @@ private:
int16_t _networkScratchBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_AMBISONIC];
// for local audio (used by audio injectors thread)
+ int _networkPeriod { 0 };
float _localMixBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_STEREO];
int16_t _localScratchBuffer[AudioConstants::NETWORK_FRAME_SAMPLES_AMBISONIC];
float* _localOutputMixBuffer { NULL };
@@ -371,7 +373,7 @@ private:
AudioIOStats _stats;
- AudioNoiseGate _inputGate;
+ AudioNoiseGate _noiseGate;
AudioPositionGetter _positionGetter;
AudioOrientationGetter _orientationGetter;
@@ -395,7 +397,7 @@ private:
QThread* _checkDevicesThread { nullptr };
RateCounter<> _silentOutbound;
- RateCounter<> _micAudioOutbound;
+ RateCounter<> _audioOutbound;
RateCounter<> _silentInbound;
RateCounter<> _audioInbound;
};
diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp
index ea81df3801..1ed020e592 100644
--- a/libraries/entities/src/EntityItemProperties.cpp
+++ b/libraries/entities/src/EntityItemProperties.cpp
@@ -49,13 +49,6 @@ EntityItemProperties::EntityItemProperties(EntityPropertyFlags desiredProperties
}
-void EntityItemProperties::setSittingPoints(const QVector& sittingPoints) {
- _sittingPoints.clear();
- foreach (SittingPoint sitPoint, sittingPoints) {
- _sittingPoints.append(sitPoint);
- }
-}
-
void EntityItemProperties::calculateNaturalPosition(const glm::vec3& min, const glm::vec3& max) {
glm::vec3 halfDimension = (max - min) / 2.0f;
_naturalPosition = max - halfDimension;
@@ -546,20 +539,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures);
}
- // Sitting properties support
- if (!skipDefaults && !strictSemantics) {
- QScriptValue sittingPoints = engine->newObject();
- for (int i = 0; i < _sittingPoints.size(); ++i) {
- QScriptValue sittingPoint = engine->newObject();
- sittingPoint.setProperty("name", _sittingPoints.at(i).name);
- sittingPoint.setProperty("position", vec3toScriptValue(engine, _sittingPoints.at(i).position));
- sittingPoint.setProperty("rotation", quatToScriptValue(engine, _sittingPoints.at(i).rotation));
- sittingPoints.setProperty(i, sittingPoint);
- }
- sittingPoints.setProperty("length", _sittingPoints.size());
- COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(sittingPoints, sittingPoints); // gettable, but not settable
- }
-
if (!skipDefaults && !strictSemantics) {
AABox aaBox = getAABox();
QScriptValue boundingBox = engine->newObject();
diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h
index 419740e4ea..590298e102 100644
--- a/libraries/entities/src/EntityItemProperties.h
+++ b/libraries/entities/src/EntityItemProperties.h
@@ -22,7 +22,6 @@
#include
#include
-#include // for SittingPoint
#include
#include
#include
@@ -255,8 +254,6 @@ public:
void clearID() { _id = UNKNOWN_ENTITY_ID; _idSet = false; }
void markAllChanged();
- void setSittingPoints(const QVector& sittingPoints);
-
const glm::vec3& getNaturalDimensions() const { return _naturalDimensions; }
void setNaturalDimensions(const glm::vec3& value) { _naturalDimensions = value; }
@@ -325,7 +322,6 @@ private:
// NOTE: The following are pseudo client only properties. They are only used in clients which can access
// properties of model geometry. But these properties are not serialized like other properties.
- QVector _sittingPoints;
QVariantMap _textureNames;
glm::vec3 _naturalDimensions;
glm::vec3 _naturalPosition;
diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp
index 535b2eb9a4..88d7acf7bf 100644
--- a/libraries/entities/src/EntityScriptingInterface.cpp
+++ b/libraries/entities/src/EntityScriptingInterface.cpp
@@ -296,13 +296,11 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit
results = entity->getProperties(desiredProperties);
- // TODO: improve sitting points and naturalDimensions in the future,
- // for now we've included the old sitting points model behavior for entity types that are models
- // we've also added this hack for setting natural dimensions of models
+ // TODO: improve naturalDimensions in the future,
+ // for now we've added this hack for setting natural dimensions of models
if (entity->getType() == EntityTypes::Model) {
const FBXGeometry* geometry = _entityTree->getGeometryForEntity(entity);
if (geometry) {
- results.setSittingPoints(geometry->sittingPoints);
Extents meshExtents = geometry->getUnscaledMeshExtents();
results.setNaturalDimensions(meshExtents.maximum - meshExtents.minimum);
results.calculateNaturalPosition(meshExtents.minimum, meshExtents.maximum);
diff --git a/libraries/entities/src/PropertyGroup.h b/libraries/entities/src/PropertyGroup.h
index 38b1e5f599..f45d19f5eb 100644
--- a/libraries/entities/src/PropertyGroup.h
+++ b/libraries/entities/src/PropertyGroup.h
@@ -14,9 +14,11 @@
#include
-//#include "EntityItemProperties.h"
+#include
+
#include "EntityPropertyFlags.h"
+
class EntityItemProperties;
class EncodeBitstreamParams;
class OctreePacketData;
@@ -24,31 +26,6 @@ class EntityTreeElementExtraEncodeData;
class ReadBitstreamToTreeParams;
using EntityTreeElementExtraEncodeDataPointer = std::shared_ptr;
-#include
-
-/*
-#include
-
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-#include // for SittingPoint
-#include
-#include
-#include
-
-#include "EntityItemID.h"
-#include "PropertyGroupMacros.h"
-#include "EntityTypes.h"
-*/
-
-//typedef PropertyFlags EntityPropertyFlags;
-
class PropertyGroup {
public:
diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp
index fcaef90527..b9e1edc168 100644
--- a/libraries/fbx/src/FBXReader.cpp
+++ b/libraries/fbx/src/FBXReader.cpp
@@ -1795,19 +1795,6 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
}
geometry.palmDirection = parseVec3(mapping.value("palmDirection", "0, -1, 0").toString());
- // Add sitting points
- QVariantHash sittingPoints = mapping.value("sit").toHash();
- for (QVariantHash::const_iterator it = sittingPoints.constBegin(); it != sittingPoints.constEnd(); it++) {
- SittingPoint sittingPoint;
- sittingPoint.name = it.key();
-
- QVariantList properties = it->toList();
- sittingPoint.position = parseVec3(properties.at(0).toString());
- sittingPoint.rotation = glm::quat(glm::radians(parseVec3(properties.at(1).toString())));
-
- geometry.sittingPoints.append(sittingPoint);
- }
-
// attempt to map any meshes to a named model
for (QHash::const_iterator m = meshIDsToMeshIndices.constBegin();
m != meshIDsToMeshIndices.constEnd(); m++) {
diff --git a/libraries/fbx/src/FBXReader.h b/libraries/fbx/src/FBXReader.h
index 6e51c413dc..fa047e512f 100644
--- a/libraries/fbx/src/FBXReader.h
+++ b/libraries/fbx/src/FBXReader.h
@@ -265,24 +265,6 @@ public:
Q_DECLARE_METATYPE(FBXAnimationFrame)
Q_DECLARE_METATYPE(QVector)
-/// A point where an avatar can sit
-class SittingPoint {
-public:
- QString name;
- glm::vec3 position; // relative postion
- glm::quat rotation; // relative orientation
-};
-
-inline bool operator==(const SittingPoint& lhs, const SittingPoint& rhs)
-{
- return (lhs.name == rhs.name) && (lhs.position == rhs.position) && (lhs.rotation == rhs.rotation);
-}
-
-inline bool operator!=(const SittingPoint& lhs, const SittingPoint& rhs)
-{
- return (lhs.name != rhs.name) || (lhs.position != rhs.position) || (lhs.rotation != rhs.rotation);
-}
-
/// A set of meshes extracted from an FBX document.
class FBXGeometry {
public:
@@ -320,8 +302,6 @@ public:
glm::vec3 palmDirection;
- QVector sittingPoints;
-
glm::vec3 neckPivot;
Extents bindExtents;
diff --git a/libraries/render/src/render/drawItemStatus.slv b/libraries/render/src/render/drawItemStatus.slv
index cb4ae7ebd2..792f2733c5 100644
--- a/libraries/render/src/render/drawItemStatus.slv
+++ b/libraries/render/src/render/drawItemStatus.slv
@@ -75,7 +75,7 @@ void main(void) {
vec4(1.0, 1.0, 0.0, 1.0)
);
- const vec2 ICON_PIXEL_SIZE = vec2(20, 20);
+ const vec2 ICON_PIXEL_SIZE = vec2(36, 36);
const vec2 MARGIN_PIXEL_SIZE = vec2(2, 2);
const vec2 ICON_GRID_SLOTS[MAX_NUM_ICONS] = vec2[MAX_NUM_ICONS](vec2(-1.5, 0.5),
vec2(-0.5, 0.5),
@@ -114,7 +114,7 @@ void main(void) {
varColor = vec4(paintRainbow(abs(iconStatus.y)), 1.0);
// Pass the texcoord and the z texcoord is representing the texture icon
- varTexcoord = vec3((quadPos.xy + 1.0) * 0.5, iconStatus.z);
+ varTexcoord = vec3( (quadPos.x + 1.0) * 0.5, (quadPos.y + 1.0) * -0.5, iconStatus.z);
// Also changes the size of the notification
vec2 iconScale = ICON_PIXEL_SIZE;