Showing the changes to interface/src/Application.cpp (1 of 604 files). Show all
Unified · Split
| @@ -171,13 +171,17 @@ · 170 unmodified lines | ||
| 171 | 171 | #include "ui/Stats.h" |
| 172 | 172 | #include "ui/UpdateDialog.h" |
| 173 | 173 | #include "ui/overlays/Overlays.h" |
| 174 | +#include "ui/DomainConnectionModel.h" | |
| 174 | 175 | #include "Util.h" |
| 175 | 176 | #include "InterfaceParentFinder.h" |
| 177 | +#include "ui/OctreeStatsProvider.h" | |
| 176 | 178 | |
| 177 | 179 | #include "FrameTimingsScriptingInterface.h" |
| 178 | 180 | #include <GPUIdent.h> |
| 179 | 181 | #include <gl/GLHelpers.h> |
| 180 | 182 | #include <src/scripting/LimitlessVoiceRecognitionScriptingInterface.h> |
| 183 | +#include <EntityScriptClient.h> | |
| 184 | +#include <ModelScriptingInterface.h> | |
| 181 | 185 | |
| 182 | 186 | // On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU |
| 183 | 187 | // FIXME seems to be broken. |
| @@ -214,20 +218,12 @@ static const QString FBX_EXTENSION = ".fbx"; · 30 unmodified lines | ||
| 214 | 218 | static const QString OBJ_EXTENSION = ".obj"; |
| 215 | 219 | static const QString AVA_JSON_EXTENSION = ".ava.json"; |
| 216 | 220 | |
| 217 | −static const int MIRROR_VIEW_TOP_PADDING = 5; | |
| 218 | −static const int MIRROR_VIEW_LEFT_PADDING = 10; | |
| 219 | −static const int MIRROR_VIEW_WIDTH = 265; | |
| 220 | −static const int MIRROR_VIEW_HEIGHT = 215; | |
| 221 | 221 | static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f; |
| 222 | −static const float MIRROR_REARVIEW_DISTANCE = 0.722f; | |
| 223 | −static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f; | |
| 224 | −static const float MIRROR_FIELD_OF_VIEW = 30.0f; | |
| 225 | 222 | |
| 226 | 223 | static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS_PER_SECOND; |
| 227 | 224 | |
| 228 | −static const QString INFO_WELCOME_PATH = "html/interface-welcome.html"; | |
| 229 | 225 | static const QString INFO_EDIT_ENTITIES_PATH = "html/edit-commands.html"; |
| 230 | −static const QString INFO_HELP_PATH = "html/help.html"; | |
| 226 | +static const QString INFO_HELP_PATH = "../../../html/tabletHelp.html"; | |
| 231 | 227 | |
| 232 | 228 | static const unsigned int THROTTLED_SIM_FRAMERATE = 15; |
| 233 | 229 | static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SIM_FRAMERATE; |
| @@ -424,6 +420,7 @@ static const QString STATE_CAMERA_THIRD_PERSON = "CameraThirdPerson"; · 190 unmodified lines | ||
| 424 | 420 | static const QString STATE_CAMERA_ENTITY = "CameraEntity"; |
| 425 | 421 | static const QString STATE_CAMERA_INDEPENDENT = "CameraIndependent"; |
| 426 | 422 | static const QString STATE_SNAP_TURN = "SnapTurn"; |
| 423 | +static const QString STATE_ADVANCED_MOVEMENT_CONTROLS = "AdvancedMovement"; | |
| 427 | 424 | static const QString STATE_GROUNDED = "Grounded"; |
| 428 | 425 | static const QString STATE_NAV_FOCUSED = "NavigationFocused"; |
| 429 | 426 | |
| @@ -500,6 +497,8 @@ bool setupEssentials(int& argc, char** argv) { · 70 unmodified lines | ||
| 500 | 497 | DependencyManager::set<TabletScriptingInterface>(); |
| 501 | 498 | DependencyManager::set<ToolbarScriptingInterface>(); |
| 502 | 499 | DependencyManager::set<UserActivityLoggerScriptingInterface>(); |
| 500 | + DependencyManager::set<AssetMappingsScriptingInterface>(); | |
| 501 | + DependencyManager::set<DomainConnectionModel>(); | |
| 503 | 502 | |
| 504 | 503 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) |
| 505 | 504 | DependencyManager::set<SpeechRecognizer>(); |
| @@ -514,7 +513,7 @@ bool setupEssentials(int& argc, char** argv) { · 8 unmodified lines | ||
| 514 | 513 | DependencyManager::set<MessagesClient>(); |
| 515 | 514 | controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR, |
| 516 | 515 | STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, |
| 517 | − STATE_SNAP_TURN, STATE_GROUNDED, STATE_NAV_FOCUSED } }); | |
| 516 | + STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED } }); | |
| 518 | 517 | DependencyManager::set<UserInputMapper>(); |
| 519 | 518 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); |
| 520 | 519 | DependencyManager::set<InterfaceParentFinder>(); |
| @@ -524,6 +523,8 @@ bool setupEssentials(int& argc, char** argv) { · 3 unmodified lines | ||
| 524 | 523 | DependencyManager::set<EntityScriptClient>(); |
| 525 | 524 | DependencyManager::set<EntityScriptServerLogClient>(); |
| 526 | 525 | DependencyManager::set<LimitlessVoiceRecognitionScriptingInterface>(); |
| 526 | + DependencyManager::set<OctreeStatsProvider>(nullptr, qApp->getOcteeSceneStats()); | |
| 527 | + | |
| 527 | 528 | return previousSessionCrashed; |
| 528 | 529 | } |
| 529 | 530 | |
| @@ -551,6 +552,7 @@ const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f; · 21 unmodified lines | ||
| 551 | 552 | const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true; |
| 552 | 553 | const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false; |
| 553 | 554 | const bool DEFAULT_TABLET_VISIBLE_TO_OTHERS = false; |
| 555 | +const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = true; | |
| 554 | 556 | |
| 555 | 557 | Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runServer, QString runServerPathOption) : |
| 556 | 558 | QApplication(argc, argv), |
| @@ -566,7 +568,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 9 unmodified lines | ||
| 566 | 568 | _entityClipboardRenderer(false, this, this), |
| 567 | 569 | _entityClipboard(new EntityTree()), |
| 568 | 570 | _lastQueriedTime(usecTimestampNow()), |
| 569 | − _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), | |
| 570 | 571 | _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION), |
| 571 | 572 | _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES), |
| 572 | 573 | _hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT), |
| @@ -574,6 +575,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1 unmodified line | ||
| 574 | 575 | _desktopTabletBecomesToolbarSetting("desktopTabletBecomesToolbar", DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR), |
| 575 | 576 | _hmdTabletBecomesToolbarSetting("hmdTabletBecomesToolbar", DEFAULT_HMD_TABLET_BECOMES_TOOLBAR), |
| 576 | 577 | _tabletVisibleToOthersSetting("tabletVisibleToOthers", DEFAULT_TABLET_VISIBLE_TO_OTHERS), |
| 578 | + _preferAvatarFingerOverStylusSetting("preferAvatarFingerOverStylus", DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS), | |
| 577 | 579 | _constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true), |
| 578 | 580 | _scaleMirror(1.0f), |
| 579 | 581 | _rotateMirror(0.0f), |
| @@ -608,6 +610,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 28 unmodified lines | ||
| 608 | 610 | } |
| 609 | 611 | } |
| 610 | 612 | |
| 613 | + // make sure the debug draw singleton is initialized on the main thread. | |
| 614 | + DebugDraw::getInstance().removeMarker(""); | |
| 611 | 615 | |
| 612 | 616 | _runningMarker.startRunningMarker(); |
| 613 | 617 | |
| @@ -744,23 +748,24 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 130 unmodified lines | ||
| 744 | 748 | } |
| 745 | 749 | }); |
| 746 | 750 | |
| 747 | − auto& audioScriptingInterface = AudioScriptingInterface::getInstance(); | |
| 751 | + auto audioScriptingInterface = DependencyManager::set<AudioScriptingInterface>(); | |
| 748 | 752 | connect(audioThread, &QThread::started, audioIO.data(), &AudioClient::start); |
| 749 | 753 | connect(audioIO.data(), &AudioClient::destroyed, audioThread, &QThread::quit); |
| 750 | 754 | connect(audioThread, &QThread::finished, audioThread, &QThread::deleteLater); |
| 751 | 755 | connect(audioIO.data(), &AudioClient::muteToggled, this, &Application::audioMuteToggled); |
| 752 | − connect(audioIO.data(), &AudioClient::mutedByMixer, &audioScriptingInterface, &AudioScriptingInterface::mutedByMixer); | |
| 753 | − connect(audioIO.data(), &AudioClient::receivedFirstPacket, &audioScriptingInterface, &AudioScriptingInterface::receivedFirstPacket); | |
| 754 | − connect(audioIO.data(), &AudioClient::disconnected, &audioScriptingInterface, &AudioScriptingInterface::disconnected); | |
| 756 | + connect(audioIO.data(), &AudioClient::mutedByMixer, audioScriptingInterface.data(), &AudioScriptingInterface::mutedByMixer); | |
| 757 | + connect(audioIO.data(), &AudioClient::receivedFirstPacket, audioScriptingInterface.data(), &AudioScriptingInterface::receivedFirstPacket); | |
| 758 | + connect(audioIO.data(), &AudioClient::disconnected, audioScriptingInterface.data(), &AudioScriptingInterface::disconnected); | |
| 755 | 759 | connect(audioIO.data(), &AudioClient::muteEnvironmentRequested, [](glm::vec3 position, float radius) { |
| 756 | 760 | auto audioClient = DependencyManager::get<AudioClient>(); |
| 761 | + auto audioScriptingInterface = DependencyManager::get<AudioScriptingInterface>(); | |
| 757 | 762 | auto myAvatarPosition = DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition(); |
| 758 | 763 | float distance = glm::distance(myAvatarPosition, position); |
| 759 | 764 | bool shouldMute = !audioClient->isMuted() && (distance < radius); |
| 760 | 765 | |
| 761 | 766 | if (shouldMute) { |
| 762 | 767 | audioClient->toggleMute(); |
| 763 | − AudioScriptingInterface::getInstance().environmentMuted(); | |
| 768 | + audioScriptingInterface->environmentMuted(); | |
| 764 | 769 | } |
| 765 | 770 | }); |
| 766 | 771 | |
| @@ -845,6 +850,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 78 unmodified lines | ||
| 845 | 850 | connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress); |
| 846 | 851 | |
| 847 | 852 | connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateThreadPoolCount); |
| 853 | + connect(this, &Application::activeDisplayPluginChanged, this, [](){ | |
| 854 | + qApp->setProperty(hifi::properties::HMD, qApp->isHMDMode()); | |
| 855 | + }); | |
| 848 | 856 | connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateSystemTabletMode); |
| 849 | 857 | |
| 850 | 858 | // Save avatar location immediately after a teleport. |
| @@ -1127,6 +1135,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 276 unmodified lines | ||
| 1127 | 1135 | _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float { |
| 1128 | 1136 | return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0; |
| 1129 | 1137 | }); |
| 1138 | + _applicationStateDevice->setInputVariant(STATE_ADVANCED_MOVEMENT_CONTROLS, []() -> float { | |
| 1139 | + return qApp->getMyAvatar()->useAdvancedMovementControls() ? 1 : 0; | |
| 1140 | + }); | |
| 1141 | + | |
| 1130 | 1142 | _applicationStateDevice->setInputVariant(STATE_GROUNDED, []() -> float { |
| 1131 | 1143 | return qApp->getMyAvatar()->getCharacterController()->onGround() ? 1 : 0; |
| 1132 | 1144 | }); |
| @@ -1181,7 +1193,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 48 unmodified lines | ||
| 1181 | 1193 | |
| 1182 | 1194 | // set the local loopback interface for local sounds |
| 1183 | 1195 | AudioInjector::setLocalAudioInterface(audioIO.data()); |
| 1184 | − AudioScriptingInterface::getInstance().setLocalAudioInterface(audioIO.data()); | |
| 1196 | + audioScriptingInterface->setLocalAudioInterface(audioIO.data()); | |
| 1197 | + connect(audioIO.data(), &AudioClient::noiseGateOpened, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateOpened); | |
| 1198 | + connect(audioIO.data(), &AudioClient::noiseGateClosed, audioScriptingInterface.data(), &AudioScriptingInterface::noiseGateClosed); | |
| 1199 | + connect(audioIO.data(), &AudioClient::inputReceived, audioScriptingInterface.data(), &AudioScriptingInterface::inputReceived); | |
| 1200 | + | |
| 1185 | 1201 | |
| 1186 | 1202 | this->installEventFilter(this); |
| 1187 | 1203 | |
| @@ -1439,7 +1455,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 251 unmodified lines | ||
| 1439 | 1455 | scriptEngines->loadScript(testScript, false); |
| 1440 | 1456 | } else { |
| 1441 | 1457 | // Get sandbox content set version, if available |
| 1442 | − auto acDirPath = PathUtils::getRootDataDirectory() + BuildInfo::MODIFIED_ORGANIZATION + "/assignment-client/"; | |
| 1458 | + auto acDirPath = PathUtils::getAppDataPath() + "../../" + BuildInfo::MODIFIED_ORGANIZATION + "/assignment-client/"; | |
| 1443 | 1459 | auto contentVersionPath = acDirPath + "content-version.txt"; |
| 1444 | 1460 | qCDebug(interfaceapp) << "Checking " << contentVersionPath << " for content version"; |
| 1445 | 1461 | auto contentVersion = 0; |
| @@ -1617,17 +1633,15 @@ QString Application::getUserAgent() { · 171 unmodified lines | ||
| 1617 | 1633 | return userAgent; |
| 1618 | 1634 | } |
| 1619 | 1635 | |
| 1620 | −uint64_t lastTabletUIToggle { 0 }; | |
| 1621 | −const uint64_t toggleTabletUILockout { 500000 }; | |
| 1622 | 1636 | void Application::toggleTabletUI() const { |
| 1623 | − uint64_t now = usecTimestampNow(); | |
| 1624 | − if (now - lastTabletUIToggle < toggleTabletUILockout) { | |
| 1625 | − return; | |
| 1637 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 1638 | + auto hmd = DependencyManager::get<HMDScriptingInterface>(); | |
| 1639 | + TabletProxy* tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 1640 | + bool messageOpen = tablet->isMessageDialogOpen(); | |
| 1641 | + if (!messageOpen || (messageOpen && !hmd->getShouldShowTablet())) { | |
| 1642 | + auto HMD = DependencyManager::get<HMDScriptingInterface>(); | |
| 1643 | + HMD->toggleShouldShowTablet(); | |
| 1626 | 1644 | } |
| 1627 | − lastTabletUIToggle = now; | |
| 1628 | − | |
| 1629 | − auto HMD = DependencyManager::get<HMDScriptingInterface>(); | |
| 1630 | − HMD->toggleShouldShowTablet(); | |
| 1631 | 1645 | } |
| 1632 | 1646 | |
| 1633 | 1647 | void Application::checkChangeCursor() { |
| @@ -1800,6 +1814,7 @@ Application::~Application() { · 166 unmodified lines | ||
| 1800 | 1814 | DependencyManager::destroy<GeometryCache>(); |
| 1801 | 1815 | DependencyManager::destroy<ScriptCache>(); |
| 1802 | 1816 | DependencyManager::destroy<SoundCache>(); |
| 1817 | + DependencyManager::destroy<OctreeStatsProvider>(); | |
| 1803 | 1818 | |
| 1804 | 1819 | ResourceManager::cleanup(); |
| 1805 | 1820 | |
| @@ -1945,8 +1960,10 @@ void Application::initializeUi() { · 139 unmodified lines | ||
| 1945 | 1960 | // For some reason there is already an "Application" object in the QML context, |
| 1946 | 1961 | // though I can't find it. Hence, "ApplicationInterface" |
| 1947 | 1962 | rootContext->setContextProperty("ApplicationInterface", this); |
| 1948 | − rootContext->setContextProperty("Audio", &AudioScriptingInterface::getInstance()); | |
| 1963 | + rootContext->setContextProperty("Audio", DependencyManager::get<AudioScriptingInterface>().data()); | |
| 1949 | 1964 | rootContext->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data()); |
| 1965 | + rootContext->setContextProperty("AudioScope", DependencyManager::get<AudioScope>().data()); | |
| 1966 | + | |
| 1950 | 1967 | rootContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data()); |
| 1951 | 1968 | rootContext->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data()); |
| 1952 | 1969 | _fileDownload = new FileScriptingInterface(engine); |
| @@ -1959,12 +1976,13 @@ void Application::initializeUi() { · 6 unmodified lines | ||
| 1959 | 1976 | rootContext->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data()); |
| 1960 | 1977 | rootContext->setContextProperty("FrameTimings", &_frameTimingsScriptingInterface); |
| 1961 | 1978 | rootContext->setContextProperty("Rates", new RatesScriptingInterface(this)); |
| 1979 | + rootContext->setContextProperty("pathToFonts", "../../"); | |
| 1962 | 1980 | |
| 1963 | 1981 | rootContext->setContextProperty("TREE_SCALE", TREE_SCALE); |
| 1964 | 1982 | rootContext->setContextProperty("Quat", new Quat()); |
| 1965 | 1983 | rootContext->setContextProperty("Vec3", new Vec3()); |
| 1966 | 1984 | rootContext->setContextProperty("Uuid", new ScriptUUID()); |
| 1967 | − rootContext->setContextProperty("Assets", new AssetMappingsScriptingInterface()); | |
| 1985 | + rootContext->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data()); | |
| 1968 | 1986 | |
| 1969 | 1987 | rootContext->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data()); |
| 1970 | 1988 | rootContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data()); |
| @@ -2111,21 +2129,6 @@ void Application::paintGL() { · 140 unmodified lines | ||
| 2111 | 2129 | batch.resetStages(); |
| 2112 | 2130 | }); |
| 2113 | 2131 | |
| 2114 | − auto inputs = AvatarInputs::getInstance(); | |
| 2115 | − if (inputs->mirrorVisible()) { | |
| 2116 | − PerformanceTimer perfTimer("Mirror"); | |
| 2117 | − | |
| 2118 | − renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; | |
| 2119 | − renderArgs._blitFramebuffer = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer(); | |
| 2120 | − | |
| 2121 | − _mirrorViewRect.moveTo(inputs->x(), inputs->y()); | |
| 2122 | − | |
| 2123 | − renderRearViewMirror(&renderArgs, _mirrorViewRect, inputs->mirrorZoomed()); | |
| 2124 | − | |
| 2125 | − renderArgs._blitFramebuffer.reset(); | |
| 2126 | − renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE; | |
| 2127 | − } | |
| 2128 | − | |
| 2129 | 2132 | { |
| 2130 | 2133 | PerformanceTimer perfTimer("renderOverlay"); |
| 2131 | 2134 | // NOTE: There is no batch associated with this renderArgs |
| @@ -2140,7 +2143,7 @@ void Application::paintGL() { · 8 unmodified lines | ||
| 2140 | 2143 | PerformanceTimer perfTimer("CameraUpdates"); |
| 2141 | 2144 | |
| 2142 | 2145 | auto myAvatar = getMyAvatar(); |
| 2143 | − boomOffset = myAvatar->getScale() * myAvatar->getBoomLength() * -IDENTITY_FRONT; | |
| 2146 | + boomOffset = myAvatar->getScale() * myAvatar->getBoomLength() * -IDENTITY_FORWARD; | |
| 2144 | 2147 | |
| 2145 | 2148 | if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| 2146 | 2149 | Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN); |
| @@ -2364,15 +2367,15 @@ void Application::setTabletVisibleToOthersSetting(bool value) { · 217 unmodified lines | ||
| 2364 | 2367 | updateSystemTabletMode(); |
| 2365 | 2368 | } |
| 2366 | 2369 | |
| 2370 | +void Application::setPreferAvatarFingerOverStylus(bool value) { | |
| 2371 | + _preferAvatarFingerOverStylusSetting.set(value); | |
| 2372 | +} | |
| 2373 | + | |
| 2367 | 2374 | void Application::setSettingConstrainToolbarPosition(bool setting) { |
| 2368 | 2375 | _constrainToolbarPosition.set(setting); |
| 2369 | 2376 | DependencyManager::get<OffscreenUi>()->setConstrainToolbarToCenterX(setting); |
| 2370 | 2377 | } |
| 2371 | 2378 | |
| 2372 | −void Application::aboutApp() { | |
| 2373 | − InfoView::show(INFO_WELCOME_PATH); | |
| 2374 | −} | |
| 2375 | − | |
| 2376 | 2379 | void Application::showHelp() { |
| 2377 | 2380 | static const QString HAND_CONTROLLER_NAME_VIVE = "vive"; |
| 2378 | 2381 | static const QString HAND_CONTROLLER_NAME_OCULUS_TOUCH = "oculus"; |
| @@ -2397,8 +2400,10 @@ void Application::showHelp() { · 18 unmodified lines | ||
| 2397 | 2400 | QUrlQuery queryString; |
| 2398 | 2401 | queryString.addQueryItem("handControllerName", handControllerName); |
| 2399 | 2402 | queryString.addQueryItem("defaultTab", defaultTab); |
| 2400 | − | |
| 2401 | − InfoView::show(INFO_HELP_PATH, false, queryString.toString()); | |
| 2403 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 2404 | + TabletProxy* tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 2405 | + tablet->gotoWebScreen(INFO_HELP_PATH + "?" + queryString.toString()); | |
| 2406 | + //InfoView::show(INFO_HELP_PATH, false, queryString.toString()); | |
| 2402 | 2407 | } |
| 2403 | 2408 | |
| 2404 | 2409 | void Application::resizeEvent(QResizeEvent* event) { |
| @@ -2754,8 +2759,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 349 unmodified lines | ||
| 2754 | 2759 | case Qt::Key_S: |
| 2755 | 2760 | if (isShifted && isMeta && !isOption) { |
| 2756 | 2761 | Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings); |
| 2757 | − } else if (isOption && !isShifted && !isMeta) { | |
| 2758 | − Menu::getInstance()->triggerOption(MenuOption::ScriptEditor); | |
| 2759 | 2762 | } else if (!isOption && !isShifted && isMeta) { |
| 2760 | 2763 | takeSnapshot(true); |
| 2761 | 2764 | } |
| @@ -2874,56 +2877,56 @@ void Application::keyPressEvent(QKeyEvent* event) { · 112 unmodified lines | ||
| 2874 | 2877 | break; |
| 2875 | 2878 | #endif |
| 2876 | 2879 | |
| 2877 | − case Qt::Key_H: | |
| 2878 | − if (isShifted) { | |
| 2879 | − Menu::getInstance()->triggerOption(MenuOption::MiniMirror); | |
| 2880 | − } else { | |
| 2881 | − // whenever switching to/from full screen mirror from the keyboard, remember | |
| 2882 | − // the state you were in before full screen mirror, and return to that. | |
| 2883 | − auto previousMode = _myCamera.getMode(); | |
| 2884 | − if (previousMode != CAMERA_MODE_MIRROR) { | |
| 2885 | − switch (previousMode) { | |
| 2886 | − case CAMERA_MODE_FIRST_PERSON: | |
| 2887 | − _returnFromFullScreenMirrorTo = MenuOption::FirstPerson; | |
| 2888 | − break; | |
| 2889 | − case CAMERA_MODE_THIRD_PERSON: | |
| 2890 | − _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson; | |
| 2891 | − break; | |
| 2892 | − | |
| 2893 | − // FIXME - it's not clear that these modes make sense to return to... | |
| 2894 | − case CAMERA_MODE_INDEPENDENT: | |
| 2895 | − _returnFromFullScreenMirrorTo = MenuOption::IndependentMode; | |
| 2896 | − break; | |
| 2897 | − case CAMERA_MODE_ENTITY: | |
| 2898 | − _returnFromFullScreenMirrorTo = MenuOption::CameraEntityMode; | |
| 2899 | − break; | |
| 2900 | − | |
| 2901 | − default: | |
| 2902 | − _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson; | |
| 2903 | − break; | |
| 2904 | − } | |
| 2880 | + case Qt::Key_H: { | |
| 2881 | + // whenever switching to/from full screen mirror from the keyboard, remember | |
| 2882 | + // the state you were in before full screen mirror, and return to that. | |
| 2883 | + auto previousMode = _myCamera.getMode(); | |
| 2884 | + if (previousMode != CAMERA_MODE_MIRROR) { | |
| 2885 | + switch (previousMode) { | |
| 2886 | + case CAMERA_MODE_FIRST_PERSON: | |
| 2887 | + _returnFromFullScreenMirrorTo = MenuOption::FirstPerson; | |
| 2888 | + break; | |
| 2889 | + case CAMERA_MODE_THIRD_PERSON: | |
| 2890 | + _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson; | |
| 2891 | + break; | |
| 2892 | + | |
| 2893 | + // FIXME - it's not clear that these modes make sense to return to... | |
| 2894 | + case CAMERA_MODE_INDEPENDENT: | |
| 2895 | + _returnFromFullScreenMirrorTo = MenuOption::IndependentMode; | |
| 2896 | + break; | |
| 2897 | + case CAMERA_MODE_ENTITY: | |
| 2898 | + _returnFromFullScreenMirrorTo = MenuOption::CameraEntityMode; | |
| 2899 | + break; | |
| 2900 | + | |
| 2901 | + default: | |
| 2902 | + _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson; | |
| 2903 | + break; | |
| 2905 | 2904 | } |
| 2905 | + } | |
| 2906 | 2906 | |
| 2907 | − bool isMirrorChecked = Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror); | |
| 2908 | − Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, !isMirrorChecked); | |
| 2909 | − if (isMirrorChecked) { | |
| 2907 | + bool isMirrorChecked = Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror); | |
| 2908 | + Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, !isMirrorChecked); | |
| 2909 | + if (isMirrorChecked) { | |
| 2910 | 2910 | |
| 2911 | − // if we got here without coming in from a non-Full Screen mirror case, then our | |
| 2912 | − // _returnFromFullScreenMirrorTo is unknown. In that case we'll go to the old | |
| 2913 | − // behavior of returning to ThirdPerson | |
| 2914 | − if (_returnFromFullScreenMirrorTo.isEmpty()) { | |
| 2915 | − _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson; | |
| 2916 | − } | |
| 2917 | − Menu::getInstance()->setIsOptionChecked(_returnFromFullScreenMirrorTo, true); | |
| 2911 | + // if we got here without coming in from a non-Full Screen mirror case, then our | |
| 2912 | + // _returnFromFullScreenMirrorTo is unknown. In that case we'll go to the old | |
| 2913 | + // behavior of returning to ThirdPerson | |
| 2914 | + if (_returnFromFullScreenMirrorTo.isEmpty()) { | |
| 2915 | + _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson; | |
| 2918 | 2916 | } |
| 2919 | − cameraMenuChanged(); | |
| 2917 | + Menu::getInstance()->setIsOptionChecked(_returnFromFullScreenMirrorTo, true); | |
| 2920 | 2918 | } |
| 2919 | + cameraMenuChanged(); | |
| 2921 | 2920 | break; |
| 2921 | + } | |
| 2922 | + | |
| 2922 | 2923 | case Qt::Key_P: { |
| 2923 | − bool isFirstPersonChecked = Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson); | |
| 2924 | − Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, !isFirstPersonChecked); | |
| 2925 | − Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, isFirstPersonChecked); | |
| 2926 | − cameraMenuChanged(); | |
| 2924 | + if (!(isShifted || isMeta || isOption)) { | |
| 2925 | + bool isFirstPersonChecked = Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson); | |
| 2926 | + Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, !isFirstPersonChecked); | |
| 2927 | + Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, isFirstPersonChecked); | |
| 2928 | + cameraMenuChanged(); | |
| 2929 | + } | |
| 2927 | 2930 | break; |
| 2928 | 2931 | } |
| 2929 | 2932 | |
| @@ -3168,7 +3171,23 @@ void Application::mousePressEvent(QMouseEvent* event) { · 238 unmodified lines | ||
| 3168 | 3171 | } |
| 3169 | 3172 | } |
| 3170 | 3173 | |
| 3171 | −void Application::mouseDoublePressEvent(QMouseEvent* event) const { | |
| 3174 | +void Application::mouseDoublePressEvent(QMouseEvent* event) { | |
| 3175 | + auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 3176 | + auto eventPosition = getApplicationCompositor().getMouseEventPosition(event); | |
| 3177 | + QPointF transformedPos = offscreenUi->mapToVirtualScreen(eventPosition, _glWidget); | |
| 3178 | + QMouseEvent mappedEvent(event->type(), | |
| 3179 | + transformedPos, | |
| 3180 | + event->screenPos(), event->button(), | |
| 3181 | + event->buttons(), event->modifiers()); | |
| 3182 | + | |
| 3183 | + if (!_aboutToQuit) { | |
| 3184 | + getOverlays().mouseDoublePressEvent(&mappedEvent); | |
| 3185 | + if (!_controllerScriptingInterface->areEntityClicksCaptured()) { | |
| 3186 | + getEntities()->mouseDoublePressEvent(&mappedEvent); | |
| 3187 | + } | |
| 3188 | + } | |
| 3189 | + | |
| 3190 | + | |
| 3172 | 3191 | // if one of our scripts have asked to capture this event, then stop processing it |
| 3173 | 3192 | if (_controllerScriptingInterface->isMouseCaptured()) { |
| 3174 | 3193 | return; |
| @@ -3772,7 +3791,7 @@ void Application::loadSettings() { · 597 unmodified lines | ||
| 3772 | 3791 | } |
| 3773 | 3792 | |
| 3774 | 3793 | getMyAvatar()->loadData(); |
| 3775 | − | |
| 3794 | + setTabletVisibleToOthersSetting(false); | |
| 3776 | 3795 | _settingsLoaded = true; |
| 3777 | 3796 | } |
| 3778 | 3797 | |
| @@ -3815,8 +3834,6 @@ void Application::init() { · 36 unmodified lines | ||
| 3815 | 3834 | DependencyManager::get<AvatarManager>()->init(); |
| 3816 | 3835 | _myCamera.setMode(CAMERA_MODE_FIRST_PERSON); |
| 3817 | 3836 | |
| 3818 | − _mirrorCamera.setMode(CAMERA_MODE_MIRROR); | |
| 3819 | − | |
| 3820 | 3837 | _timerStart.start(); |
| 3821 | 3838 | _lastTimeUpdated.start(); |
| 3822 | 3839 | |
| @@ -3951,7 +3968,7 @@ void Application::updateMyAvatarLookAtPosition() { · 128 unmodified lines | ||
| 3951 | 3968 | auto lookingAtHead = static_pointer_cast<Avatar>(lookingAt)->getHead(); |
| 3952 | 3969 | |
| 3953 | 3970 | const float MAXIMUM_FACE_ANGLE = 65.0f * RADIANS_PER_DEGREE; |
| 3954 | − glm::vec3 lookingAtFaceOrientation = lookingAtHead->getFinalOrientationInWorldFrame() * IDENTITY_FRONT; | |
| 3971 | + glm::vec3 lookingAtFaceOrientation = lookingAtHead->getFinalOrientationInWorldFrame() * IDENTITY_FORWARD; | |
| 3955 | 3972 | glm::vec3 fromLookingAtToMe = glm::normalize(myAvatar->getHead()->getEyePosition() |
| 3956 | 3973 | - lookingAtHead->getEyePosition()); |
| 3957 | 3974 | float faceAngle = glm::angle(lookingAtFaceOrientation, fromLookingAtToMe); |
| @@ -4230,12 +4247,6 @@ void Application::updateDialogs(float deltaTime) const { · 272 unmodified lines | ||
| 4230 | 4247 | PerformanceWarning warn(showWarnings, "Application::updateDialogs()"); |
| 4231 | 4248 | auto dialogsManager = DependencyManager::get<DialogsManager>(); |
| 4232 | 4249 | |
| 4233 | − // Update bandwidth dialog, if any | |
| 4234 | − BandwidthDialog* bandwidthDialog = dialogsManager->getBandwidthDialog(); | |
| 4235 | − if (bandwidthDialog) { | |
| 4236 | − bandwidthDialog->update(); | |
| 4237 | − } | |
| 4238 | − | |
| 4239 | 4250 | QPointer<OctreeStatsDialog> octreeStatsDialog = dialogsManager->getOctreeStatsDialog(); |
| 4240 | 4251 | if (octreeStatsDialog) { |
| 4241 | 4252 | octreeStatsDialog->update(); |
| @@ -4359,16 +4370,16 @@ void Application::update(float deltaTime) { · 117 unmodified lines | ||
| 4359 | 4370 | myAvatar->clearDriveKeys(); |
| 4360 | 4371 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { |
| 4361 | 4372 | if (!_controllerScriptingInterface->areActionsCaptured()) { |
| 4362 | − myAvatar->setDriveKeys(TRANSLATE_Z, -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z)); | |
| 4363 | − myAvatar->setDriveKeys(TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y)); | |
| 4364 | − myAvatar->setDriveKeys(TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X)); | |
| 4373 | + myAvatar->setDriveKey(MyAvatar::TRANSLATE_Z, -1.0f * userInputMapper->getActionState(controller::Action::TRANSLATE_Z)); | |
| 4374 | + myAvatar->setDriveKey(MyAvatar::TRANSLATE_Y, userInputMapper->getActionState(controller::Action::TRANSLATE_Y)); | |
| 4375 | + myAvatar->setDriveKey(MyAvatar::TRANSLATE_X, userInputMapper->getActionState(controller::Action::TRANSLATE_X)); | |
| 4365 | 4376 | if (deltaTime > FLT_EPSILON) { |
| 4366 | − myAvatar->setDriveKeys(PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH)); | |
| 4367 | − myAvatar->setDriveKeys(YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW)); | |
| 4368 | − myAvatar->setDriveKeys(STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW)); | |
| 4377 | + myAvatar->setDriveKey(MyAvatar::PITCH, -1.0f * userInputMapper->getActionState(controller::Action::PITCH)); | |
| 4378 | + myAvatar->setDriveKey(MyAvatar::YAW, -1.0f * userInputMapper->getActionState(controller::Action::YAW)); | |
| 4379 | + myAvatar->setDriveKey(MyAvatar::STEP_YAW, -1.0f * userInputMapper->getActionState(controller::Action::STEP_YAW)); | |
| 4369 | 4380 | } |
| 4370 | 4381 | } |
| 4371 | − myAvatar->setDriveKeys(ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); | |
| 4382 | + myAvatar->setDriveKey(MyAvatar::ZOOM, userInputMapper->getActionState(controller::Action::TRANSLATE_CAMERA_Z)); | |
| 4372 | 4383 | } |
| 4373 | 4384 | |
| 4374 | 4385 | controller::Pose leftHandPose = userInputMapper->getPoseState(controller::Action::LEFT_HAND); |
| @@ -4439,9 +4450,12 @@ void Application::update(float deltaTime) { · 64 unmodified lines | ||
| 4439 | 4450 | |
| 4440 | 4451 | getEntities()->getTree()->withWriteLock([&] { |
| 4441 | 4452 | PerformanceTimer perfTimer("handleOutgoingChanges"); |
| 4442 | − const VectorOfMotionStates& outgoingChanges = _physicsEngine->getOutgoingChanges(); | |
| 4443 | − _entitySimulation->handleOutgoingChanges(outgoingChanges); | |
| 4444 | − avatarManager->handleOutgoingChanges(outgoingChanges); | |
| 4453 | + const VectorOfMotionStates& deactivations = _physicsEngine->getDeactivatedMotionStates(); | |
| 4454 | + _entitySimulation->handleDeactivatedMotionStates(deactivations); | |
| 4455 | + | |
| 4456 | + const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates(); | |
| 4457 | + _entitySimulation->handleChangedMotionStates(outgoingChanges); | |
| 4458 | + avatarManager->handleChangedMotionStates(outgoingChanges); | |
| 4445 | 4459 | }); |
| 4446 | 4460 | |
| 4447 | 4461 | if (!_aboutToQuit) { |
| @@ -5100,58 +5114,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 652 unmodified lines | ||
| 5100 | 5114 | activeRenderingThread = nullptr; |
| 5101 | 5115 | } |
| 5102 | 5116 | |
| 5103 | −void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& region, bool isZoomed) { | |
| 5104 | − auto originalViewport = renderArgs->_viewport; | |
| 5105 | − // Grab current viewport to reset it at the end | |
| 5106 | − | |
| 5107 | − float aspect = (float)region.width() / region.height(); | |
| 5108 | − float fov = MIRROR_FIELD_OF_VIEW; | |
| 5109 | − | |
| 5110 | − auto myAvatar = getMyAvatar(); | |
| 5111 | − | |
| 5112 | − // bool eyeRelativeCamera = false; | |
| 5113 | − if (!isZoomed) { | |
| 5114 | − _mirrorCamera.setPosition(myAvatar->getChestPosition() + | |
| 5115 | − myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * myAvatar->getScale()); | |
| 5116 | − | |
| 5117 | − } else { // HEAD zoom level | |
| 5118 | − // FIXME note that the positioning of the camera relative to the avatar can suffer limited | |
| 5119 | − // precision as the user's position moves further away from the origin. Thus at | |
| 5120 | − // /1e7,1e7,1e7 (well outside the buildable volume) the mirror camera veers and sways | |
| 5121 | − // wildly as you rotate your avatar because the floating point values are becoming | |
| 5122 | − // larger, squeezing out the available digits of precision you have available at the | |
| 5123 | − // human scale for camera positioning. | |
| 5124 | − | |
| 5125 | − // Previously there was a hack to correct this using the mechanism of repositioning | |
| 5126 | − // the avatar at the origin of the world for the purposes of rendering the mirror, | |
| 5127 | − // but it resulted in failing to render the avatar's head model in the mirror view | |
| 5128 | − // when in first person mode. Presumably this was because of some missed culling logic | |
| 5129 | − // that was not accounted for in the hack. | |
| 5130 | − | |
| 5131 | − // This was removed in commit 71e59cfa88c6563749594e25494102fe01db38e9 but could be further | |
| 5132 | − // investigated in order to adapt the technique while fixing the head rendering issue, | |
| 5133 | − // but the complexity of the hack suggests that a better approach | |
| 5134 | − _mirrorCamera.setPosition(myAvatar->getDefaultEyePosition() + | |
| 5135 | − myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_DISTANCE * myAvatar->getScale()); | |
| 5136 | − } | |
| 5137 | − _mirrorCamera.setProjection(glm::perspective(glm::radians(fov), aspect, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP)); | |
| 5138 | − _mirrorCamera.setOrientation(myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI, 0.0f))); | |
| 5139 | − | |
| 5140 | − | |
| 5141 | − // set the bounds of rear mirror view | |
| 5142 | − // the region is in device independent coordinates; must convert to device | |
| 5143 | − float ratio = (float)QApplication::desktop()->windowHandle()->devicePixelRatio() * getRenderResolutionScale(); | |
| 5144 | − int width = region.width() * ratio; | |
| 5145 | − int height = region.height() * ratio; | |
| 5146 | − gpu::Vec4i viewport = gpu::Vec4i(0, 0, width, height); | |
| 5147 | − renderArgs->_viewport = viewport; | |
| 5148 | − | |
| 5149 | − // render rear mirror view | |
| 5150 | − displaySide(renderArgs, _mirrorCamera, true); | |
| 5151 | − | |
| 5152 | − renderArgs->_viewport = originalViewport; | |
| 5153 | −} | |
| 5154 | − | |
| 5155 | 5117 | void Application::resetSensors(bool andReload) { |
| 5156 | 5118 | DependencyManager::get<Faceshift>()->reset(); |
| 5157 | 5119 | DependencyManager::get<DdeFaceTracker>()->reset(); |
| @@ -5188,6 +5150,7 @@ void Application::updateWindowTitle() const { · 30 unmodified lines | ||
| 5188 | 5150 | #endif |
| 5189 | 5151 | _window->setWindowTitle(title); |
| 5190 | 5152 | } |
| 5153 | + | |
| 5191 | 5154 | void Application::clearDomainOctreeDetails() { |
| 5192 | 5155 | |
| 5193 | 5156 | // if we're about to quit, we really don't need to do any of these things... |
| @@ -5217,6 +5180,12 @@ void Application::clearDomainOctreeDetails() { · 23 unmodified lines | ||
| 5217 | 5180 | skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT); |
| 5218 | 5181 | |
| 5219 | 5182 | _recentlyClearedDomain = true; |
| 5183 | + | |
| 5184 | + DependencyManager::get<AvatarManager>()->clearOtherAvatars(); | |
| 5185 | + DependencyManager::get<AnimationCache>()->clearUnusedResources(); | |
| 5186 | + DependencyManager::get<ModelCache>()->clearUnusedResources(); | |
| 5187 | + DependencyManager::get<SoundCache>()->clearUnusedResources(); | |
| 5188 | + DependencyManager::get<TextureCache>()->clearUnusedResources(); | |
| 5220 | 5189 | } |
| 5221 | 5190 | |
| 5222 | 5191 | void Application::domainChanged(const QString& domainHostname) { |
| @@ -5474,8 +5443,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 251 unmodified lines | ||
| 5474 | 5443 | scriptEngine->registerGlobalObject("Rates", new RatesScriptingInterface(this)); |
| 5475 | 5444 | |
| 5476 | 5445 | // hook our avatar and avatar hash map object into this script engine |
| 5477 | − scriptEngine->registerGlobalObject("MyAvatar", getMyAvatar().get()); | |
| 5478 | − qScriptRegisterMetaType(scriptEngine, audioListenModeToScriptValue, audioListenModeFromScriptValue); | |
| 5446 | + getMyAvatar()->registerMetaTypes(scriptEngine); | |
| 5479 | 5447 | |
| 5480 | 5448 | scriptEngine->registerGlobalObject("AvatarList", DependencyManager::get<AvatarManager>().data()); |
| 5481 | 5449 | |
| @@ -5516,6 +5484,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 34 unmodified lines | ||
| 5516 | 5484 | scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance()); |
| 5517 | 5485 | scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance()); |
| 5518 | 5486 | scriptEngine->registerGlobalObject("AudioStats", DependencyManager::get<AudioClient>()->getStats().data()); |
| 5487 | + scriptEngine->registerGlobalObject("AudioScope", DependencyManager::get<AudioScope>().data()); | |
| 5519 | 5488 | |
| 5520 | 5489 | // Caches |
| 5521 | 5490 | scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data()); |
| @@ -5784,9 +5753,26 @@ bool Application::displayAvatarAttachmentConfirmationDialog(const QString& name) · 262 unmodified lines | ||
| 5784 | 5753 | } |
| 5785 | 5754 | } |
| 5786 | 5755 | |
| 5787 | −void Application::toggleRunningScriptsWidget() const { | |
| 5788 | − static const QUrl url("hifi/dialogs/RunningScripts.qml"); | |
| 5789 | − DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts"); | |
| 5756 | +void Application::toggleRunningScriptsWidget() const { | |
| 5757 | + auto scriptEngines = DependencyManager::get<ScriptEngines>(); | |
| 5758 | + bool scriptsRunning = !scriptEngines->getRunningScripts().isEmpty(); | |
| 5759 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 5760 | + auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 5761 | + | |
| 5762 | + if (tablet->getToolbarMode() || false == scriptsRunning) { | |
| 5763 | + static const QUrl url("hifi/dialogs/RunningScripts.qml"); | |
| 5764 | + DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts"); | |
| 5765 | + } else { | |
| 5766 | + auto hmd = DependencyManager::get<HMDScriptingInterface>(); | |
| 5767 | + if (!hmd->getShouldShowTablet() && !isHMDMode()) { | |
| 5768 | + static const QUrl url("hifi/dialogs/RunningScripts.qml"); | |
| 5769 | + DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts"); | |
| 5770 | + } else { | |
| 5771 | + static const QUrl url("../../hifi/dialogs/TabletRunningScripts.qml"); | |
| 5772 | + tablet->pushOntoStack(url); | |
| 5773 | + } | |
| 5774 | + } | |
| 5775 | + //DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts"); | |
| 5790 | 5776 | //if (_runningScriptsWidget->isVisible()) { |
| 5791 | 5777 | // if (_runningScriptsWidget->hasFocus()) { |
| 5792 | 5778 | // _runningScriptsWidget->hide(); |
| @@ -5801,6 +5787,24 @@ void Application::toggleRunningScriptsWidget() const { · 8 unmodified lines | ||
| 5801 | 5787 | //} |
| 5802 | 5788 | } |
| 5803 | 5789 | |
| 5790 | +void Application::showScriptLogs() { | |
| 5791 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 5792 | + auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 5793 | + auto scriptEngines = DependencyManager::get<ScriptEngines>(); | |
| 5794 | + QUrl defaultScriptsLoc = defaultScriptsLocation(); | |
| 5795 | + defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "developer/debugging/debugWindow.js"); | |
| 5796 | + | |
| 5797 | + if (tablet->getToolbarMode()) { | |
| 5798 | + scriptEngines->loadScript(defaultScriptsLoc.toString()); | |
| 5799 | + } else { | |
| 5800 | + QQuickItem* tabletRoot = tablet->getTabletRoot(); | |
| 5801 | + if (!tabletRoot && !isHMDMode()) { | |
| 5802 | + scriptEngines->loadScript(defaultScriptsLoc.toString()); | |
| 5803 | + } else { | |
| 5804 | + tablet->pushOntoStack("../../hifi/dialogs/TabletDebugWindow.qml"); | |
| 5805 | + } | |
| 5806 | + } | |
| 5807 | +} | |
| 5804 | 5808 | |
| 5805 | 5809 | void Application::showAssetServerWidget(QString filePath) { |
| 5806 | 5810 | if (!DependencyManager::get<NodeList>()->getThisNodeCanWriteAssets()) { |
| @@ -5813,7 +5817,20 @@ void Application::showAssetServerWidget(QString filePath) { · 6 unmodified lines | ||
| 5813 | 5817 | emit uploadRequest(filePath); |
| 5814 | 5818 | } |
| 5815 | 5819 | }; |
| 5816 | − DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload); | |
| 5820 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 5821 | + auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 5822 | + auto hmd = DependencyManager::get<HMDScriptingInterface>(); | |
| 5823 | + if (tablet->getToolbarMode()) { | |
| 5824 | + DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload); | |
| 5825 | + } else { | |
| 5826 | + if (!hmd->getShouldShowTablet() && !isHMDMode()) { | |
| 5827 | + DependencyManager::get<OffscreenUi>()->show(url, "AssetServer", startUpload); | |
| 5828 | + } else { | |
| 5829 | + static const QUrl url("../../hifi/dialogs/TabletAssetServer.qml"); | |
| 5830 | + tablet->pushOntoStack(url); | |
| 5831 | + } | |
| 5832 | + } | |
| 5833 | + | |
| 5817 | 5834 | startUpload(nullptr, nullptr); |
| 5818 | 5835 | } |
| 5819 | 5836 | |
| @@ -5836,6 +5853,21 @@ void Application::addAssetToWorldFromURL(QString url) { · 16 unmodified lines | ||
| 5836 | 5853 | request->send(); |
| 5837 | 5854 | } |
| 5838 | 5855 | |
| 5856 | +void Application::showDialog(const QString& desktopURL, const QString& tabletURL, const QString& name) const { | |
| 5857 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 5858 | + auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 5859 | + auto hmd = DependencyManager::get<HMDScriptingInterface>(); | |
| 5860 | + if (tablet->getToolbarMode()) { | |
| 5861 | + DependencyManager::get<OffscreenUi>()->show(desktopURL, name); | |
| 5862 | + } else { | |
| 5863 | + tablet->pushOntoStack(tabletURL); | |
| 5864 | + if (!hmd->getShouldShowTablet() && !isHMDMode()) { | |
| 5865 | + hmd->openTablet(); | |
| 5866 | + } | |
| 5867 | + | |
| 5868 | + } | |
| 5869 | +} | |
| 5870 | + | |
| 5839 | 5871 | void Application::addAssetToWorldFromURLRequestFinished() { |
| 5840 | 5872 | auto request = qobject_cast<ResourceRequest*>(sender()); |
| 5841 | 5873 | auto url = request->getUrl().toString(); |
| @@ -6317,6 +6349,41 @@ void Application::loadScriptURLDialog() const { · 475 unmodified lines | ||
| 6317 | 6349 | } |
| 6318 | 6350 | } |
| 6319 | 6351 | |
| 6352 | +void Application::loadLODToolsDialog() { | |
| 6353 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 6354 | + auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 6355 | + if (tablet->getToolbarMode() || (!tablet->getTabletRoot() && !isHMDMode())) { | |
| 6356 | + auto dialogsManager = DependencyManager::get<DialogsManager>(); | |
| 6357 | + dialogsManager->lodTools(); | |
| 6358 | + } else { | |
| 6359 | + tablet->pushOntoStack("../../hifi/dialogs/TabletLODTools.qml"); | |
| 6360 | + } | |
| 6361 | + | |
| 6362 | +} | |
| 6363 | + | |
| 6364 | + | |
| 6365 | +void Application::loadEntityStatisticsDialog() { | |
| 6366 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 6367 | + auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 6368 | + if (tablet->getToolbarMode() || (!tablet->getTabletRoot() && !isHMDMode())) { | |
| 6369 | + auto dialogsManager = DependencyManager::get<DialogsManager>(); | |
| 6370 | + dialogsManager->octreeStatsDetails(); | |
| 6371 | + } else { | |
| 6372 | + tablet->pushOntoStack("../../hifi/dialogs/TabletEntityStatistics.qml"); | |
| 6373 | + } | |
| 6374 | +} | |
| 6375 | + | |
| 6376 | +void Application::loadDomainConnectionDialog() { | |
| 6377 | + auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | |
| 6378 | + auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | |
| 6379 | + if (tablet->getToolbarMode() || (!tablet->getTabletRoot() && !isHMDMode())) { | |
| 6380 | + auto dialogsManager = DependencyManager::get<DialogsManager>(); | |
| 6381 | + dialogsManager->showDomainConnectionDialog(); | |
| 6382 | + } else { | |
| 6383 | + tablet->pushOntoStack("../../hifi/dialogs/TabletDCDialog.qml"); | |
| 6384 | + } | |
| 6385 | +} | |
| 6386 | + | |
| 6320 | 6387 | void Application::toggleLogDialog() { |
| 6321 | 6388 | if (! _logDialog) { |
| 6322 | 6389 | _logDialog = new LogDialog(nullptr, getLogger()); |
| @@ -6903,6 +6970,7 @@ void Application::updateThreadPoolCount() const { · 580 unmodified lines | ||
| 6903 | 6970 | } |
| 6904 | 6971 | |
| 6905 | 6972 | void Application::updateSystemTabletMode() { |
| 6973 | + qApp->setProperty(hifi::properties::HMD, isHMDMode()); | |
| 6906 | 6974 | if (isHMDMode()) { |
| 6907 | 6975 | DependencyManager::get<TabletScriptingInterface>()->setToolbarMode(getHmdTabletBecomesToolbarSetting()); |
| 6908 | 6976 | } else { |