- Qt 6.12
- Qt Quick 3D
- QML Types
- QtQuick3D.AssetUtils
- RuntimeLoader
- Qt Quick 3D | Commercial or GPLv3

# RuntimeLoader QML Type

Imports a 3D asset at runtime. More...

Import Statement: | `import QtQuick3D.AssetUtils`
Since: | Qt 6.2
Inherits: | Node

- List of all members, including inherited members

## Enumerations

- QueryFilter

## Properties

- bounds : Bounds
- errorString : string
- instancing : Instancing
- source : url
- status : enumeration

## Methods

- Object3D query(string arg) `(since 6.12)`
- List<Object3D> queryAll(QueryFilter filter) `(since 6.12)`

## Detailed Description

The RuntimeLoader type provides a way to load a 3D asset directly from source at runtime, without converting it to QtQuick3D's internal format first.

RuntimeLoader supports .obj and glTF version 2.0 files in both in text (.gltf) and binary (.glb) formats.

Warning: RuntimeLoader does not sandbox or validate asset contents. Loading malformed or untrusted assets may have security implications. See source for details.

## Enumeration Documentation

### QueryFilter

Specifies the type of objects to query for.

Constant | Description
--- | ---
`RuntimeLoader.Textures` | Query for texture objects
`RuntimeLoader.Materials` | Query for material objects
`RuntimeLoader.Nodes` | Query for node objects
`RuntimeLoader.Cameras` | Query for camera objects
`RuntimeLoader.Lights` | Query for light objects
`RuntimeLoader.Models` | Query for model objects

See also queryAll().

## Property Documentation

### bounds : Bounds `[read-only]`

This property describes the extents of the bounding volume around the imported model.

Note: The value may not be available before the first render

### errorString : string `[read-only]`

This property holds a human-readable string indicating the status of the latest load operation.

### instancing : Instancing

If this property is set, the imported model will not be rendered normally. Instead, a number of instances will be rendered, as defined by the instance table.

See the Instanced Rendering overview documentation for more information.

### source : url

This property holds the location of the source file containing the 3D asset. Changing this property will unload the current asset and attempt to load an asset from the given URL.

The success or failure of the load operation is indicated by status.

Warning: RuntimeLoader does not sandbox or validate asset contents. Loading malformed or untrusted assets may have security implications. Application developers should carefully consider these before allowing the loading of user-provided content that is not part of the application.

### status : enumeration `[read-only]`

This property holds the status of the latest load operation.

Constant | Description
--- | ---
`RuntimeLoader.Empty` | No URL was specified.
`RuntimeLoader.Success` | The load operation was successful.
`RuntimeLoader.Error` | The load operation failed. A human-readable error message is provided by errorString.

## Method Documentation

### `[since 6.12]` Object3D query(string arg)

Returns the object with the given name, or `null` if no object with that name exists.

The arg parameter is the name of the object to query or a query string. For example, to query the object named "PaintMaterialX", use the following code:

     var object = runtimeLoader.query("PaintMaterial")

The above code works as expected assuming the objects are sensibly named in the source asset file. However, if there are multiple objects with the same name, the query will return the first object found matching the given name. To query a specific object, and avoid ambiguity, use the full object path.

     var object = runtimeLoader.query("/House2/Wall001/Mirror/Material")

Note: Even with paths it's possible for a improperly structured asset file to have multiple objects with the same path, as the paths are built up from the object names in the source asset file.

Note: The object names are defined as in the source asset file.

This method was introduced in Qt 6.12.

### `[since 6.12]` List<Object3D> queryAll(QueryFilter filter)

Returns a list of all objects matching the given filter.

The filter parameter specifies the type of objects to query for. For example, to query for all materials, use the following code:

     var materials = runtimeLoader.queryAll(RuntimeLoader.Materials)

The above code returns a list of all materials in the source asset file.

This method was introduced in Qt 6.12.