Overte C++ Documentation
AvatarDoctor.h
1 //
2 // AvatarDoctor.h
3 //
4 //
5 // Created by Thijs Wenker on 02/12/2019.
6 // Copyright 2019 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #pragma once
13 #ifndef hifi_AvatarDoctor_h
14 #define hifi_AvatarDoctor_h
15 
16 #include <QUrl>
17 #include <QVector>
18 #include <QVariantMap>
19 #include "GeometryCache.h"
20 
21 struct AvatarDiagnosticResult {
22  QString message;
23  QUrl url;
24 };
25 Q_DECLARE_METATYPE(AvatarDiagnosticResult)
26 Q_DECLARE_METATYPE(QVector<AvatarDiagnosticResult>)
27 
28 class AvatarDoctor : public QObject {
29  Q_OBJECT
30 public:
31  AvatarDoctor(const QUrl& avatarFSTFileUrl);
32 
33  Q_INVOKABLE void startDiagnosing();
34 
35  Q_INVOKABLE QVariantList getErrors() const;
36 
37 signals:
38  void complete(QVariantList errors);
39 
40 private:
41  void diagnoseTextures();
42 
43  void addError(const QString& errorMessage, const QString& docFragment);
44 
45  QUrl _avatarFSTFileUrl;
46  QVector<AvatarDiagnosticResult> _errors;
47 
48  int _externalTextureCount = 0;
49  int _checkedTextureCount = 0;
50  int _missingTextureCount = 0;
51  int _unsupportedTextureCount = 0;
52 
53  int _materialMappingCount = 0;
54  int _materialMappingLoadedCount = 0;
55 
56  GeometryResource::Pointer _model;
57 
58  bool _isDiagnosing = false;
59 };
60 
61 #endif // hifi_AvatarDoctor_h