Showing the changes to interface/src/Application.cpp (1 of 16 files). Show all
Unified · Split
| @@ -1138,33 +1138,34 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1137 unmodified lines | ||
| 1138 | 1138 | domainCheckInTimer->deleteLater(); |
| 1139 | 1139 | }); |
| 1140 | 1140 | |
| 1141 | + { | |
| 1142 | + auto audioIO = DependencyManager::get<AudioClient>().data(); | |
| 1143 | + audioIO->setPositionGetter([] { | |
| 1144 | + auto avatarManager = DependencyManager::get<AvatarManager>(); | |
| 1145 | + auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr; | |
| 1141 | 1146 | |
| 1142 | − auto audioIO = DependencyManager::get<AudioClient>(); | |
| 1143 | − audioIO->setPositionGetter([]{ | |
| 1144 | − auto avatarManager = DependencyManager::get<AvatarManager>(); | |
| 1145 | − auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr; | |
| 1146 | − | |
| 1147 | − return myAvatar ? myAvatar->getPositionForAudio() : Vectors::ZERO; | |
| 1148 | − }); | |
| 1149 | − audioIO->setOrientationGetter([]{ | |
| 1150 | − auto avatarManager = DependencyManager::get<AvatarManager>(); | |
| 1151 | − auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr; | |
| 1147 | + return myAvatar ? myAvatar->getPositionForAudio() : Vectors::ZERO; | |
| 1148 | + }); | |
| 1149 | + audioIO->setOrientationGetter([] { | |
| 1150 | + auto avatarManager = DependencyManager::get<AvatarManager>(); | |
| 1151 | + auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr; | |
| 1152 | 1152 | |
| 1153 | − return myAvatar ? myAvatar->getOrientationForAudio() : Quaternions::IDENTITY; | |
| 1154 | − }); | |
| 1153 | + return myAvatar ? myAvatar->getOrientationForAudio() : Quaternions::IDENTITY; | |
| 1154 | + }); | |
| 1155 | 1155 | |
| 1156 | − recording::Frame::registerFrameHandler(AudioConstants::getAudioFrameName(), [=](recording::Frame::ConstPointer frame) { | |
| 1157 | − audioIO->handleRecordedAudioInput(frame->data); | |
| 1158 | − }); | |
| 1156 | + recording::Frame::registerFrameHandler(AudioConstants::getAudioFrameName(), [=](recording::Frame::ConstPointer frame) { | |
| 1157 | + audioIO->handleRecordedAudioInput(frame->data); | |
| 1158 | + }); | |
| 1159 | 1159 | |
| 1160 | − connect(audioIO.data(), &AudioClient::inputReceived, [](const QByteArray& audio){ | |
| 1161 | − static auto recorder = DependencyManager::get<recording::Recorder>(); | |
| 1162 | − if (recorder->isRecording()) { | |
| 1163 | − static const recording::FrameType AUDIO_FRAME_TYPE = recording::Frame::registerFrameType(AudioConstants::getAudioFrameName()); | |
| 1164 | − recorder->recordFrame(AUDIO_FRAME_TYPE, audio); | |
| 1165 | − } | |
| 1166 | − }); | |
| 1167 | − audioIO->startThread(); | |
| 1160 | + connect(audioIO, &AudioClient::inputReceived, [](const QByteArray& audio) { | |
| 1161 | + static auto recorder = DependencyManager::get<recording::Recorder>(); | |
| 1162 | + if (recorder->isRecording()) { | |
| 1163 | + static const recording::FrameType AUDIO_FRAME_TYPE = recording::Frame::registerFrameType(AudioConstants::getAudioFrameName()); | |
| 1164 | + recorder->recordFrame(AUDIO_FRAME_TYPE, audio); | |
| 1165 | + } | |
| 1166 | + }); | |
| 1167 | + audioIO->startThread(); | |
| 1168 | + } | |
| 1168 | 1169 | |
| 1169 | 1170 | // Make sure we don't time out during slow operations at startup |
| 1170 | 1171 | updateHeartbeat(); |
| @@ -1263,27 +1264,29 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 92 unmodified lines | ||
| 1263 | 1264 | // Inititalize sample before registering |
| 1264 | 1265 | _sampleSound = DependencyManager::get<SoundCache>()->getSound(PathUtils::resourcesUrl("sounds/sample.wav")); |
| 1265 | 1266 | |
| 1266 | − auto scriptEngines = DependencyManager::get<ScriptEngines>().data(); | |
| 1267 | − scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){ | |
| 1268 | − registerScriptEngineWithApplicationServices(engine); | |
| 1269 | − }); | |
| 1267 | + { | |
| 1268 | + auto scriptEngines = DependencyManager::get<ScriptEngines>().data(); | |
| 1269 | + scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine) { | |
| 1270 | + registerScriptEngineWithApplicationServices(engine); | |
| 1271 | + }); | |
| 1270 | 1272 | |
| 1271 | − connect(scriptEngines, &ScriptEngines::scriptCountChanged, scriptEngines, [this] { | |
| 1272 | − auto scriptEngines = DependencyManager::get<ScriptEngines>(); | |
| 1273 | − if (scriptEngines->getRunningScripts().isEmpty()) { | |
| 1274 | − getMyAvatar()->clearScriptableSettings(); | |
| 1275 | − } | |
| 1276 | − }, Qt::QueuedConnection); | |
| 1273 | + connect(scriptEngines, &ScriptEngines::scriptCountChanged, this, [this] { | |
| 1274 | + auto scriptEngines = DependencyManager::get<ScriptEngines>(); | |
| 1275 | + if (scriptEngines->getRunningScripts().isEmpty()) { | |
| 1276 | + getMyAvatar()->clearScriptableSettings(); | |
| 1277 | + } | |
| 1278 | + }, Qt::QueuedConnection); | |
| 1277 | 1279 | |
| 1278 | − connect(scriptEngines, &ScriptEngines::scriptsReloading, scriptEngines, [this] { | |
| 1279 | − getEntities()->reloadEntityScripts(); | |
| 1280 | − loadAvatarScripts(getMyAvatar()->getScriptUrls()); | |
| 1281 | − }, Qt::QueuedConnection); | |
| 1280 | + connect(scriptEngines, &ScriptEngines::scriptsReloading, this, [this] { | |
| 1281 | + getEntities()->reloadEntityScripts(); | |
| 1282 | + loadAvatarScripts(getMyAvatar()->getScriptUrls()); | |
| 1283 | + }, Qt::QueuedConnection); | |
| 1282 | 1284 | |
| 1283 | − connect(scriptEngines, &ScriptEngines::scriptLoadError, | |
| 1284 | − scriptEngines, [](const QString& filename, const QString& error){ | |
| 1285 | − OffscreenUi::asyncWarning(nullptr, "Error Loading Script", filename + " failed to load."); | |
| 1286 | − }, Qt::QueuedConnection); | |
| 1285 | + connect(scriptEngines, &ScriptEngines::scriptLoadError, | |
| 1286 | + this, [](const QString& filename, const QString& error) { | |
| 1287 | + OffscreenUi::asyncWarning(nullptr, "Error Loading Script", filename + " failed to load."); | |
| 1288 | + }, Qt::QueuedConnection); | |
| 1289 | + } | |
| 1287 | 1290 | |
| 1288 | 1291 | #ifdef _WIN32 |
| 1289 | 1292 | WSADATA WsaData; |
| @@ -1353,10 +1356,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 63 unmodified lines | ||
| 1353 | 1356 | // so we defer the setup of the `scripting::Audio` class until this point |
| 1354 | 1357 | { |
| 1355 | 1358 | auto audioScriptingInterface = DependencyManager::set<AudioScriptingInterface, scripting::Audio>(); |
| 1356 | − connect(audioIO.data(), &AudioClient::mutedByMixer, audioScriptingInterface.data(), &AudioScriptingInterface::mutedByMixer); | |
| 1357 | − connect(audioIO.data(), &AudioClient::receivedFirstPacket, audioScriptingInterface.data(), &AudioScriptingInterface::receivedFirstPacket); | |
| 1358 | − connect(audioIO.data(), &AudioClient::disconnected, audioScriptingInterface.data(), &AudioScriptingInterface::disconnected); | |
| 1359 | − connect(audioIO.data(), &AudioClient::muteEnvironmentRequested, [](glm::vec3 position, float radius) { | |
| 1359 | + auto audioIO = DependencyManager::get<AudioClient>().data(); | |
| 1360 | + connect(audioIO, &AudioClient::mutedByMixer, audioScriptingInterface.data(), &AudioScriptingInterface::mutedByMixer); | |
| 1361 | + connect(audioIO, &AudioClient::receivedFirstPacket, audioScriptingInterface.data(), &AudioScriptingInterface::receivedFirstPacket); | |
| 1362 | + connect(audioIO, &AudioClient::disconnected, audioScriptingInterface.data(), &AudioScriptingInterface::disconnected); | |
| 1363 | + connect(audioIO, &AudioClient::muteEnvironmentRequested, [](glm::vec3 position, float radius) { | |
| 1360 | 1364 | auto audioClient = DependencyManager::get<AudioClient>(); |
| 1361 | 1365 | auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>(); |
| 1362 | 1366 | auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldPosition(); |
| @@ -1688,23 +1692,26 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 325 unmodified lines | ||
| 1688 | 1692 | userInputMapper->registerDevice(_touchscreenVirtualPadDevice->getInputDevice()); |
| 1689 | 1693 | } |
| 1690 | 1694 | |
| 1691 | − // this will force the model the look at the correct directory (weird order of operations issue) | |
| 1692 | − scriptEngines->reloadLocalFiles(); | |
| 1693 | − | |
| 1694 | − // do this as late as possible so that all required subsystems are initialized | |
| 1695 | − // If we've overridden the default scripts location, just load default scripts | |
| 1696 | − // otherwise, load 'em all | |
| 1697 | − | |
| 1698 | − // we just want to see if --scripts was set, we've already parsed it and done | |
| 1699 | − // the change in PathUtils. Rather than pass that in the constructor, lets just | |
| 1700 | − // look (this could be debated) | |
| 1701 | − QString scriptsSwitch = QString("--").append(SCRIPTS_SWITCH); | |
| 1702 | − QDir defaultScriptsLocation(getCmdOption(argc, constArgv, scriptsSwitch.toStdString().c_str())); | |
| 1703 | − if (!defaultScriptsLocation.exists()) { | |
| 1704 | − scriptEngines->loadDefaultScripts(); | |
| 1705 | − scriptEngines->defaultScriptsLocationOverridden(true); | |
| 1706 | − } else { | |
| 1707 | − scriptEngines->loadScripts(); | |
| 1695 | + { | |
| 1696 | + auto scriptEngines = DependencyManager::get<ScriptEngines>().data(); | |
| 1697 | + // this will force the model the look at the correct directory (weird order of operations issue) | |
| 1698 | + scriptEngines->reloadLocalFiles(); | |
| 1699 | + | |
| 1700 | + // do this as late as possible so that all required subsystems are initialized | |
| 1701 | + // If we've overridden the default scripts location, just load default scripts | |
| 1702 | + // otherwise, load 'em all | |
| 1703 | + | |
| 1704 | + // we just want to see if --scripts was set, we've already parsed it and done | |
| 1705 | + // the change in PathUtils. Rather than pass that in the constructor, lets just | |
| 1706 | + // look (this could be debated) | |
| 1707 | + QString scriptsSwitch = QString("--").append(SCRIPTS_SWITCH); | |
| 1708 | + QDir defaultScriptsLocation(getCmdOption(argc, constArgv, scriptsSwitch.toStdString().c_str())); | |
| 1709 | + if (!defaultScriptsLocation.exists()) { | |
| 1710 | + scriptEngines->loadDefaultScripts(); | |
| 1711 | + scriptEngines->defaultScriptsLocationOverridden(true); | |
| 1712 | + } else { | |
| 1713 | + scriptEngines->loadScripts(); | |
| 1714 | + } | |
| 1708 | 1715 | } |
| 1709 | 1716 | |
| 1710 | 1717 | // Make sure we don't time out during slow operations at startup |
| @@ -1754,13 +1761,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 43 unmodified lines | ||
| 1754 | 1761 | cameraMenuChanged(); |
| 1755 | 1762 | } |
| 1756 | 1763 | |
| 1757 | − // set the local loopback interface for local sounds | |
| 1758 | − AudioInjector::setLocalAudioInterface(audioIO.data()); | |
| 1759 | − auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>(); | |
| 1760 | − audioScriptingInterface->setLocalAudioInterface(audioIO.data()); | |
| 1761 | − connect(audioIO.data(), &AudioClient::noiseGateOpened, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateOpened); | |
| 1762 | − connect(audioIO.data(), &AudioClient::noiseGateClosed, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateClosed); | |
| 1763 | − connect(audioIO.data(), &AudioClient::inputReceived, audioScriptingInterface.data(), &AudioScriptingInterface::inputReceived); | |
| 1764 | + { | |
| 1765 | + auto audioIO = DependencyManager::get<AudioClient>().data(); | |
| 1766 | + // set the local loopback interface for local sounds | |
| 1767 | + AudioInjector::setLocalAudioInterface(audioIO); | |
| 1768 | + auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>(); | |
| 1769 | + audioScriptingInterface->setLocalAudioInterface(audioIO); | |
| 1770 | + connect(audioIO, &AudioClient::noiseGateOpened, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateOpened); | |
| 1771 | + connect(audioIO, &AudioClient::noiseGateClosed, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateClosed); | |
| 1772 | + connect(audioIO, &AudioClient::inputReceived, audioScriptingInterface.data(), &AudioScriptingInterface::inputReceived); | |
| 1773 | + } | |
| 1764 | 1774 | |
| 1765 | 1775 | this->installEventFilter(this); |
| 1766 | 1776 | |
| @@ -2174,11 +2184,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 407 unmodified lines | ||
| 2174 | 2184 | QVariant testProperty = property(hifi::properties::TEST); |
| 2175 | 2185 | qDebug() << testProperty; |
| 2176 | 2186 | if (testProperty.isValid()) { |
| 2177 | − auto scriptEngines = DependencyManager::get<ScriptEngines>(); | |
| 2178 | 2187 | const auto testScript = property(hifi::properties::TEST).toUrl(); |
| 2179 | 2188 | |
| 2180 | 2189 | // Set last parameter to exit interface when the test script finishes, if so requested |
| 2181 | − scriptEngines->loadScript(testScript, false, false, false, false, quitWhenFinished); | |
| 2190 | + DependencyManager::get<ScriptEngines>()->loadScript(testScript, false, false, false, false, quitWhenFinished); | |
| 2182 | 2191 | |
| 2183 | 2192 | // This is done so we don't get a "connection time-out" message when we haven't passed in a URL. |
| 2184 | 2193 | if (arguments().contains("--url")) { |
| @@ -2456,6 +2465,15 @@ void Application::cleanupBeforeQuit() { · 271 unmodified lines | ||
| 2456 | 2465 | // Clear any queued processing (I/O, FBX/OBJ/Texture parsing) |
| 2457 | 2466 | QThreadPool::globalInstance()->clear(); |
| 2458 | 2467 | |
| 2468 | + // These classes hold ScriptEnginePointers, so they must be destroyed before ScriptEngines | |
| 2469 | + { | |
| 2470 | + DependencyManager::destroy<RecordingScriptingInterface>(); | |
| 2471 | + DependencyManager::destroy<StandAloneJSConsole>(); | |
| 2472 | + EntityTreePointer tree = getEntities()->getTree(); | |
| 2473 | + tree->setSimulation(nullptr); | |
| 2474 | + DependencyManager::destroy<EntityTreeRenderer>(); | |
| 2475 | + } | |
| 2476 | + | |
| 2459 | 2477 | DependencyManager::get<ScriptEngines>()->shutdownScripting(); // stop all currently running global scripts |
| 2460 | 2478 | DependencyManager::destroy<ScriptEngines>(); |
| 2461 | 2479 | |
| @@ -2493,6 +2511,8 @@ void Application::cleanupBeforeQuit() { · 31 unmodified lines | ||
| 2493 | 2511 | DependencyManager::destroy<EyeTracker>(); |
| 2494 | 2512 | #endif |
| 2495 | 2513 | |
| 2514 | + DependencyManager::destroy<ContextOverlayInterface>(); // Must be destroyed before TabletScriptingInterface | |
| 2515 | + | |
| 2496 | 2516 | // stop QML |
| 2497 | 2517 | DependencyManager::destroy<TabletScriptingInterface>(); |
| 2498 | 2518 | DependencyManager::destroy<ToolbarScriptingInterface>(); |
| @@ -2504,10 +2524,6 @@ void Application::cleanupBeforeQuit() { · 5 unmodified lines | ||
| 2504 | 2524 | _snapshotSoundInjector->stop(); |
| 2505 | 2525 | } |
| 2506 | 2526 | |
| 2507 | − // FIXME: something else is holding a reference to AudioClient, | |
| 2508 | − // so it must be explicitly synchronously stopped here | |
| 2509 | − DependencyManager::get<AudioClient>()->cleanupBeforeQuit(); | |
| 2510 | − | |
| 2511 | 2527 | // destroy Audio so it and its threads have a chance to go down safely |
| 2512 | 2528 | // this must happen after QML, as there are unexplained audio crashes originating in qtwebengine |
| 2513 | 2529 | DependencyManager::destroy<AudioClient>(); |
| @@ -2547,9 +2563,6 @@ Application::~Application() { · 33 unmodified lines | ||
| 2547 | 2563 | _entityClipboard->eraseAllOctreeElements(); |
| 2548 | 2564 | _entityClipboard.reset(); |
| 2549 | 2565 | |
| 2550 | − EntityTreePointer tree = getEntities()->getTree(); | |
| 2551 | − tree->setSimulation(nullptr); | |
| 2552 | − | |
| 2553 | 2566 | _octreeProcessor.terminate(); |
| 2554 | 2567 | _entityEditSender.terminate(); |
| 2555 | 2568 | |
| @@ -3239,8 +3252,7 @@ void Application::showHelp() { · 683 unmodified lines | ||
| 3239 | 3252 | QUrlQuery queryString; |
| 3240 | 3253 | queryString.addQueryItem("handControllerName", handControllerName); |
| 3241 | 3254 | queryString.addQueryItem("defaultTab", defaultTab); |
| 3242 | − auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 3243 | − TabletProxy* tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET)); | |
| 3255 | + TabletProxy* tablet = dynamic_cast<TabletProxy*>(DependencyManager::get<TabletScriptingInterface>()->getTablet(SYSTEM_TABLET)); | |
| 3244 | 3256 | tablet->gotoWebScreen(PathUtils::resourcesUrl() + INFO_HELP_PATH + "?" + queryString.toString()); |
| 3245 | 3257 | DependencyManager::get<HMDScriptingInterface>()->openTablet(); |
| 3246 | 3258 | //InfoView::show(INFO_HELP_PATH, false, queryString.toString()); |
| @@ -3545,6 +3557,10 @@ static void dumpEventQueue(QThread* thread) { · 298 unmodified lines | ||
| 3545 | 3557 | |
| 3546 | 3558 | bool Application::event(QEvent* event) { |
| 3547 | 3559 | |
| 3560 | + if (_aboutToQuit) { | |
| 3561 | + return false; | |
| 3562 | + } | |
| 3563 | + | |
| 3548 | 3564 | if (!Menu::getInstance()) { |
| 3549 | 3565 | return false; |
| 3550 | 3566 | } |
| @@ -3937,10 +3953,6 @@ void Application::maybeToggleMenuVisible(QMouseEvent* event) const { · 386 unmodified lines | ||
| 3937 | 3953 | void Application::mouseMoveEvent(QMouseEvent* event) { |
| 3938 | 3954 | PROFILE_RANGE(app_input_mouse, __FUNCTION__); |
| 3939 | 3955 | |
| 3940 | − if (_aboutToQuit) { | |
| 3941 | − return; | |
| 3942 | − } | |
| 3943 | − | |
| 3944 | 3956 | maybeToggleMenuVisible(event); |
| 3945 | 3957 | |
| 3946 | 3958 | auto& compositor = getApplicationCompositor(); |
| @@ -4005,11 +4017,9 @@ void Application::mousePressEvent(QMouseEvent* event) { · 58 unmodified lines | ||
| 4005 | 4017 | event->screenPos(), event->button(), |
| 4006 | 4018 | event->buttons(), event->modifiers()); |
| 4007 | 4019 | |
| 4008 | − if (!_aboutToQuit) { | |
| 4009 | − getOverlays().mousePressEvent(&mappedEvent); | |
| 4010 | − if (!_controllerScriptingInterface->areEntityClicksCaptured()) { | |
| 4011 | − getEntities()->mousePressEvent(&mappedEvent); | |
| 4012 | − } | |
| 4020 | + getOverlays().mousePressEvent(&mappedEvent); | |
| 4021 | + if (!_controllerScriptingInterface->areEntityClicksCaptured()) { | |
| 4022 | + getEntities()->mousePressEvent(&mappedEvent); | |
| 4013 | 4023 | } |
| 4014 | 4024 | |
| 4015 | 4025 | _controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts |
| @@ -4035,14 +4045,11 @@ void Application::mouseDoublePressEvent(QMouseEvent* event) { · 19 unmodified lines | ||
| 4035 | 4045 | event->screenPos(), event->button(), |
| 4036 | 4046 | event->buttons(), event->modifiers()); |
| 4037 | 4047 | |
| 4038 | − if (!_aboutToQuit) { | |
| 4039 | − getOverlays().mouseDoublePressEvent(&mappedEvent); | |
| 4040 | − if (!_controllerScriptingInterface->areEntityClicksCaptured()) { | |
| 4041 | − getEntities()->mouseDoublePressEvent(&mappedEvent); | |
| 4042 | − } | |
| 4048 | + getOverlays().mouseDoublePressEvent(&mappedEvent); | |
| 4049 | + if (!_controllerScriptingInterface->areEntityClicksCaptured()) { | |
| 4050 | + getEntities()->mouseDoublePressEvent(&mappedEvent); | |
| 4043 | 4051 | } |
| 4044 | 4052 | |
| 4045 | − | |
| 4046 | 4053 | // if one of our scripts have asked to capture this event, then stop processing it |
| 4047 | 4054 | if (_controllerScriptingInterface->isMouseCaptured()) { |
| 4048 | 4055 | return; |
| @@ -4061,10 +4068,8 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 12 unmodified lines | ||
| 4061 | 4068 | event->screenPos(), event->button(), |
| 4062 | 4069 | event->buttons(), event->modifiers()); |
| 4063 | 4070 | |
| 4064 | − if (!_aboutToQuit) { | |
| 4065 | − getOverlays().mouseReleaseEvent(&mappedEvent); | |
| 4066 | − getEntities()->mouseReleaseEvent(&mappedEvent); | |
| 4067 | − } | |
| 4071 | + getOverlays().mouseReleaseEvent(&mappedEvent); | |
| 4072 | + getEntities()->mouseReleaseEvent(&mappedEvent); | |
| 4068 | 4073 | |
| 4069 | 4074 | _controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts |
| 4070 | 4075 | |
| @@ -4215,7 +4220,6 @@ bool Application::shouldPaint() const { · 144 unmodified lines | ||
| 4215 | 4220 | return false; |
| 4216 | 4221 | } |
| 4217 | 4222 | |
| 4218 | − | |
| 4219 | 4223 | auto displayPlugin = getActiveDisplayPlugin(); |
| 4220 | 4224 | |
| 4221 | 4225 | #ifdef DEBUG_PAINT_DELAY |
| @@ -5439,6 +5443,10 @@ static bool domainLoadingInProgress = false; · 1217 unmodified lines | ||
| 5439 | 5443 | void Application::update(float deltaTime) { |
| 5440 | 5444 | PROFILE_RANGE_EX(app, __FUNCTION__, 0xffff0000, (uint64_t)_renderFrameCount + 1); |
| 5441 | 5445 | |
| 5446 | + if (_aboutToQuit) { | |
| 5447 | + return; | |
| 5448 | + } | |
| 5449 | + | |
| 5442 | 5450 | if (!_physicsEnabled) { |
| 5443 | 5451 | if (!domainLoadingInProgress) { |
| 5444 | 5452 | PROFILE_ASYNC_BEGIN(app, "Scene Loading", ""); |
| @@ -5705,15 +5713,13 @@ void Application::update(float deltaTime) { · 260 unmodified lines | ||
| 5705 | 5713 | _entitySimulation->handleDeactivatedMotionStates(deactivations); |
| 5706 | 5714 | }); |
| 5707 | 5715 | |
| 5708 | − if (!_aboutToQuit) { | |
| 5709 | − // handleCollisionEvents() AFTER handleChangedMotionStates() | |
| 5710 | − { | |
| 5711 | − PROFILE_RANGE(simulation_physics, "CollisionEvents"); | |
| 5712 | − avatarManager->handleCollisionEvents(collisionEvents); | |
| 5713 | − // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk | |
| 5714 | − // deadlock.) | |
| 5715 | − _entitySimulation->handleCollisionEvents(collisionEvents); | |
| 5716 | − } | |
| 5716 | + // handleCollisionEvents() AFTER handleChangedMotionStates() | |
| 5717 | + { | |
| 5718 | + PROFILE_RANGE(simulation_physics, "CollisionEvents"); | |
| 5719 | + avatarManager->handleCollisionEvents(collisionEvents); | |
| 5720 | + // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk | |
| 5721 | + // deadlock.) | |
| 5722 | + _entitySimulation->handleCollisionEvents(collisionEvents); | |
| 5717 | 5723 | } |
| 5718 | 5724 | |
| 5719 | 5725 | { |
| @@ -5731,11 +5737,9 @@ void Application::update(float deltaTime) { · 11 unmodified lines | ||
| 5731 | 5737 | } |
| 5732 | 5738 | auto t4 = std::chrono::high_resolution_clock::now(); |
| 5733 | 5739 | |
| 5734 | − if (!_aboutToQuit) { | |
| 5735 | − // NOTE: the getEntities()->update() call below will wait for lock | |
| 5736 | − // and will provide non-physical entity motion | |
| 5737 | − getEntities()->update(true); // update the models... | |
| 5738 | − } | |
| 5740 | + // NOTE: the getEntities()->update() call below will wait for lock | |
| 5741 | + // and will provide non-physical entity motion | |
| 5742 | + getEntities()->update(true); // update the models... | |
| 5739 | 5743 | |
| 5740 | 5744 | auto t5 = std::chrono::high_resolution_clock::now(); |
| 5741 | 5745 | |
| @@ -6639,16 +6643,12 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 897 unmodified lines | ||
| 6639 | 6643 | DependencyManager::get<PickScriptingInterface>()->registerMetaTypes(scriptEngine.data()); |
| 6640 | 6644 | |
| 6641 | 6645 | // connect this script engines printedMessage signal to the global ScriptEngines these various messages |
| 6642 | − connect(scriptEngine.data(), &ScriptEngine::printedMessage, | |
| 6643 | − DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onPrintedMessage); | |
| 6644 | − connect(scriptEngine.data(), &ScriptEngine::errorMessage, | |
| 6645 | − DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onErrorMessage); | |
| 6646 | − connect(scriptEngine.data(), &ScriptEngine::warningMessage, | |
| 6647 | − DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onWarningMessage); | |
| 6648 | − connect(scriptEngine.data(), &ScriptEngine::infoMessage, | |
| 6649 | − DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onInfoMessage); | |
| 6650 | − connect(scriptEngine.data(), &ScriptEngine::clearDebugWindow, | |
| 6651 | − DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onClearDebugWindow); | |
| 6646 | + auto scriptEngines = DependencyManager::get<ScriptEngines>().data(); | |
| 6647 | + connect(scriptEngine.data(), &ScriptEngine::printedMessage, scriptEngines, &ScriptEngines::onPrintedMessage); | |
| 6648 | + connect(scriptEngine.data(), &ScriptEngine::errorMessage, scriptEngines, &ScriptEngines::onErrorMessage); | |
| 6649 | + connect(scriptEngine.data(), &ScriptEngine::warningMessage, scriptEngines, &ScriptEngines::onWarningMessage); | |
| 6650 | + connect(scriptEngine.data(), &ScriptEngine::infoMessage, scriptEngines, &ScriptEngines::onInfoMessage); | |
| 6651 | + connect(scriptEngine.data(), &ScriptEngine::clearDebugWindow, scriptEngines, &ScriptEngines::onClearDebugWindow); | |
| 6652 | 6652 | |
| 6653 | 6653 | } |
| 6654 | 6654 | |
| @@ -6956,10 +6956,9 @@ void Application::showDialog(const QUrl& widgetUrl, const QUrl& tabletUrl, const · 301 unmodified lines | ||
| 6956 | 6956 | } |
| 6957 | 6957 | |
| 6958 | 6958 | void Application::showScriptLogs() { |
| 6959 | − auto scriptEngines = DependencyManager::get<ScriptEngines>(); | |
| 6960 | 6959 | QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation(); |
| 6961 | 6960 | defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "developer/debugging/debugWindow.js"); |
| 6962 | − scriptEngines->loadScript(defaultScriptsLoc.toString()); | |
| 6961 | + DependencyManager::get<ScriptEngines>()->loadScript(defaultScriptsLoc.toString()); | |
| 6963 | 6962 | } |
| 6964 | 6963 | |
| 6965 | 6964 | void Application::showAssetServerWidget(QString filePath) { |
| @@ -7523,7 +7522,6 @@ void Application::openUrl(const QUrl& url) const { · 557 unmodified lines | ||
| 7523 | 7522 | } |
| 7524 | 7523 | |
| 7525 | 7524 | void Application::loadDialog() { |
| 7526 | − auto scriptEngines = DependencyManager::get<ScriptEngines>(); | |
| 7527 | 7525 | ModalDialogListener* dlg = OffscreenUi::getOpenFileNameAsync(_glWidget, tr("Open Script"), |
| 7528 | 7526 | getPreviousScriptLocation(), |
| 7529 | 7527 | tr("JavaScript Files (*.js)")); |