shift get/set of face model URL to Profile class

This commit is contained in:
Stephen Birarda 2013-10-08 13:52:04 -07:00
parent 8bac70e4a5
commit b17e12460c
5 changed files with 14 additions and 13 deletions

View file

@ -121,11 +121,8 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int
if (strcmp(dataKeyPosition, DataServerKey::FaceMeshURL) == 0) {
// pull the user's face mesh and set it on the Avatar instance
qDebug("Changing user's face model URL to %s\n", dataValueString.toLocal8Bit().constData());
QMetaObject::invokeMethod(&Application::getInstance()->getAvatar()->getHead().getBlendFace(),
"setModelURL",
Q_ARG(QUrl, QUrl(dataValueString)));
Application::getInstance()->getProfile()->setFaceModelURL(QUrl(dataValueString));
} else if (strcmp(dataKeyPosition, DataServerKey::UUID) == 0) {
// this is the user's UUID - set it on the profile
Application::getInstance()->getProfile()->setUUID(dataValueString);

View file

@ -766,7 +766,7 @@ void Menu::editPreferences() {
avatarURL->setMinimumWidth(QLINE_MINIMUM_WIDTH);
form->addRow("Avatar URL:", avatarURL);
QString faceURLString = applicationInstance->getAvatar()->getHead().getBlendFace().getModelURL().toString();
QString faceURLString = applicationInstance->getProfile()->getFaceModelURL().toString();
QLineEdit* faceURLEdit = new QLineEdit(faceURLString);
faceURLEdit->setMinimumWidth(QLINE_MINIMUM_WIDTH);
form->addRow("Face URL:", faceURLEdit);
@ -820,14 +820,14 @@ void Menu::editPreferences() {
applicationInstance->getProfile()->setUsername(avatarUsernameEdit->text());
if (faceModelURL.toString() == faceURLString && !avatarUsernameEdit->text().isEmpty()) {
// if there was no change to the face model URL then clear it and ask the data-server for what it is
applicationInstance->getAvatar()->getHead().getBlendFace().setModelURL(QUrl());
// if there was no change to the face model URL then ask the data-server for what it is
DataServerClient::getClientValueForKey(DataServerKey::FaceMeshURL);
}
}
if (faceModelURL.toString() != faceURLString) {
applicationInstance->getAvatar()->getHead().getBlendFace().setModelURL(faceModelURL);
// change the faceModelURL in the profile, it will also update this user's BlendFace
applicationInstance->getProfile()->setFaceModelURL(faceModelURL);
// send the new face mesh URL to the data-server (if we have a client UUID)
DataServerClient::putValueForKey(DataServerKey::FaceMeshURL,
@ -837,8 +837,6 @@ void Menu::editPreferences() {
QUrl avatarVoxelURL(avatarURL->text());
applicationInstance->getAvatar()->getVoxels()->setVoxelURL(avatarVoxelURL);
Avatar::sendAvatarURLsMessage(avatarVoxelURL, faceModelURL);
applicationInstance->getAvatar()->getHead().setPupilDilation(pupilDilation->value() / (float)pupilDilation->maximum());

View file

@ -537,7 +537,6 @@ void MyAvatar::saveData(QSettings* settings) {
settings->setValue("position_z", _position.z);
settings->setValue("voxelURL", _voxels.getVoxelURL());
settings->setValue("faceModelURL", _head.getBlendFace().getModelURL());
settings->setValue("pupilDilation", _head.getPupilDilation());
settings->setValue("leanScale", _leanScale);
@ -558,7 +557,6 @@ void MyAvatar::loadData(QSettings* settings) {
_position.z = loadSetting(settings, "position_z", 0.0f);
_voxels.setVoxelURL(settings->value("voxelURL").toUrl());
_head.getBlendFace().setModelURL(settings->value("faceModelURL").toUrl());
_head.setPupilDilation(settings->value("pupilDilation", 0.0f).toFloat());
_leanScale = loadSetting(settings, "leanScale", 0.05f);

View file

@ -42,6 +42,14 @@ void Profile::setUUID(const QUuid& uuid) {
Application::getInstance()->getAvatar()->setUUID(_uuid);
}
void Profile::setFaceModelURL(const QUrl& faceModelURL) {
_faceModelURL = faceModelURL;
QMetaObject::invokeMethod(&Application::getInstance()->getAvatar()->getHead().getBlendFace(),
"setModelURL",
Q_ARG(QUrl, _faceModelURL));
}
void Profile::saveData(QSettings* settings) {
settings->beginGroup("Profile");

View file

@ -23,7 +23,7 @@ public:
void setUUID(const QUuid& uuid);
QUuid& getUUID() { return _uuid; }
void setFaceModelURL(const QUrl& faceModelURL) { _faceModelURL = faceModelURL; }
void setFaceModelURL(const QUrl& faceModelURL);
QUrl& getFaceModelURL() { return _faceModelURL; }
void clear();