History

Merge branch 'master' of github.com:highfidelity/hifi into fix/audio-bg-join

Zach Pomerantz committed 9 years ago

Commit ca7cd612 parents e9c5b86 fd836dc665 files · +110757 −8736Browse files

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

Unified · Split

interface/src/Application.cpp+134−109
@@ -78,6 +78,7 @@ · 77 unmodified lines
7878 #include <InfoView.h>
7979 #include <input-plugins/InputPlugin.h>
8080 #include <controllers/UserInputMapper.h>
81+#include <controllers/InputRecorder.h>
8182 #include <controllers/ScriptingInterface.h>
8283 #include <controllers/StateController.h>
8384 #include <UserActivityLoggerScriptingInterface.h>
@@ -127,20 +128,19 @@ · 43 unmodified lines
127128 #include <QmlWebWindowClass.h>
128129 #include <Preferences.h>
129130 #include <display-plugins/CompositorHelper.h>
130−
131+#include <trackers/EyeTracker.h>
132+#include <avatars-renderer/ScriptAvatar.h>
131133
132134 #include "AudioClient.h"
133135 #include "audio/AudioScope.h"
134136 #include "avatar/AvatarManager.h"
135−#include "avatar/ScriptAvatar.h"
137+#include "avatar/MyHead.h"
136138 #include "CrashHandler.h"
137139 #include "devices/DdeFaceTracker.h"
138−#include "devices/EyeTracker.h"
139−#include "devices/Faceshift.h"
140140 #include "devices/Leapmotion.h"
141141 #include "DiscoverabilityManager.h"
142142 #include "GLCanvas.h"
143−#include "InterfaceActionFactory.h"
143+#include "InterfaceDynamicFactory.h"
144144 #include "InterfaceLogging.h"
145145 #include "LODManager.h"
146146 #include "ModelPackager.h"
@@ -462,7 +462,7 @@ bool setupEssentials(int& argc, char** argv) { · 315 unmodified lines
462462
463463 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
464464 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
465− DependencyManager::registerInheritance<EntityActionFactoryInterface, InterfaceActionFactory>();
465+ DependencyManager::registerInheritance<EntityDynamicFactoryInterface, InterfaceDynamicFactory>();
466466 DependencyManager::registerInheritance<SpatialParentFinder, InterfaceParentFinder>();
467467
468468 // Set dependencies
@@ -479,7 +479,6 @@ bool setupEssentials(int& argc, char** argv) { · 10 unmodified lines
479479 DependencyManager::set<ModelCache>();
480480 DependencyManager::set<ScriptCache>();
481481 DependencyManager::set<SoundCache>();
482− DependencyManager::set<Faceshift>();
483482 DependencyManager::set<DdeFaceTracker>();
484483 DependencyManager::set<EyeTracker>();
485484 DependencyManager::set<AudioClient>();
@@ -516,7 +515,7 @@ bool setupEssentials(int& argc, char** argv) { · 30 unmodified lines
516515 DependencyManager::set<OffscreenUi>();
517516 DependencyManager::set<AutoUpdater>();
518517 DependencyManager::set<PathUtils>();
519− DependencyManager::set<InterfaceActionFactory>();
518+ DependencyManager::set<InterfaceDynamicFactory>();
520519 DependencyManager::set<AudioInjectorManager>();
521520 DependencyManager::set<MessagesClient>();
522521 controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR,
@@ -534,6 +533,7 @@ bool setupEssentials(int& argc, char** argv) { · 11 unmodified lines
534533 DependencyManager::set<OctreeStatsProvider>(nullptr, qApp->getOcteeSceneStats());
535534 DependencyManager::set<AvatarBookmarks>();
536535 DependencyManager::set<LocationBookmarks>();
536+ DependencyManager::set<Snapshot>();
537537
538538 return previousSessionCrashed;
539539 }
@@ -796,7 +796,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 256 unmodified lines
796796 connect(&domainHandler, SIGNAL(resetting()), SLOT(resettingDomain()));
797797 connect(&domainHandler, SIGNAL(connectedToDomain(const QString&)), SLOT(updateWindowTitle()));
798798 connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));
799− connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails()));
799+ connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &Application::clearDomainAvatars);
800800 connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, [this]() {
801801 getOverlays().deleteOverlay(getTabletScreenID());
802802 getOverlays().deleteOverlay(getTabletHomeButtonID());
@@ -1208,10 +1208,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 405 unmodified lines
12081208
12091209 this->installEventFilter(this);
12101210
1211− // initialize our face trackers after loading the menu settings
1212− auto faceshiftTracker = DependencyManager::get<Faceshift>();
1213− faceshiftTracker->init();
1214− connect(faceshiftTracker.data(), &FaceTracker::muteToggled, this, &Application::faceTrackerMuteToggled);
12151211 #ifdef HAVE_DDE
12161212 auto ddeTracker = DependencyManager::get<DdeFaceTracker>();
12171213 ddeTracker->init();
@@ -1445,8 +1441,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 227 unmodified lines
14451441 QString skyboxUrl { PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.jpg" };
14461442 QString skyboxAmbientUrl { PathUtils::resourcesPath() + "images/Default-Sky-9-ambient.jpg" };
14471443
1448− _defaultSkyboxTexture = textureCache->getImageTexture(skyboxUrl, NetworkTexture::CUBE_TEXTURE, { { "generateIrradiance", false } });
1449− _defaultSkyboxAmbientTexture = textureCache->getImageTexture(skyboxAmbientUrl, NetworkTexture::CUBE_TEXTURE, { { "generateIrradiance", true } });
1444+ _defaultSkyboxTexture = textureCache->getImageTexture(skyboxUrl, image::TextureUsage::CUBE_TEXTURE, { { "generateIrradiance", false } });
1445+ _defaultSkyboxAmbientTexture = textureCache->getImageTexture(skyboxAmbientUrl, image::TextureUsage::CUBE_TEXTURE, { { "generateIrradiance", true } });
14501446
14511447 _defaultSkybox->setCubemap(_defaultSkyboxTexture);
14521448
@@ -1465,46 +1461,53 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 12 unmodified lines
14651461 const auto testScript = property(hifi::properties::TEST).toUrl();
14661462 scriptEngines->loadScript(testScript, false);
14671463 } else {
1468− // Get sandbox content set version, if available
1464+ enum HandControllerType {
1465+ Vive,
1466+ Oculus
1467+ };
1468+ static const std::map<HandControllerType, int> MIN_CONTENT_VERSION = {
1469+ { Vive, 1 },
1470+ { Oculus, 27 }
1471+ };
1472+
1473+ // Get sandbox content set version
14691474 auto acDirPath = PathUtils::getAppDataPath() + "../../" + BuildInfo::MODIFIED_ORGANIZATION + "/assignment-client/";
14701475 auto contentVersionPath = acDirPath + "content-version.txt";
14711476 qCDebug(interfaceapp) << "Checking " << contentVersionPath << " for content version";
1472− auto contentVersion = 0;
1477+ int contentVersion = 0;
14731478 QFile contentVersionFile(contentVersionPath);
14741479 if (contentVersionFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
14751480 QString line = contentVersionFile.readAll();
1476− // toInt() returns 0 if the conversion fails, so we don't need to specifically check for failure
1477− contentVersion = line.toInt();
1481+ contentVersion = line.toInt(); // returns 0 if conversion fails
14781482 }
1479− qCDebug(interfaceapp) << "Server content version: " << contentVersion;
1480−
1481− static const int MIN_VIVE_CONTENT_VERSION = 1;
1482− static const int MIN_OCULUS_TOUCH_CONTENT_VERSION = 27;
14831483
1484− bool hasSufficientTutorialContent = false;
1484+ // Get controller availability
14851485 bool hasHandControllers = false;
1486−
1487− // Only specific hand controllers are currently supported, so only send users to the tutorial
1488− // if they have one of those hand controllers.
1486+ HandControllerType handControllerType = Vive;
14891487 if (PluginUtils::isViveControllerAvailable()) {
14901488 hasHandControllers = true;
1491− hasSufficientTutorialContent = contentVersion >= MIN_VIVE_CONTENT_VERSION;
1489+ handControllerType = Vive;
14921490 } else if (PluginUtils::isOculusTouchControllerAvailable()) {
14931491 hasHandControllers = true;
1494− hasSufficientTutorialContent = contentVersion >= MIN_OCULUS_TOUCH_CONTENT_VERSION;
1492+ handControllerType = Oculus;
14951493 }
14961494
1497− Setting::Handle<bool> firstRun { Settings::firstRun, true };
1495+ // Check tutorial content versioning
1496+ bool hasTutorialContent = contentVersion >= MIN_CONTENT_VERSION.at(handControllerType);
1497+
1498+ // Check HMD use (may be technically available without being in use)
1499+ bool hasHMD = PluginUtils::isHMDAvailable();
1500+ bool isUsingHMD = hasHMD && hasHandControllers && _displayPlugin->isHmd();
14981501
1499− bool hasHMDAndHandControllers = PluginUtils::isHMDAvailable() && hasHandControllers;
15001502 Setting::Handle<bool> tutorialComplete { "tutorialComplete", false };
1503+ Setting::Handle<bool> firstRun { Settings::firstRun, true };
15011504
1502− bool shouldGoToTutorial = hasHMDAndHandControllers && hasSufficientTutorialContent && !tutorialComplete.get();
1505+ bool isTutorialComplete = tutorialComplete.get();
1506+ bool shouldGoToTutorial = isUsingHMD && hasTutorialContent && !isTutorialComplete;
15031507
1504− qCDebug(interfaceapp) << "Has HMD + Hand Controllers: " << hasHMDAndHandControllers << ", current plugin: " << _displayPlugin->getName();
1505− qCDebug(interfaceapp) << "Has sufficient tutorial content (" << contentVersion << ") : " << hasSufficientTutorialContent;
1506− qCDebug(interfaceapp) << "Tutorial complete: " << tutorialComplete.get();
1507− qCDebug(interfaceapp) << "Should go to tutorial: " << shouldGoToTutorial;
1508+ qCDebug(interfaceapp) << "HMD:" << hasHMD << ", Hand Controllers: " << hasHandControllers << ", Using HMD: " << isUsingHMD;
1509+ qCDebug(interfaceapp) << "Tutorial version:" << contentVersion << ", sufficient:" << hasTutorialContent <<
1510+ ", complete:" << isTutorialComplete << ", should go:" << shouldGoToTutorial;
15081511
15091512 // when --url in command line, teleport to location
15101513 const QString HIFI_URL_COMMAND_LINE_KEY = "--url";
@@ -1541,7 +1544,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 30 unmodified lines
15411544
15421545 // If this is a first run we short-circuit the address passed in
15431546 if (isFirstRun) {
1544− if (hasHMDAndHandControllers) {
1547+ if (isUsingHMD) {
15451548 if (sandboxIsRunning) {
15461549 qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home.";
15471550 DependencyManager::get<AddressManager>()->goToLocalSandbox();
@@ -1583,6 +1586,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 35 unmodified lines
15831586 connect(&domainHandler, &DomainHandler::hostnameChanged, this, &Application::addAssetToWorldMessageClose);
15841587
15851588 updateSystemTabletMode();
1589+
1590+ connect(&_myCamera, &Camera::modeUpdated, this, &Application::cameraModeChanged);
15861591 }
15871592
15881593 void Application::domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo) {
@@ -2042,6 +2047,7 @@ void Application::initializeUi() { · 453 unmodified lines
20422047 rootContext->setContextProperty("Scene", DependencyManager::get<SceneScriptingInterface>().data());
20432048 rootContext->setContextProperty("Render", _renderEngine->getConfiguration().get());
20442049 rootContext->setContextProperty("Reticle", getApplicationCompositor().getReticleInterface());
2050+ rootContext->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
20452051
20462052 rootContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
20472053
@@ -2185,7 +2191,7 @@ void Application::paintGL() { · 137 unmodified lines
21852191 _myCamera.setOrientation(glm::quat_cast(camMat));
21862192 } else {
21872193 _myCamera.setPosition(myAvatar->getDefaultEyePosition());
2188− _myCamera.setOrientation(myAvatar->getHead()->getCameraOrientation());
2194+ _myCamera.setOrientation(myAvatar->getMyHead()->getCameraOrientation());
21892195 }
21902196 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
21912197 if (isHMDMode()) {
@@ -2520,6 +2526,11 @@ bool Application::event(QEvent* event) { · 328 unmodified lines
25202526
25212527 isPaintingThrottled = false;
25222528
2529+ return true;
2530+ } else if ((int)event->type() == (int)Idle) {
2531+ float nsecsElapsed = (float)_lastTimeUpdated.nsecsElapsed();
2532+ idle(nsecsElapsed);
2533+
25232534 return true;
25242535 }
25252536
@@ -2744,6 +2755,9 @@ void Application::keyPressEvent(QKeyEvent* event) { · 218 unmodified lines
27442755 if (isMeta) {
27452756 auto offscreenUi = DependencyManager::get<OffscreenUi>();
27462757 offscreenUi->load("Browser.qml");
2758+ } else if (isOption) {
2759+ controller::InputRecorder* inputRecorder = controller::InputRecorder::getInstance();
2760+ inputRecorder->stopPlayback();
27472761 }
27482762 break;
27492763
@@ -3611,20 +3625,13 @@ ivec2 Application::getMouse() const { · 861 unmodified lines
36113625 }
36123626
36133627 FaceTracker* Application::getActiveFaceTracker() {
3614− auto faceshift = DependencyManager::get<Faceshift>();
36153628 auto dde = DependencyManager::get<DdeFaceTracker>();
36163629
3617− return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) :
3618− (faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) : nullptr));
3630+ return dde->isActive() ? static_cast<FaceTracker*>(dde.data()) : nullptr;
36193631 }
36203632
36213633 FaceTracker* Application::getSelectedFaceTracker() {
36223634 FaceTracker* faceTracker = nullptr;
3623−#ifdef HAVE_FACESHIFT
3624− if (Menu::getInstance()->isOptionChecked(MenuOption::Faceshift)) {
3625− faceTracker = DependencyManager::get<Faceshift>().data();
3626− }
3627−#endif
36283635 #ifdef HAVE_DDE
36293636 if (Menu::getInstance()->isOptionChecked(MenuOption::UseCamera)) {
36303637 faceTracker = DependencyManager::get<DdeFaceTracker>().data();
@@ -3634,15 +3641,8 @@ FaceTracker* Application::getSelectedFaceTracker() { · 3 unmodified lines
36343641 }
36353642
36363643 void Application::setActiveFaceTracker() const {
3637−#if defined(HAVE_FACESHIFT) || defined(HAVE_DDE)
3638− bool isMuted = Menu::getInstance()->isOptionChecked(MenuOption::MuteFaceTracking);
3639−#endif
3640−#ifdef HAVE_FACESHIFT
3641− auto faceshiftTracker = DependencyManager::get<Faceshift>();
3642− faceshiftTracker->setIsMuted(isMuted);
3643− faceshiftTracker->setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift) && !isMuted);
3644−#endif
36453644 #ifdef HAVE_DDE
3645+ bool isMuted = Menu::getInstance()->isOptionChecked(MenuOption::MuteFaceTracking);
36463646 bool isUsingDDE = Menu::getInstance()->isOptionChecked(MenuOption::UseCamera);
36473647 Menu::getInstance()->getActionForOption(MenuOption::BinaryEyelidControl)->setVisible(isUsingDDE);
36483648 Menu::getInstance()->getActionForOption(MenuOption::CoupleEyelids)->setVisible(isUsingDDE);
@@ -4087,6 +4087,30 @@ void Application::cycleCamera() { · 438 unmodified lines
40874087 cameraMenuChanged(); // handle the menu change
40884088 }
40894089
4090+void Application::cameraModeChanged() {
4091+ switch (_myCamera.getMode()) {
4092+ case CAMERA_MODE_FIRST_PERSON:
4093+ Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, true);
4094+ break;
4095+ case CAMERA_MODE_THIRD_PERSON:
4096+ Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, true);
4097+ break;
4098+ case CAMERA_MODE_MIRROR:
4099+ Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, true);
4100+ break;
4101+ case CAMERA_MODE_INDEPENDENT:
4102+ Menu::getInstance()->setIsOptionChecked(MenuOption::IndependentMode, true);
4103+ break;
4104+ case CAMERA_MODE_ENTITY:
4105+ Menu::getInstance()->setIsOptionChecked(MenuOption::CameraEntityMode, true);
4106+ break;
4107+ default:
4108+ break;
4109+ }
4110+ cameraMenuChanged();
4111+}
4112+
4113+
40904114 void Application::cameraMenuChanged() {
40914115 if (Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
40924116 if (_myCamera.getMode() != CAMERA_MODE_MIRROR) {
@@ -4360,7 +4384,13 @@ void Application::update(float deltaTime) { · 267 unmodified lines
43604384 controller::InputCalibrationData calibrationData = {
43614385 myAvatar->getSensorToWorldMatrix(),
43624386 createMatFromQuatAndPos(myAvatar->getOrientation(), myAvatar->getPosition()),
4363− myAvatar->getHMDSensorMatrix()
4387+ myAvatar->getHMDSensorMatrix(),
4388+ myAvatar->getCenterEyeCalibrationMat(),
4389+ myAvatar->getHeadCalibrationMat(),
4390+ myAvatar->getSpine2CalibrationMat(),
4391+ myAvatar->getHipsCalibrationMat(),
4392+ myAvatar->getLeftFootCalibrationMat(),
4393+ myAvatar->getRightFootCalibrationMat()
43644394 };
43654395
43664396 InputPluginPointer keyboardMousePlugin;
@@ -4408,6 +4438,13 @@ void Application::update(float deltaTime) { · 41 unmodified lines
44084438 controller::Pose rightFootPose = userInputMapper->getPoseState(controller::Action::RIGHT_FOOT);
44094439 myAvatar->setFootControllerPosesInSensorFrame(leftFootPose.transform(avatarToSensorMatrix), rightFootPose.transform(avatarToSensorMatrix));
44104440
4441+ controller::Pose hipsPose = userInputMapper->getPoseState(controller::Action::HIPS);
4442+ controller::Pose spine2Pose = userInputMapper->getPoseState(controller::Action::SPINE2);
4443+ myAvatar->setSpineControllerPosesInSensorFrame(hipsPose.transform(avatarToSensorMatrix), spine2Pose.transform(avatarToSensorMatrix));
4444+
4445+ controller::Pose headPose = userInputMapper->getPoseState(controller::Action::HEAD);
4446+ myAvatar->setHeadControllerPoseInSensorFrame(headPose.transform(avatarToSensorMatrix));
4447+
44114448 updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
44124449 updateDialogs(deltaTime); // update various stats dialogs if present
44134450
@@ -4438,7 +4475,7 @@ void Application::update(float deltaTime) { · 24 unmodified lines
44384475 _entitySimulation->setObjectsToChange(stillNeedChange);
44394476 });
44404477
4441− _entitySimulation->applyActionChanges();
4478+ _entitySimulation->applyDynamicChanges();
44424479
44434480 avatarManager->getObjectsToRemoveFromPhysics(motionStates);
44444481 _physicsEngine->removeObjects(motionStates);
@@ -4448,8 +4485,8 @@ void Application::update(float deltaTime) { · 3 unmodified lines
44484485 _physicsEngine->changeObjects(motionStates);
44494486
44504487 myAvatar->prepareForPhysicsSimulation();
4451− _physicsEngine->forEachAction([&](EntityActionPointer action) {
4452− action->prepareForPhysicsSimulation();
4488+ _physicsEngine->forEachDynamic([&](EntityDynamicPointer dynamic) {
4489+ dynamic->prepareForPhysicsSimulation();
44534490 });
44544491 }
44554492 {
@@ -5118,7 +5155,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 662 unmodified lines
51185155 }
51195156
51205157 void Application::resetSensors(bool andReload) {
5121− DependencyManager::get<Faceshift>()->reset();
51225158 DependencyManager::get<DdeFaceTracker>()->reset();
51235159 DependencyManager::get<EyeTracker>()->reset();
51245160 getActiveDisplayPlugin()->resetSensors();
@@ -5164,7 +5200,6 @@ void Application::clearDomainOctreeDetails() { · 39 unmodified lines
51645200 qCDebug(interfaceapp) << "Clearing domain octree details...";
51655201
51665202 resetPhysicsReadyInformation();
5167− getMyAvatar()->setAvatarEntityDataChanged(true); // to recreate worn entities
51685203
51695204 // reset our node to stats and node to jurisdiction maps... since these must be changing...
51705205 _entityServerJurisdictions.withWriteLock([&] {
@@ -5183,14 +5218,18 @@ void Application::clearDomainOctreeDetails() { · 12 unmodified lines
51835218 skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT);
51845219
51855220 _recentlyClearedDomain = true;
5186−
5187− DependencyManager::get<AvatarManager>()->clearOtherAvatars();
5221+
51885222 DependencyManager::get<AnimationCache>()->clearUnusedResources();
51895223 DependencyManager::get<ModelCache>()->clearUnusedResources();
51905224 DependencyManager::get<SoundCache>()->clearUnusedResources();
51915225 DependencyManager::get<TextureCache>()->clearUnusedResources();
51925226 }
51935227
5228+void Application::clearDomainAvatars() {
5229+ getMyAvatar()->setAvatarEntityDataChanged(true); // to recreate worn entities
5230+ DependencyManager::get<AvatarManager>()->clearOtherAvatars();
5231+}
5232+
51945233 void Application::domainChanged(const QString& domainHostname) {
51955234 updateWindowTitle();
51965235 // disable physics until we have enough information about our new location to not cause craziness.
@@ -5203,11 +5242,7 @@ void Application::resettingDomain() { · 6 unmodified lines
52035242 }
52045243
52055244 void Application::nodeAdded(SharedNodePointer node) const {
5206− if (node->getType() == NodeType::AvatarMixer) {
5207− // new avatar mixer, send off our identity packet right away
5208− getMyAvatar()->sendIdentityPacket();
5209− getMyAvatar()->resetLastSent();
5210− }
5245+ // nothing to do here
52115246 }
52125247
52135248 void Application::nodeActivated(SharedNodePointer node) {
@@ -5243,6 +5278,13 @@ void Application::nodeActivated(SharedNodePointer node) { · 29 unmodified lines
52435278 if (node->getType() == NodeType::AudioMixer) {
52445279 DependencyManager::get<AudioClient>()->negotiateAudioFormat();
52455280 }
5281+
5282+ if (node->getType() == NodeType::AvatarMixer) {
5283+ // new avatar mixer, send off our identity packet right away
5284+ getMyAvatar()->markIdentityDataChanged();
5285+ getMyAvatar()->sendIdentityPacket();
5286+ getMyAvatar()->resetLastSent();
5287+ }
52465288 }
52475289
52485290 void Application::nodeKilled(SharedNodePointer node) {
@@ -5257,33 +5299,8 @@ void Application::nodeKilled(SharedNodePointer node) { · 8 unmodified lines
52575299 if (node->getType() == NodeType::AudioMixer) {
52585300 QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "audioMixerKilled");
52595301 } else if (node->getType() == NodeType::EntityServer) {
5260− QUuid nodeUUID = node->getUUID();
5261− // see if this is the first we've heard of this node...
5262− _entityServerJurisdictions.withReadLock([&] {
5263− if (_entityServerJurisdictions.find(nodeUUID) == _entityServerJurisdictions.end()) {
5264− return;
5265− }
5266−
5267− auto rootCode = _entityServerJurisdictions[nodeUUID].getRootOctalCode();
5268− VoxelPositionSize rootDetails;
5269− voxelDetailsForCode(rootCode.get(), rootDetails);
5270−
5271− qCDebug(interfaceapp, "model server going away...... v[%f, %f, %f, %f]",
5272− (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
5273−
5274− });
5275−
5276− // If the model server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
5277− _entityServerJurisdictions.withWriteLock([&] {
5278− _entityServerJurisdictions.erase(_entityServerJurisdictions.find(nodeUUID));
5279− });
5280−
5281− // also clean up scene stats for that server
5282− _octreeServerSceneStats.withWriteLock([&] {
5283− if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
5284− _octreeServerSceneStats.erase(nodeUUID);
5285− }
5286− });
5302+ // we lost an entity server, clear all of the domain octree details
5303+ clearDomainOctreeDetails();
52875304 } else if (node->getType() == NodeType::AvatarMixer) {
52885305 // our avatar mixer has gone away - clear the hash of avatars
52895306 DependencyManager::get<AvatarManager>()->clearOtherAvatars();
@@ -5435,9 +5452,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 145 unmodified lines
54355452 entityScriptingInterface->setPacketSender(&_entityEditSender);
54365453 entityScriptingInterface->setEntityTree(getEntities()->getTree());
54375454
5438− // AvatarManager has some custom types
5439− AvatarManager::registerMetaTypes(scriptEngine);
5440−
54415455 // give the script engine to the RecordingScriptingInterface for its callbacks
54425456 DependencyManager::get<RecordingScriptingInterface>()->setScriptEngine(scriptEngine);
54435457
@@ -5488,6 +5502,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 44 unmodified lines
54885502 scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
54895503 scriptEngine->registerGlobalObject("Stats", Stats::getInstance());
54905504 scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
5505+ scriptEngine->registerGlobalObject("Snapshot", DependencyManager::get<Snapshot>().data());
54915506 scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
54925507 scriptEngine->registerGlobalObject("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
54935508 scriptEngine->registerGlobalObject("AudioScope", DependencyManager::get<AudioScope>().data());
@@ -6432,7 +6447,7 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa · 938 unmodified lines
64326447 // Get a screenshot and save it
64336448 QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
64346449 // If we're not doing an animated snapshot as well...
6435− if (!includeAnimated || !(SnapshotAnimated::alsoTakeAnimatedSnapshot.get())) {
6450+ if (!includeAnimated) {
64366451 // Tell the dependency manager that the capture of the still snapshot has taken place.
64376452 emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
64386453 } else {
@@ -6505,10 +6520,22 @@ void Application::activeChanged(Qt::ApplicationState state) { · 66 unmodified lines
65056520 }
65066521
65076522 void Application::windowMinimizedChanged(bool minimized) {
6523+ // initialize the _minimizedWindowTimer
6524+ static std::once_flag once;
6525+ std::call_once(once, [&] {
6526+ connect(&_minimizedWindowTimer, &QTimer::timeout, this, [] {
6527+ QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(static_cast<QEvent::Type>(Idle)), Qt::HighEventPriority);
6528+ });
6529+ });
6530+
6531+ // avoid rendering to the display plugin but continue posting Idle events,
6532+ // so that physics continues to simulate and the deadlock watchdog knows we're alive
65086533 if (!minimized && !getActiveDisplayPlugin()->isActive()) {
6534+ _minimizedWindowTimer.stop();
65096535 getActiveDisplayPlugin()->activate();
65106536 } else if (minimized && getActiveDisplayPlugin()->isActive()) {
65116537 getActiveDisplayPlugin()->deactivate();
6538+ _minimizedWindowTimer.start(THROTTLED_SIM_FRAME_PERIOD_MS);
65126539 }
65136540 }
65146541
@@ -6757,11 +6784,6 @@ void Application::updateDisplayMode() { · 242 unmodified lines
67576784 return;
67586785 }
67596786
6760− UserActivityLogger::getInstance().logAction("changed_display_mode", {
6761− { "previous_display_mode", _displayPlugin ? _displayPlugin->getName() : "" },
6762− { "display_mode", newDisplayPlugin ? newDisplayPlugin->getName() : "" }
6763− });
6764−
67656787 auto offscreenUi = DependencyManager::get<OffscreenUi>();
67666788
67676789 // Make the switch atomic from the perspective of other threads
@@ -6816,13 +6838,16 @@ void Application::updateDisplayMode() { · 48 unmodified lines
68166838 offscreenUi->getDesktop()->setProperty("repositionLocked", wasRepositionLocked);
68176839 }
68186840
6841+ bool isHmd = _displayPlugin->isHmd();
6842+ qCDebug(interfaceapp) << "Entering into" << (isHmd ? "HMD" : "Desktop") << "Mode";
6843+
6844+ // Only log/emit after a successful change
6845+ UserActivityLogger::getInstance().logAction("changed_display_mode", {
6846+ { "previous_display_mode", _displayPlugin ? _displayPlugin->getName() : "" },
6847+ { "display_mode", newDisplayPlugin ? newDisplayPlugin->getName() : "" },
6848+ { "hmd", isHmd }
6849+ });
68196850 emit activeDisplayPluginChanged();
6820−
6821− if (_displayPlugin->isHmd()) {
6822− qCDebug(interfaceapp) << "Entering into HMD Mode";
6823− } else {
6824− qCDebug(interfaceapp) << "Entering into Desktop Mode";
6825− }
68266851
68276852 // reset the avatar, to set head and hand palms back to a reasonable default pose.
68286853 getMyAvatar()->reset(false);

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