Showing the changes to interface/src/Application.cpp (1 of 92 files). Show all
Unified · Split
| @@ -70,7 +70,7 @@ · 69 unmodified lines | |||
| 70 | #include <EntityScriptClient.h> | 70 | #include <EntityScriptClient.h> |
| 71 | #include <EntityScriptServerLogClient.h> | 71 | #include <EntityScriptServerLogClient.h> |
| 72 | #include <EntityScriptingInterface.h> | 72 | #include <EntityScriptingInterface.h> |
| 73 | #include <HoverOverlayInterface.h> | 73 | #include "ui/overlays/ContextOverlayInterface.h" |
| 74 | #include <ErrorDialog.h> | 74 | #include <ErrorDialog.h> |
| 75 | #include <FileScriptingInterface.h> | 75 | #include <FileScriptingInterface.h> |
| 76 | #include <Finally.h> | 76 | #include <Finally.h> |
| @@ -595,7 +595,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 518 unmodified lines | |||
| 595 | DependencyManager::set<Snapshot>(); | 595 | DependencyManager::set<Snapshot>(); |
| 596 | DependencyManager::set<CloseEventSender>(); | 596 | DependencyManager::set<CloseEventSender>(); |
| 597 | DependencyManager::set<ResourceManager>(); | 597 | DependencyManager::set<ResourceManager>(); |
| 598 | DependencyManager::set<HoverOverlayInterface>(); | 598 | DependencyManager::set<ContextOverlayInterface>(); |
| 599 | 599 | ||
| 600 | return previousSessionCrashed; | 600 | return previousSessionCrashed; |
| 601 | } | 601 | } |
| @@ -1324,12 +1324,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 722 unmodified lines | |||
| 1324 | // Keyboard focus handling for Web overlays. | 1324 | // Keyboard focus handling for Web overlays. |
| 1325 | auto overlays = &(qApp->getOverlays()); | 1325 | auto overlays = &(qApp->getOverlays()); |
| 1326 | 1326 | ||
| 1327 | connect(overlays, &Overlays::mousePressOnOverlay, [=](OverlayID overlayID, const PointerEvent& event) { | 1327 | connect(overlays, &Overlays::mousePressOnOverlay, [=](const OverlayID& overlayID, const PointerEvent& event) { |
| 1328 | setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); | 1328 | auto thisOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays->getOverlay(overlayID)); |
| 1329 | setKeyboardFocusOverlay(overlayID); | 1329 | // Only Web overlays can have keyboard focus. |
| 1330 | if (thisOverlay) { | ||
| 1331 | setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); | ||
| 1332 | setKeyboardFocusOverlay(overlayID); | ||
| 1333 | } | ||
| 1330 | }); | 1334 | }); |
| 1331 | 1335 | ||
| 1332 | connect(overlays, &Overlays::overlayDeleted, [=](OverlayID overlayID) { | 1336 | connect(overlays, &Overlays::overlayDeleted, [=](const OverlayID& overlayID) { |
| 1333 | if (overlayID == _keyboardFocusedOverlay.get()) { | 1337 | if (overlayID == _keyboardFocusedOverlay.get()) { |
| 1334 | setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); | 1338 | setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); |
| 1335 | } | 1339 | } |
| @@ -1344,6 +1348,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 8 unmodified lines | |||
| 1344 | setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); | 1348 | setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); |
| 1345 | }); | 1349 | }); |
| 1346 | 1350 | ||
| 1351 | connect(overlays, | ||
| 1352 | SIGNAL(mousePressOnOverlay(const OverlayID&, const PointerEvent&)), | ||
| 1353 | DependencyManager::get<ContextOverlayInterface>().data(), | ||
| 1354 | SLOT(contextOverlays_mousePressOnOverlay(const OverlayID&, const PointerEvent&))); | ||
| 1355 | |||
| 1356 | connect(overlays, | ||
| 1357 | SIGNAL(hoverEnterOverlay(const OverlayID&, const PointerEvent&)), | ||
| 1358 | DependencyManager::get<ContextOverlayInterface>().data(), | ||
| 1359 | SLOT(contextOverlays_hoverEnterOverlay(const OverlayID&, const PointerEvent&))); | ||
| 1360 | |||
| 1361 | connect(overlays, | ||
| 1362 | SIGNAL(hoverLeaveOverlay(const OverlayID&, const PointerEvent&)), | ||
| 1363 | DependencyManager::get<ContextOverlayInterface>().data(), | ||
| 1364 | SLOT(contextOverlays_hoverLeaveOverlay(const OverlayID&, const PointerEvent&))); | ||
| 1365 | |||
| 1347 | // Add periodic checks to send user activity data | 1366 | // Add periodic checks to send user activity data |
| 1348 | static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000; | 1367 | static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000; |
| 1349 | static int NEARBY_AVATAR_RADIUS_METERS = 10; | 1368 | static int NEARBY_AVATAR_RADIUS_METERS = 10; |
| @@ -1470,7 +1489,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 120 unmodified lines | |||
| 1470 | properties["atp_mapping_requests"] = atpMappingRequests; | 1489 | properties["atp_mapping_requests"] = atpMappingRequests; |
| 1471 | 1490 | ||
| 1472 | properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false; | 1491 | properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false; |
| 1473 | 1492 | ||
| 1474 | QJsonObject bytesDownloaded; | 1493 | QJsonObject bytesDownloaded; |
| 1475 | bytesDownloaded["atp"] = statTracker->getStat(STAT_ATP_RESOURCE_TOTAL_BYTES).toInt(); | 1494 | bytesDownloaded["atp"] = statTracker->getStat(STAT_ATP_RESOURCE_TOTAL_BYTES).toInt(); |
| 1476 | bytesDownloaded["http"] = statTracker->getStat(STAT_HTTP_RESOURCE_TOTAL_BYTES).toInt(); | 1495 | bytesDownloaded["http"] = statTracker->getStat(STAT_HTTP_RESOURCE_TOTAL_BYTES).toInt(); |
| @@ -2131,7 +2150,7 @@ void Application::initializeUi() { · 654 unmodified lines | |||
| 2131 | surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor()); | 2150 | surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor()); |
| 2132 | 2151 | ||
| 2133 | surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); | 2152 | surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); |
| 2134 | surfaceContext->setContextProperty("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data()); | 2153 | surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data()); |
| 2135 | 2154 | ||
| 2136 | if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) { | 2155 | if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) { |
| 2137 | surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get())); | 2156 | surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get())); |
| @@ -2323,7 +2342,7 @@ void Application::paintGL() { · 185 unmodified lines | |||
| 2323 | } | 2342 | } |
| 2324 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { | 2343 | } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 2325 | if (isHMDMode()) { | 2344 | if (isHMDMode()) { |
| 2326 | auto mirrorBodyOrientation = myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)); | 2345 | auto mirrorBodyOrientation = myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)); |
| 2327 | 2346 | ||
| 2328 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); | 2347 | glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix()); |
| 2329 | // Mirror HMD yaw and roll | 2348 | // Mirror HMD yaw and roll |
| @@ -2345,7 +2364,7 @@ void Application::paintGL() { · 15 unmodified lines | |||
| 2345 | + mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror | 2364 | + mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror |
| 2346 | + mirrorBodyOrientation * hmdOffset); | 2365 | + mirrorBodyOrientation * hmdOffset); |
| 2347 | } else { | 2366 | } else { |
| 2348 | _myCamera.setOrientation(myAvatar->getWorldAlignedOrientation() | 2367 | _myCamera.setOrientation(myAvatar->getOrientation() |
| 2349 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); | 2368 | * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); |
| 2350 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() | 2369 | _myCamera.setPosition(myAvatar->getDefaultEyePosition() |
| 2351 | + glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0) | 2370 | + glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0) |
| @@ -4482,11 +4501,9 @@ void Application::cameraModeChanged() { · 2130 unmodified lines | |||
| 4482 | void Application::cameraMenuChanged() { | 4501 | void Application::cameraMenuChanged() { |
| 4483 | auto menu = Menu::getInstance(); | 4502 | auto menu = Menu::getInstance(); |
| 4484 | if (menu->isOptionChecked(MenuOption::FullscreenMirror)) { | 4503 | if (menu->isOptionChecked(MenuOption::FullscreenMirror)) { |
| 4485 | if (isHMDMode()) { | 4504 | if (_myCamera.getMode() != CAMERA_MODE_MIRROR) { |
| 4486 | menu->setIsOptionChecked(MenuOption::FullscreenMirror, false); | ||
| 4487 | menu->setIsOptionChecked(MenuOption::FirstPerson, true); | ||
| 4488 | } else if (_myCamera.getMode() != CAMERA_MODE_MIRROR) { | ||
| 4489 | _myCamera.setMode(CAMERA_MODE_MIRROR); | 4505 | _myCamera.setMode(CAMERA_MODE_MIRROR); |
| 4506 | getMyAvatar()->reset(false, false, false); // to reset any active MyAvatar::FollowHelpers | ||
| 4490 | } | 4507 | } |
| 4491 | } else if (menu->isOptionChecked(MenuOption::FirstPerson)) { | 4508 | } else if (menu->isOptionChecked(MenuOption::FirstPerson)) { |
| 4492 | if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { | 4509 | if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) { |
| @@ -5422,6 +5439,17 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 929 unmodified lines | |||
| 5422 | } | 5439 | } |
| 5423 | renderArgs->_debugFlags = renderDebugFlags; | 5440 | renderArgs->_debugFlags = renderDebugFlags; |
| 5424 | //ViveControllerManager::getInstance().updateRendering(renderArgs, _main3DScene, transaction); | 5441 | //ViveControllerManager::getInstance().updateRendering(renderArgs, _main3DScene, transaction); |
| 5442 | |||
| 5443 | RenderArgs::OutlineFlags renderOutlineFlags = RenderArgs::RENDER_OUTLINE_NONE; | ||
| 5444 | auto contextOverlayInterface = DependencyManager::get<ContextOverlayInterface>(); | ||
| 5445 | if (contextOverlayInterface->getEnabled()) { | ||
| 5446 | if (DependencyManager::get<ContextOverlayInterface>()->getIsInMarketplaceInspectionMode()) { | ||
| 5447 | renderOutlineFlags = RenderArgs::RENDER_OUTLINE_MARKETPLACE_MODE; | ||
| 5448 | } else { | ||
| 5449 | renderOutlineFlags = RenderArgs::RENDER_OUTLINE_WIREFRAMES; | ||
| 5450 | } | ||
| 5451 | } | ||
| 5452 | renderArgs->_outlineFlags = renderOutlineFlags; | ||
| 5425 | } | 5453 | } |
| 5426 | } | 5454 | } |
| 5427 | 5455 | ||
| @@ -5885,7 +5913,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 457 unmodified lines | |||
| 5885 | auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>(); | 5913 | auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>(); |
| 5886 | scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data()); | 5914 | scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data()); |
| 5887 | scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance()); | 5915 | scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance()); |
| 5888 | scriptEngine->registerGlobalObject("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data()); | 5916 | scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data()); |
| 5889 | 5917 | ||
| 5890 | qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue); | 5918 | qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue); |
| 5891 | 5919 | ||