This commit is contained in:
Thijs Wenker 2019-02-15 23:58:42 +01:00
parent 74ce98a075
commit e900d3784b
4 changed files with 25 additions and 32 deletions

View file

@ -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: "<a href='javascript:void'>" + modelData.message + "</a>"
onLinkActivated: Qt.openUrlExternally(modelData.url)
elide: Text.ElideRight
}
}
}
}
}

View file

@ -14,11 +14,22 @@
#include <AvatarConstants.h>
#include <ResourceManager.h>
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) {

View file

@ -13,17 +13,11 @@
#ifndef hifi_AvatarDoctor_h
#define hifi_AvatarDoctor_h
#include <QtCore/QObject>
#include <QUrl>
#include <QVector>
#include <QVariantMap>
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

View file

@ -32,8 +32,6 @@ AvatarPackager::AvatarPackager() {
qRegisterMetaType<AvatarPackager*>();
qRegisterMetaType<AvatarProject*>();
qRegisterMetaType<AvatarDoctor*>();
qRegisterMetaType<AvatarDiagnosticResult>();
qRegisterMetaType<QVector<AvatarDiagnosticResult>>();
qRegisterMetaType<AvatarProjectStatus::AvatarProjectStatus>();
qmlRegisterUncreatableMetaObject(
AvatarProjectStatus::staticMetaObject,