1 | // Copyright (C) 2022 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "assimpimporter.h" |
5 | |
6 | #include <QtCore/QJsonDocument> |
7 | #include <QtCore/QJsonObject> |
8 | |
9 | #include <QtQuick3DAssetImport/private/qssgassetimporterfactory_p.h> |
10 | #include <QtQuick3DAssetImport/private/qssgassetimporter_p.h> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | AssimpImporter::AssimpImporter() |
15 | { |
16 | QFile optionFile(":/assimpimporter/options.json"); |
17 | optionFile.open(flags: QIODevice::ReadOnly); |
18 | QByteArray options = optionFile.readAll(); |
19 | optionFile.close(); |
20 | auto optionsDocument = QJsonDocument::fromJson(json: options); |
21 | m_options = optionsDocument.object(); |
22 | } |
23 | |
24 | AssimpImporter::~AssimpImporter() |
25 | { |
26 | } |
27 | |
28 | QString AssimpImporter::name() const |
29 | { |
30 | return QStringLiteral("assimp"); |
31 | } |
32 | |
33 | QStringList AssimpImporter::inputExtensions() const |
34 | { |
35 | QStringList extensions; |
36 | extensions.append(QStringLiteral("fbx")); |
37 | extensions.append(QStringLiteral("dae")); |
38 | extensions.append(QStringLiteral("obj")); |
39 | extensions.append(QStringLiteral("gltf")); |
40 | extensions.append(QStringLiteral("glb")); |
41 | extensions.append(QStringLiteral("stl")); |
42 | extensions.append(QStringLiteral("ply")); |
43 | return extensions; |
44 | } |
45 | |
46 | QString AssimpImporter::outputExtension() const |
47 | { |
48 | return QStringLiteral(".qml"); |
49 | } |
50 | |
51 | QString AssimpImporter::type() const |
52 | { |
53 | return QStringLiteral("Scene"); |
54 | } |
55 | |
56 | QString AssimpImporter::typeDescription() const |
57 | { |
58 | return QObject::tr(s: "3D Scene"); |
59 | } |
60 | |
61 | QJsonObject AssimpImporter::importOptions() const |
62 | { |
63 | return m_options; |
64 | } |
65 | |
66 | QT_END_NAMESPACE |
67 |