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
12QT_BEGIN_NAMESPACE
13
14AssimpImporter::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
24AssimpImporter::~AssimpImporter()
25{
26}
27
28QString AssimpImporter::name() const
29{
30 return QStringLiteral("assimp");
31}
32
33QStringList 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
46QString AssimpImporter::outputExtension() const
47{
48 return QStringLiteral(".qml");
49}
50
51QString AssimpImporter::type() const
52{
53 return QStringLiteral("Scene");
54}
55
56QString AssimpImporter::typeDescription() const
57{
58 return QObject::tr(s: "3D Scene");
59}
60
61QJsonObject AssimpImporter::importOptions() const
62{
63 return m_options;
64}
65
66QT_END_NAMESPACE
67

source code of qtquick3d/src/plugins/assetimporters/assimp/assimpimporter.cpp