From cbce911e8382c122a9fc079d417e279adc3e315f Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Fri, 17 Jul 2020 14:40:40 -0700 Subject: [PATCH 1/3] fix lag on restart with scaled avatar --- interface/src/avatar/MyCharacterController.cpp | 8 ++++---- interface/src/avatar/OtherAvatar.cpp | 4 ++-- libraries/physics/src/CharacterController.cpp | 8 ++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/interface/src/avatar/MyCharacterController.cpp b/interface/src/avatar/MyCharacterController.cpp index 3a25721528..997dcfe685 100755 --- a/interface/src/avatar/MyCharacterController.cpp +++ b/interface/src/avatar/MyCharacterController.cpp @@ -407,13 +407,13 @@ void MyCharacterController::clearDetailedMotionStates() { } void MyCharacterController::buildPhysicsTransaction(PhysicsEngine::Transaction& transaction) { - for (size_t i = 0; i < _detailedMotionStates.size(); i++) { - _detailedMotionStates[i]->forceActive(); + for (auto& detailedMotionState : _detailedMotionStates) { + detailedMotionState->forceActive(); } if (_pendingFlags & PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION) { _pendingFlags &= ~PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION; - for (size_t i = 0; i < _detailedMotionStates.size(); i++) { - transaction.objectsToRemove.push_back(_detailedMotionStates[i]); + for (auto& detailedMotionState : _detailedMotionStates) { + transaction.objectsToRemove.push_back(detailedMotionState); } // NOTE: the DetailedMotionStates are deleted after being added to PhysicsEngine::Transaction::_objectsToRemove // See AvatarManager::handleProcessedPhysicsTransaction() diff --git a/interface/src/avatar/OtherAvatar.cpp b/interface/src/avatar/OtherAvatar.cpp index aa6c074d08..ae453d5b00 100755 --- a/interface/src/avatar/OtherAvatar.cpp +++ b/interface/src/avatar/OtherAvatar.cpp @@ -116,10 +116,10 @@ void OtherAvatar::updateSpaceProxy(workload::Transaction& transaction) const { int OtherAvatar::parseDataFromBuffer(const QByteArray& buffer) { int32_t bytesRead = Avatar::parseDataFromBuffer(buffer); - for (size_t i = 0; i < _detailedMotionStates.size(); i++) { + for (auto& detailedMotionState : _detailedMotionStates) { // NOTE: we activate _detailedMotionStates is because they are KINEMATIC // and Bullet will automagically call DetailedMotionState::getWorldTransform() when active. - _detailedMotionStates[i]->forceActive(); + detailedMotionState->forceActive(); } if (_moving && _motionState) { _motionState->addDirtyFlags(Simulation::DIRTY_POSITION); diff --git a/libraries/physics/src/CharacterController.cpp b/libraries/physics/src/CharacterController.cpp index a796ea28a0..e222692aea 100755 --- a/libraries/physics/src/CharacterController.cpp +++ b/libraries/physics/src/CharacterController.cpp @@ -543,12 +543,8 @@ void CharacterController::setLocalBoundingBox(const glm::vec3& minCorner, const _minStepHeight = DEFAULT_MIN_STEP_HEIGHT_FACTOR * (_halfHeight + _radius); _maxStepHeight = DEFAULT_MAX_STEP_HEIGHT_FACTOR * (_halfHeight + _radius); - if (_physicsEngine) { - // must REMOVE from world prior to shape update - _pendingFlags |= PENDING_FLAG_REMOVE_FROM_SIMULATION | PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION; - } - _pendingFlags |= PENDING_FLAG_UPDATE_SHAPE; - _pendingFlags |= PENDING_FLAG_ADD_TO_SIMULATION | PENDING_FLAG_ADD_DETAILED_TO_SIMULATION; + _pendingFlags |= PENDING_FLAG_UPDATE_SHAPE | PENDING_FLAG_REMOVE_FROM_SIMULATION | PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION | + PENDING_FLAG_ADD_TO_SIMULATION | PENDING_FLAG_ADD_DETAILED_TO_SIMULATION; } // it's ok to change offset immediately -- there are no thread safety issues here From 1c8f783be6b783f3b720aed279ade109a121346d Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Wed, 22 Jul 2020 14:38:33 -0700 Subject: [PATCH 2/3] try to fix renderWithZones from JSON --- libraries/entities/src/EntityTree.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 049a4b6229..e6f5e36202 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -2793,6 +2793,17 @@ bool EntityTree::sendEntitiesOperation(const OctreeElementPointer& element, void } } + QVector oldRenderWithZones = properties.getRenderWithZones(); + if (!oldRenderWithZones.isEmpty()) { + QVector newRenderWithZones; + for (QUuid oldRenderWithZoneID : oldRenderWithZones) { + if (args->ourTree->findEntityByEntityItemID(oldRenderWithZoneID)) { + newRenderWithZones.append(getMapped(oldRenderWithZoneID)); + } + } + properties.setRenderWithZones(newRenderWithZones); + } + properties.setXNNeighborID(getMapped(properties.getXNNeighborID())); properties.setXPNeighborID(getMapped(properties.getXPNeighborID())); properties.setYNNeighborID(getMapped(properties.getYNNeighborID())); From c6af3d23c9787d09757e2e92daacd52fb9765075 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sun, 26 Jul 2020 19:41:30 +1200 Subject: [PATCH 3/3] Fix --url command line parameter to work with both "=" and " " --- interface/src/Application.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b7b2fea67d..a5cb1c2936 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3939,12 +3939,15 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { qCDebug(interfaceapp) << "HMD:" << hasHMD << ", Hand Controllers: " << hasHandControllers << ", Using HMD: " << isUsingHMDAndHandControllers; - // when --url in command line, teleport to location - const QString HIFI_URL_COMMAND_LINE_KEY = "--url"; - int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY); QString addressLookupString; - if (urlIndex != -1) { - QUrl url(arguments().value(urlIndex + 1)); + + // when --url in command line, teleport to location + QCommandLineParser parser; + QCommandLineOption urlOption("url", "", "value"); + parser.addOption(urlOption); + parser.parse(arguments()); + if (parser.isSet(urlOption)) { + QUrl url = QUrl(parser.value(urlOption)); if (url.scheme() == URL_SCHEME_HIFIAPP) { Setting::Handle("startUpApp").set(url.path()); } else {