Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 102 files). Show all
Unified · Split
| @@ -13,7 +13,6 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <QtCore/QEventLoop> |
| 14 | 14 | #include <QtCore/QTimer> |
| 15 | 15 | #include <QtCore/QThread> |
| 16 | −#include <QtNetwork/QNetworkAccessManager> | |
| 17 | 16 | #include <QtNetwork/QNetworkRequest> |
| 18 | 17 | #include <QtNetwork/QNetworkReply> |
| 19 | 18 | #include <QScriptEngine> |
| @@ -23,6 +22,7 @@ · 3 unmodified lines | ||
| 23 | 22 | #include <AvatarData.h> |
| 24 | 23 | #include <CollisionInfo.h> |
| 25 | 24 | #include <EntityScriptingInterface.h> |
| 25 | +#include <NetworkAccessManager.h> | |
| 26 | 26 | #include <NodeList.h> |
| 27 | 27 | #include <PacketHeaders.h> |
| 28 | 28 | #include <ParticlesScriptingInterface.h> |
| @@ -33,6 +33,7 @@ · 4 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #include "AnimationObject.h" |
| 35 | 35 | #include "MenuItemProperties.h" |
| 36 | +#include "MIDIEvent.h" | |
| 36 | 37 | #include "LocalVoxels.h" |
| 37 | 38 | #include "ScriptEngine.h" |
| 38 | 39 | #include "XMLHttpRequestClass.h" |
| @@ -141,8 +142,8 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL, · 102 unmodified lines | ||
| 141 | 142 | emit errorMessage("ERROR Loading file:" + fileName); |
| 142 | 143 | } |
| 143 | 144 | } else { |
| 144 | − QNetworkAccessManager* networkManager = new QNetworkAccessManager(this); | |
| 145 | − QNetworkReply* reply = networkManager->get(QNetworkRequest(url)); | |
| 145 | + NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | |
| 146 | + QNetworkReply* reply = networkAccessManager.get(QNetworkRequest(url)); | |
| 146 | 147 | qDebug() << "Downloading included script at" << url; |
| 147 | 148 | QEventLoop loop; |
| 148 | 149 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); |
| @@ -217,6 +218,7 @@ void ScriptEngine::init() { · 68 unmodified lines | ||
| 217 | 218 | |
| 218 | 219 | // register various meta-types |
| 219 | 220 | registerMetaTypes(&_engine); |
| 221 | + registerMIDIMetaTypes(&_engine); | |
| 220 | 222 | registerVoxelMetaTypes(&_engine); |
| 221 | 223 | registerEventTypes(&_engine); |
| 222 | 224 | registerMenuItemProperties(&_engine); |
| @@ -254,6 +256,8 @@ void ScriptEngine::init() { · 31 unmodified lines | ||
| 254 | 256 | |
| 255 | 257 | qScriptRegisterMetaType(&_engine, injectorToScriptValue, injectorFromScriptValue); |
| 256 | 258 | |
| 259 | + qScriptRegisterMetaType(&_engine, animationDetailsToScriptValue, animationDetailsFromScriptValue); | |
| 260 | + | |
| 257 | 261 | registerGlobalObject("Script", this); |
| 258 | 262 | registerGlobalObject("Audio", &_audioScriptingInterface); |
| 259 | 263 | registerGlobalObject("Controller", _controllerScriptingInterface); |
| @@ -469,7 +473,10 @@ void ScriptEngine::run() { · 209 unmodified lines | ||
| 469 | 473 | |
| 470 | 474 | // pack a placeholder value for sequence number for now, will be packed when destination node is known |
| 471 | 475 | int numPreSequenceNumberBytes = audioPacket.size(); |
| 472 | − packetStream << (quint16)0; | |
| 476 | + packetStream << (quint16) 0; | |
| 477 | + | |
| 478 | + // assume scripted avatar audio is mono and set channel flag to zero | |
| 479 | + packetStream << (quint8) 0; | |
| 473 | 480 | |
| 474 | 481 | // use the orientation and position of this avatar for the source of this audio |
| 475 | 482 | packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3)); |
| @@ -646,8 +653,8 @@ void ScriptEngine::include(const QString& includeFile) { · 170 unmodified lines | ||
| 646 | 653 | QString includeContents; |
| 647 | 654 | |
| 648 | 655 | if (url.scheme() == "http" || url.scheme() == "ftp") { |
| 649 | − QNetworkAccessManager* networkManager = new QNetworkAccessManager(this); | |
| 650 | − QNetworkReply* reply = networkManager->get(QNetworkRequest(url)); | |
| 656 | + NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | |
| 657 | + QNetworkReply* reply = networkAccessManager.get(QNetworkRequest(url)); | |
| 651 | 658 | qDebug() << "Downloading included script at" << includeFile; |
| 652 | 659 | QEventLoop loop; |
| 653 | 660 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); |