Imports glTF 2 scenes into a Qt 3D Scene. More...
Header: | #include <Kuesa/GLTF2Importer> |
Since: | Kuesa 1.0 |
Instantiated By: | GLTF2Importer |
Inherits: | Kuesa::KuesaNode |
This class was introduced in Kuesa 1.0.
enum | ActiveScene { DefaultScene, EmptyScene } |
enum | Status { None, Loading, Ready, Error } |
|
int | activeSceneIndex() const |
bool | assignNames() const |
bool | asynchronous() const |
QStringList | availableScenes() const |
Kuesa::GLTF2Import::GLTF2Options * | options() |
const Kuesa::GLTF2Import::GLTF2Options * | options() const |
QUrl | source() const |
GLTF2Importer::Status | status() const |
void | reload() |
void | setActiveSceneIndex(int index) |
void | setAssignNames(bool assignNames) |
void | setAsynchronous(bool asynchronous) |
void | setSource(const QUrl &source) |
void | activeSceneIndexChanged(int activeSceneIndex) |
void | assignNamesChanged(bool assignNames) |
void | asynchronousChanged(bool asynchronous) |
void | availableScenesChanged(const QStringList &availableScenes) |
void | sourceChanged(const QUrl &source) |
void | statusChanged(const Kuesa::GLTF2Importer::Status status) |
GLTF2Importer imports glTF 2 scenes into a Qt 3D scene.
#include <GLTF2Importer> Kuesa::SceneEntity *scene = new Kuesa::SceneEntity(); Kuesa::GLTF2Importer *importer = new Kuesa::GLTF2Importer(scene); importer->setSceneEntity(scene); importer->setSource(QUrl("file:///source.gltf"));
If a Kuesa::SceneEntity has been set on the importer, various Qt 3D resources generated upon import will be registered into named collections. If no name is specified and assignNames is true, a default name will be assigned to the asset. If several assets of the same type share the same name, subsequent assets will be given unique names by appending an index.
Below is a list of Qt 3D resources currently registered into collections:
As far as glTF is concerned, a material could be used for skinned as well as regular meshes. This doesn't match with how Qt 3D works. If a material named "Mat" is used for both skinned and regular meshes, the importer will register two materials:
Constant | Value | Description |
---|---|---|
Kuesa::GLTF2Importer::DefaultScene | -2 | Makes the importer load the glTF scene specified as being the default one in the glTF file. If the glTF file doesn't specify anything, nothing will be loaded |
Kuesa::GLTF2Importer::EmptyScene | -1 | Tell the importer to not load any scene by default |
This enum type describes state of the importer.
Constant | Value | Description |
---|---|---|
Kuesa::GLTF2Importer::None | 0 | Unknown state (default). |
Kuesa::GLTF2Importer::Loading | 1 | Importer is currently loading a file. |
Kuesa::GLTF2Importer::Ready | 2 | A glTF file was successfully loaded. |
Kuesa::GLTF2Importer::Error | 3 | An error occurred when loading the current glTF file. |
Specifies which glTF scene should be loaded. Defaults to index GLTF2Importer::DefaultScene.
Access functions:
int | activeSceneIndex() const |
void | setActiveSceneIndex(int index) |
Notifier signal:
void | activeSceneIndexChanged(int activeSceneIndex) |
if true, assets with no names will be added to collections with default names (default is false)
Access functions:
bool | assignNames() const |
void | setAssignNames(bool assignNames) |
Notifier signal:
void | assignNamesChanged(bool assignNames) |
if true, parsing is performed in a non blocking manner from a secondary thread. This is false by default.
Access functions:
bool | asynchronous() const |
void | setAsynchronous(bool asynchronous) |
Notifier signal:
void | asynchronousChanged(bool asynchronous) |
Holds the names of the available glTF scenes.
Access functions:
QStringList | availableScenes() const |
Notifier signal:
void | availableScenesChanged(const QStringList &availableScenes) |
Holds the Kuesa::GLTF2Import::GLTF2Options used to select what to import/generate
Access functions:
Kuesa::GLTF2Import::GLTF2Options * | options() |
const Kuesa::GLTF2Import::GLTF2Options * | options() const |
This property holds the source of the glTF file
Access functions:
Notifier signal:
void | sourceChanged(const QUrl &source) |
This property holds the current status of the importer
Access functions:
GLTF2Importer::Status | status() const |
Notifier signal:
void | statusChanged(const Kuesa::GLTF2Importer::Status status) |
See also Kuesa::GLTF2Importer::Status.
[slot]
void GLTF2Importer::reload()Reloads the current glTF file.
[slot]
void GLTF2Importer::setAssignNames(bool assignNames)If assignNames is true, assets with no names will be added to collections with default names.
Otherwise, assets will not be added to collections.
Note: Setter function for property assignNames.
See also assignNames().
[slot]
void GLTF2Importer::setSource(const QUrl &source)Load the glTF file from the given url source.
Note: The loading is asynchronous. When loading is complete the status property will change.
Note: Setter function for property source.
See also source().
Returns true
if assets with no names should be added to collections
Note: Getter function for property assignNames.
See also setAssignNames().
Returns the url of the glTF file
Note: Getter function for property source.
See also setSource().
Return the current state of the importer
Note: Getter function for property status.