From 8bac70e4a58668dcebb074f4f4f111cbcb7841f5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 8 Oct 2013 13:43:31 -0700 Subject: [PATCH] pass UUID from data-server to avatar-mixer --- interface/src/avatar/Profile.cpp | 9 ++++++++- interface/src/avatar/Profile.h | 2 +- libraries/avatars/src/AvatarData.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/interface/src/avatar/Profile.cpp b/interface/src/avatar/Profile.cpp index 763e74fdd9..976c60f1cb 100644 --- a/interface/src/avatar/Profile.cpp +++ b/interface/src/avatar/Profile.cpp @@ -35,6 +35,13 @@ void Profile::setUsername(const QString &username) { } } +void Profile::setUUID(const QUuid& uuid) { + _uuid = uuid; + + // when the UUID is changed we need set it appropriately on our avatar instance + Application::getInstance()->getAvatar()->setUUID(_uuid); +} + void Profile::saveData(QSettings* settings) { settings->beginGroup("Profile"); @@ -49,7 +56,7 @@ void Profile::loadData(QSettings* settings) { settings->beginGroup("Profile"); _username = settings->value("username").toString(); - _uuid = settings->value("UUID").toUuid(); + this->setUUID(settings->value("UUID").toUuid()); _faceModelURL = settings->value("faceModelURL").toUrl(); settings->endGroup(); diff --git a/interface/src/avatar/Profile.h b/interface/src/avatar/Profile.h index 02c8b0ad9e..7f84f0c4f8 100644 --- a/interface/src/avatar/Profile.h +++ b/interface/src/avatar/Profile.h @@ -20,7 +20,7 @@ public: void setUsername(const QString& username); QString& getUsername() { return _username; } - void setUUID(const QUuid& uuid) { _uuid = uuid; } + void setUUID(const QUuid& uuid); QUuid& getUUID() { return _uuid; } void setFaceModelURL(const QUrl& faceModelURL) { _faceModelURL = faceModelURL; } diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 41c8270e29..f0085a4138 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -119,7 +119,7 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) { // UUID QByteArray uuidByteArray = _uuid.toRfc4122(); - memcpy(destinationBuffer, &uuidByteArray, uuidByteArray.size()); + memcpy(destinationBuffer, uuidByteArray.constData(), uuidByteArray.size()); destinationBuffer += uuidByteArray.size(); // Body world position @@ -270,7 +270,7 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) { sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyRoll); // Body scale - sourceBuffer += unpackFloatRatioFromTwoByte( sourceBuffer, _newScale); + sourceBuffer += unpackFloatRatioFromTwoByte(sourceBuffer, _newScale); // Follow mode info memcpy(&_leaderID, sourceBuffer, sizeof(uint16_t));