Kuesa::Qt3D::GLTF2Importer
Module: Kuesa Qt 3D API
Imports glTF 2 scenes into a Qt 3D Scene. More...
#include <Kuesa/Qt3D/api/gltf2importer/gltf2importer.h>
Inherits from Kuesa::Qt3D::KuesaNode, Qt3DCore::QNode
Public Types
|
Name |
enum |
Status { None, Loading, Ready, Error} |
enum |
ActiveScene { DefaultScene = -2, EmptyScene = -1} |
Public Slots
Public Signals
Public Functions
Public Properties
Friends
Additional inherited members
Public Slots inherited from Kuesa::Qt3D::KuesaNode
Public Signals inherited from Kuesa::Qt3D::KuesaNode
Public Functions inherited from Kuesa::Qt3D::KuesaNode
Public Properties inherited from Kuesa::Qt3D::KuesaNode
Protected Attributes inherited from Kuesa::Qt3D::KuesaNode
Detailed Description
| class Kuesa::Qt3D::GLTF2Importer;
|
Imports glTF 2 scenes into a Qt 3D Scene.
Since: Kuesa 2.0
\inherits{KuesaNode} GLTF2Importer imports glTF 2 scenes into a Qt 3D scene.
| #include <GLTF2Importer>
Kuesa::Qt3D::SceneEntity *scene = new Kuesa::Qt3D::SceneEntity();
Kuesa::Qt3D::GLTF2Importer *importer = new Kuesa::Qt3D::GLTF2Importer(scene);
importer->setSceneEntity(scene);
importer->setSource(QUrl("file:///source.gltf"));
|
If a Kuesa::Qt3D::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:
- Materials
- Meshes
- Armatures
- Skeletons
- Cameras
- Entities
- Textures
- TextureImages
- AnimationClips
- AnimationMappings
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:
- a material that doesn't perform skinning for use with regular meshes. It will be added to the collection with the name "Mat"
- a material that does perform skinning for use with skinned meshes. It will be added to the collection with the name "skinned_Mat"
Public Types Documentation
enum Status
Enumerator |
Value |
Description |
None |
|
|
Loading |
|
|
Ready |
|
|
Error |
|
|
enum ActiveScene
Enumerator |
Value |
Description |
DefaultScene |
-2 |
|
EmptyScene |
-1 |
|
- DefaultScene 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
- EmptyScene Tell the importer to not load any scene by default
Public Slots Documentation
slot setSource
| void setSource(
const QUrl & source
)
|
Note: The loading is asynchronous. When loading is complete the status property will change.
Load the glTF file from the given url source.
slot setAssignNames
| void 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.
slot setOptions
| void setOptions(
const Kuesa::Qt3D::GLTF2Options & options
)
|
slot setActiveSceneIndex
| void setActiveSceneIndex(
int index
)
|
slot setAsynchronous
| void setAsynchronous(
bool asynchronous
)
|
slot reload
Reloads the current glTF file.
Public Signals Documentation
signal sourceChanged
| void sourceChanged(
const QUrl & source
)
|
signal statusChanged
| void statusChanged(
const Kuesa::Qt3D::GLTF2Importer::Status status
)
|
signal assignNamesChanged
| void assignNamesChanged(
bool assignNames
)
|
signal activeSceneIndexChanged
| void activeSceneIndexChanged(
int activeSceneIndex
)
|
signal availableScenesChanged
| void availableScenesChanged(
const QStringList & availableScenes
)
|
signal asynchronousChanged
| void asynchronousChanged(
bool asynchronous
)
|
Public Functions Documentation
function GLTF2Importer
| GLTF2Importer(
Qt3DCore::QNode * parent =nullptr
)
|
function ~GLTF2Importer
function source
Returns the url of the glTF file
function status
| GLTF2Importer::Status status() const
|
Return the current state of the importer
function assignNames
Returns true
if assets with no names should be added to collections
function asynchronous
| bool asynchronous() const
|
function options
| Kuesa::Qt3D::GLTF2Options * options()
|
function options
| const Kuesa::Qt3D::GLTF2Options * options() const
|
function activeSceneIndex
| int activeSceneIndex() const
|
function availableScenes
| QStringList availableScenes() const
|
function context
| Kuesa::GLTF2Import::GLTF2Context * context() const
|
Public Property Documentation
property source
the source of the glTF file
property status
| Kuesa::Qt3D::GLTF2Importer::Status status;
|
the current status of the importer
See: Kuesa::Qt3D::GLTF2Importer::Status
property assignNames
if true, assets with no names will be added to collections with default names (default is false)
property options
| Kuesa::Qt3D::GLTF2Options * options;
|
Holds the Kuesa::Qt3D::GLTF2Import::GLTF2Options used to select what to import/generate.
property activeSceneIndex
Specifies which glTF scene should be loaded. Defaults to index GLTF2Importer::DefaultScene.
property availableScenes
| QStringList availableScenes;
|
Holds the names of the available glTF scenes.
property asynchronous
if true, parsing is performed in a non blocking manner from a secondary thread. This is false by default.
Friends
friend GLTF2Exporter
| friend class GLTF2Exporter(
GLTF2Exporter
);
|
Updated on 2023-07-03 at 11:02:12 +0000