From 62941c09140feeffcbe3e7ceb72efac1f024305f Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Thu, 13 Aug 2015 12:39:30 -0700 Subject: [PATCH] Remove dead code. --- interface/src/Application.cpp | 27 +---- interface/src/avatar/Avatar.cpp | 13 +-- interface/src/avatar/Avatar.h | 2 - interface/src/avatar/MyAvatar.cpp | 142 +------------------------ interface/src/avatar/MyAvatar.h | 24 +---- interface/src/ui/PreferencesDialog.cpp | 18 ---- interface/src/ui/PreferencesDialog.h | 2 - libraries/avatars/src/AvatarData.cpp | 2 +- libraries/avatars/src/AvatarData.h | 7 +- 9 files changed, 12 insertions(+), 225 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index dba2ed3234..5dac571045 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3896,23 +3896,12 @@ bool Application::askToSetAvatarUrl(const QString& url) { QMessageBox msgBox; msgBox.setIcon(QMessageBox::Question); msgBox.setWindowTitle("Set Avatar"); - QPushButton* headButton = NULL; - QPushButton* bodyButton = NULL; QPushButton* bodyAndHeadButton = NULL; QString modelName = fstMapping["name"].toString(); QString message; QString typeInfo; switch (modelType) { - case FSTReader::HEAD_MODEL: - message = QString("Would you like to use '") + modelName + QString("' for your avatar head?"); - headButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); - break; - - case FSTReader::BODY_ONLY_MODEL: - message = QString("Would you like to use '") + modelName + QString("' for your avatar body?"); - bodyButton = msgBox.addButton(tr("Yes"), QMessageBox::ActionRole); - break; case FSTReader::HEAD_AND_BODY_MODEL: message = QString("Would you like to use '") + modelName + QString("' for your avatar?"); @@ -3920,10 +3909,7 @@ bool Application::askToSetAvatarUrl(const QString& url) { break; default: - message = QString("Would you like to use '") + modelName + QString("' for some part of your avatar head?"); - headButton = msgBox.addButton(tr("Use for Head"), QMessageBox::ActionRole); - bodyButton = msgBox.addButton(tr("Use for Body"), QMessageBox::ActionRole); - bodyAndHeadButton = msgBox.addButton(tr("Use for Body and Head"), QMessageBox::ActionRole); + message = QString(modelName + QString("Does not support a head and body as required.")); break; } @@ -3932,14 +3918,7 @@ bool Application::askToSetAvatarUrl(const QString& url) { msgBox.exec(); - if (msgBox.clickedButton() == headButton) { - _myAvatar->useHeadURL(url, modelName); - emit headURLChanged(url, modelName); - } else if (msgBox.clickedButton() == bodyButton) { - _myAvatar->useBodyURL(url, modelName); - emit bodyURLChanged(url, modelName); - } else if (msgBox.clickedButton() == bodyAndHeadButton) { - _myAvatar->useFullAvatarURL(url, modelName); + if (msgBox.clickedButton() == bodyAndHeadButton) { emit fullAvatarURLChanged(url, modelName); } else { qCDebug(interfaceapp) << "Declined to use the avatar: " << url; @@ -4426,7 +4405,7 @@ void Application::checkSkeleton() { msgBox.setIcon(QMessageBox::Warning); msgBox.exec(); - _myAvatar->useBodyURL(DEFAULT_BODY_MODEL_URL, "Default"); + _myAvatar->useFullAvatarURL(DEFAULT_FULL_AVATAR_MODEL_URL, DEFAULT_FULL_AVATAR_MODEL_NAME); } else { _physicsEngine.setCharacterController(_myAvatar->getCharacterController()); } diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 8ba58217c3..b537d5a5d8 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -953,20 +952,12 @@ void Avatar::scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const { void Avatar::setFaceModelURL(const QUrl& faceModelURL) { AvatarData::setFaceModelURL(faceModelURL); - const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_head.fst"); - getHead()->getFaceModel().setURL(_faceModelURL, DEFAULT_FACE_MODEL_URL, true, !isMyAvatar()); + getHead()->getFaceModel().setURL(_faceModelURL, DEFAULT_FULL_AVATAR_MODEL_URL, true, !isMyAvatar()); } void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { AvatarData::setSkeletonModelURL(skeletonModelURL); - const QUrl DEFAULT_FULL_MODEL_URL = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_full.fst"); - const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_body.fst"); - if (isMyAvatar()) { - _skeletonModel.setURL(_skeletonModelURL, - getUseFullAvatar() ? DEFAULT_FULL_MODEL_URL : DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar()); - } else { - _skeletonModel.setURL(_skeletonModelURL, DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar()); - } + _skeletonModel.setURL(_skeletonModelURL, DEFAULT_FULL_AVATAR_MODEL_URL, true, !isMyAvatar()); } void Avatar::setAttachmentData(const QVector& attachmentData) { diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index a51da387d0..2adff1ce02 100644 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -149,8 +149,6 @@ public: Q_INVOKABLE glm::vec3 getAcceleration() const { return _acceleration; } Q_INVOKABLE glm::vec3 getAngularVelocity() const { return _angularVelocity; } Q_INVOKABLE glm::vec3 getAngularAcceleration() const { return _angularAcceleration; } - - virtual bool getUseFullAvatar() const { return false; } /// Scales a world space position vector relative to the avatar position and scale /// \param vector position to be scaled. Will store the result diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 2cc1105fdc..05bfac1523 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -651,12 +651,7 @@ void MyAvatar::saveData() { settings.setValue("leanScale", _leanScale); settings.setValue("scale", _targetScale); - settings.setValue("useFullAvatar", _useFullAvatar); settings.setValue("fullAvatarURL", _fullAvatarURLFromPreferences); - settings.setValue("faceModelURL", _headURLFromPreferences); - settings.setValue("skeletonModelURL", _skeletonURLFromPreferences); - settings.setValue("headModelName", _headModelName); - settings.setValue("bodyModelName", _bodyModelName); settings.setValue("fullAvatarModelName", _fullAvatarModelName); settings.beginWriteArray("attachmentData"); @@ -726,61 +721,10 @@ void MyAvatar::loadData() { _targetScale = loadSetting(settings, "scale", 1.0f); setScale(_scale); - // The old preferences only stored the face and skeleton URLs, we didn't track if the user wanted to use 1 or 2 urls - // for their avatar, So we need to attempt to detect this old case and set our new preferences accordingly. If - // the head URL is empty, then we will assume they are using a full url... - bool isOldSettings = !(settings.contains("useFullAvatar") || settings.contains("fullAvatarURL")); - - _useFullAvatar = settings.value("useFullAvatar").toBool(); - _headURLFromPreferences = settings.value("faceModelURL", DEFAULT_HEAD_MODEL_URL).toUrl(); _fullAvatarURLFromPreferences = settings.value("fullAvatarURL", DEFAULT_FULL_AVATAR_MODEL_URL).toUrl(); - _skeletonURLFromPreferences = settings.value("skeletonModelURL", DEFAULT_BODY_MODEL_URL).toUrl(); - _headModelName = settings.value("headModelName", DEFAULT_HEAD_MODEL_NAME).toString(); - _bodyModelName = settings.value("bodyModelName", DEFAULT_BODY_MODEL_NAME).toString(); _fullAvatarModelName = settings.value("fullAvatarModelName", DEFAULT_FULL_AVATAR_MODEL_NAME).toString(); - if (isOldSettings) { - bool assumeFullAvatar = _headURLFromPreferences.isEmpty(); - _useFullAvatar = assumeFullAvatar; - - if (_useFullAvatar) { - _fullAvatarURLFromPreferences = settings.value("skeletonModelURL").toUrl(); - _headURLFromPreferences = DEFAULT_HEAD_MODEL_URL; - _skeletonURLFromPreferences = DEFAULT_BODY_MODEL_URL; - - QVariantHash fullAvatarFST = FSTReader::downloadMapping(_fullAvatarURLFromPreferences.toString()); - - _headModelName = "Default"; - _bodyModelName = "Default"; - _fullAvatarModelName = fullAvatarFST["name"].toString(); - - } else { - _fullAvatarURLFromPreferences = DEFAULT_FULL_AVATAR_MODEL_URL; - _skeletonURLFromPreferences = settings.value("skeletonModelURL", DEFAULT_BODY_MODEL_URL).toUrl(); - - if (_skeletonURLFromPreferences == DEFAULT_BODY_MODEL_URL) { - _bodyModelName = DEFAULT_BODY_MODEL_NAME; - } else { - QVariantHash bodyFST = FSTReader::downloadMapping(_skeletonURLFromPreferences.toString()); - _bodyModelName = bodyFST["name"].toString(); - } - - if (_headURLFromPreferences == DEFAULT_HEAD_MODEL_URL) { - _headModelName = DEFAULT_HEAD_MODEL_NAME; - } else { - QVariantHash headFST = FSTReader::downloadMapping(_headURLFromPreferences.toString()); - _headModelName = headFST["name"].toString(); - } - - _fullAvatarModelName = "Default"; - } - } - - if (_useFullAvatar) { - useFullAvatarURL(_fullAvatarURLFromPreferences, _fullAvatarModelName); - } else { - useHeadAndBodyURLs(_headURLFromPreferences, _skeletonURLFromPreferences, _headModelName, _bodyModelName); - } + useFullAvatarURL(_fullAvatarURLFromPreferences, _fullAvatarModelName); QVector attachmentData; int attachmentCount = settings.beginReadArray("attachmentData"); @@ -1015,29 +959,6 @@ void MyAvatar::clearJointAnimationPriorities() { } } -QString MyAvatar::getModelDescription() const { - QString result; - if (_useFullAvatar) { - if (!getFullAvartarModelName().isEmpty()) { - result = "Full Avatar \"" + getFullAvartarModelName() + "\""; - } else { - result = "Full Avatar \"" + _fullAvatarURLFromPreferences.fileName() + "\""; - } - } else { - if (!getHeadModelName().isEmpty()) { - result = "Head \"" + getHeadModelName() + "\""; - } else { - result = "Head \"" + _headURLFromPreferences.fileName() + "\""; - } - if (!getBodyModelName().isEmpty()) { - result += " and Body \"" + getBodyModelName() + "\""; - } else { - result += " and Body \"" + _skeletonURLFromPreferences.fileName() + "\""; - } - } - return result; -} - void MyAvatar::setFaceModelURL(const QUrl& faceModelURL) { Avatar::setFaceModelURL(faceModelURL); @@ -1064,8 +985,6 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN return; } - _useFullAvatar = true; - if (_fullAvatarURLFromPreferences != fullAvatarURL) { _fullAvatarURLFromPreferences = fullAvatarURL; if (modelName.isEmpty()) { @@ -1087,59 +1006,6 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN sendIdentityPacket(); } -void MyAvatar::useHeadURL(const QUrl& headURL, const QString& modelName) { - useHeadAndBodyURLs(headURL, _skeletonURLFromPreferences, modelName, _bodyModelName); -} - -void MyAvatar::useBodyURL(const QUrl& bodyURL, const QString& modelName) { - useHeadAndBodyURLs(_headURLFromPreferences, bodyURL, _headModelName, modelName); -} - -void MyAvatar::useHeadAndBodyURLs(const QUrl& headURL, const QUrl& bodyURL, const QString& headName, const QString& bodyName) { - if (QThread::currentThread() != thread()) { - QMetaObject::invokeMethod(this, "useFullAvatarURL", Qt::BlockingQueuedConnection, - Q_ARG(const QUrl&, headURL), - Q_ARG(const QUrl&, bodyURL), - Q_ARG(const QString&, headName), - Q_ARG(const QString&, bodyName)); - return; - } - - _useFullAvatar = false; - - if (_headURLFromPreferences != headURL) { - _headURLFromPreferences = headURL; - if (headName.isEmpty()) { - QVariantHash headFST = FSTReader::downloadMapping(_headURLFromPreferences.toString()); - _headModelName = headFST["name"].toString(); - } else { - _headModelName = headName; - } - } - - if (_skeletonURLFromPreferences != bodyURL) { - _skeletonURLFromPreferences = bodyURL; - if (bodyName.isEmpty()) { - QVariantHash bodyFST = FSTReader::downloadMapping(_skeletonURLFromPreferences.toString()); - _bodyModelName = bodyFST["name"].toString(); - } else { - _bodyModelName = bodyName; - } - } - - if (headURL != getFaceModelURL()) { - setFaceModelURL(headURL); - UserActivityLogger::getInstance().changedModel("head", headURL.toString()); - } - - if (bodyURL != getSkeletonModelURL()) { - setSkeletonModelURL(bodyURL); - UserActivityLogger::getInstance().changedModel("skeleton", bodyURL.toString()); - } - sendIdentityPacket(); -} - - void MyAvatar::setAttachmentData(const QVector& attachmentData) { Avatar::setAttachmentData(attachmentData); if (QThread::currentThread() != thread()) { @@ -1295,11 +1161,7 @@ void MyAvatar::preRender(RenderArgs* renderArgs) { } if (shouldDrawHead != _prevShouldDrawHead) { - if (_useFullAvatar) { - _skeletonModel.setCauterizeBones(!shouldDrawHead); - } else { - getHead()->getFaceModel().setVisibleInScene(shouldDrawHead, scene); - } + _skeletonModel.setCauterizeBones(!shouldDrawHead); } _prevShouldDrawHead = shouldDrawHead; } diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 88649429f5..0cd56ec99c 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -126,22 +126,9 @@ public: virtual void clearJointsData(); Q_INVOKABLE void useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelName = QString()); - Q_INVOKABLE void useHeadURL(const QUrl& headURL, const QString& modelName = QString()); - Q_INVOKABLE void useBodyURL(const QUrl& bodyURL, const QString& modelName = QString()); - Q_INVOKABLE void useHeadAndBodyURLs(const QUrl& headURL, const QUrl& bodyURL, - const QString& headName = QString(), const QString& bodyName = QString()); - - Q_INVOKABLE virtual bool getUseFullAvatar() const { return _useFullAvatar; } Q_INVOKABLE const QUrl& getFullAvatarURLFromPreferences() const { return _fullAvatarURLFromPreferences; } - Q_INVOKABLE const QUrl& getHeadURLFromPreferences() const { return _headURLFromPreferences; } - Q_INVOKABLE const QUrl& getBodyURLFromPreferences() const { return _skeletonURLFromPreferences; } - - Q_INVOKABLE const QString& getHeadModelName() const { return _headModelName; } - Q_INVOKABLE const QString& getBodyModelName() const { return _bodyModelName; } Q_INVOKABLE const QString& getFullAvartarModelName() const { return _fullAvatarModelName; } - Q_INVOKABLE QString getModelDescription() const; - virtual void setAttachmentData(const QVector& attachmentData); DynamicCharacterController* getCharacterController() { return &_characterController; } @@ -298,18 +285,9 @@ private: void initHeadBones(); // Avatar Preferences - bool _useFullAvatar = false; QUrl _fullAvatarURLFromPreferences; - QUrl _headURLFromPreferences; - QUrl _skeletonURLFromPreferences; - - QString _headModelName; - QString _bodyModelName; QString _fullAvatarModelName; - RigPointer _rig; - bool _prevShouldDrawHead; - // cache of the current HMD sensor position and orientation // in sensor space. glm::mat4 _hmdSensorMatrix; @@ -330,6 +308,8 @@ private: glm::quat _goToOrientation; std::unordered_set _headBoneSet; + RigPointer _rig; + bool _prevShouldDrawHead; }; #endif // hifi_MyAvatar_h diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index cec379c596..59701e5cf3 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -47,15 +47,10 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : connect(ui.buttonBrowseScriptsLocation, &QPushButton::clicked, this, &PreferencesDialog::openScriptsLocationBrowser); connect(ui.buttonReloadDefaultScripts, &QPushButton::clicked, Application::getInstance(), &Application::loadDefaultScripts); - //FIXME remove DialogsManager* dialogsManager = DependencyManager::get().data(); - //FIXME remove connect(ui.buttonChangeApperance, &QPushButton::clicked, dialogsManager, &DialogsManager::changeAvatarAppearance); connect(ui.buttonChangeApperance, &QPushButton::clicked, this, &PreferencesDialog::openFullAvatarModelBrowser); connect(ui.apperanceDescription, &QLineEdit::textChanged, this, [this](const QString& url) { this->fullAvatarURLChanged(url, ""); }); - - //FIXME remove connect(Application::getInstance(), &Application::headURLChanged, this, &PreferencesDialog::headURLChanged); - //FIXME remove connect(Application::getInstance(), &Application::bodyURLChanged, this, &PreferencesDialog::bodyURLChanged); connect(Application::getInstance(), &Application::fullAvatarURLChanged, this, &PreferencesDialog::fullAvatarURLChanged); // move dialog to left side @@ -65,20 +60,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : UIUtil::scaleWidgetFontSizes(this); } -/*FIXME remove void PreferencesDialog::avatarDescriptionChanged() { - ui.apperanceDescription->setText(DependencyManager::get()->getMyAvatar()->getModelDescription()); -} - -void PreferencesDialog::headURLChanged(const QString& newValue, const QString& modelName) { - ui.apperanceDescription->setText(DependencyManager::get()->getMyAvatar()->getModelDescription()); -} - -void PreferencesDialog::bodyURLChanged(const QString& newValue, const QString& modelName) { - ui.apperanceDescription->setText(DependencyManager::get()->getMyAvatar()->getModelDescription()); -} -*/ void PreferencesDialog::fullAvatarURLChanged(const QString& newValue, const QString& modelName) { - //FIXME remove ui.apperanceDescription->setText(DependencyManager::get()->getMyAvatar()->getModelDescription()); ui.apperanceDescription->setText(newValue); const QString APPEARANCE_LABEL_TEXT("Appearance: "); ui.appearanceLabel->setText(APPEARANCE_LABEL_TEXT + modelName); diff --git a/interface/src/ui/PreferencesDialog.h b/interface/src/ui/PreferencesDialog.h index 6cdb4deba1..47341b8feb 100644 --- a/interface/src/ui/PreferencesDialog.h +++ b/interface/src/ui/PreferencesDialog.h @@ -45,8 +45,6 @@ private slots: void openFullAvatarModelBrowser(); void openSnapshotLocationBrowser(); void openScriptsLocationBrowser(); - /* FIXME remove void headURLChanged(const QString& newValue, const QString& modelName); - void bodyURLChanged(const QString& newValue, const QString& modelName);*/ void fullAvatarURLChanged(const QString& newValue, const QString& modelName); }; diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 5b970a95a3..78fa00eed7 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -941,7 +941,7 @@ void AvatarData::setFaceModelURL(const QUrl& faceModelURL) { } void AvatarData::setSkeletonModelURL(const QUrl& skeletonModelURL) { - _skeletonModelURL = skeletonModelURL.isEmpty() ? DEFAULT_BODY_MODEL_URL : skeletonModelURL; + _skeletonModelURL = skeletonModelURL.isEmpty() ? DEFAULT_FULL_AVATAR_MODEL_URL : skeletonModelURL; qCDebug(avatars) << "Changing skeleton model for avatar to" << _skeletonModelURL.toString(); diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 69783652fc..16003594c9 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -48,6 +48,7 @@ typedef unsigned long long quint64; #include #include +//FIXME #include #include #include @@ -107,12 +108,8 @@ const float MAX_AUDIO_LOUDNESS = 1000.0; // close enough for mouth animation const int AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS = 1000; const int AVATAR_BILLBOARD_PACKET_SEND_INTERVAL_MSECS = 5000; -const QUrl DEFAULT_HEAD_MODEL_URL = QUrl("http://public.highfidelity.io/models/heads/defaultAvatar_head.fst"); -const QUrl DEFAULT_BODY_MODEL_URL = QUrl("http://public.highfidelity.io/models/skeletons/defaultAvatar_body.fst"); +//FIXME const QUrl DEFAULT_FULL_AVATAR_MODEL_URL = QUrl::fromLocalFile(PathUtils::resourcesPath() + "meshes/defaultAvatar_full.fst"); const QUrl DEFAULT_FULL_AVATAR_MODEL_URL = QUrl("http://public.highfidelity.io/marketplace/contents/029db3d4-da2c-4cb2-9c08-b9612ba576f5/02949063e7c4aed42ad9d1a58461f56d.fst"); - -const QString DEFAULT_HEAD_MODEL_NAME = QString("Robot"); -const QString DEFAULT_BODY_MODEL_NAME = QString("Robot"); const QString DEFAULT_FULL_AVATAR_MODEL_NAME = QString("Default");