Merge branch 'master' of github.com:highfidelity/hifi into fix-vive-head-pose

This commit is contained in:
Dante Ruiz 2017-11-28 10:44:04 -08:00
commit 7daad29906
10 changed files with 105 additions and 19 deletions

View file

@ -916,6 +916,14 @@
"default": false
}
]
},
{
"name": "multi_kick_logged_in",
"type": "checkbox",
"label": "Multi-Kick for Logged In Users",
"help": "Kick logged in users by machine fingerprint (in addition to the default kick by username)",
"default": false,
"advanced": true
}
]
},

View file

@ -183,6 +183,11 @@ NodePermissions DomainGatekeeper::setPermissionsForUser(bool isLocalUser, QStrin
#ifdef WANT_DEBUG
qDebug() << "| user-permissions: specific MAC matches, so:" << userPerms;
#endif
} else if (_server->_settingsManager.hasPermissionsForMachineFingerprint(machineFingerprint)) {
userPerms = _server->_settingsManager.getPermissionsForMachineFingerprint(machineFingerprint);
#ifdef WANT_DEBUG
qDebug(() << "| user-permissions: specific Machine Fingerprint matches, so: " << userPerms;
#endif
} else if (_server->_settingsManager.hasPermissionsForIP(senderAddress)) {
// this user comes from an IP we have in our permissions table, apply those permissions

View file

@ -672,7 +672,7 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
bool newPermissions = false;
if (!verifiedUsername.isEmpty()) {
// if we have a verified user name for this user, we apply the kick to the username
// if we have a verified user name for this user, we first apply the kick to the username
// check if there were already permissions
bool hadPermissions = havePermissionsForName(verifiedUsername);
@ -684,7 +684,14 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
// ensure that the connect permission is clear
userPermissions->clear(NodePermissions::Permission::canConnectToDomain);
} else {
}
// if we didn't have a username, or this domain-server uses the "multi-kick" setting to
// kick logged in users via username AND machine fingerprint (or IP as fallback)
// then we remove connect permissions for the machine fingerprint (or IP as fallback)
const QString MULTI_KICK_SETTINGS_KEYPATH = "security.multi_kick_logged_in";
if (verifiedUsername.isEmpty() || valueOrDefaultValueForKeyPath(MULTI_KICK_SETTINGS_KEYPATH).toBool()) {
// remove connect permissions for the machine fingerprint
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
if (nodeData) {
@ -719,8 +726,8 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
// TODO: soon we will have feedback (in the form of a message to the client) after we kick. When we
// do, we will have a success flag, and perhaps a reason for failure. For now, just don't do it.
if (kickAddress == limitedNodeList->getPublicSockAddr().getAddress() ||
kickAddress == limitedNodeList->getLocalSockAddr().getAddress() ||
kickAddress.isLoopback() ) {
kickAddress == limitedNodeList->getLocalSockAddr().getAddress() ||
kickAddress.isLoopback() ) {
qWarning() << "attempt to kick node running on same machine as domain server, ignoring KickRequest";
return;
}

View file

@ -36,7 +36,9 @@ Rectangle {
readonly property bool hmdHead: headBox.checked
readonly property bool headPuck: headPuckBox.checked
readonly property bool handController: handBox.checked
readonly property bool handPuck: handPuckBox.checked
readonly property bool hmdDesktop: hmdInDesktop.checked
property int state: buttonState.disabled
property var lastConfiguration: null
@ -53,10 +55,6 @@ Rectangle {
}
MouseArea {
id: mouseArea
@ -99,6 +97,7 @@ Rectangle {
onClicked: {
if (checked) {
headPuckBox.checked = false;
hmdInDesktop.checked = false;
} else {
checked = true;
}
@ -121,6 +120,7 @@ Rectangle {
onClicked: {
if (checked) {
headBox.checked = false;
hmdInDesktop.checked = false;
} else {
checked = true;
}
@ -133,6 +133,36 @@ Rectangle {
text: "Tracker"
color: hifi.colors.lightGrayText
}
HifiControls.CheckBox {
id: hmdInDesktop
width: 15
height: 15
boxRadius: 7
visible: viveInDesktop.checked
anchors.top: viveInDesktop.bottom
anchors.topMargin: 5
anchors.left: openVrConfiguration.left
anchors.leftMargin: leftMargin + 10
onClicked: {
if (checked) {
headBox.checked = false;
headPuckBox.checked = false;
} else {
checked = true;
}
sendConfigurationSettings();
}
}
RalewayBold {
size: 12
visible: viveInDesktop.checked
text: "None"
color: hifi.colors.lightGrayText
}
}
Row {
@ -773,6 +803,11 @@ Rectangle {
anchors.leftMargin: leftMargin + 10
onClicked: {
if (!checked & hmdInDesktop.checked) {
headBox.checked = true;
headPuckBox.checked = false;
hmdInDesktop.checked = false;
}
sendConfigurationSettings();
}
}
@ -789,6 +824,7 @@ Rectangle {
verticalCenter: viveInDesktop.verticalCenter
}
}
NumberAnimation {
id: numberAnimation
@ -797,6 +833,7 @@ Rectangle {
to: 0
}
function logAction(action, status) {
console.log("calibrated from ui");
var data = {
@ -877,6 +914,7 @@ Rectangle {
var HmdHead = settings["HMDHead"];
var viveController = settings["handController"];
var desktopMode = settings["desktopMode"];
var hmdDesktopPosition = settings["hmdDesktopTracking"];
armCircumference.value = settings.armCircumference;
shoulderWidth.value = settings.shoulderWidth;
@ -898,6 +936,7 @@ Rectangle {
}
viveInDesktop.checked = desktopMode;
hmdInDesktop.checked = hmdDesktopPosition;
initializeButtonState();
updateCalibrationText();
@ -1058,7 +1097,8 @@ Rectangle {
"handConfiguration": handObject,
"armCircumference": armCircumference.value,
"shoulderWidth": shoulderWidth.value,
"desktopMode": viveInDesktop.checked
"desktopMode": viveInDesktop.checked,
"hmdDesktopTracking": hmdInDesktop.checked
}
return settingsObject;

View file

@ -1602,7 +1602,7 @@ void EntityItem::setParentID(const QUuid& value) {
QUuid oldParentID = getParentID();
if (oldParentID != value) {
EntityTreePointer tree = getTree();
if (!oldParentID.isNull()) {
if (tree && !oldParentID.isNull()) {
tree->removeFromChildrenOfAvatars(getThisPointer());
}
SpatiallyNestable::setParentID(value);

View file

@ -385,9 +385,9 @@ void NodeList::sendDomainServerCheckIn() {
packetStream << hardwareAddress;
// now add the machine fingerprint - a null UUID if logged in, real one if not logged in
// now add the machine fingerprint
auto accountManager = DependencyManager::get<AccountManager>();
packetStream << (accountManager->isLoggedIn() ? QUuid() : FingerprintUtils::getMachineFingerprint());
packetStream << FingerprintUtils::getMachineFingerprint();
}
// pack our data to send to the domain-server including

View file

@ -57,7 +57,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo);
case PacketType::DomainConnectRequest:
return static_cast<PacketVersion>(DomainConnectRequestVersion::HasMachineFingerprint);
return static_cast<PacketVersion>(DomainConnectRequestVersion::AlwaysHasMachineFingerprint);
case PacketType::DomainServerAddedNode:
return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid);

View file

@ -247,7 +247,8 @@ enum class DomainConnectRequestVersion : PacketVersion {
HasHostname,
HasProtocolVersions,
HasMACAddress,
HasMachineFingerprint
HasMachineFingerprint,
AlwaysHasMachineFingerprint
};
enum class DomainConnectionDeniedVersion : PacketVersion {

View file

@ -166,6 +166,11 @@ void ViveControllerManager::setConfigurationSettings(const QJsonObject configura
_resetMatCalculated = false;
}
}
if (configurationSettings.contains("hmdDesktopTracking")) {
_hmdDesktopTracking = configurationSettings["hmdDesktopTracking"].toBool();
}
_inputDevice->configureCalibrationSettings(configurationSettings);
saveSettings();
}
@ -175,6 +180,7 @@ QJsonObject ViveControllerManager::configurationSettings() {
if (isSupported()) {
QJsonObject configurationSettings = _inputDevice->configurationSettings();
configurationSettings["desktopMode"] = _desktopMode;
configurationSettings["hmdDesktopTracking"] = _hmdDesktopTracking;
return configurationSettings;
}
@ -414,6 +420,8 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
if (!configurationSettings.empty()) {
auto iter = configurationSettings.begin();
auto end = configurationSettings.end();
bool hmdDesktopTracking = true;
bool hmdDesktopMode = false;
while (iter != end) {
if (iter.key() == "bodyConfiguration") {
setConfigFromString(iter.value().toString());
@ -441,9 +449,15 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
_armCircumference = (float)iter.value().toDouble() * CM_TO_M;
} else if (iter.key() == "shoulderWidth") {
_shoulderWidth = (float)iter.value().toDouble() * CM_TO_M;
} else if (iter.key() == "hmdDesktopTracking") {
hmdDesktopTracking = iter.value().toBool();
} else if (iter.key() == "desktopMode") {
hmdDesktopMode = iter.value().toBool();
}
iter++;
}
_hmdTrackingEnabled = !(hmdDesktopMode && hmdDesktopTracking);
}
}
@ -735,11 +749,18 @@ void ViveControllerManager::InputDevice::handleHmd(uint32_t deviceIndex, const c
_system->GetTrackedDeviceClass(deviceIndex) == vr::TrackedDeviceClass_HMD &&
_nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid) {
const mat4& mat = _nextSimPoseData.poses[deviceIndex];
const vec3 linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
const vec3 angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
if (_hmdTrackingEnabled){
const mat4& mat = _nextSimPoseData.poses[deviceIndex];
const vec3 linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
const vec3 angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
handleHeadPoseEvent(inputCalibrationData, mat, linearVelocity, angularVelocity);
handleHeadPoseEvent(inputCalibrationData, mat, linearVelocity, angularVelocity);
} else {
const mat4& mat = mat4();
const vec3 zero = vec3();
handleHeadPoseEvent(inputCalibrationData, mat, zero, zero);
}
}
}

View file

@ -113,7 +113,6 @@ private:
void emitCalibrationStatus();
void calibrateNextFrame();
class FilteredStick {
public:
glm::vec2 process(float deltaTime, const glm::vec2& stick) {
@ -195,6 +194,8 @@ private:
bool _overrideHands { false };
mutable std::recursive_mutex _lock;
bool _hmdTrackingEnabled { false };
QString configToString(Config config);
friend class ViveControllerManager;
};
@ -204,7 +205,10 @@ private:
bool _registeredWithInputMapper { false };
bool _modelLoaded { false };
bool _resetMatCalculated { false };
bool _desktopMode { false };
bool _hmdDesktopTracking { false };
glm::mat4 _resetMat { glm::mat4() };
model::Geometry _modelGeometry;
gpu::TexturePointer _texture;