ask for a mesh if username is present on login or is changed

This commit is contained in:
Stephen Birarda 2013-10-07 13:52:46 -07:00
parent e9e77d8276
commit b33843fddc
3 changed files with 19 additions and 3 deletions

View file

@ -58,6 +58,7 @@
#include <VoxelSceneStats.h>
#include "Application.h"
#include "DataServerClient.h"
#include "LogDisplay.h"
#include "Menu.h"
#include "Swatch.h"
@ -1585,6 +1586,11 @@ void Application::init() {
_audio.setJitterBufferSamples(Menu::getInstance()->getAudioJitterBufferSamples());
}
qDebug("Loaded settings.\n");
if (!_myAvatar.getUsername().isEmpty()) {
// we have a username for this avatar, ask the data-server for the mesh URL for this avatar
DataServerClient::getClientValueForKey(DataServerKey::FaceMeshURL);
}
// Set up VoxelSystem after loading preferences so we can get the desired max voxel count
_voxels.setMaxVoxels(Menu::getInstance()->getMaxVoxels());

View file

@ -29,4 +29,8 @@ private:
static std::vector<unsigned char*> _unconfirmedPackets;
};
namespace DataServerKey {
const char FaceMeshURL[] = "mesh";
}
#endif /* defined(__hifi__DataServerClient__) */

View file

@ -804,21 +804,27 @@ void Menu::editPreferences() {
return;
}
QUrl faceModelURL(faceURLEdit->text());
if (avatarUsernameEdit->text() != avatarUsername) {
// there has been a UUID change - set the new UUID on the avatar instance
// there has been a username change - set the new UUID on the avatar instance
applicationInstance->getAvatar()->setUsername(avatarUsernameEdit->text());
if (faceModelURL.toString() == faceURLString) {
// if there was no change to the face model URL then ask the data-server for what it is
DataServerClient::getClientValueForKey(DataServerKey::FaceMeshURL);
}
}
QUrl avatarVoxelURL(avatarURL->text());
applicationInstance->getAvatar()->getVoxels()->setVoxelURL(avatarVoxelURL);
QUrl faceModelURL(faceURLEdit->text());
if (faceModelURL.toString() != faceURLString) {
applicationInstance->getAvatar()->getHead().getBlendFace().setModelURL(faceModelURL);
// send the new face mesh URL to the data-server (if we have a client UUID)
DataServerClient::putValueForKey("mesh", faceModelURL.toString().toLocal8Bit().constData());
DataServerClient::putValueForKey(DataServerKey::FaceMeshURL,
faceModelURL.toString().toLocal8Bit().constData());
}
Avatar::sendAvatarURLsMessage(avatarVoxelURL, faceModelURL);