New Avatar UI
Showing the changes to interface/src/Application.cpp (1 of 15 files). Show all
Unified · Split
| @@ -3719,17 +3719,7 @@ bool Application::askToSetAvatarUrl(const QString& url) { · 3718 unmodified lines | |||
| 3719 | } | 3719 | } |
| 3720 | 3720 | ||
| 3721 | // Download the FST file, to attempt to determine its model type | 3721 | // Download the FST file, to attempt to determine its model type |
| 3722 | QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | 3722 | QVariantHash fstMapping = FSTReader::downloadMapping(url); |
| 3723 | QNetworkRequest networkRequest = QNetworkRequest(url); | ||
| 3724 | networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); | ||
| 3725 | QNetworkReply* reply = networkAccessManager.get(networkRequest); | ||
| 3726 | qCDebug(interfaceapp) << "Downloading avatar file at " << url; | ||
| 3727 | QEventLoop loop; | ||
| 3728 | QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit); | ||
| 3729 | loop.exec(); | ||
| 3730 | QByteArray fstContents = reply->readAll(); | ||
| 3731 | delete reply; | ||
| 3732 | QVariantHash fstMapping = FSTReader::readMapping(fstContents); | ||
| 3733 | 3723 | ||
| 3734 | FSTReader::ModelType modelType = FSTReader::predictModelType(fstMapping); | 3724 | FSTReader::ModelType modelType = FSTReader::predictModelType(fstMapping); |
| 3735 | 3725 | ||
| @@ -3740,26 +3730,27 @@ bool Application::askToSetAvatarUrl(const QString& url) { · 4 unmodified lines | |||
| 3740 | QPushButton* bodyButton = NULL; | 3730 | QPushButton* bodyButton = NULL; |
| 3741 | QPushButton* bodyAndHeadButton = NULL; | 3731 | QPushButton* bodyAndHeadButton = NULL; |
| 3742 | 3732 | ||
| 3733 | QString modelName = fstMapping["name"].toString(); | ||
| 3743 | QString message; | 3734 | QString message; |
| 3744 | QString typeInfo; | 3735 | QString typeInfo; |
| 3745 | switch (modelType) { | 3736 | switch (modelType) { |
| 3746 | case FSTReader::HEAD_MODEL: | 3737 | case FSTReader::HEAD_MODEL: |
| 3747 | message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for your avatar head?"); | 3738 | message = QString("Would you like to use '") + modelName + QString("' for your avatar head?"); |
| 3748 | headButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); | 3739 | headButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3749 | break; | 3740 | break; |
| 3750 | 3741 | ||
| 3751 | case FSTReader::BODY_ONLY_MODEL: | 3742 | case FSTReader::BODY_ONLY_MODEL: |
| 3752 | message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for your avatar body?"); | 3743 | message = QString("Would you like to use '") + modelName + QString("' for your avatar body?"); |
| 3753 | bodyButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); | 3744 | bodyButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3754 | break; | 3745 | break; |
| 3755 | 3746 | ||
| 3756 | case FSTReader::HEAD_AND_BODY_MODEL: | 3747 | case FSTReader::HEAD_AND_BODY_MODEL: |
| 3757 | message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for your avatar?"); | 3748 | message = QString("Would you like to use '") + modelName + QString("' for your avatar?"); |
| 3758 | bodyAndHeadButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); | 3749 | bodyAndHeadButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3759 | break; | 3750 | break; |
| 3760 | 3751 | ||
| 3761 | default: | 3752 | default: |
| 3762 | message = QString("Would you like to use '") + fstMapping["name"].toString() + QString("' for some part of your avatar head?"); | 3753 | message = QString("Would you like to use '") + modelName + QString("' for some part of your avatar head?"); |
| 3763 | headButton = msgBox.addButton(tr("Use for Head"), QMessageBox::ActionRole); | 3754 | headButton = msgBox.addButton(tr("Use for Head"), QMessageBox::ActionRole); |
| 3764 | bodyButton = msgBox.addButton(tr("Use for Body"), QMessageBox::ActionRole); | 3755 | bodyButton = msgBox.addButton(tr("Use for Body"), QMessageBox::ActionRole); |
| 3765 | bodyAndHeadButton = msgBox.addButton(tr("Use for Body and Head"), QMessageBox::ActionRole); | 3756 | bodyAndHeadButton = msgBox.addButton(tr("Use for Body and Head"), QMessageBox::ActionRole); |
| @@ -3772,34 +3763,18 @@ bool Application::askToSetAvatarUrl(const QString& url) { · 6 unmodified lines | |||
| 3772 | msgBox.exec(); | 3763 | msgBox.exec(); |
| 3773 | 3764 | ||
| 3774 | if (msgBox.clickedButton() == headButton) { | 3765 | if (msgBox.clickedButton() == headButton) { |
| 3775 | qCDebug(interfaceapp) << "Chose to use for head: " << url; | 3766 | _myAvatar->useHeadURL(url, modelName); |
| 3776 | _myAvatar->setFaceModelURL(url); | 3767 | emit headURLChanged(url, modelName); |
| 3777 | UserActivityLogger::getInstance().changedModel("head", url); | ||
| 3778 | _myAvatar->sendIdentityPacket(); | ||
| 3779 | emit faceURLChanged(url); | ||
| 3780 | } else if (msgBox.clickedButton() == bodyButton) { | 3768 | } else if (msgBox.clickedButton() == bodyButton) { |
| 3781 | qCDebug(interfaceapp) << "Chose to use for body: " << url; | 3769 | _myAvatar->useBodyURL(url, modelName); |
| 3782 | _myAvatar->setSkeletonModelURL(url); | 3770 | emit bodyURLChanged(url, modelName); |
| 3783 | // if the head is empty, reset it to the default head. | ||
| 3784 | if (_myAvatar->getFaceModelURLString().isEmpty()) { | ||
| 3785 | _myAvatar->setFaceModelURL(DEFAULT_HEAD_MODEL_URL); | ||
| 3786 | emit faceURLChanged(DEFAULT_HEAD_MODEL_URL.toString()); | ||
| 3787 | UserActivityLogger::getInstance().changedModel("head", DEFAULT_HEAD_MODEL_URL.toString()); | ||
| 3788 | } | ||
| 3789 | UserActivityLogger::getInstance().changedModel("skeleton", url); | ||
| 3790 | _myAvatar->sendIdentityPacket(); | ||
| 3791 | emit skeletonURLChanged(url); | ||
| 3792 | } else if (msgBox.clickedButton() == bodyAndHeadButton) { | 3771 | } else if (msgBox.clickedButton() == bodyAndHeadButton) { |
| 3793 | qCDebug(interfaceapp) << "Chose to use for body + head: " << url; | 3772 | _myAvatar->useFullAvatarURL(url, modelName); |
| 3794 | _myAvatar->setFaceModelURL(QString()); | 3773 | emit fullAvatarURLChanged(url, modelName); |
| 3795 | _myAvatar->setSkeletonModelURL(url); | ||
| 3796 | UserActivityLogger::getInstance().changedModel("skeleton", url); | ||
| 3797 | _myAvatar->sendIdentityPacket(); | ||
| 3798 | emit faceURLChanged(QString()); | ||
| 3799 | emit skeletonURLChanged(url); | ||
| 3800 | } else { | 3774 | } else { |
| 3801 | qCDebug(interfaceapp) << "Declined to use the avatar: " << url; | 3775 | qCDebug(interfaceapp) << "Declined to use the avatar: " << url; |
| 3802 | } | 3776 | } |
| 3777 | |||
| 3803 | return true; | 3778 | return true; |
| 3804 | } | 3779 | } |
| 3805 | 3780 | ||
| @@ -4311,8 +4286,7 @@ void Application::checkSkeleton() { · 505 unmodified lines | |||
| 4311 | msgBox.setIcon(QMessageBox::Warning); | 4286 | msgBox.setIcon(QMessageBox::Warning); |
| 4312 | msgBox.exec(); | 4287 | msgBox.exec(); |
| 4313 | 4288 | ||
| 4314 | _myAvatar->setSkeletonModelURL(DEFAULT_BODY_MODEL_URL); | 4289 | _myAvatar->useBodyURL(DEFAULT_BODY_MODEL_URL, "Default"); |
| 4315 | _myAvatar->sendIdentityPacket(); | ||
| 4316 | } else { | 4290 | } else { |
| 4317 | _myAvatar->updateCharacterController(); | 4291 | _myAvatar->updateCharacterController(); |
| 4318 | _physicsEngine.setCharacterController(_myAvatar->getCharacterController()); | 4292 | _physicsEngine.setCharacterController(_myAvatar->getCharacterController()); |