Showing the changes to interface/src/Application.cpp (1 of 406 files). Show all
Unified · Split
| @@ -37,8 +37,6 @@ · 36 unmodified lines | |||
| 37 | #include <QtQml/QQmlEngine> | 37 | #include <QtQml/QQmlEngine> |
| 38 | #include <QtQuick/QQuickWindow> | 38 | #include <QtQuick/QQuickWindow> |
| 39 | 39 | ||
| 40 | #include <QtWebEngineWidgets/QWebEngineProfile> | ||
| 41 | |||
| 42 | #include <QtWidgets/QDesktopWidget> | 40 | #include <QtWidgets/QDesktopWidget> |
| 43 | #include <QtWidgets/QMessageBox> | 41 | #include <QtWidgets/QMessageBox> |
| 44 | 42 | ||
| @@ -88,6 +86,7 @@ · 43 unmodified lines | |||
| 88 | #include <UserActivityLoggerScriptingInterface.h> | 86 | #include <UserActivityLoggerScriptingInterface.h> |
| 89 | #include <LogHandler.h> | 87 | #include <LogHandler.h> |
| 90 | #include "LocationBookmarks.h" | 88 | #include "LocationBookmarks.h" |
| 89 | #include <LocationScriptingInterface.h> | ||
| 91 | #include <MainWindow.h> | 90 | #include <MainWindow.h> |
| 92 | #include <MappingRequest.h> | 91 | #include <MappingRequest.h> |
| 93 | #include <MessagesClient.h> | 92 | #include <MessagesClient.h> |
| @@ -98,8 +97,8 @@ · 4 unmodified lines | |||
| 98 | #include <OctalCode.h> | 97 | #include <OctalCode.h> |
| 99 | #include <OctreeSceneStats.h> | 98 | #include <OctreeSceneStats.h> |
| 100 | #include <OffscreenUi.h> | 99 | #include <OffscreenUi.h> |
| 101 | #include <gl/OffscreenQmlSurfaceCache.h> | ||
| 102 | #include <gl/OffscreenGLCanvas.h> | 100 | #include <gl/OffscreenGLCanvas.h> |
| 101 | #include <ui/OffscreenQmlSurfaceCache.h> | ||
| 103 | #include <PathUtils.h> | 102 | #include <PathUtils.h> |
| 104 | #include <PerfStat.h> | 103 | #include <PerfStat.h> |
| 105 | #include <PhysicsEngine.h> | 104 | #include <PhysicsEngine.h> |
| @@ -108,6 +107,7 @@ · 2 unmodified lines | |||
| 108 | #include <plugins/PluginManager.h> | 107 | #include <plugins/PluginManager.h> |
| 109 | #include <plugins/PluginUtils.h> | 108 | #include <plugins/PluginUtils.h> |
| 110 | #include <plugins/SteamClientPlugin.h> | 109 | #include <plugins/SteamClientPlugin.h> |
| 110 | #include <plugins/InputConfiguration.h> | ||
| 111 | #include <RecordingScriptingInterface.h> | 111 | #include <RecordingScriptingInterface.h> |
| 112 | #include <RenderableWebEntityItem.h> | 112 | #include <RenderableWebEntityItem.h> |
| 113 | #include <RenderShadowTask.h> | 113 | #include <RenderShadowTask.h> |
| @@ -123,7 +123,8 @@ · 9 unmodified lines | |||
| 123 | #include <ScriptEngines.h> | 123 | #include <ScriptEngines.h> |
| 124 | #include <ScriptCache.h> | 124 | #include <ScriptCache.h> |
| 125 | #include <SoundCache.h> | 125 | #include <SoundCache.h> |
| 126 | #include <TabletScriptingInterface.h> | 126 | #include <ui/TabletScriptingInterface.h> |
| 127 | #include <ui/ToolbarScriptingInterface.h> | ||
| 127 | #include <Tooltip.h> | 128 | #include <Tooltip.h> |
| 128 | #include <udt/PacketHeaders.h> | 129 | #include <udt/PacketHeaders.h> |
| 129 | #include <UserActivityLogger.h> | 130 | #include <UserActivityLogger.h> |
| @@ -160,12 +161,10 @@ · 30 unmodified lines | |||
| 160 | #include "scripting/DesktopScriptingInterface.h" | 161 | #include "scripting/DesktopScriptingInterface.h" |
| 161 | #include "scripting/GlobalServicesScriptingInterface.h" | 162 | #include "scripting/GlobalServicesScriptingInterface.h" |
| 162 | #include "scripting/HMDScriptingInterface.h" | 163 | #include "scripting/HMDScriptingInterface.h" |
| 163 | #include "scripting/LocationScriptingInterface.h" | ||
| 164 | #include "scripting/MenuScriptingInterface.h" | 164 | #include "scripting/MenuScriptingInterface.h" |
| 165 | #include "scripting/SettingsScriptingInterface.h" | 165 | #include "scripting/SettingsScriptingInterface.h" |
| 166 | #include "scripting/WindowScriptingInterface.h" | 166 | #include "scripting/WindowScriptingInterface.h" |
| 167 | #include "scripting/ControllerScriptingInterface.h" | 167 | #include "scripting/ControllerScriptingInterface.h" |
| 168 | #include "scripting/ToolbarScriptingInterface.h" | ||
| 169 | #include "scripting/RatesScriptingInterface.h" | 168 | #include "scripting/RatesScriptingInterface.h" |
| 170 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) | 169 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) |
| 171 | #include "SpeechRecognizer.h" | 170 | #include "SpeechRecognizer.h" |
| @@ -441,8 +440,41 @@ static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement"; · 269 unmodified lines | |||
| 441 | static const QString STATE_GROUNDED = "Grounded"; | 440 | static const QString STATE_GROUNDED = "Grounded"; |
| 442 | static const QString STATE_NAV_FOCUSED = "NavigationFocused"; | 441 | static const QString STATE_NAV_FOCUSED = "NavigationFocused"; |
| 443 | 442 | ||
| 443 | // Statically provided display and input plugins | ||
| 444 | extern DisplayPluginList getDisplayPlugins(); | ||
| 445 | extern InputPluginList getInputPlugins(); | ||
| 446 | extern void saveInputPluginSettings(const InputPluginList& plugins); | ||
| 447 | |||
| 444 | bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { | 448 | bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { |
| 445 | const char** constArgv = const_cast<const char**>(argv); | 449 | const char** constArgv = const_cast<const char**>(argv); |
| 450 | |||
| 451 | // HRS: I could not figure out how to move these any earlier in startup, so when using this option, be sure to also supply | ||
| 452 | // --allowMultipleInstances | ||
| 453 | auto reportAndQuit = [&](const char* commandSwitch, std::function<void(FILE* fp)> report) { | ||
| 454 | const char* reportfile = getCmdOption(argc, constArgv, commandSwitch); | ||
| 455 | // Reports to the specified file, because stdout is set up to be captured for logging. | ||
| 456 | if (reportfile) { | ||
| 457 | FILE* fp = fopen(reportfile, "w"); | ||
| 458 | if (fp) { | ||
| 459 | report(fp); | ||
| 460 | fclose(fp); | ||
| 461 | if (!runningMarkerExisted) { // don't leave ours around | ||
| 462 | RunningMarker runingMarker(RUNNING_MARKER_FILENAME); | ||
| 463 | runingMarker.deleteRunningMarkerFile(); // happens in deleter, but making the side-effect explicit. | ||
| 464 | } | ||
| 465 | _exit(0); | ||
| 466 | } | ||
| 467 | } | ||
| 468 | }; | ||
| 469 | reportAndQuit("--protocolVersion", [&](FILE* fp) { | ||
| 470 | DependencyManager::set<AddressManager>(); | ||
| 471 | auto version = DependencyManager::get<AddressManager>()->protocolVersion(); | ||
| 472 | fputs(version.toLatin1().data(), fp); | ||
| 473 | }); | ||
| 474 | reportAndQuit("--version", [&](FILE* fp) { | ||
| 475 | fputs(BuildInfo::VERSION.toLatin1().data(), fp); | ||
| 476 | }); | ||
| 477 | |||
| 446 | const char* portStr = getCmdOption(argc, constArgv, "--listenPort"); | 478 | const char* portStr = getCmdOption(argc, constArgv, "--listenPort"); |
| 447 | const int listenPort = portStr ? atoi(portStr) : INVALID_PORT; | 479 | const int listenPort = portStr ? atoi(portStr) : INVALID_PORT; |
| 448 | 480 | ||
| @@ -452,7 +484,12 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 3 unmodified lines | |||
| 452 | 484 | ||
| 453 | Setting::init(); | 485 | Setting::init(); |
| 454 | 486 | ||
| 455 | if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) { | 487 | // Tell the plugin manager about our statically linked plugins |
| 488 | auto pluginManager = PluginManager::getInstance(); | ||
| 489 | pluginManager->setInputPluginProvider([] { return getInputPlugins(); }); | ||
| 490 | pluginManager->setDisplayPluginProvider([] { return getDisplayPlugins(); }); | ||
| 491 | pluginManager->setInputPluginSettingsPersister([](const InputPluginList& plugins) { saveInputPluginSettings(plugins); }); | ||
| 492 | if (auto steamClient = pluginManager->getSteamClientPlugin()) { | ||
| 456 | steamClient->init(); | 493 | steamClient->init(); |
| 457 | } | 494 | } |
| 458 | 495 | ||
| @@ -512,6 +549,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 53 unmodified lines | |||
| 512 | DependencyManager::set<HMDScriptingInterface>(); | 549 | DependencyManager::set<HMDScriptingInterface>(); |
| 513 | DependencyManager::set<ResourceScriptingInterface>(); | 550 | DependencyManager::set<ResourceScriptingInterface>(); |
| 514 | DependencyManager::set<TabletScriptingInterface>(); | 551 | DependencyManager::set<TabletScriptingInterface>(); |
| 552 | DependencyManager::set<InputConfiguration>(); | ||
| 515 | DependencyManager::set<ToolbarScriptingInterface>(); | 553 | DependencyManager::set<ToolbarScriptingInterface>(); |
| 516 | DependencyManager::set<UserActivityLoggerScriptingInterface>(); | 554 | DependencyManager::set<UserActivityLoggerScriptingInterface>(); |
| 517 | DependencyManager::set<AssetMappingsScriptingInterface>(); | 555 | DependencyManager::set<AssetMappingsScriptingInterface>(); |
| @@ -582,7 +620,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 64 unmodified lines | |||
| 582 | _undoStackScriptingInterface(&_undoStack), | 620 | _undoStackScriptingInterface(&_undoStack), |
| 583 | _entitySimulation(new PhysicalEntitySimulation()), | 621 | _entitySimulation(new PhysicalEntitySimulation()), |
| 584 | _physicsEngine(new PhysicsEngine(Vectors::ZERO)), | 622 | _physicsEngine(new PhysicsEngine(Vectors::ZERO)), |
| 585 | _entityClipboardRenderer(false, this, this), | ||
| 586 | _entityClipboard(new EntityTree()), | 623 | _entityClipboard(new EntityTree()), |
| 587 | _lastQueriedTime(usecTimestampNow()), | 624 | _lastQueriedTime(usecTimestampNow()), |
| 588 | _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION), | 625 | _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION), |
| @@ -685,9 +722,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 96 unmodified lines | |||
| 685 | updateHeartbeat(); | 722 | updateHeartbeat(); |
| 686 | 723 | ||
| 687 | // setup a timer for domain-server check ins | 724 | // setup a timer for domain-server check ins |
| 688 | QTimer* domainCheckInTimer = new QTimer(nodeList.data()); | 725 | QTimer* domainCheckInTimer = new QTimer(this); |
| 689 | connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn); | 726 | connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn); |
| 690 | domainCheckInTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS); | 727 | domainCheckInTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS); |
| 728 | connect(this, &QCoreApplication::aboutToQuit, [domainCheckInTimer] { | ||
| 729 | domainCheckInTimer->stop(); | ||
| 730 | domainCheckInTimer->deleteLater(); | ||
| 731 | }); | ||
| 691 | 732 | ||
| 692 | 733 | ||
| 693 | auto audioIO = DependencyManager::get<AudioClient>(); | 734 | auto audioIO = DependencyManager::get<AudioClient>(); |
| @@ -861,6 +902,25 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 167 unmodified lines | |||
| 861 | } | 902 | } |
| 862 | ResourceCache::setRequestLimit(concurrentDownloads); | 903 | ResourceCache::setRequestLimit(concurrentDownloads); |
| 863 | 904 | ||
| 905 | // perhaps override the avatar url. Since we will test later for validity | ||
| 906 | // we don't need to do so here. | ||
| 907 | QString avatarURL = getCmdOption(argc, constArgv, "--avatarURL"); | ||
| 908 | _avatarOverrideUrl = QUrl::fromUserInput(avatarURL); | ||
| 909 | |||
| 910 | // If someone specifies both --avatarURL and --replaceAvatarURL, | ||
| 911 | // the replaceAvatarURL wins. So only set the _overrideUrl if this | ||
| 912 | // does have a non-empty string. | ||
| 913 | QString replaceURL = getCmdOption(argc, constArgv, "--replaceAvatarURL"); | ||
| 914 | if (!replaceURL.isEmpty()) { | ||
| 915 | _avatarOverrideUrl = QUrl::fromUserInput(replaceURL); | ||
| 916 | _saveAvatarOverrideUrl = true; | ||
| 917 | } | ||
| 918 | |||
| 919 | QString defaultScriptsLocation = getCmdOption(argc, constArgv, "--scripts"); | ||
| 920 | if (!defaultScriptsLocation.isEmpty()) { | ||
| 921 | PathUtils::defaultScriptsLocation(defaultScriptsLocation); | ||
| 922 | } | ||
| 923 | |||
| 864 | _glWidget = new GLCanvas(); | 924 | _glWidget = new GLCanvas(); |
| 865 | getApplicationCompositor().setRenderingWidget(_glWidget); | 925 | getApplicationCompositor().setRenderingWidget(_glWidget); |
| 866 | _window->setCentralWidget(_glWidget); | 926 | _window->setCentralWidget(_glWidget); |
| @@ -957,7 +1017,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 90 unmodified lines | |||
| 957 | // Make sure we don't time out during slow operations at startup | 1017 | // Make sure we don't time out during slow operations at startup |
| 958 | updateHeartbeat(); | 1018 | updateHeartbeat(); |
| 959 | 1019 | ||
| 960 | connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit())); | 1020 | connect(this, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); |
| 961 | 1021 | ||
| 962 | // hook up bandwidth estimator | 1022 | // hook up bandwidth estimator |
| 963 | QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>(); | 1023 | QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>(); |
| @@ -1125,7 +1185,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 161 unmodified lines | |||
| 1125 | // force the model the look at the correct directory (weird order of operations issue) | 1185 | // force the model the look at the correct directory (weird order of operations issue) |
| 1126 | scriptEngines->setScriptsLocation(scriptEngines->getScriptsLocation()); | 1186 | scriptEngines->setScriptsLocation(scriptEngines->getScriptsLocation()); |
| 1127 | // do this as late as possible so that all required subsystems are initialized | 1187 | // do this as late as possible so that all required subsystems are initialized |
| 1128 | scriptEngines->loadScripts(); | 1188 | // If we've overridden the default scripts location, just load default scripts |
| 1189 | // otherwise, load 'em all | ||
| 1190 | if (!defaultScriptsLocation.isEmpty()) { | ||
| 1191 | scriptEngines->loadDefaultScripts(); | ||
| 1192 | scriptEngines->defaultScriptsLocationOverridden(true); | ||
| 1193 | } else { | ||
| 1194 | scriptEngines->loadScripts(); | ||
| 1195 | } | ||
| 1196 | |||
| 1129 | // Make sure we don't time out during slow operations at startup | 1197 | // Make sure we don't time out during slow operations at startup |
| 1130 | updateHeartbeat(); | 1198 | updateHeartbeat(); |
| 1131 | 1199 | ||
| @@ -1451,7 +1519,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 319 unmodified lines | |||
| 1451 | }); | 1519 | }); |
| 1452 | sendStatsTimer->start(); | 1520 | sendStatsTimer->start(); |
| 1453 | 1521 | ||
| 1454 | |||
| 1455 | // Periodically check for count of nearby avatars | 1522 | // Periodically check for count of nearby avatars |
| 1456 | static int lastCountOfNearbyAvatars = -1; | 1523 | static int lastCountOfNearbyAvatars = -1; |
| 1457 | QTimer* checkNearbyAvatarsTimer = new QTimer(this); | 1524 | QTimer* checkNearbyAvatarsTimer = new QTimer(this); |
| @@ -1646,7 +1713,7 @@ void Application::updateHeartbeat() const { · 188 unmodified lines | |||
| 1646 | static_cast<DeadlockWatchdogThread*>(_deadlockWatchdogThread)->updateHeartbeat(); | 1713 | static_cast<DeadlockWatchdogThread*>(_deadlockWatchdogThread)->updateHeartbeat(); |
| 1647 | } | 1714 | } |
| 1648 | 1715 | ||
| 1649 | void Application::aboutToQuit() { | 1716 | void Application::onAboutToQuit() { |
| 1650 | emit beforeAboutToQuit(); | 1717 | emit beforeAboutToQuit(); |
| 1651 | 1718 | ||
| 1652 | foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) { | 1719 | foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) { |
| @@ -1751,6 +1818,8 @@ void Application::cleanupBeforeQuit() { · 98 unmodified lines | |||
| 1751 | #endif | 1818 | #endif |
| 1752 | 1819 | ||
| 1753 | // stop QML | 1820 | // stop QML |
| 1821 | DependencyManager::destroy<TabletScriptingInterface>(); | ||
| 1822 | DependencyManager::destroy<ToolbarScriptingInterface>(); | ||
| 1754 | DependencyManager::destroy<OffscreenUi>(); | 1823 | DependencyManager::destroy<OffscreenUi>(); |
| 1755 | 1824 | ||
| 1756 | DependencyManager::destroy<OffscreenQmlSurfaceCache>(); | 1825 | DependencyManager::destroy<OffscreenQmlSurfaceCache>(); |
| @@ -2001,6 +2070,7 @@ void Application::initializeUi() { · 244 unmodified lines | |||
| 2001 | surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data()); | 2070 | surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data()); |
| 2002 | surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data()); | 2071 | surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data()); |
| 2003 | surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data()); | 2072 | surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data()); |
| 2073 | surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data()); | ||
| 2004 | 2074 | ||
| 2005 | surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance()); | 2075 | surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance()); |
| 2006 | surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data()); | 2076 | surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data()); |
| @@ -2483,8 +2553,11 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { · 476 unmodified lines | |||
| 2483 | Setting::Handle<bool> tutorialComplete{ "tutorialComplete", false }; | 2553 | Setting::Handle<bool> tutorialComplete{ "tutorialComplete", false }; |
| 2484 | Setting::Handle<bool> firstRun{ Settings::firstRun, true }; | 2554 | Setting::Handle<bool> firstRun{ Settings::firstRun, true }; |
| 2485 | 2555 | ||
| 2556 | const QString HIFI_SKIP_TUTORIAL_COMMAND_LINE_KEY = "--skipTutorial"; | ||
| 2557 | // Skips tutorial/help behavior, and does NOT clear firstRun setting. | ||
| 2558 | bool skipTutorial = arguments().contains(HIFI_SKIP_TUTORIAL_COMMAND_LINE_KEY); | ||
| 2486 | bool isTutorialComplete = tutorialComplete.get(); | 2559 | bool isTutorialComplete = tutorialComplete.get(); |
| 2487 | bool shouldGoToTutorial = isUsingHMDAndHandControllers && hasTutorialContent && !isTutorialComplete; | 2560 | bool shouldGoToTutorial = isUsingHMDAndHandControllers && hasTutorialContent && !isTutorialComplete && !skipTutorial; |
| 2488 | 2561 | ||
| 2489 | qCDebug(interfaceapp) << "HMD:" << hasHMD << ", Hand Controllers: " << hasHandControllers << ", Using HMD: " << isUsingHMDAndHandControllers; | 2562 | qCDebug(interfaceapp) << "HMD:" << hasHMD << ", Hand Controllers: " << hasHandControllers << ", Using HMD: " << isUsingHMDAndHandControllers; |
| 2490 | qCDebug(interfaceapp) << "Tutorial version:" << contentVersion << ", sufficient:" << hasTutorialContent << | 2563 | qCDebug(interfaceapp) << "Tutorial version:" << contentVersion << ", sufficient:" << hasTutorialContent << |
| @@ -2527,14 +2600,9 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { · 36 unmodified lines | |||
| 2527 | } | 2600 | } |
| 2528 | } else { | 2601 | } else { |
| 2529 | 2602 | ||
| 2530 | bool isFirstRun = firstRun.get(); | ||
| 2531 | |||
| 2532 | if (isFirstRun) { | ||
| 2533 | showHelp(); | ||
| 2534 | } | ||
| 2535 | |||
| 2536 | // If this is a first run we short-circuit the address passed in | 2603 | // If this is a first run we short-circuit the address passed in |
| 2537 | if (isFirstRun) { | 2604 | if (firstRun.get() && !skipTutorial) { |
| 2605 | showHelp(); | ||
| 2538 | if (isUsingHMDAndHandControllers) { | 2606 | if (isUsingHMDAndHandControllers) { |
| 2539 | if (sandboxIsRunning) { | 2607 | if (sandboxIsRunning) { |
| 2540 | qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home."; | 2608 | qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home."; |
| @@ -2572,7 +2640,9 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { · 31 unmodified lines | |||
| 2572 | _connectionMonitor.init(); | 2640 | _connectionMonitor.init(); |
| 2573 | 2641 | ||
| 2574 | // After all of the constructor is completed, then set firstRun to false. | 2642 | // After all of the constructor is completed, then set firstRun to false. |
| 2575 | firstRun.set(false); | 2643 | if (!skipTutorial) { |
| 2644 | firstRun.set(false); | ||
| 2645 | } | ||
| 2576 | } | 2646 | } |
| 2577 | 2647 | ||
| 2578 | bool Application::importJSONFromURL(const QString& urlString) { | 2648 | bool Application::importJSONFromURL(const QString& urlString) { |
| @@ -3992,11 +4062,6 @@ void Application::init() { · 1413 unmodified lines | |||
| 3992 | DependencyManager::get<NodeList>()->sendDomainServerCheckIn(); | 4062 | DependencyManager::get<NodeList>()->sendDomainServerCheckIn(); |
| 3993 | 4063 | ||
| 3994 | getEntities()->init(); | 4064 | getEntities()->init(); |
| 3995 | { | ||
| 3996 | QMutexLocker viewLocker(&_viewMutex); | ||
| 3997 | getEntities()->setViewFrustum(_viewFrustum); | ||
| 3998 | } | ||
| 3999 | |||
| 4000 | getEntities()->setEntityLoadingPriorityFunction([this](const EntityItem& item) { | 4065 | getEntities()->setEntityLoadingPriorityFunction([this](const EntityItem& item) { |
| 4001 | auto dims = item.getDimensions(); | 4066 | auto dims = item.getDimensions(); |
| 4002 | auto maxSize = glm::compMax(dims); | 4067 | auto maxSize = glm::compMax(dims); |
| @@ -4026,13 +4091,6 @@ void Application::init() { · 23 unmodified lines | |||
| 4026 | // of events related clicking, hovering over, and entering entities | 4091 | // of events related clicking, hovering over, and entering entities |
| 4027 | getEntities()->connectSignalsToSlots(entityScriptingInterface.data()); | 4092 | getEntities()->connectSignalsToSlots(entityScriptingInterface.data()); |
| 4028 | 4093 | ||
| 4029 | _entityClipboardRenderer.init(); | ||
| 4030 | { | ||
| 4031 | QMutexLocker viewLocker(&_viewMutex); | ||
| 4032 | _entityClipboardRenderer.setViewFrustum(_viewFrustum); | ||
| 4033 | } | ||
| 4034 | _entityClipboardRenderer.setTree(_entityClipboard); | ||
| 4035 | |||
| 4036 | // Make sure any new sounds are loaded as soon as know about them. | 4094 | // Make sure any new sounds are loaded as soon as know about them. |
| 4037 | connect(tree.get(), &EntityTree::newCollisionSoundURL, this, [this](QUrl newURL, EntityItemID id) { | 4095 | connect(tree.get(), &EntityTree::newCollisionSoundURL, this, [this](QUrl newURL, EntityItemID id) { |
| 4038 | EntityTreePointer tree = getEntities()->getTree(); | 4096 | EntityTreePointer tree = getEntities()->getTree(); |
| @@ -5025,9 +5083,6 @@ QRect Application::getDesirableApplicationGeometry() const { · 986 unmodified lines | |||
| 5025 | return applicationGeometry; | 5083 | return applicationGeometry; |
| 5026 | } | 5084 | } |
| 5027 | 5085 | ||
| 5028 | // FIXME, preprocessor guard this check to occur only in DEBUG builds | ||
| 5029 | static QThread * activeRenderingThread = nullptr; | ||
| 5030 | |||
| 5031 | PickRay Application::computePickRay(float x, float y) const { | 5086 | PickRay Application::computePickRay(float x, float y) const { |
| 5032 | vec2 pickPoint { x, y }; | 5087 | vec2 pickPoint { x, y }; |
| 5033 | PickRay result; | 5088 | PickRay result; |
| @@ -5098,7 +5153,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 64 unmodified lines | |||
| 5098 | auto myAvatar = getMyAvatar(); | 5153 | auto myAvatar = getMyAvatar(); |
| 5099 | myAvatar->preDisplaySide(renderArgs); | 5154 | myAvatar->preDisplaySide(renderArgs); |
| 5100 | 5155 | ||
| 5101 | activeRenderingThread = QThread::currentThread(); | ||
| 5102 | PROFILE_RANGE(render, __FUNCTION__); | 5156 | PROFILE_RANGE(render, __FUNCTION__); |
| 5103 | PerformanceTimer perfTimer("display"); | 5157 | PerformanceTimer perfTimer("display"); |
| 5104 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()"); | 5158 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()"); |
| @@ -5171,8 +5225,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 66 unmodified lines | |||
| 5171 | // Before the deferred pass, let's try to use the render engine | 5225 | // Before the deferred pass, let's try to use the render engine |
| 5172 | _renderEngine->run(); | 5226 | _renderEngine->run(); |
| 5173 | } | 5227 | } |
| 5174 | |||
| 5175 | activeRenderingThread = nullptr; | ||
| 5176 | } | 5228 | } |
| 5177 | 5229 | ||
| 5178 | void Application::resetSensors(bool andReload) { | 5230 | void Application::resetSensors(bool andReload) { |
| @@ -5303,6 +5355,10 @@ void Application::nodeActivated(SharedNodePointer node) { · 124 unmodified lines | |||
| 5303 | if (node->getType() == NodeType::AvatarMixer) { | 5355 | if (node->getType() == NodeType::AvatarMixer) { |
| 5304 | // new avatar mixer, send off our identity packet on next update loop | 5356 | // new avatar mixer, send off our identity packet on next update loop |
| 5305 | // Reset skeletonModelUrl if the last server modified our choice. | 5357 | // Reset skeletonModelUrl if the last server modified our choice. |
| 5358 | // Override the avatar url (but not model name) here too. | ||
| 5359 | if (_avatarOverrideUrl.isValid()) { | ||
| 5360 | getMyAvatar()->useFullAvatarURL(_avatarOverrideUrl); | ||
| 5361 | } | ||
| 5306 | static const QUrl empty{}; | 5362 | static const QUrl empty{}; |
| 5307 | if (getMyAvatar()->getFullAvatarURLFromPreferences() != getMyAvatar()->cannonicalSkeletonModelURL(empty)) { | 5363 | if (getMyAvatar()->getFullAvatarURLFromPreferences() != getMyAvatar()->cannonicalSkeletonModelURL(empty)) { |
| 5308 | getMyAvatar()->resetFullAvatarURL(); | 5364 | getMyAvatar()->resetFullAvatarURL(); |
| @@ -5508,8 +5564,16 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 199 unmodified lines | |||
| 5508 | 5564 | ||
| 5509 | scriptEngine->registerGlobalObject("OffscreenFlags", DependencyManager::get<OffscreenUi>()->getFlags()); | 5565 | scriptEngine->registerGlobalObject("OffscreenFlags", DependencyManager::get<OffscreenUi>()->getFlags()); |
| 5510 | scriptEngine->registerGlobalObject("Desktop", DependencyManager::get<DesktopScriptingInterface>().data()); | 5566 | scriptEngine->registerGlobalObject("Desktop", DependencyManager::get<DesktopScriptingInterface>().data()); |
| 5567 | |||
| 5568 | qScriptRegisterMetaType(scriptEngine, wrapperToScriptValue<ToolbarProxy>, wrapperFromScriptValue<ToolbarProxy>); | ||
| 5569 | qScriptRegisterMetaType(scriptEngine, wrapperToScriptValue<ToolbarButtonProxy>, wrapperFromScriptValue<ToolbarButtonProxy>); | ||
| 5511 | scriptEngine->registerGlobalObject("Toolbars", DependencyManager::get<ToolbarScriptingInterface>().data()); | 5570 | scriptEngine->registerGlobalObject("Toolbars", DependencyManager::get<ToolbarScriptingInterface>().data()); |
| 5512 | 5571 | ||
| 5572 | qScriptRegisterMetaType(scriptEngine, wrapperToScriptValue<TabletProxy>, wrapperFromScriptValue<TabletProxy>); | ||
| 5573 | qScriptRegisterMetaType(scriptEngine, wrapperToScriptValue<TabletButtonProxy>, wrapperFromScriptValue<TabletButtonProxy>); | ||
| 5574 | scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data()); | ||
| 5575 | |||
| 5576 | |||
| 5513 | DependencyManager::get<TabletScriptingInterface>().data()->setToolbarScriptingInterface(DependencyManager::get<ToolbarScriptingInterface>().data()); | 5577 | DependencyManager::get<TabletScriptingInterface>().data()->setToolbarScriptingInterface(DependencyManager::get<ToolbarScriptingInterface>().data()); |
| 5514 | 5578 | ||
| 5515 | scriptEngine->registerGlobalObject("Window", DependencyManager::get<WindowScriptingInterface>().data()); | 5579 | scriptEngine->registerGlobalObject("Window", DependencyManager::get<WindowScriptingInterface>().data()); |
| @@ -5583,7 +5647,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 67 unmodified lines | |||
| 5583 | scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data()); | 5647 | scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data()); |
| 5584 | scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance()); | 5648 | scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance()); |
| 5585 | 5649 | ||
| 5586 | |||
| 5587 | qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue); | 5650 | qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue); |
| 5588 | 5651 | ||
| 5589 | // connect this script engines printedMessage signal to the global ScriptEngines these various messages | 5652 | // connect this script engines printedMessage signal to the global ScriptEngines these various messages |
| @@ -5591,6 +5654,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 1 unmodified line | |||
| 5591 | connect(scriptEngine, &ScriptEngine::errorMessage, DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onErrorMessage); | 5654 | connect(scriptEngine, &ScriptEngine::errorMessage, DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onErrorMessage); |
| 5592 | connect(scriptEngine, &ScriptEngine::warningMessage, DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onWarningMessage); | 5655 | connect(scriptEngine, &ScriptEngine::warningMessage, DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onWarningMessage); |
| 5593 | connect(scriptEngine, &ScriptEngine::infoMessage, DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onInfoMessage); | 5656 | connect(scriptEngine, &ScriptEngine::infoMessage, DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onInfoMessage); |
| 5657 | connect(scriptEngine, &ScriptEngine::clearDebugWindow, DependencyManager::get<ScriptEngines>().data(), &ScriptEngines::onClearDebugWindow); | ||
| 5658 | |||
| 5594 | } | 5659 | } |
| 5595 | 5660 | ||
| 5596 | bool Application::canAcceptURL(const QString& urlString) const { | 5661 | bool Application::canAcceptURL(const QString& urlString) const { |
| @@ -5827,7 +5892,7 @@ void Application::showDialog(const QUrl& widgetUrl, const QUrl& tabletUrl, const · 230 unmodified lines | |||
| 5827 | 5892 | ||
| 5828 | void Application::showScriptLogs() { | 5893 | void Application::showScriptLogs() { |
| 5829 | auto scriptEngines = DependencyManager::get<ScriptEngines>(); | 5894 | auto scriptEngines = DependencyManager::get<ScriptEngines>(); |
| 5830 | QUrl defaultScriptsLoc = defaultScriptsLocation(); | 5895 | QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation(); |
| 5831 | defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "developer/debugging/debugWindow.js"); | 5896 | defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "developer/debugging/debugWindow.js"); |
| 5832 | scriptEngines->loadScript(defaultScriptsLoc.toString()); | 5897 | scriptEngines->loadScript(defaultScriptsLoc.toString()); |
| 5833 | } | 5898 | } |
| @@ -7056,3 +7121,8 @@ QUuid Application::getTabletFrameID() const { · 1222 unmodified lines | |||
| 7056 | auto HMD = DependencyManager::get<HMDScriptingInterface>(); | 7121 | auto HMD = DependencyManager::get<HMDScriptingInterface>(); |
| 7057 | return HMD->getCurrentTabletFrameID(); | 7122 | return HMD->getCurrentTabletFrameID(); |
| 7058 | } | 7123 | } |
| 7124 | |||
| 7125 | void Application::setAvatarOverrideUrl(const QUrl& url, bool save) { | ||
| 7126 | _avatarOverrideUrl = url; | ||
| 7127 | _saveAvatarOverrideUrl = save; | ||
| 7128 | } | ||