Fixed simplifiedNametag

This commit is contained in:
ksuprynowicz 2022-08-21 17:11:36 +02:00
parent 716a02495e
commit 80e5f2430f
3 changed files with 6 additions and 7 deletions

View file

@ -1217,8 +1217,6 @@ public:
* @function MyAvatar.getTargetAvatar
* @returns {ScriptAvatar} Information on the avatar being looked at, <code>null</code> if no avatar is being looked at.
*/
// FIXME: The return type doesn't have a conversion to a script value so the function always returns undefined in
// JavaScript. Note: When fixed, JSDoc is needed for the return type.
Q_INVOKABLE ScriptAvatarData* getTargetAvatar() const;

View file

@ -29,7 +29,7 @@ bool avatarDataFromScriptValue(const ScriptValue& object, ScriptAvatarData*& out
STATIC_SCRIPT_TYPES_INITIALIZER((+[](ScriptManager* manager) {
auto scriptEngine = manager->engine().get();
scriptRegisterMetaType<ScriptAvatarData*, avatarDataToScriptValue, avatarDataFromScriptValue>(scriptEngine);
scriptRegisterMetaType<ScriptAvatarData*, avatarDataToScriptValue, avatarDataFromScriptValue>(scriptEngine, "ScriptAvatarData*");
}));
ScriptAvatarData::ScriptAvatarData(AvatarSharedPointer avatarData) :

View file

@ -148,8 +148,9 @@ function getAvatarData(uuid) {
var avatarInfo = avatar.avatarInfo;
var newAvatarInfo = AvatarManager.getAvatar(uuid);
// Save the username so it doesn't get overwritten when grabbing new avatarData
var combinedAvatarInfo = Object.assign({}, newAvatarInfo, {
var combinedAvatarInfo = Object.assign({}, {avatarData: newAvatarInfo}, {
username: avatarInfo === null ? null : avatarInfo.username
});
@ -168,7 +169,7 @@ function getDistance(uuid, checkAvatar, shouldSave) {
var avatar = _this.avatars[uuid];
var avatarInfo = avatar.avatarInfo;
var target = avatarInfo.position;
var target = avatarInfo.avatarData.position;
var currentDistance = Vec3.distance(target, eye);
@ -304,7 +305,7 @@ function getCorrectName(uuid) {
var avatar = _this.avatars[uuid];
var avatarInfo = avatar.avatarInfo;
var displayNameToUse = avatarInfo.displayName.trim();
var displayNameToUse = avatarInfo.avatarData.displayName.trim();
if (displayNameToUse === "") {
displayNameToUse = "anonymous";
@ -744,4 +745,4 @@ nameTagListManager.prototype = {
};
module.exports = nameTagListManager;
module.exports = nameTagListManager;