Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 101 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 <ModelsScriptingInterface.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" |
| @@ -149,8 +150,8 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL, · 110 unmodified lines | ||
| 149 | 150 | emit errorMessage("ERROR Loading file:" + fileName); |
| 150 | 151 | } |
| 151 | 152 | } else { |
| 152 | − QNetworkAccessManager* networkManager = new QNetworkAccessManager(this); | |
| 153 | − QNetworkReply* reply = networkManager->get(QNetworkRequest(url)); | |
| 153 | + NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | |
| 154 | + QNetworkReply* reply = networkAccessManager.get(QNetworkRequest(url)); | |
| 154 | 155 | qDebug() << "Downloading included script at" << url; |
| 155 | 156 | QEventLoop loop; |
| 156 | 157 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); |
| @@ -225,6 +226,7 @@ void ScriptEngine::init() { · 68 unmodified lines | ||
| 225 | 226 | |
| 226 | 227 | // register various meta-types |
| 227 | 228 | registerMetaTypes(&_engine); |
| 229 | + registerMIDIMetaTypes(&_engine); | |
| 228 | 230 | registerVoxelMetaTypes(&_engine); |
| 229 | 231 | registerEventTypes(&_engine); |
| 230 | 232 | registerMenuItemProperties(&_engine); |
| @@ -263,6 +265,8 @@ void ScriptEngine::init() { · 32 unmodified lines | ||
| 263 | 265 | qScriptRegisterMetaType(&_engine, injectorToScriptValue, injectorFromScriptValue); |
| 264 | 266 | qScriptRegisterMetaType( &_engine, injectorToScriptValue_InputController, injectorFromScriptValue_InputController); |
| 265 | 267 | |
| 268 | + qScriptRegisterMetaType(&_engine, animationDetailsToScriptValue, animationDetailsFromScriptValue); | |
| 269 | + | |
| 266 | 270 | registerGlobalObject("Script", this); |
| 267 | 271 | registerGlobalObject("Audio", &_audioScriptingInterface); |
| 268 | 272 | registerGlobalObject("Controller", _controllerScriptingInterface); |
| @@ -478,7 +482,10 @@ void ScriptEngine::run() { · 209 unmodified lines | ||
| 478 | 482 | |
| 479 | 483 | // pack a placeholder value for sequence number for now, will be packed when destination node is known |
| 480 | 484 | int numPreSequenceNumberBytes = audioPacket.size(); |
| 481 | − packetStream << (quint16)0; | |
| 485 | + packetStream << (quint16) 0; | |
| 486 | + | |
| 487 | + // assume scripted avatar audio is mono and set channel flag to zero | |
| 488 | + packetStream << (quint8) 0; | |
| 482 | 489 | |
| 483 | 490 | // use the orientation and position of this avatar for the source of this audio |
| 484 | 491 | packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3)); |
| @@ -655,8 +662,8 @@ void ScriptEngine::include(const QString& includeFile) { · 170 unmodified lines | ||
| 655 | 662 | QString includeContents; |
| 656 | 663 | |
| 657 | 664 | if (url.scheme() == "http" || url.scheme() == "ftp") { |
| 658 | − QNetworkAccessManager* networkManager = new QNetworkAccessManager(this); | |
| 659 | − QNetworkReply* reply = networkManager->get(QNetworkRequest(url)); | |
| 665 | + NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | |
| 666 | + QNetworkReply* reply = networkAccessManager.get(QNetworkRequest(url)); | |
| 660 | 667 | qDebug() << "Downloading included script at" << includeFile; |
| 661 | 668 | QEventLoop loop; |
| 662 | 669 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); |