History

Merge remote-tracking branch 'upstream/master' into destroy

SamGondelman committed 8 years ago

Commit 8a9c27e2 parents d2699e8 7905c91476 files · +19958 −8214Browse files

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

Unified · Split

interface/src/Application.cpp+92−21
@@ -30,6 +30,7 @@ · 29 unmodified lines
30#include <QtCore/QFileSelector>30#include <QtCore/QFileSelector>
31#include <QtConcurrent/QtConcurrentRun>31#include <QtConcurrent/QtConcurrentRun>
32 32
33#include <QtGui/QClipboard>
33#include <QtGui/QScreen>34#include <QtGui/QScreen>
34#include <QtGui/QWindow>35#include <QtGui/QWindow>
35#include <QtGui/QDesktopServices>36#include <QtGui/QDesktopServices>
@@ -62,6 +63,7 @@ · 26 unmodified lines
62#include <AddressManager.h>63#include <AddressManager.h>
63#include <AnimDebugDraw.h>64#include <AnimDebugDraw.h>
64#include <BuildInfo.h>65#include <BuildInfo.h>
66#include <AnimationCacheScriptingInterface.h>
65#include <AssetClient.h>67#include <AssetClient.h>
66#include <AssetUpload.h>68#include <AssetUpload.h>
67#include <AutoUpdater.h>69#include <AutoUpdater.h>
@@ -97,6 +99,8 @@ · 29 unmodified lines
97#include <MainWindow.h>99#include <MainWindow.h>
98#include <MappingRequest.h>100#include <MappingRequest.h>
99#include <MessagesClient.h>101#include <MessagesClient.h>
102#include <model-networking/ModelCacheScriptingInterface.h>
103#include <model-networking/TextureCacheScriptingInterface.h>
100#include <ModelEntityItem.h>104#include <ModelEntityItem.h>
101#include <NetworkAccessManager.h>105#include <NetworkAccessManager.h>
102#include <NetworkingConstants.h>106#include <NetworkingConstants.h>
@@ -126,9 +130,10 @@ · 23 unmodified lines
126#include <ScriptEngines.h>130#include <ScriptEngines.h>
127#include <ScriptCache.h>131#include <ScriptCache.h>
128#include <ShapeEntityItem.h>132#include <ShapeEntityItem.h>
129#include <SoundCache.h>133#include <SoundCacheScriptingInterface.h>
130#include <ui/TabletScriptingInterface.h>134#include <ui/TabletScriptingInterface.h>
131#include <ui/ToolbarScriptingInterface.h>135#include <ui/ToolbarScriptingInterface.h>
136#include <InteractiveWindow.h>
132#include <Tooltip.h>137#include <Tooltip.h>
133#include <udt/PacketHeaders.h>138#include <udt/PacketHeaders.h>
134#include <UserActivityLogger.h>139#include <UserActivityLogger.h>
@@ -141,6 +146,7 @@ · 6 unmodified lines
141#include <QmlFragmentClass.h>146#include <QmlFragmentClass.h>
142#include <Preferences.h>147#include <Preferences.h>
143#include <display-plugins/CompositorHelper.h>148#include <display-plugins/CompositorHelper.h>
149#include <display-plugins/hmd/HmdDisplayPlugin.h>
144#include <trackers/EyeTracker.h>150#include <trackers/EyeTracker.h>
145#include <avatars-renderer/ScriptAvatar.h>151#include <avatars-renderer/ScriptAvatar.h>
146#include <RenderableEntityItem.h>152#include <RenderableEntityItem.h>
@@ -864,16 +870,20 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 717 unmodified lines
864 DependencyManager::set<recording::ClipCache>();870 DependencyManager::set<recording::ClipCache>();
865 DependencyManager::set<GeometryCache>();871 DependencyManager::set<GeometryCache>();
866 DependencyManager::set<ModelCache>();872 DependencyManager::set<ModelCache>();
873 DependencyManager::set<ModelCacheScriptingInterface>();
867 DependencyManager::set<ScriptCache>();874 DependencyManager::set<ScriptCache>();
868 DependencyManager::set<SoundCache>();875 DependencyManager::set<SoundCache>();
876 DependencyManager::set<SoundCacheScriptingInterface>();
869 DependencyManager::set<DdeFaceTracker>();877 DependencyManager::set<DdeFaceTracker>();
870 DependencyManager::set<EyeTracker>();878 DependencyManager::set<EyeTracker>();
871 DependencyManager::set<AudioClient>();879 DependencyManager::set<AudioClient>();
872 DependencyManager::set<AudioScope>();880 DependencyManager::set<AudioScope>();
873 DependencyManager::set<DeferredLightingEffect>();881 DependencyManager::set<DeferredLightingEffect>();
874 DependencyManager::set<TextureCache>();882 DependencyManager::set<TextureCache>();
883 DependencyManager::set<TextureCacheScriptingInterface>();
875 DependencyManager::set<FramebufferCache>();884 DependencyManager::set<FramebufferCache>();
876 DependencyManager::set<AnimationCache>();885 DependencyManager::set<AnimationCache>();
886 DependencyManager::set<AnimationCacheScriptingInterface>();
877 DependencyManager::set<ModelBlender>();887 DependencyManager::set<ModelBlender>();
878 DependencyManager::set<UsersScriptingInterface>();888 DependencyManager::set<UsersScriptingInterface>();
879 DependencyManager::set<AvatarManager>();889 DependencyManager::set<AvatarManager>();
@@ -1072,6 +1082,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 192 unmodified lines
1072 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Regular.ttf");1082 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Regular.ttf");
1073 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Bold.ttf");1083 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Bold.ttf");
1074 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-SemiBold.ttf");1084 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-SemiBold.ttf");
1085 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Cairo-SemiBold.ttf");
1075 _window->setWindowTitle("High Fidelity Interface");1086 _window->setWindowTitle("High Fidelity Interface");
1076 1087
1077 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us1088 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
@@ -1449,8 +1460,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 371 unmodified lines
1449 // add firstRun flag from settings to launch event1460 // add firstRun flag from settings to launch event
1450 Setting::Handle<bool> firstRun { Settings::firstRun, true };1461 Setting::Handle<bool> firstRun { Settings::firstRun, true };
1451 1462
1452 QString machineFingerPrint = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint());
1453
1454 auto& userActivityLogger = UserActivityLogger::getInstance();1463 auto& userActivityLogger = UserActivityLogger::getInstance();
1455 if (userActivityLogger.isEnabled()) {1464 if (userActivityLogger.isEnabled()) {
1456 // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value.1465 // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value.
@@ -1502,13 +1511,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 45 unmodified lines
1502 properties["first_run"] = firstRun.get();1511 properties["first_run"] = firstRun.get();
1503 1512
1504 // add the user's machine ID to the launch event1513 // add the user's machine ID to the launch event
1514 QString machineFingerPrint = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint());
1505 properties["machine_fingerprint"] = machineFingerPrint;1515 properties["machine_fingerprint"] = machineFingerPrint;
1506 1516
1507 userActivityLogger.logAction("launch", properties);1517 userActivityLogger.logAction("launch", properties);
1508 }1518 }
1509 1519
1510 setCrashAnnotation("machine_fingerprint", machineFingerPrint.toStdString());
1511
1512 _entityEditSender.setMyAvatar(myAvatar.get());1520 _entityEditSender.setMyAvatar(myAvatar.get());
1513 1521
1514 // The entity octree will have to know about MyAvatar for the parentJointName import1522 // The entity octree will have to know about MyAvatar for the parentJointName import
@@ -2130,6 +2138,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 615 unmodified lines
2130 || ((rightHandPose.valid || lastRightHandPose.valid) && (rightHandPose != lastRightHandPose));2138 || ((rightHandPose.valid || lastRightHandPose.valid) && (rightHandPose != lastRightHandPose));
2131 lastLeftHandPose = leftHandPose;2139 lastLeftHandPose = leftHandPose;
2132 lastRightHandPose = rightHandPose;2140 lastRightHandPose = rightHandPose;
2141 properties["avatar_identity_requests_sent"] = DependencyManager::get<AvatarManager>()->getIdentityRequestsSent();
2133 2142
2134 UserActivityLogger::getInstance().logAction("stats", properties);2143 UserActivityLogger::getInstance().logAction("stats", properties);
2135 });2144 });
@@ -2266,6 +2275,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 130 unmodified lines
2266 qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());2275 qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
2267 2276
2268#if defined(Q_OS_ANDROID)2277#if defined(Q_OS_ANDROID)
2278 connect(&AndroidHelper::instance(), &AndroidHelper::beforeEnterBackground, this, &Application::beforeEnterBackground);
2269 connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);2279 connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);
2270 connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);2280 connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
2271 AndroidHelper::instance().notifyLoadComplete();2281 AndroidHelper::instance().notifyLoadComplete();
@@ -2575,12 +2585,18 @@ Application::~Application() { · 303 unmodified lines
2575 2585
2576 DependencyManager::destroy<CompositorHelper>(); // must be destroyed before the FramebufferCache2586 DependencyManager::destroy<CompositorHelper>(); // must be destroyed before the FramebufferCache
2577 2587
2588 DependencyManager::destroy<SoundCacheScriptingInterface>();
2589
2578 DependencyManager::destroy<AvatarManager>();2590 DependencyManager::destroy<AvatarManager>();
2591 DependencyManager::destroy<AnimationCacheScriptingInterface>();
2579 DependencyManager::destroy<AnimationCache>();2592 DependencyManager::destroy<AnimationCache>();
2580 DependencyManager::destroy<FramebufferCache>();2593 DependencyManager::destroy<FramebufferCache>();
2594 DependencyManager::destroy<TextureCacheScriptingInterface>();
2581 DependencyManager::destroy<TextureCache>();2595 DependencyManager::destroy<TextureCache>();
2596 DependencyManager::destroy<ModelCacheScriptingInterface>();
2582 DependencyManager::destroy<ModelCache>();2597 DependencyManager::destroy<ModelCache>();
2583 DependencyManager::destroy<ScriptCache>();2598 DependencyManager::destroy<ScriptCache>();
2599 DependencyManager::destroy<SoundCacheScriptingInterface>();
2584 DependencyManager::destroy<SoundCache>();2600 DependencyManager::destroy<SoundCache>();
2585 DependencyManager::destroy<OctreeStatsProvider>();2601 DependencyManager::destroy<OctreeStatsProvider>();
2586 DependencyManager::destroy<GeometryCache>();2602 DependencyManager::destroy<GeometryCache>();
@@ -2730,6 +2746,10 @@ void Application::initializeDisplayPlugins() { · 143 unmodified lines
2730 QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged,2746 QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged,
2731 [this](const QSize& size) { resizeGL(); });2747 [this](const QSize& size) { resizeGL(); });
2732 QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset);2748 QObject::connect(displayPlugin.get(), &DisplayPlugin::resetSensorsRequested, this, &Application::requestReset);
2749 if (displayPlugin->isHmd()) {
2750 QObject::connect(dynamic_cast<HmdDisplayPlugin*>(displayPlugin.get()), &HmdDisplayPlugin::hmdMountedChanged,
2751 DependencyManager::get<HMDScriptingInterface>().data(), &HMDScriptingInterface::mountedChanged);
2752 }
2733 }2753 }
2734 2754
2735 // The default display plugin needs to be activated first, otherwise the display plugin thread2755 // The default display plugin needs to be activated first, otherwise the display plugin thread
@@ -2994,6 +3014,7 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 258 unmodified lines
2994 3014
2995 surfaceContext->setContextProperty("Overlays", &_overlays);3015 surfaceContext->setContextProperty("Overlays", &_overlays);
2996 surfaceContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());3016 surfaceContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
3017 surfaceContext->setContextProperty("Desktop", DependencyManager::get<DesktopScriptingInterface>().data());
2997 surfaceContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());3018 surfaceContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
2998 surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());3019 surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
2999 surfaceContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());3020 surfaceContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
@@ -3001,10 +3022,11 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 1 unmodified line
3001 surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());3022 surfaceContext->setContextProperty("LocationBookmarks", DependencyManager::get<LocationBookmarks>().data());
3002 3023
3003 // Caches3024 // Caches
3004 surfaceContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data());3025 surfaceContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data());
3005 surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data());3026 surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCacheScriptingInterface>().data());
3006 surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data());3027 surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCacheScriptingInterface>().data());
3007 surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());3028 surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
3029
3008 surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());3030 surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
3009 3031
3010 surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED3032 surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED
@@ -3233,6 +3255,7 @@ void Application::setSettingConstrainToolbarPosition(bool setting) { · 222 unmodified lines
3233void Application::showHelp() {3255void Application::showHelp() {
3234 static const QString HAND_CONTROLLER_NAME_VIVE = "vive";3256 static const QString HAND_CONTROLLER_NAME_VIVE = "vive";
3235 static const QString HAND_CONTROLLER_NAME_OCULUS_TOUCH = "oculus";3257 static const QString HAND_CONTROLLER_NAME_OCULUS_TOUCH = "oculus";
3258 static const QString HAND_CONTROLLER_NAME_WINDOWS_MR = "windowsMR";
3236 3259
3237 static const QString TAB_KEYBOARD_MOUSE = "kbm";3260 static const QString TAB_KEYBOARD_MOUSE = "kbm";
3238 static const QString TAB_GAMEPAD = "gamepad";3261 static const QString TAB_GAMEPAD = "gamepad";
@@ -3247,9 +3270,13 @@ void Application::showHelp() { · 8 unmodified lines
3247 } else if (PluginUtils::isOculusTouchControllerAvailable()) {3270 } else if (PluginUtils::isOculusTouchControllerAvailable()) {
3248 defaultTab = TAB_HAND_CONTROLLERS;3271 defaultTab = TAB_HAND_CONTROLLERS;
3249 handControllerName = HAND_CONTROLLER_NAME_OCULUS_TOUCH;3272 handControllerName = HAND_CONTROLLER_NAME_OCULUS_TOUCH;
3273 } else if (qApp->getActiveDisplayPlugin()->getName() == "WindowMS") {
3274 defaultTab = TAB_HAND_CONTROLLERS;
3275 handControllerName = HAND_CONTROLLER_NAME_WINDOWS_MR;
3250 } else if (PluginUtils::isXboxControllerAvailable()) {3276 } else if (PluginUtils::isXboxControllerAvailable()) {
3251 defaultTab = TAB_GAMEPAD;3277 defaultTab = TAB_GAMEPAD;
3252 }3278 }
3279 // TODO need some way to detect windowsMR to load controls reference default tab in Help > Controls Reference menu.
3253 3280
3254 QUrlQuery queryString;3281 QUrlQuery queryString;
3255 queryString.addQueryItem("handControllerName", handControllerName);3282 queryString.addQueryItem("handControllerName", handControllerName);
@@ -3274,13 +3301,22 @@ void Application::resizeGL() { · 18 unmodified lines
3274 // Set the desired FBO texture size. If it hasn't changed, this does nothing.3301 // Set the desired FBO texture size. If it hasn't changed, this does nothing.
3275 // Otherwise, it must rebuild the FBOs3302 // Otherwise, it must rebuild the FBOs
3276 uvec2 framebufferSize = displayPlugin->getRecommendedRenderSize();3303 uvec2 framebufferSize = displayPlugin->getRecommendedRenderSize();
3277 float renderResolutionScale = getRenderResolutionScale();3304 uvec2 renderSize = uvec2(framebufferSize);
3278 uvec2 renderSize = uvec2(vec2(framebufferSize) * renderResolutionScale);
3279 if (_renderResolution != renderSize) {3305 if (_renderResolution != renderSize) {
3280 _renderResolution = renderSize;3306 _renderResolution = renderSize;
3281 DependencyManager::get<FramebufferCache>()->setFrameBufferSize(fromGlm(renderSize));3307 DependencyManager::get<FramebufferCache>()->setFrameBufferSize(fromGlm(renderSize));
3282 }3308 }
3283 3309
3310 auto renderResolutionScale = getRenderResolutionScale();
3311 if (displayPlugin->getRenderResolutionScale() != renderResolutionScale) {
3312 auto renderConfig = _renderEngine->getConfiguration();
3313 assert(renderConfig);
3314 auto mainView = renderConfig->getConfig("RenderMainView.RenderDeferredTask");
3315 assert(mainView);
3316 mainView->setProperty("resolutionScale", renderResolutionScale);
3317 displayPlugin->setRenderResolutionScale(renderResolutionScale);
3318 }
3319
3284 // FIXME the aspect ratio for stereo displays is incorrect based on this.3320 // FIXME the aspect ratio for stereo displays is incorrect based on this.
3285 float aspectRatio = displayPlugin->getRecommendedAspectRatio();3321 float aspectRatio = displayPlugin->getRecommendedAspectRatio();
3286 _myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()), aspectRatio,3322 _myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()), aspectRatio,
@@ -3292,7 +3328,6 @@ void Application::resizeGL() { · 5 unmodified lines
3292 }3328 }
3293 3329
3294 DependencyManager::get<OffscreenUi>()->resize(fromGlm(displayPlugin->getRecommendedUiSize()));3330 DependencyManager::get<OffscreenUi>()->resize(fromGlm(displayPlugin->getRecommendedUiSize()));
3295 displayPlugin->setRenderResolutionScale(renderResolutionScale);
3296}3331}
3297 3332
3298void Application::handleSandboxStatus(QNetworkReply* reply) {3333void Application::handleSandboxStatus(QNetworkReply* reply) {
@@ -3652,6 +3687,10 @@ bool Application::event(QEvent* event) { · 353 unmodified lines
3652 3687
3653bool Application::eventFilter(QObject* object, QEvent* event) {3688bool Application::eventFilter(QObject* object, QEvent* event) {
3654 3689
3690 if (_aboutToQuit) {
3691 return true;
3692 }
3693
3655 if (event->type() == QEvent::Leave) {3694 if (event->type() == QEvent::Leave) {
3656 getApplicationCompositor().handleLeaveEvent();3695 getApplicationCompositor().handleLeaveEvent();
3657 }3696 }
@@ -4031,7 +4070,18 @@ void Application::mousePressEvent(QMouseEvent* event) { · 373 unmodified lines
4031 return;4070 return;
4032 }4071 }
4033 4072
4073#if defined(Q_OS_MAC)
4074 // Fix for OSX right click dragging on window when coming from a native window
4075 bool isFocussed = hasFocus();
4076 if (!isFocussed && event->button() == Qt::MouseButton::RightButton) {
4077 setFocus();
4078 isFocussed = true;
4079 }
4080
4081 if (isFocussed) {
4082#else
4034 if (hasFocus()) {4083 if (hasFocus()) {
4084#endif
4035 if (_keyboardMouseDevice->isActive()) {4085 if (_keyboardMouseDevice->isActive()) {
4036 _keyboardMouseDevice->mousePressEvent(event);4086 _keyboardMouseDevice->mousePressEvent(event);
4037 }4087 }
@@ -4818,6 +4868,7 @@ void Application::loadSettings() { · 780 unmodified lines
4818 }4868 }
4819 4869
4820 isFirstPerson = (qApp->isHMDMode());4870 isFirstPerson = (qApp->isHMDMode());
4871
4821 } else {4872 } else {
4822 // if this is not the first run, the camera will be initialized differently depending on user settings4873 // if this is not the first run, the camera will be initialized differently depending on user settings
4823 4874
@@ -5265,7 +5316,7 @@ void Application::setKeyboardFocusHighlight(const glm::vec3& position, const glm · 441 unmodified lines
5265 _keyboardFocusHighlight->setPulseMin(0.5);5316 _keyboardFocusHighlight->setPulseMin(0.5);
5266 _keyboardFocusHighlight->setPulseMax(1.0);5317 _keyboardFocusHighlight->setPulseMax(1.0);
5267 _keyboardFocusHighlight->setColorPulse(1.0);5318 _keyboardFocusHighlight->setColorPulse(1.0);
5268 _keyboardFocusHighlight->setIgnoreRayIntersection(true);5319 _keyboardFocusHighlight->setIgnorePickIntersection(true);
5269 _keyboardFocusHighlight->setDrawInFront(false);5320 _keyboardFocusHighlight->setDrawInFront(false);
5270 _keyboardFocusHighlightID = getOverlays().addOverlay(_keyboardFocusHighlight);5321 _keyboardFocusHighlightID = getOverlays().addOverlay(_keyboardFocusHighlight);
5271 }5322 }
@@ -6169,6 +6220,9 @@ PickRay Application::computePickRay(float x, float y) const { · 897 unmodified lines
6169 getApplicationCompositor().computeHmdPickRay(pickPoint, result.origin, result.direction);6220 getApplicationCompositor().computeHmdPickRay(pickPoint, result.origin, result.direction);
6170 } else {6221 } else {
6171 pickPoint /= getCanvasSize();6222 pickPoint /= getCanvasSize();
6223 if (_myCamera.getMode() == CameraMode::CAMERA_MODE_MIRROR) {
6224 pickPoint.x = 1.0f - pickPoint.x;
6225 }
6172 QMutexLocker viewLocker(&_viewMutex);6226 QMutexLocker viewLocker(&_viewMutex);
6173 _viewFrustum.computePickRay(pickPoint.x, pickPoint.y, result.origin, result.direction);6227 _viewFrustum.computePickRay(pickPoint.x, pickPoint.y, result.origin, result.direction);
6174 }6228 }
@@ -6504,9 +6558,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 329 unmodified lines
6504 entityScriptingInterface->setPacketSender(&_entityEditSender);6558 entityScriptingInterface->setPacketSender(&_entityEditSender);
6505 entityScriptingInterface->setEntityTree(getEntities()->getTree());6559 entityScriptingInterface->setEntityTree(getEntities()->getTree());
6506 6560
6507 // give the script engine to the RecordingScriptingInterface for its callbacks
6508 DependencyManager::get<RecordingScriptingInterface>()->setScriptEngine(scriptEngine);
6509
6510 if (property(hifi::properties::TEST).isValid()) {6561 if (property(hifi::properties::TEST).isValid()) {
6511 scriptEngine->registerGlobalObject("Test", TestScriptingInterface::getInstance());6562 scriptEngine->registerGlobalObject("Test", TestScriptingInterface::getInstance());
6512 }6563 }
@@ -6580,10 +6631,10 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 67 unmodified lines
6580 scriptEngine->registerGlobalObject("Pointers", DependencyManager::get<PointerScriptingInterface>().data());6631 scriptEngine->registerGlobalObject("Pointers", DependencyManager::get<PointerScriptingInterface>().data());
6581 6632
6582 // Caches6633 // Caches
6583 scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());6634 scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCacheScriptingInterface>().data());
6584 scriptEngine->registerGlobalObject("TextureCache", DependencyManager::get<TextureCache>().data());6635 scriptEngine->registerGlobalObject("TextureCache", DependencyManager::get<TextureCacheScriptingInterface>().data());
6585 scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCache>().data());6636 scriptEngine->registerGlobalObject("ModelCache", DependencyManager::get<ModelCacheScriptingInterface>().data());
6586 scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCache>().data());6637 scriptEngine->registerGlobalObject("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
6587 6638
6588 scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface);6639 scriptEngine->registerGlobalObject("DialogsManager", _dialogsManagerScriptingInterface);
6589 6640
@@ -6642,6 +6693,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 52 unmodified lines
6642 6693
6643 qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue);6694 qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue);
6644 6695
6696 registerInteractiveWindowMetaType(scriptEngine.data());
6697
6645 DependencyManager::get<PickScriptingInterface>()->registerMetaTypes(scriptEngine.data());6698 DependencyManager::get<PickScriptingInterface>()->registerMetaTypes(scriptEngine.data());
6646 6699
6647 // connect this script engines printedMessage signal to the global ScriptEngines these various messages6700 // connect this script engines printedMessage signal to the global ScriptEngines these various messages
@@ -7622,7 +7675,6 @@ void Application::toggleEntityScriptServerLogDialog() { · 974 unmodified lines
7622 7675
7623void Application::loadAddAvatarBookmarkDialog() const {7676void Application::loadAddAvatarBookmarkDialog() const {
7624 auto avatarBookmarks = DependencyManager::get<AvatarBookmarks>();7677 auto avatarBookmarks = DependencyManager::get<AvatarBookmarks>();
7625 avatarBookmarks->addBookmark();
7626}7678}
7627 7679
7628void Application::loadAvatarBrowser() const {7680void Application::loadAvatarBrowser() const {
@@ -8304,7 +8356,24 @@ void Application::saveNextPhysicsStats(QString filename) { · 675 unmodified lines
8304 _physicsEngine->saveNextPhysicsStats(filename);8356 _physicsEngine->saveNextPhysicsStats(filename);
8305}8357}
8306 8358
8359void Application::copyToClipboard(const QString& text) {
8360 if (QThread::currentThread() != qApp->thread()) {
8361 QMetaObject::invokeMethod(this, "copyToClipboard");
8362 return;
8363 }
8364
8365 // assume that the address is being copied because the user wants a shareable address
8366 QApplication::clipboard()->setText(text);
8367}
8368
8307#if defined(Q_OS_ANDROID)8369#if defined(Q_OS_ANDROID)
8370void Application::beforeEnterBackground() {
8371 auto nodeList = DependencyManager::get<NodeList>();
8372 nodeList->setSendDomainServerCheckInEnabled(false);
8373 nodeList->reset(true);
8374 clearDomainOctreeDetails();
8375}
8376
8308void Application::enterBackground() {8377void Application::enterBackground() {
8309 QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),8378 QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
8310 "stop", Qt::BlockingQueuedConnection);8379 "stop", Qt::BlockingQueuedConnection);
@@ -8319,6 +8388,8 @@ void Application::enterForeground() { · 8 unmodified lines
8319 if (!getActiveDisplayPlugin() || getActiveDisplayPlugin()->isActive() || !getActiveDisplayPlugin()->activate()) {8388 if (!getActiveDisplayPlugin() || getActiveDisplayPlugin()->isActive() || !getActiveDisplayPlugin()->activate()) {
8320 qWarning() << "Could not re-activate display plugin";8389 qWarning() << "Could not re-activate display plugin";
8321 }8390 }
8391 auto nodeList = DependencyManager::get<NodeList>();
8392 nodeList->setSendDomainServerCheckInEnabled(true);
8322}8393}
8323#endif8394#endif
8324 8395