Merge branch 'loginInitiative2' of https://github.com/wayne-chen/hifi into loginInitiative2

This commit is contained in:
Wayne Chen 2018-11-20 10:44:29 -08:00
commit 5f658b90ff
13 changed files with 71 additions and 49 deletions

View file

@ -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();

View file

@ -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<chrono::microseconds>(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--;
}

View file

@ -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": {

View file

@ -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);

View file

@ -87,6 +87,10 @@ FocusScope {
id: bodyLoader
anchors.fill: parent
}
Component.onDestruction: {
loginKeyboard.raised = false;
KeyboardScriptingInterface.raised = false;
}
Image {

Binary file not shown.

View file

@ -8101,9 +8101,9 @@ void Application::loadDomainConnectionDialog() {
}
void Application::toggleLogDialog() {
//if (getLoginDialogPoppedUp()) {
// return;
//}
if (getLoginDialogPoppedUp()) {
return;
}
if (! _logDialog) {
_logDialog = new LogDialog(nullptr, getLogger());
}

View file

@ -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<PointerManager>();
auto windowScriptingInterface = DependencyManager::get<WindowScriptingInterface>();
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
auto hmdScriptingInterface = DependencyManager::get<HMDScriptingInterface>();
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<PointerManager>();

View file

@ -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);

View file

@ -535,7 +535,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionVector(const PickRay
bool bestIsFront = false;
bool bestIsTablet = false;
auto tabletIDs = qApp->getTabletIDs();
const QVector<OverlayID> keyboardKeysToDiscard = DependencyManager::get<Keyboard>()->getKeysID();
QMutexLocker locker(&_mutex);
RayToOverlayIntersectionResult result;
QMapIterator<OverlayID, Overlay::Pointer> i(_overlaysWorld);
@ -545,7 +545,8 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionVector(const PickRay
auto thisOverlay = std::dynamic_pointer_cast<Base3DOverlay>(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;
}

View file

@ -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;
}