From e900d3784be72a9f9576ac9d835b4878e895fe2d Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Fri, 15 Feb 2019 23:58:42 +0100 Subject: [PATCH] fixes --- .../AvatarDoctorErrorReport.qml | 22 ++++++---------- interface/src/avatar/AvatarDoctor.cpp | 25 ++++++++++++------- interface/src/avatar/AvatarDoctor.h | 8 ++---- interface/src/avatar/AvatarPackager.cpp | 2 -- 4 files changed, 25 insertions(+), 32 deletions(-) diff --git a/interface/resources/qml/hifi/avatarPackager/AvatarDoctorErrorReport.qml b/interface/resources/qml/hifi/avatarPackager/AvatarDoctorErrorReport.qml index 8811ba48a3..73c5e34d13 100644 --- a/interface/resources/qml/hifi/avatarPackager/AvatarDoctorErrorReport.qml +++ b/interface/resources/qml/hifi/avatarPackager/AvatarDoctorErrorReport.qml @@ -21,7 +21,6 @@ Item { height: 40 width: 134 text: qsTr("Try Again") - // colorScheme: root.colorScheme onClicked: { avatarPackager.state = AvatarPackagerState.avatarDoctorDiagnose; } @@ -49,7 +48,7 @@ Item { color: "#EA4C5F" anchors { top: parent.top - //topMargin: 73 + topMargin: -20 horizontalCenter: parent.horizontalCenter } } @@ -60,7 +59,7 @@ Item { right: parent.right bottom: parent.bottom top: errorReportIcon.bottom - topMargin: 27 + topMargin: -40 leftMargin: 13 rightMargin: 13 } @@ -68,15 +67,6 @@ Item { Repeater { id: errorRepeater - /*model: [ - {message: "Rig is not Hifi compatible", url: "http://www.highfidelity.com/"}, - {message: "Bone limit exceeds 256", url: "http://www.highfidelity.com/2"}, - {message: "Unsupported Texture", url: "http://www.highfidelity.com/texture"}, - {message: "Rig is not Hifi compatible", url: "http://www.highfidelity.com/"}, - {message: "Bone limit exceeds 256", url: "http://www.highfidelity.com/2"}, - {message: "Unsupported Texture", url: "http://www.highfidelity.com/texture"} - ]*/ - Item { height: 37 width: parent.width @@ -89,6 +79,7 @@ Item { anchors { top: parent.top left: parent.left + leftMargin: -5 } } @@ -96,17 +87,18 @@ Item { id: errorLink anchors { top: parent.top + topMargin: 5 left: errorIcon.right right: parent.right } - linkColor: "#00B4EF"// style.colors.blueHighlight + color: "#00B4EF" + linkColor: "#00B4EF" size: 28 text: "" + modelData.message + "" onLinkActivated: Qt.openUrlExternally(modelData.url) + elide: Text.ElideRight } } } } - - } diff --git a/interface/src/avatar/AvatarDoctor.cpp b/interface/src/avatar/AvatarDoctor.cpp index c8f5d52336..b528441be7 100644 --- a/interface/src/avatar/AvatarDoctor.cpp +++ b/interface/src/avatar/AvatarDoctor.cpp @@ -14,11 +14,22 @@ #include #include + AvatarDoctor::AvatarDoctor(QUrl avatarFSTFileUrl) : - _avatarFSTFileUrl(std::move(avatarFSTFileUrl)) { + _avatarFSTFileUrl(avatarFSTFileUrl) { + + connect(this, &AvatarDoctor::complete, this, [this](QVariantList errors) { + _isDiagnosing = false; + }); } void AvatarDoctor::startDiagnosing() { + if (_isDiagnosing) { + // One diagnose at a time for now + return; + } + _isDiagnosing = true; + _errors.clear(); _externalTextureCount = 0; @@ -47,8 +58,7 @@ void AvatarDoctor::startDiagnosing() { // RIG if (avatarModel.joints.isEmpty()) { _errors.push_back({ "Avatar has no rig", DEFAULT_URL }); - } - else { + } else { if (avatarModel.joints.length() > 256) { _errors.push_back({ "Avatar has over 256 bones", DEFAULT_URL }); } @@ -69,13 +79,10 @@ void AvatarDoctor::startDiagnosing() { const float RECOMMENDED_MAX_HEIGHT = DEFAULT_AVATAR_HEIGHT * 1.5f; const float avatarHeight = avatarModel.bindExtents.largestDimension(); - - qDebug() << "avatarHeight" << avatarHeight; - qDebug() << "defined Scale =" << model->getMapping()["scale"].toFloat(); if (avatarHeight < RECOMMENDED_MIN_HEIGHT) { - _errors.push_back({ "Avatar is possibly smaller then expected.", DEFAULT_URL }); + _errors.push_back({ "Avatar is possibly too small.", DEFAULT_URL }); } else if (avatarHeight > RECOMMENDED_MAX_HEIGHT) { - _errors.push_back({ "Avatar is possibly larger then expected.", DEFAULT_URL }); + _errors.push_back({ "Avatar is possibly too large.", DEFAULT_URL }); } // TEXTURES @@ -119,7 +126,7 @@ void AvatarDoctor::startDiagnosing() { qDebug() << "checkTextureLoadingComplete" << _checkedTextureCount << "/" << _externalTextureCount; if (_checkedTextureCount == _externalTextureCount) { - if (_missingTextureCount == 1) { + if (_missingTextureCount > 0) { _errors.push_back({ tr("Missing %n texture(s).","", _missingTextureCount), DEFAULT_URL }); } if (_unsupportedTextureCount > 0) { diff --git a/interface/src/avatar/AvatarDoctor.h b/interface/src/avatar/AvatarDoctor.h index f11bc7377c..bebec32542 100644 --- a/interface/src/avatar/AvatarDoctor.h +++ b/interface/src/avatar/AvatarDoctor.h @@ -13,17 +13,11 @@ #ifndef hifi_AvatarDoctor_h #define hifi_AvatarDoctor_h -#include #include #include #include struct AvatarDiagnosticResult { - -//public: - // AvatarDiagnosticResult() {} - // AvatarDiagnosticResult(QString message, QUrl url) : _message(std::move(message)), _url(std::move(url)) { } -//private: QString message; QUrl url; }; @@ -50,6 +44,8 @@ private: int _checkedTextureCount = 0; int _missingTextureCount = 0; int _unsupportedTextureCount = 0; + + bool _isDiagnosing = false; }; #endif // hifi_AvatarDoctor_h diff --git a/interface/src/avatar/AvatarPackager.cpp b/interface/src/avatar/AvatarPackager.cpp index 24f31cac9c..90def7ad43 100644 --- a/interface/src/avatar/AvatarPackager.cpp +++ b/interface/src/avatar/AvatarPackager.cpp @@ -32,8 +32,6 @@ AvatarPackager::AvatarPackager() { qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); - qRegisterMetaType(); - qRegisterMetaType>(); qRegisterMetaType(); qmlRegisterUncreatableMetaObject( AvatarProjectStatus::staticMetaObject,