Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 7 files). Show all
Unified · Split
| @@ -11,9 +11,13 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | #include "EntityScriptServer.h" | 12 | #include "EntityScriptServer.h" |
| 13 | 13 | ||
| 14 | #include <mutex> | ||
| 15 | |||
| 14 | #include <AudioConstants.h> | 16 | #include <AudioConstants.h> |
| 15 | #include <AudioInjectorManager.h> | 17 | #include <AudioInjectorManager.h> |
| 18 | #include <ClientServerUtils.h> | ||
| 16 | #include <EntityScriptingInterface.h> | 19 | #include <EntityScriptingInterface.h> |
| 20 | #include <LogHandler.h> | ||
| 17 | #include <MessagesClient.h> | 21 | #include <MessagesClient.h> |
| 18 | #include <plugins/CodecPlugin.h> | 22 | #include <plugins/CodecPlugin.h> |
| 19 | #include <plugins/PluginManager.h> | 23 | #include <plugins/PluginManager.h> |
| @@ -24,13 +28,9 @@ · 4 unmodified lines | |||
| 24 | #include <UUID.h> | 28 | #include <UUID.h> |
| 25 | #include <WebSocketServerClass.h> | 29 | #include <WebSocketServerClass.h> |
| 26 | 30 | ||
| 27 | #include "ClientServerUtils.h" | 31 | #include "EntityScriptServerLogging.h" |
| 28 | #include "../entities/AssignmentParentFinder.h" | 32 | #include "../entities/AssignmentParentFinder.h" |
| 29 | 33 | ||
| 30 | |||
| 31 | #include <LogHandler.h> | ||
| 32 | #include <mutex> | ||
| 33 | |||
| 34 | using Mutex = std::mutex; | 34 | using Mutex = std::mutex; |
| 35 | using Lock = std::lock_guard<Mutex>; | 35 | using Lock = std::lock_guard<Mutex>; |
| 36 | 36 | ||
| @@ -101,7 +101,7 @@ void EntityScriptServer::handleReloadEntityServerScriptPacket(QSharedPointer<Rec · 64 unmodified lines | |||
| 101 | auto entityID = QUuid::fromRfc4122(message->read(NUM_BYTES_RFC4122_UUID)); | 101 | auto entityID = QUuid::fromRfc4122(message->read(NUM_BYTES_RFC4122_UUID)); |
| 102 | 102 | ||
| 103 | if (_entityViewer.getTree() && !_shuttingDown) { | 103 | if (_entityViewer.getTree() && !_shuttingDown) { |
| 104 | qDebug() << "Reloading: " << entityID; | 104 | qCDebug(entity_script_server) << "Reloading: " << entityID; |
| 105 | _entitiesScriptEngine->unloadEntityScript(entityID); | 105 | _entitiesScriptEngine->unloadEntityScript(entityID); |
| 106 | checkAndCallPreload(entityID, true); | 106 | checkAndCallPreload(entityID, true); |
| 107 | } | 107 | } |
| @@ -191,12 +191,12 @@ void EntityScriptServer::handleEntityServerScriptLogPacket(QSharedPointer<Receiv · 83 unmodified lines | |||
| 191 | if (enable && senderNode->getCanRez()) { | 191 | if (enable && senderNode->getCanRez()) { |
| 192 | if (it == std::end(_logListeners)) { | 192 | if (it == std::end(_logListeners)) { |
| 193 | _logListeners.insert(senderUUID); | 193 | _logListeners.insert(senderUUID); |
| 194 | qInfo() << "Node" << senderUUID << "subscribed to log stream"; | 194 | qCInfo(entity_script_server) << "Node" << senderUUID << "subscribed to log stream"; |
| 195 | } | 195 | } |
| 196 | } else { | 196 | } else { |
| 197 | if (it != std::end(_logListeners)) { | 197 | if (it != std::end(_logListeners)) { |
| 198 | _logListeners.erase(it); | 198 | _logListeners.erase(it); |
| 199 | qInfo() << "Node" << senderUUID << "unsubscribed from log stream"; | 199 | qCInfo(entity_script_server) << "Node" << senderUUID << "unsubscribed from log stream"; |
| 200 | } | 200 | } |
| 201 | } | 201 | } |
| 202 | } | 202 | } |
| @@ -226,16 +226,12 @@ void EntityScriptServer::pushLogs() { · 23 unmodified lines | |||
| 226 | if (node && node->getActiveSocket()) { | 226 | if (node && node->getActiveSocket()) { |
| 227 | auto copy = NLPacket::createCopy(*packet); | 227 | auto copy = NLPacket::createCopy(*packet); |
| 228 | nodeList->sendPacket(std::move(copy), *node); | 228 | nodeList->sendPacket(std::move(copy), *node); |
| 229 | } else { | ||
| 230 | qWarning() << "Node not found"; | ||
| 231 | } | 229 | } |
| 232 | } | 230 | } |
| 233 | 231 | ||
| 234 | auto node = nodeList->nodeWithUUID(*last); | 232 | auto node = nodeList->nodeWithUUID(*last); |
| 235 | if (node && node->getActiveSocket()) { | 233 | if (node && node->getActiveSocket()) { |
| 236 | nodeList->sendPacket(std::move(packet), *node); | 234 | nodeList->sendPacket(std::move(packet), *node); |
| 237 | } else { | ||
| 238 | qWarning() << "Node not found"; | ||
| 239 | } | 235 | } |
| 240 | } | 236 | } |
| 241 | 237 | ||
| @@ -388,7 +384,7 @@ void EntityScriptServer::handleSelectedAudioFormat(QSharedPointer<ReceivedMessag · 146 unmodified lines | |||
| 388 | void EntityScriptServer::selectAudioFormat(const QString& selectedCodecName) { | 384 | void EntityScriptServer::selectAudioFormat(const QString& selectedCodecName) { |
| 389 | _selectedCodecName = selectedCodecName; | 385 | _selectedCodecName = selectedCodecName; |
| 390 | 386 | ||
| 391 | qDebug() << "Selected Codec:" << _selectedCodecName; | 387 | qCDebug(entity_script_server) << "Selected Codec:" << _selectedCodecName; |
| 392 | 388 | ||
| 393 | // release any old codec encoder/decoder first... | 389 | // release any old codec encoder/decoder first... |
| 394 | if (_codec && _encoder) { | 390 | if (_codec && _encoder) { |
| @@ -402,7 +398,7 @@ void EntityScriptServer::selectAudioFormat(const QString& selectedCodecName) { · 7 unmodified lines | |||
| 402 | if (_selectedCodecName == plugin->getName()) { | 398 | if (_selectedCodecName == plugin->getName()) { |
| 403 | _codec = plugin; | 399 | _codec = plugin; |
| 404 | _encoder = plugin->createEncoder(AudioConstants::SAMPLE_RATE, AudioConstants::MONO); | 400 | _encoder = plugin->createEncoder(AudioConstants::SAMPLE_RATE, AudioConstants::MONO); |
| 405 | qDebug() << "Selected Codec Plugin:" << _codec.get(); | 401 | qCDebug(entity_script_server) << "Selected Codec Plugin:" << _codec.get(); |
| 406 | break; | 402 | break; |
| 407 | } | 403 | } |
| 408 | } | 404 | } |
| @@ -490,7 +486,7 @@ void EntityScriptServer::checkAndCallPreload(const EntityItemID& entityID, const · 81 unmodified lines | |||
| 490 | QString scriptUrl = entity->getServerScripts(); | 486 | QString scriptUrl = entity->getServerScripts(); |
| 491 | if (!scriptUrl.isEmpty()) { | 487 | if (!scriptUrl.isEmpty()) { |
| 492 | scriptUrl = ResourceManager::normalizeURL(scriptUrl); | 488 | scriptUrl = ResourceManager::normalizeURL(scriptUrl); |
| 493 | qDebug() << "Loading entity server script" << scriptUrl << "for" << entityID; | 489 | qCDebug(entity_script_server) << "Loading entity server script" << scriptUrl << "for" << entityID; |
| 494 | ScriptEngine::loadEntityScript(_entitiesScriptEngine, entityID, scriptUrl, reload); | 490 | ScriptEngine::loadEntityScript(_entitiesScriptEngine, entityID, scriptUrl, reload); |
| 495 | } | 491 | } |
| 496 | } | 492 | } |