Asset is to access names nodes loaded from a glTF 2 file in a SceneEntity. More...
Inherits: |
When loading a scene from a glTF 2 file, the resulting nodes are inserted into various collections. They can then searched for by name within these collections.
Asset provides a declarative way of retrieving assets by name within a specified collection or the entire scene.
If a collection is provided, the search will be limited to that collection. Otherwise, the search will be done in all collections, returning the first asset matching the name.
Conveniently, to set or retrieve properties from the node, a property forwarding mechanism is available.
To set values on a the asset node, one can simply do:
Asset { collection: scene.cameras name: "CameraName" readonly property float aspectRatio: 16/9 }
The node's matching property is initialized if a valid default value is provided.
For properties that should be read from the node and not necessarely used to initialize the node, omit the readonly keyword.
Asset { collection: scene.cameras name: "CameraName" property float aspectRatio }
See also Kuesa::SceneEntity and Kuesa::AbstractAssetCollection.
Defines in which collection the asset name will be searched for.
Note: If undefined, the name will searched for in all the scene's collection.
The name of the asset. The asset collections will ensure that the name is unique within a collection, but the same name may be used in different collections.
The resulting asset. Will be null if no scene is loaded or if the names asset is not found.