From d659696b60a3d205cb0967a42f52f9ab9dc9ac9d Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Mon, 2 Apr 2018 00:23:25 +0300 Subject: [PATCH 01/10] FB13789 - Log in/Sign up dialog is missing "Forgot Username?" and "Forgot Password?" links --- interface/resources/qml/controls-uit/TextField.qml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/controls-uit/TextField.qml b/interface/resources/qml/controls-uit/TextField.qml index f94541897b..6743d08275 100644 --- a/interface/resources/qml/controls-uit/TextField.qml +++ b/interface/resources/qml/controls-uit/TextField.qml @@ -163,10 +163,18 @@ TextField { text: textField.label colorScheme: textField.colorScheme anchors.left: parent.left - anchors.right: parent.right + + Binding on anchors.right { + when: parent.right + value: parent.right + } + Binding on wrapMode { + when: parent.right + value: Text.WordWrap + } + anchors.bottom: parent.top anchors.bottomMargin: 3 - wrapMode: Text.WordWrap visible: label != "" } } From 06203d44d8b52b9aad0b9e984eaee05d1a660c9a Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 22 May 2018 17:08:28 -0700 Subject: [PATCH 02/10] Correct `Camera.mode` command. --- interface/src/Application.cpp | 21 +++++++++++++++------ interface/src/Application.h | 2 ++ interface/src/avatar/MyAvatar.cpp | 5 +++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6a102f418b..4be3a7ec2f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4632,12 +4632,6 @@ void Application::idle() { _overlayConductor.update(secondsSinceLastUpdate); - auto myAvatar = getMyAvatar(); - if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { - Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN); - Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN)); - cameraMenuChanged(); - } _gameLoopCounter.increment(); } @@ -5184,6 +5178,21 @@ void Application::cameraModeChanged() { cameraMenuChanged(); } +void Application::changeViewAsNeeded(float boomLength) { + // Switch between first and third person views as needed + // This is called when the boom length has changed + bool boomLengthGreaterThanMinimum = (boomLength > MyAvatar::ZOOM_MIN); + + if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON && boomLengthGreaterThanMinimum) { + Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, false); + Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, true); + cameraMenuChanged(); + } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON && !boomLengthGreaterThanMinimum) { + Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, true); + Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, false); + cameraMenuChanged(); + } +} void Application::cameraMenuChanged() { auto menu = Menu::getInstance(); diff --git a/interface/src/Application.h b/interface/src/Application.h index ee97077002..9d7451c2d1 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -417,6 +417,8 @@ public slots: void updateVerboseLogging(); + void changeViewAsNeeded(float boomLength); + private slots: void onDesktopRootItemCreated(QQuickItem* qmlContext); void onDesktopRootContextCreated(QQmlContext* qmlContext); diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 5fb4e80b80..3c1cc7dbd2 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2248,6 +2248,11 @@ void MyAvatar::updateActionMotor(float deltaTime) { float boomChange = getDriveKey(ZOOM); _boomLength += 2.0f * _boomLength * boomChange + boomChange * boomChange; _boomLength = glm::clamp(_boomLength, ZOOM_MIN, ZOOM_MAX); + + // May need to change view if boom length has changed + if (fabs(boomChange) > 0.0) { + qApp->changeViewAsNeeded(_boomLength); + } } void MyAvatar::updatePosition(float deltaTime) { From e07e716d4051930daab3da99d40ef8aa42903efa Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 23 May 2018 07:35:25 -0700 Subject: [PATCH 03/10] Fixed stupid gcc warning. --- interface/src/avatar/MyAvatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 3c1cc7dbd2..0875966cbb 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2250,7 +2250,7 @@ void MyAvatar::updateActionMotor(float deltaTime) { _boomLength = glm::clamp(_boomLength, ZOOM_MIN, ZOOM_MAX); // May need to change view if boom length has changed - if (fabs(boomChange) > 0.0) { + if (fabs(boomChange) > 0.0f) { qApp->changeViewAsNeeded(_boomLength); } } From 3d0e0da42f0b3f9af1956a13bfaf4347d8a99a6d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 24 May 2018 11:08:26 -0700 Subject: [PATCH 04/10] re-adding removed toggleSpaceMode function --- .../system/libraries/entitySelectionTool.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index d03d4477f7..1b41559160 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -1036,6 +1036,29 @@ SelectionDisplay = (function() { } }; + // FUNCTION: TOGGLE SPACE MODE + that.toggleSpaceMode = function() { + var wantDebug = false; + if (wantDebug) { + print("========> ToggleSpaceMode called. ========="); + } + if ((spaceMode === SPACE_WORLD) && (SelectionManager.selections.length > 1)) { + if (wantDebug) { + print("Local space editing is not available with multiple selections"); + } + return; + } + if (wantDebug) { + print("PreToggle: " + spaceMode); + } + spaceMode = (spaceMode === SPACE_LOCAL) ? SPACE_WORLD : SPACE_LOCAL; + that.updateHandles(); + if (wantDebug) { + print("PostToggle: " + spaceMode); + print("======== ToggleSpaceMode called. <========="); + } + }; + function addHandleTool(overlay, tool) { handleTools[overlay] = tool; return tool; From d01482bf687dd768adc612e58b195bcb0394ce15 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Thu, 24 May 2018 17:44:39 -0700 Subject: [PATCH 05/10] Now looks for an actual change in the boom length (vs a change has been requested). --- interface/src/avatar/MyAvatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 0875966cbb..d3ab739649 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2245,12 +2245,13 @@ void MyAvatar::updateActionMotor(float deltaTime) { _actionMotorVelocity = getSensorToWorldScale() * (_walkSpeed.get() * _walkSpeedScalar) * direction; } + float previousBoomLength = _boomLength; float boomChange = getDriveKey(ZOOM); _boomLength += 2.0f * _boomLength * boomChange + boomChange * boomChange; _boomLength = glm::clamp(_boomLength, ZOOM_MIN, ZOOM_MAX); // May need to change view if boom length has changed - if (fabs(boomChange) > 0.0f) { + if (previousBoomLength != _boomLength) { qApp->changeViewAsNeeded(_boomLength); } } From e34d67fee4b7e164edab56ed049d5a3d7ba532ef Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 24 May 2018 17:54:53 -0700 Subject: [PATCH 06/10] fix crash --- interface/src/ui/overlays/Web3DOverlay.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index c678e3d2a2..8af818edc6 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -259,7 +259,6 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("Web3DOverlay", this); _webSurface->getSurfaceContext()->setContextProperty("Window", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("Reticle", qApp->getApplicationCompositor().getReticleInterface()); - _webSurface->getSurfaceContext()->setContextProperty("desktop", DependencyManager::get()->getDesktop()); _webSurface->getSurfaceContext()->setContextProperty("HiFiAbout", AboutUtil::getInstance()); // Override min fps for tablet UI, for silky smooth scrolling From ed62a2fc37bd14b6a4230fa0bb0869be10d3e95c Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 19 Apr 2018 15:15:26 -0700 Subject: [PATCH 07/10] _lastKinematicStep now mutable, avoids explicit const_cast --- libraries/physics/src/ObjectMotionState.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index 24dd655342..bb3c00bd5d 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -184,7 +184,7 @@ protected: btRigidBody* _body { nullptr }; float _density { 1.0f }; - uint32_t _lastKinematicStep; + mutable uint32_t _lastKinematicStep; bool _hasInternalKinematicChanges { false }; }; From 1612d90cd338049736b725f91038e1dd5b4a5e51 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 19 Apr 2018 15:15:42 -0700 Subject: [PATCH 08/10] minor DynamicsWorld optimizations and track global steps count therein --- libraries/physics/src/EntityMotionState.cpp | 4 +- libraries/physics/src/PhysicsEngine.cpp | 8 +-- libraries/physics/src/PhysicsEngine.h | 3 +- .../physics/src/ThreadSafeDynamicsWorld.cpp | 63 +++++++------------ .../physics/src/ThreadSafeDynamicsWorld.h | 2 + 5 files changed, 28 insertions(+), 52 deletions(-) diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 30bbcd1fb8..deb779b1f8 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -252,11 +252,9 @@ void EntityMotionState::getWorldTransform(btTransform& worldTrans) const { uint32_t thisStep = ObjectMotionState::getWorldSimulationStep(); float dt = (thisStep - _lastKinematicStep) * PHYSICS_ENGINE_FIXED_SUBSTEP; + _lastKinematicStep = thisStep; _entity->stepKinematicMotion(dt); - // bypass const-ness so we can remember the step - const_cast(this)->_lastKinematicStep = thisStep; - // and set the acceleration-matches-gravity count high so that if we send an update // it will use the correct acceleration for remote simulations _accelerationNearlyGravityCount = (uint8_t)(-1); diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 9aab27c3e9..21b5b38b13 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -71,8 +71,8 @@ void PhysicsEngine::init() { } } -uint32_t PhysicsEngine::getNumSubsteps() { - return _numSubsteps; +uint32_t PhysicsEngine::getNumSubsteps() const { + return _dynamicsWorld->getNumSubsteps(); } // private @@ -329,13 +329,9 @@ void PhysicsEngine::stepSimulation() { PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep); if (numSubsteps > 0) { BT_PROFILE("postSimulation"); - _numSubsteps += (uint32_t)numSubsteps; - ObjectMotionState::setWorldSimulationStep(_numSubsteps); - if (_myAvatarController) { _myAvatarController->postSimulation(); } - _hasOutgoingChanges = true; } diff --git a/libraries/physics/src/PhysicsEngine.h b/libraries/physics/src/PhysicsEngine.h index 0dfe3a7a7c..2ac195956a 100644 --- a/libraries/physics/src/PhysicsEngine.h +++ b/libraries/physics/src/PhysicsEngine.h @@ -52,7 +52,7 @@ public: ~PhysicsEngine(); void init(); - uint32_t getNumSubsteps(); + uint32_t getNumSubsteps() const; void removeObjects(const VectorOfMotionStates& objects); void removeSetOfObjects(const SetOfMotionStates& objects); // only called during teardown @@ -135,7 +135,6 @@ private: CharacterController* _myAvatarController; uint32_t _numContactFrames = 0; - uint32_t _numSubsteps; bool _dumpNextStats { false }; bool _saveNextStats { false }; diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp index 3f24851dce..07d5ceb9ac 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp @@ -59,14 +59,11 @@ int ThreadSafeDynamicsWorld::stepSimulationWithSubstepCallback(btScalar timeStep } } - /*//process some debugging flags - if (getDebugDrawer()) { - btIDebugDraw* debugDrawer = getDebugDrawer(); - gDisableDeactivation = (debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0; - }*/ if (subSteps) { //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt int clampedSimulationSteps = (subSteps > maxSubSteps)? maxSubSteps : subSteps; + _numSubsteps += clampedSimulationSteps; + ObjectMotionState::setWorldSimulationStep(_numSubsteps); saveKinematicState(fixedTimeStep*clampedSimulationSteps); @@ -98,28 +95,24 @@ int ThreadSafeDynamicsWorld::stepSimulationWithSubstepCallback(btScalar timeStep // call this instead of non-virtual btDiscreteDynamicsWorld::synchronizeSingleMotionState() void ThreadSafeDynamicsWorld::synchronizeMotionState(btRigidBody* body) { btAssert(body); - if (body->getMotionState() && !body->isStaticObject()) { - //we need to call the update at least once, even for sleeping objects - //otherwise the 'graphics' transform never updates properly - ///@todo: add 'dirty' flag - //if (body->getActivationState() != ISLAND_SLEEPING) - { - if (body->isKinematicObject()) { - ObjectMotionState* objectMotionState = static_cast(body->getMotionState()); - if (objectMotionState->hasInternalKinematicChanges()) { - objectMotionState->clearInternalKinematicChanges(); - body->getMotionState()->setWorldTransform(body->getWorldTransform()); - } - return; - } - btTransform interpolatedTransform; - btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(), - body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(), - (m_latencyMotionStateInterpolation && m_fixedTimeStep) ? m_localTime - m_fixedTimeStep : m_localTime*body->getHitFraction(), - interpolatedTransform); - body->getMotionState()->setWorldTransform(interpolatedTransform); + btAssert(body->getMotionState()); + + if (body->isKinematicObject()) { + ObjectMotionState* objectMotionState = static_cast(body->getMotionState()); + if (objectMotionState->hasInternalKinematicChanges()) { + // this is a special case where the kinematic motion has been updated by an Action + // so we supply the body's current transform to the MotionState + objectMotionState->clearInternalKinematicChanges(); + body->getMotionState()->setWorldTransform(body->getWorldTransform()); } + return; } + btTransform interpolatedTransform; + btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(), + body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(), + (m_latencyMotionStateInterpolation && m_fixedTimeStep) ? m_localTime - m_fixedTimeStep : m_localTime*body->getHitFraction(), + interpolatedTransform); + body->getMotionState()->setWorldTransform(interpolatedTransform); } void ThreadSafeDynamicsWorld::synchronizeMotionStates() { @@ -164,24 +157,12 @@ void ThreadSafeDynamicsWorld::synchronizeMotionStates() { } void ThreadSafeDynamicsWorld::saveKinematicState(btScalar timeStep) { -///would like to iterate over m_nonStaticRigidBodies, but unfortunately old API allows -///to switch status _after_ adding kinematic objects to the world -///fix it for Bullet 3.x release DETAILED_PROFILE_RANGE(simulation_physics, "saveKinematicState"); BT_PROFILE("saveKinematicState"); - for (int i=0;igetActivationState() != ISLAND_SLEEPING) - { - if (body->isKinematicObject()) - { - //to calculate velocities next frame - body->saveKinematicState(timeStep); - } + for (int i=0;iisKinematicObject() && body->getActivationState() != ISLAND_SLEEPING) { + body->saveKinematicState(timeStep); } } } - - diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.h b/libraries/physics/src/ThreadSafeDynamicsWorld.h index 54c3ddb756..d8cee4d2de 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.h +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.h @@ -37,6 +37,7 @@ public: btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration); + int getNumSubsteps() const { return _numSubsteps; } int stepSimulationWithSubstepCallback(btScalar timeStep, int maxSubSteps = 1, btScalar fixedTimeStep = btScalar(1.)/btScalar(60.), SubStepCallback onSubStep = []() { }); @@ -61,6 +62,7 @@ private: VectorOfMotionStates _deactivatedStates; SetOfMotionStates _activeStates; SetOfMotionStates _lastActiveStates; + int _numSubsteps { 0 }; }; #endif // hifi_ThreadSafeDynamicsWorld_h From 89f7eb0b301e99ae908f212f807af9eee496eb5d Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 25 May 2018 09:20:55 -0700 Subject: [PATCH 09/10] Adding fix for enabling saved front/back advanced controls. --- ...oggleAdvancedMovementForHandControllers.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js index a1b96ac607..2f3a1d9628 100644 --- a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js +++ b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js @@ -171,4 +171,25 @@ Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL); Messages.messageReceived.connect(handleMessage); + function initializeControls() { + if(HMD.active) { + if (Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) { + if (MyAvatar.useAdvancedMovementControls) { + Controller.disableMapping(DRIVING_MAPPING_NAME); + } else { + Controller.enableMapping(DRIVING_MAPPING_NAME); + } + + if (MyAvatar.getFlyingEnabled()) { + Controller.disableMapping(FLYING_MAPPING_NAME); + } else { + Controller.enableMapping(FLYING_MAPPING_NAME); + } + }); + + } + } + + initializeControls(); + }()); // END LOCAL_SCOPE From 8453c7baba9ada9bf890f8ae380a7a63e0e3de37 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 25 May 2018 09:25:05 -0700 Subject: [PATCH 10/10] =?UTF-8?q?reverting=20commit=20=C2=9D802cedf1bc=20r?= =?UTF-8?q?egarding=20toggleSpaceMode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/libraries/entitySelectionTool.js | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 1b41559160..d03d4477f7 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -1036,29 +1036,6 @@ SelectionDisplay = (function() { } }; - // FUNCTION: TOGGLE SPACE MODE - that.toggleSpaceMode = function() { - var wantDebug = false; - if (wantDebug) { - print("========> ToggleSpaceMode called. ========="); - } - if ((spaceMode === SPACE_WORLD) && (SelectionManager.selections.length > 1)) { - if (wantDebug) { - print("Local space editing is not available with multiple selections"); - } - return; - } - if (wantDebug) { - print("PreToggle: " + spaceMode); - } - spaceMode = (spaceMode === SPACE_LOCAL) ? SPACE_WORLD : SPACE_LOCAL; - that.updateHandles(); - if (wantDebug) { - print("PostToggle: " + spaceMode); - print("======== ToggleSpaceMode called. <========="); - } - }; - function addHandleTool(overlay, tool) { handleTools[overlay] = tool; return tool;