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