History

Merge branch 'master' into feature/secondary-pose-support

Anthony J. Thibault committed 9 years ago

Commit 98bbe882 parents 25b5cb4 732d0de92 files · +3460 −969Browse files

Showing the changes to interface/src/Application.cpp (1 of 92 files). Show all

Unified · Split

interface/src/Application.cpp+43−15
@@ -70,7 +70,7 @@ · 69 unmodified lines
7070 #include <EntityScriptClient.h>
7171 #include <EntityScriptServerLogClient.h>
7272 #include <EntityScriptingInterface.h>
73−#include <HoverOverlayInterface.h>
73+#include "ui/overlays/ContextOverlayInterface.h"
7474 #include <ErrorDialog.h>
7575 #include <FileScriptingInterface.h>
7676 #include <Finally.h>
@@ -595,7 +595,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 518 unmodified lines
595595 DependencyManager::set<Snapshot>();
596596 DependencyManager::set<CloseEventSender>();
597597 DependencyManager::set<ResourceManager>();
598− DependencyManager::set<HoverOverlayInterface>();
598+ DependencyManager::set<ContextOverlayInterface>();
599599
600600 return previousSessionCrashed;
601601 }
@@ -1324,12 +1324,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 722 unmodified lines
13241324 // Keyboard focus handling for Web overlays.
13251325 auto overlays = &(qApp->getOverlays());
13261326
1327− connect(overlays, &Overlays::mousePressOnOverlay, [=](OverlayID overlayID, const PointerEvent& event) {
1328− setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
1329− setKeyboardFocusOverlay(overlayID);
1327+ connect(overlays, &Overlays::mousePressOnOverlay, [=](const OverlayID& overlayID, const PointerEvent& event) {
1328+ auto thisOverlay = std::dynamic_pointer_cast<Web3DOverlay>(overlays->getOverlay(overlayID));
1329+ // Only Web overlays can have keyboard focus.
1330+ if (thisOverlay) {
1331+ setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
1332+ setKeyboardFocusOverlay(overlayID);
1333+ }
13301334 });
13311335
1332− connect(overlays, &Overlays::overlayDeleted, [=](OverlayID overlayID) {
1336+ connect(overlays, &Overlays::overlayDeleted, [=](const OverlayID& overlayID) {
13331337 if (overlayID == _keyboardFocusedOverlay.get()) {
13341338 setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID);
13351339 }
@@ -1344,6 +1348,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 8 unmodified lines
13441348 setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
13451349 });
13461350
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+
13471366 // Add periodic checks to send user activity data
13481367 static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000;
13491368 static int NEARBY_AVATAR_RADIUS_METERS = 10;
@@ -1470,7 +1489,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 120 unmodified lines
14701489 properties["atp_mapping_requests"] = atpMappingRequests;
14711490
14721491 properties["throttled"] = _displayPlugin ? _displayPlugin->isThrottled() : false;
1473−
1492+
14741493 QJsonObject bytesDownloaded;
14751494 bytesDownloaded["atp"] = statTracker->getStat(STAT_ATP_RESOURCE_TOTAL_BYTES).toInt();
14761495 bytesDownloaded["http"] = statTracker->getStat(STAT_HTTP_RESOURCE_TOTAL_BYTES).toInt();
@@ -2131,7 +2150,7 @@ void Application::initializeUi() { · 654 unmodified lines
21312150 surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
21322151
21332152 surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
2134− surfaceContext->setContextProperty("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
2153+ surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());
21352154
21362155 if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
21372156 surfaceContext->setContextProperty("Steam", new SteamScriptingInterface(engine, steamClient.get()));
@@ -2323,7 +2342,7 @@ void Application::paintGL() { · 185 unmodified lines
23232342 }
23242343 } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
23252344 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));
23272346
23282347 glm::quat hmdRotation = extractRotation(myAvatar->getHMDSensorMatrix());
23292348 // Mirror HMD yaw and roll
@@ -2345,7 +2364,7 @@ void Application::paintGL() { · 15 unmodified lines
23452364 + mirrorBodyOrientation * glm::vec3(0.0f, 0.0f, 1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror
23462365 + mirrorBodyOrientation * hmdOffset);
23472366 } else {
2348− _myCamera.setOrientation(myAvatar->getWorldAlignedOrientation()
2367+ _myCamera.setOrientation(myAvatar->getOrientation()
23492368 * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
23502369 _myCamera.setPosition(myAvatar->getDefaultEyePosition()
23512370 + glm::vec3(0, _raiseMirror * myAvatar->getUniformScale(), 0)
@@ -4482,11 +4501,9 @@ void Application::cameraModeChanged() { · 2130 unmodified lines
44824501 void Application::cameraMenuChanged() {
44834502 auto menu = Menu::getInstance();
44844503 if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {
4485− if (isHMDMode()) {
4486− menu->setIsOptionChecked(MenuOption::FullscreenMirror, false);
4487− menu->setIsOptionChecked(MenuOption::FirstPerson, true);
4488− } else if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
4504+ if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
44894505 _myCamera.setMode(CAMERA_MODE_MIRROR);
4506+ getMyAvatar()->reset(false, false, false); // to reset any active MyAvatar::FollowHelpers
44904507 }
44914508 } else if (menu->isOptionChecked(MenuOption::FirstPerson)) {
44924509 if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
@@ -5422,6 +5439,17 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 929 unmodified lines
54225439 }
54235440 renderArgs->_debugFlags = renderDebugFlags;
54245441 //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;
54255453 }
54265454 }
54275455
@@ -5885,7 +5913,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 457 unmodified lines
58855913 auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>();
58865914 scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data());
58875915 scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance());
5888− scriptEngine->registerGlobalObject("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
5916+ scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());
58895917
58905918 qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue);
58915919