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 | 3721 | // Download the FST file, to attempt to determine its model type |
| 3722 | − QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | |
| 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); | |
| 3722 | + QVariantHash fstMapping = FSTReader::downloadMapping(url); | |
| 3733 | 3723 | |
| 3734 | 3724 | FSTReader::ModelType modelType = FSTReader::predictModelType(fstMapping); |
| 3735 | 3725 | |
| @@ -3740,26 +3730,27 @@ bool Application::askToSetAvatarUrl(const QString& url) { · 4 unmodified lines | ||
| 3740 | 3730 | QPushButton* bodyButton = NULL; |
| 3741 | 3731 | QPushButton* bodyAndHeadButton = NULL; |
| 3742 | 3732 | |
| 3733 | + QString modelName = fstMapping["name"].toString(); | |
| 3743 | 3734 | QString message; |
| 3744 | 3735 | QString typeInfo; |
| 3745 | 3736 | switch (modelType) { |
| 3746 | 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 | 3739 | headButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3749 | 3740 | break; |
| 3750 | 3741 | |
| 3751 | 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 | 3744 | bodyButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3754 | 3745 | break; |
| 3755 | 3746 | |
| 3756 | 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 | 3749 | bodyAndHeadButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); |
| 3759 | 3750 | break; |
| 3760 | 3751 | |
| 3761 | 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 | 3754 | headButton = msgBox.addButton(tr("Use for Head"), QMessageBox::ActionRole); |
| 3764 | 3755 | bodyButton = msgBox.addButton(tr("Use for Body"), QMessageBox::ActionRole); |
| 3765 | 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 | 3763 | msgBox.exec(); |
| 3773 | 3764 | |
| 3774 | 3765 | if (msgBox.clickedButton() == headButton) { |
| 3775 | − qCDebug(interfaceapp) << "Chose to use for head: " << url; | |
| 3776 | − _myAvatar->setFaceModelURL(url); | |
| 3777 | − UserActivityLogger::getInstance().changedModel("head", url); | |
| 3778 | − _myAvatar->sendIdentityPacket(); | |
| 3779 | − emit faceURLChanged(url); | |
| 3766 | + _myAvatar->useHeadURL(url, modelName); | |
| 3767 | + emit headURLChanged(url, modelName); | |
| 3780 | 3768 | } else if (msgBox.clickedButton() == bodyButton) { |
| 3781 | − qCDebug(interfaceapp) << "Chose to use for body: " << url; | |
| 3782 | − _myAvatar->setSkeletonModelURL(url); | |
| 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); | |
| 3769 | + _myAvatar->useBodyURL(url, modelName); | |
| 3770 | + emit bodyURLChanged(url, modelName); | |
| 3792 | 3771 | } else if (msgBox.clickedButton() == bodyAndHeadButton) { |
| 3793 | − qCDebug(interfaceapp) << "Chose to use for body + head: " << url; | |
| 3794 | − _myAvatar->setFaceModelURL(QString()); | |
| 3795 | − _myAvatar->setSkeletonModelURL(url); | |
| 3796 | − UserActivityLogger::getInstance().changedModel("skeleton", url); | |
| 3797 | − _myAvatar->sendIdentityPacket(); | |
| 3798 | − emit faceURLChanged(QString()); | |
| 3799 | − emit skeletonURLChanged(url); | |
| 3772 | + _myAvatar->useFullAvatarURL(url, modelName); | |
| 3773 | + emit fullAvatarURLChanged(url, modelName); | |
| 3800 | 3774 | } else { |
| 3801 | 3775 | qCDebug(interfaceapp) << "Declined to use the avatar: " << url; |
| 3802 | 3776 | } |
| 3777 | + | |
| 3803 | 3778 | return true; |
| 3804 | 3779 | } |
| 3805 | 3780 | |
| @@ -4311,8 +4286,7 @@ void Application::checkSkeleton() { · 505 unmodified lines | ||
| 4311 | 4286 | msgBox.setIcon(QMessageBox::Warning); |
| 4312 | 4287 | msgBox.exec(); |
| 4313 | 4288 | |
| 4314 | − _myAvatar->setSkeletonModelURL(DEFAULT_BODY_MODEL_URL); | |
| 4315 | − _myAvatar->sendIdentityPacket(); | |
| 4289 | + _myAvatar->useBodyURL(DEFAULT_BODY_MODEL_URL, "Default"); | |
| 4316 | 4290 | } else { |
| 4317 | 4291 | _myAvatar->updateCharacterController(); |
| 4318 | 4292 | _physicsEngine.setCharacterController(_myAvatar->getCharacterController()); |