diff --git a/assignment-client/src/audio/AudioMixer.cpp b/assignment-client/src/audio/AudioMixer.cpp index e8568a7ff3..77f416f31e 100644 --- a/assignment-client/src/audio/AudioMixer.cpp +++ b/assignment-client/src/audio/AudioMixer.cpp @@ -435,7 +435,11 @@ void AudioMixer::start() { QCoreApplication::processEvents(); } - int numToRetain = nodeList->size() * (1 - _throttlingRatio); + int numToRetain = -1; + assert(_throttlingRatio >= 0.0f && _throttlingRatio <= 1.0f); + if (_throttlingRatio > EPSILON) { + numToRetain = nodeList->size() * (1.0f - _throttlingRatio); + } nodeList->nestedEach([&](NodeList::const_iterator cbegin, NodeList::const_iterator cend) { // mix across slave threads auto mixTimer = _mixTiming.timer(); diff --git a/assignment-client/src/avatars/AvatarMixerSlave.cpp b/assignment-client/src/avatars/AvatarMixerSlave.cpp index 7e0b6a00ad..a037f24345 100644 --- a/assignment-client/src/avatars/AvatarMixerSlave.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlave.cpp @@ -416,7 +416,8 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node) // NOTE: Here's where we determine if we are over budget and drop remaining avatars, // or send minimal avatar data in uncommon case of PALIsOpen. int minimRemainingAvatarBytes = minimumBytesPerAvatar * remainingAvatars; - bool overBudget = (identityBytesSent + numAvatarDataBytes + minimRemainingAvatarBytes) > maxAvatarBytesPerFrame; + auto frameByteEstimate = identityBytesSent + traitBytesSent + numAvatarDataBytes + minimRemainingAvatarBytes; + bool overBudget = frameByteEstimate > maxAvatarBytesPerFrame; if (overBudget) { if (PALIsOpen) { _stats.overBudgetAvatars++; @@ -497,8 +498,11 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node) _stats.avatarDataPackingElapsedTime += (quint64) chrono::duration_cast(endAvatarDataPacking - startAvatarDataPacking).count(); - // use helper to add any changed traits to our packet list - traitBytesSent += addChangedTraitsToBulkPacket(nodeData, otherNodeData, *traitsPacketList); + if (!overBudget) { + // use helper to add any changed traits to our packet list + traitBytesSent += addChangedTraitsToBulkPacket(nodeData, otherNodeData, *traitsPacketList); + } + remainingAvatars--; } diff --git a/interface/resources/config/keyboard.json b/interface/resources/config/keyboard.json index 186a9c1084..b3688ef06e 100644 --- a/interface/resources/config/keyboard.json +++ b/interface/resources/config/keyboard.json @@ -701,9 +701,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.53203323516845703, + "x": -0.59333323516845703, "y": 0.019300000742077827, - "z": -0.07286686894893646 + "z": 0.037454843521118164 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -752,7 +752,7 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.59333323516845703, + "x": -0.65333323516845703, "y": 0.019300000742077827, "z": 0.037454843521118164 }, @@ -777,9 +777,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.5103323516845703, - "y": 0.019300000742077827, - "z": -0.127054843521118164 + "x": -0.5503323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 }, "modelURL": "meshes/keyboard/SM_enter.fbx", "texture": { @@ -1479,9 +1479,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.53203323516845703, + "x": -0.59333323516845703, "y": 0.019300000742077827, - "z": -0.07286686894893646 + "z": 0.037454843521118164 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -1530,7 +1530,7 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.59333323516845703, + "x": -0.65333323516845703, "y": 0.019300000742077827, "z": 0.037454843521118164 }, @@ -1555,9 +1555,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.5103323516845703, - "y": 0.019300000742077827, - "z": -0.127054843521118164 + "x": -0.5503323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 }, "modelURL": "meshes/keyboard/SM_enter.fbx", "texture": { @@ -2305,9 +2305,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.53203323516845703, + "x": -0.59333323516845703, "y": 0.019300000742077827, - "z": -0.07286686894893646 + "z": 0.037454843521118164 }, "modelURL": "meshes/keyboard/SM_key.fbx", "texture": { @@ -2356,7 +2356,7 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.59333323516845703, + "x": -0.65333323516845703, "y": 0.019300000742077827, "z": 0.037454843521118164 }, @@ -2381,9 +2381,9 @@ "y": 0.04787999764084816 }, "position": { - "x": -0.5103323516845703, - "y": 0.019300000742077827, - "z": -0.127054843521118164 + "x": -0.5503323516845703, + "y": 0.019300000742077827, + "z": -0.07282185554504395 }, "modelURL": "meshes/keyboard/SM_enter.fbx", "texture": { diff --git a/interface/resources/html/raiseAndLowerKeyboard.js b/interface/resources/html/raiseAndLowerKeyboard.js index 8cdb3c2327..db8ff24fcb 100644 --- a/interface/resources/html/raiseAndLowerKeyboard.js +++ b/interface/resources/html/raiseAndLowerKeyboard.js @@ -18,7 +18,7 @@ window.isKeyboardRaised = false; window.isNumericKeyboard = false; window.isPasswordField = false; - window.lastActiveElement = null; + window.lastActiveInputElement = null; function getActiveElement() { return document.activeElement; @@ -70,11 +70,15 @@ var keyboardRaised = shouldRaiseKeyboard(); var numericKeyboard = shouldSetNumeric(); var passwordField = shouldSetPasswordField(); - var activeElement = getActiveElement(); + var activeInputElement = null; + // Only set the active input element when there is an input element focussed, otherwise it will scroll on body focus as well. + if (keyboardRaised) { + activeInputElement = getActiveElement(); + } if (isWindowFocused && (keyboardRaised !== window.isKeyboardRaised || numericKeyboard !== window.isNumericKeyboard - || passwordField !== window.isPasswordField || activeElement !== window.lastActiveElement)) { + || passwordField !== window.isPasswordField || activeInputElement !== window.lastActiveInputElement)) { if (typeof EventBridge !== "undefined" && EventBridge !== null) { EventBridge.emitWebEvent( @@ -96,7 +100,7 @@ window.isKeyboardRaised = keyboardRaised; window.isNumericKeyboard = numericKeyboard; window.isPasswordField = passwordField; - window.lastActiveElement = activeElement; + window.lastActiveInputElement = activeInputElement; } }, POLL_FREQUENCY); diff --git a/interface/resources/meshes/drumstick.fbx b/interface/resources/meshes/drumstick.fbx index 0243d9fd1b..b384e6a30a 100644 Binary files a/interface/resources/meshes/drumstick.fbx and b/interface/resources/meshes/drumstick.fbx differ diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index 2a6b83a954..34000fdec2 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -87,6 +87,10 @@ FocusScope { id: bodyLoader anchors.fill: parent } + + Component.onDestruction: { + loginKeyboard.raised = false; + KeyboardScriptingInterface.raised = false; } Image { diff --git a/interface/resources/sounds/keyboardPress.mp3 b/interface/resources/sounds/keyboardPress.mp3 new file mode 100644 index 0000000000..e4cd21b971 Binary files /dev/null and b/interface/resources/sounds/keyboardPress.mp3 differ diff --git a/interface/resources/sounds/keyboard_key.mp3 b/interface/resources/sounds/keyboard_key.mp3 deleted file mode 100644 index e2cec81032..0000000000 Binary files a/interface/resources/sounds/keyboard_key.mp3 and /dev/null differ diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b17496ccd0..ce4308b228 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -8101,9 +8101,9 @@ void Application::loadDomainConnectionDialog() { } void Application::toggleLogDialog() { - //if (getLoginDialogPoppedUp()) { - // return; - //} + if (getLoginDialogPoppedUp()) { + return; + } if (! _logDialog) { _logDialog = new LogDialog(nullptr, getLogger()); } diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index 4c216d1ce7..c8810d8b1b 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -45,6 +45,7 @@ #include "scripting/HMDScriptingInterface.h" #include "scripting/WindowScriptingInterface.h" #include "scripting/SelectionScriptingInterface.h" +#include "scripting/HMDScriptingInterface.h" #include "DependencyManager.h" #include "raypick/StylusPointer.h" @@ -54,9 +55,9 @@ static const int LEFT_HAND_CONTROLLER_INDEX = 0; static const int RIGHT_HAND_CONTROLLER_INDEX = 1; -static const float MALLET_LENGTH = 0.2f; -static const float MALLET_TOUCH_Y_OFFSET = 0.052f; -static const float MALLET_Y_OFFSET = 0.180f; +static const float MALLET_LENGTH = 0.18f; +static const float MALLET_TOUCH_Y_OFFSET = 0.050f; +static const float MALLET_Y_OFFSET = 0.160f; static const glm::quat MALLET_ROTATION_OFFSET{0.70710678f, 0.0f, -0.70710678f, 0.0f}; static const glm::vec3 MALLET_MODEL_DIMENSIONS{0.03f, MALLET_LENGTH, 0.03f}; @@ -65,14 +66,14 @@ static const glm::vec3 MALLET_TIP_OFFSET{0.0f, MALLET_LENGTH - MALLET_TOUCH_Y_OF static const glm::vec3 Z_AXIS {0.0f, 0.0f, 1.0f}; -static const glm::vec3 KEYBOARD_TABLET_OFFSET{0.28f, -0.3f, -0.05f}; +static const glm::vec3 KEYBOARD_TABLET_OFFSET{0.30f, -0.38f, -0.04f}; static const glm::vec3 KEYBOARD_TABLET_DEGREES_OFFSET{-45.0f, 0.0f, 0.0f}; static const glm::vec3 KEYBOARD_TABLET_LANDSCAPE_OFFSET{-0.2f, -0.27f, -0.05f}; static const glm::vec3 KEYBOARD_TABLET_LANDSCAPE_DEGREES_OFFSET{-45.0f, 0.0f, -90.0f}; static const glm::vec3 KEYBOARD_AVATAR_OFFSET{-0.6f, 0.3f, -0.7f}; static const glm::vec3 KEYBOARD_AVATAR_DEGREES_OFFSET{0.0f, 180.0f, 0.0f}; -static const QString SOUND_FILE = PathUtils::resourcesUrl() + "sounds/keyboard_key.mp3"; +static const QString SOUND_FILE = PathUtils::resourcesUrl() + "sounds/keyboardPress.mp3"; static const QString MALLET_MODEL_URL = PathUtils::resourcesUrl() + "meshes/drumstick.fbx"; static const float PULSE_STRENGTH = 0.6f; @@ -221,6 +222,7 @@ Keyboard::Keyboard() { auto pointerManager = DependencyManager::get(); auto windowScriptingInterface = DependencyManager::get(); auto myAvatar = DependencyManager::get()->getMyAvatar(); + auto hmdScriptingInterface = DependencyManager::get(); connect(pointerManager.data(), &PointerManager::triggerBeginOverlay, this, &Keyboard::handleTriggerBegin, Qt::QueuedConnection); connect(pointerManager.data(), &PointerManager::triggerContinueOverlay, this, &Keyboard::handleTriggerContinue, Qt::QueuedConnection); connect(pointerManager.data(), &PointerManager::triggerEndOverlay, this, &Keyboard::handleTriggerEnd, Qt::QueuedConnection); @@ -228,6 +230,7 @@ Keyboard::Keyboard() { connect(pointerManager.data(), &PointerManager::hoverEndOverlay, this, &Keyboard::handleHoverEnd, Qt::QueuedConnection); connect(myAvatar.get(), &MyAvatar::sensorToWorldScaleChanged, this, &Keyboard::scaleKeyboard, Qt::QueuedConnection); connect(windowScriptingInterface.data(), &WindowScriptingInterface::domainChanged, [&]() { setRaised(false); }); + connect(hmdScriptingInterface.data(), &HMDScriptingInterface::displayModeChanged, [&]() { setRaised(false); }); } void Keyboard::registerKeyboardHighlighting() { @@ -493,7 +496,7 @@ void Keyboard::handleTriggerBegin(const OverlayID& overlayID, const PointerEvent AudioInjectorOptions audioOptions; audioOptions.localOnly = true; audioOptions.position = keyWorldPosition; - audioOptions.volume = 0.1f; + audioOptions.volume = 0.05f; AudioInjector::playSoundAndDelete(_keySound, audioOptions); @@ -845,8 +848,8 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) { _textDisplay = textDisplay; _ignoreItemsLock.withWriteLock([&] { - _itemsToIgnore.push_back(_textDisplay.overlayID); - _itemsToIgnore.push_back(_anchor.overlayID); + _itemsToIgnore.append(_textDisplay.overlayID); + _itemsToIgnore.append(_anchor.overlayID); }); _layerIndex = 0; auto pointerManager = DependencyManager::get(); diff --git a/interface/src/ui/StandAloneJSConsole.cpp b/interface/src/ui/StandAloneJSConsole.cpp index 15c7eaba7f..e6c3748d20 100644 --- a/interface/src/ui/StandAloneJSConsole.cpp +++ b/interface/src/ui/StandAloneJSConsole.cpp @@ -20,8 +20,7 @@ void StandAloneJSConsole::toggleConsole() { QMainWindow* mainWindow = qApp->getWindow(); - //if (!_jsConsole && !qApp->getLoginDialogPoppedUp()) { - if (!_jsConsole) { + if (!_jsConsole && !qApp->getLoginDialogPoppedUp()) { QDialog* dialog = new QDialog(mainWindow, Qt::WindowStaysOnTopHint); QVBoxLayout* layout = new QVBoxLayout(dialog); dialog->setLayout(layout); diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 7593e12e07..22b123c85d 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -535,7 +535,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionVector(const PickRay bool bestIsFront = false; bool bestIsTablet = false; auto tabletIDs = qApp->getTabletIDs(); - + const QVector keyboardKeysToDiscard = DependencyManager::get()->getKeysID(); QMutexLocker locker(&_mutex); RayToOverlayIntersectionResult result; QMapIterator i(_overlaysWorld); @@ -545,7 +545,8 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionVector(const PickRay auto thisOverlay = std::dynamic_pointer_cast(i.value()); if ((overlaysToDiscard.size() > 0 && overlaysToDiscard.contains(thisID)) || - (overlaysToInclude.size() > 0 && !overlaysToInclude.contains(thisID))) { + (overlaysToInclude.size() > 0 && !overlaysToInclude.contains(thisID)) || + (keyboardKeysToDiscard.size() > 0 && keyboardKeysToDiscard.contains(thisID))) { continue; } diff --git a/libraries/octree/src/OctreeEntitiesFileParser.cpp b/libraries/octree/src/OctreeEntitiesFileParser.cpp index 873eaff0e1..962f744c34 100644 --- a/libraries/octree/src/OctreeEntitiesFileParser.cpp +++ b/libraries/octree/src/OctreeEntitiesFileParser.cpp @@ -46,8 +46,13 @@ bool OctreeEntitiesFileParser::parseEntities(QVariantMap& parsedEntities) { bool gotId = false; bool gotVersion = false; - while (!(gotDataVersion && gotEntities && gotId && gotVersion)) { - if (nextToken() != '"') { + int token = nextToken(); + + while (true) { + if (token == '}') { + break; + } + else if (token != '"') { _errorString = "Incorrect key string"; return false; } @@ -144,15 +149,13 @@ bool OctreeEntitiesFileParser::parseEntities(QVariantMap& parsedEntities) { return false; } - if (gotDataVersion && gotEntities && gotId && gotVersion) { - break; - } else if (nextToken() != ',') { - _errorString = "Id/value incorrectly terminated"; - return false; + token = nextToken(); + if (token == ',') { + token = nextToken(); } } - if (nextToken() != '}' || nextToken() != -1) { + if (nextToken() != -1) { _errorString = "Ill-formed end of object"; return false; }