mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 09:31:36 +02:00
Merge pull request #9689 from howard-stearns/pal-mini-code-cleanup
cleaner living for pal
This commit is contained in:
commit
821c01eeca
2 changed files with 18 additions and 26 deletions
|
@ -360,7 +360,7 @@ Rectangle {
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: displayNameHeaderMetrics
|
id: displayNameHeaderMetrics
|
||||||
text: displayNameHeader.title
|
text: displayNameHeader.title
|
||||||
font: displayNameHeader.font
|
// font: displayNameHeader.font // was this always undefined? giving error now...
|
||||||
}
|
}
|
||||||
// This Rectangle refers to the [?] popup button next to "NAMES"
|
// This Rectangle refers to the [?] popup button next to "NAMES"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -426,7 +426,6 @@ Rectangle {
|
||||||
onExited: adminHelpText.color = hifi.colors.redHighlight
|
onExited: adminHelpText.color = hifi.colors.redHighlight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
HifiControls.Keyboard {
|
HifiControls.Keyboard {
|
||||||
id: keyboard
|
id: keyboard
|
||||||
|
@ -438,6 +437,7 @@ Rectangle {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Timer used when selecting table rows that aren't yet present in the model
|
// Timer used when selecting table rows that aren't yet present in the model
|
||||||
// (i.e. when selecting avatars using edit.js or sphere overlays)
|
// (i.e. when selecting avatars using edit.js or sphere overlays)
|
||||||
|
|
|
@ -290,17 +290,14 @@ function populateUserList(selectData) {
|
||||||
userName: '',
|
userName: '',
|
||||||
sessionId: id || '',
|
sessionId: id || '',
|
||||||
audioLevel: 0.0,
|
audioLevel: 0.0,
|
||||||
admin: false
|
admin: false,
|
||||||
|
personalMute: !!id && Users.getPersonalMuteStatus(id), // expects proper boolean, not null
|
||||||
|
ignore: !!id && Users.getIgnoreStatus(id) // ditto
|
||||||
};
|
};
|
||||||
// Request the username, fingerprint, and admin status from the given UUID
|
|
||||||
// Username and fingerprint returns default constructor output if the requesting user isn't an admin
|
|
||||||
Users.requestUsernameFromID(id);
|
|
||||||
// Request personal mute status and ignore status
|
|
||||||
// from NodeList (as long as we're not requesting it for our own ID)
|
|
||||||
if (id) {
|
if (id) {
|
||||||
avatarPalDatum['personalMute'] = Users.getPersonalMuteStatus(id);
|
|
||||||
avatarPalDatum['ignore'] = Users.getIgnoreStatus(id);
|
|
||||||
addAvatarNode(id); // No overlay for ourselves
|
addAvatarNode(id); // No overlay for ourselves
|
||||||
|
// Everyone needs to see admin status. Username and fingerprint returns default constructor output if the requesting user isn't an admin.
|
||||||
|
Users.requestUsernameFromID(id);
|
||||||
}
|
}
|
||||||
data.push(avatarPalDatum);
|
data.push(avatarPalDatum);
|
||||||
print('PAL data:', JSON.stringify(avatarPalDatum));
|
print('PAL data:', JSON.stringify(avatarPalDatum));
|
||||||
|
@ -314,20 +311,13 @@ function populateUserList(selectData) {
|
||||||
|
|
||||||
// The function that handles the reply from the server
|
// The function that handles the reply from the server
|
||||||
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
function usernameFromIDReply(id, username, machineFingerprint, isAdmin) {
|
||||||
var data;
|
var data = [
|
||||||
// If the ID we've received is our ID...
|
(MyAvatar.sessionUUID === id) ? '' : id, // Pal.qml recognizes empty id specially.
|
||||||
if (MyAvatar.sessionUUID === id) {
|
// If we get username (e.g., if in future we receive it when we're friends), use it.
|
||||||
// Set the data to contain specific strings.
|
// Otherwise, use valid machineFingerprint (which is not valid when not an admin).
|
||||||
data = ['', username, isAdmin];
|
username || (Users.canKick && machineFingerprint) || '',
|
||||||
} else if (Users.canKick) {
|
isAdmin
|
||||||
// Set the data to contain the ID and the username (if we have one)
|
];
|
||||||
// or fingerprint (if we don't have a username) string.
|
|
||||||
data = [id, username || machineFingerprint, isAdmin];
|
|
||||||
} else {
|
|
||||||
// Set the data to contain specific strings.
|
|
||||||
data = [id, '', isAdmin];
|
|
||||||
}
|
|
||||||
print('Username Data:', JSON.stringify(data));
|
|
||||||
// Ship the data off to QML
|
// Ship the data off to QML
|
||||||
sendToQml({ method: 'updateUsername', params: data });
|
sendToQml({ method: 'updateUsername', params: data });
|
||||||
}
|
}
|
||||||
|
@ -339,13 +329,15 @@ function updateOverlays() {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return; // don't update ourself
|
return; // don't update ourself
|
||||||
}
|
}
|
||||||
|
var avatar = AvatarList.getAvatar(id);
|
||||||
|
if (!avatar) {
|
||||||
|
return; // will be deleted below if there had been an overlay.
|
||||||
|
}
|
||||||
var overlay = ExtendedOverlay.get(id);
|
var overlay = ExtendedOverlay.get(id);
|
||||||
if (!overlay) { // For now, we're treating this as a temporary loss, as from the personal space bubble. Add it back.
|
if (!overlay) { // For now, we're treating this as a temporary loss, as from the personal space bubble. Add it back.
|
||||||
print('Adding non-PAL avatar node', id);
|
print('Adding non-PAL avatar node', id);
|
||||||
overlay = addAvatarNode(id);
|
overlay = addAvatarNode(id);
|
||||||
}
|
}
|
||||||
var avatar = AvatarList.getAvatar(id);
|
|
||||||
var target = avatar.position;
|
var target = avatar.position;
|
||||||
var distance = Vec3.distance(target, eye);
|
var distance = Vec3.distance(target, eye);
|
||||||
var offset = 0.2;
|
var offset = 0.2;
|
||||||
|
|
Loading…
Reference in a new issue