History

Merge pull request #11016 from highfidelity/context-overlays

Context Overlays

Howard Stearns committed 9 years ago

Commit 71ce5a62 parents ddb7d0f 4b7779f32 files · +752 −337Browse files

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

Unified · Split

interface/src/Application.cpp+39−9
@@ -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()));
@@ -5397,6 +5416,17 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 3259 unmodified lines
53975416 }
53985417 renderArgs->_debugFlags = renderDebugFlags;
53995418 //ViveControllerManager::getInstance().updateRendering(renderArgs, _main3DScene, transaction);
5419+
5420+ RenderArgs::OutlineFlags renderOutlineFlags = RenderArgs::RENDER_OUTLINE_NONE;
5421+ auto contextOverlayInterface = DependencyManager::get<ContextOverlayInterface>();
5422+ if (contextOverlayInterface->getEnabled()) {
5423+ if (DependencyManager::get<ContextOverlayInterface>()->getIsInMarketplaceInspectionMode()) {
5424+ renderOutlineFlags = RenderArgs::RENDER_OUTLINE_MARKETPLACE_MODE;
5425+ } else {
5426+ renderOutlineFlags = RenderArgs::RENDER_OUTLINE_WIREFRAMES;
5427+ }
5428+ }
5429+ renderArgs->_outlineFlags = renderOutlineFlags;
54005430 }
54015431 }
54025432
@@ -5860,7 +5890,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 457 unmodified lines
58605890 auto entityScriptServerLog = DependencyManager::get<EntityScriptServerLogClient>();
58615891 scriptEngine->registerGlobalObject("EntityScriptServerLog", entityScriptServerLog.data());
58625892 scriptEngine->registerGlobalObject("AvatarInputs", AvatarInputs::getInstance());
5863− scriptEngine->registerGlobalObject("HoverOverlay", DependencyManager::get<HoverOverlayInterface>().data());
5893+ scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());
58645894
58655895 qScriptRegisterMetaType(scriptEngine, OverlayIDtoScriptValue, OverlayIDfromScriptValue);
58665896

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t