Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 158 files). Show all
Unified · Split
| @@ -485,17 +485,17 @@ void ScriptEngine::run() { · 484 unmodified lines | ||
| 485 | 485 | |
| 486 | 486 | // write audio packet to AudioMixer nodes |
| 487 | 487 | NodeList* nodeList = NodeList::getInstance(); |
| 488 | − foreach(const SharedNodePointer& node, nodeList->getNodeHash()) { | |
| 488 | + nodeList->eachNode([this, &nodeList, &audioPacket, &numPreSequenceNumberBytes](const SharedNodePointer& node){ | |
| 489 | 489 | // only send to nodes of type AudioMixer |
| 490 | 490 | if (node->getType() == NodeType::AudioMixer) { |
| 491 | 491 | // pack sequence number |
| 492 | 492 | quint16 sequence = _outgoingScriptAudioSequenceNumbers[node->getUUID()]++; |
| 493 | 493 | memcpy(audioPacket.data() + numPreSequenceNumberBytes, &sequence, sizeof(quint16)); |
| 494 | − | |
| 494 | + | |
| 495 | 495 | // send audio packet |
| 496 | 496 | nodeList->writeDatagram(audioPacket, node); |
| 497 | 497 | } |
| 498 | − } | |
| 498 | + }); | |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
| @@ -602,16 +602,20 @@ void ScriptEngine::stopTimer(QTimer *timer) { · 100 unmodified lines | ||
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | QUrl ScriptEngine::resolvePath(const QString& include) const { |
| 605 | − // first lets check to see if it's already a full URL | |
| 606 | 605 | QUrl url(include); |
| 606 | + // first lets check to see if it's already a full URL | |
| 607 | 607 | if (!url.scheme().isEmpty()) { |
| 608 | 608 | return url; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | // we apparently weren't a fully qualified url, so, let's assume we're relative |
| 612 | 612 | // to the original URL of our script |
| 613 | − QUrl parentURL(_fileNameString); | |
| 614 | − | |
| 613 | + QUrl parentURL; | |
| 614 | + if (_parentURL.isEmpty()) { | |
| 615 | + parentURL = QUrl(_fileNameString); | |
| 616 | + } else { | |
| 617 | + parentURL = QUrl(_parentURL); | |
| 618 | + } | |
| 615 | 619 | // if the parent URL's scheme is empty, then this is probably a local file... |
| 616 | 620 | if (parentURL.scheme().isEmpty()) { |
| 617 | 621 | parentURL = QUrl::fromLocalFile(_fileNameString); |
| @@ -644,6 +648,7 @@ void ScriptEngine::include(const QString& includeFile) { · 26 unmodified lines | ||
| 644 | 648 | #else |
| 645 | 649 | QString fileName = url.toLocalFile(); |
| 646 | 650 | #endif |
| 651 | + | |
| 647 | 652 | QFile scriptFile(fileName); |
| 648 | 653 | if (scriptFile.open(QFile::ReadOnly | QFile::Text)) { |
| 649 | 654 | qDebug() << "Including file:" << fileName; |