Loader3D

Note: The Loader3D component is released as a tech preview feature in Qt Design Studio 2.2, and its functionality will be improved in future releases.

Loader3D is a loader component used to dynamically load 3D components. It can load a QML file using the Source property or a component using the Source component property. Loader3D is useful for delaying the creation of a component until it is required, for example, when a component should be created on demand or when a component should not be created unnecessarily for performance reasons.

Add a Loader3D component to your scene by drag-and-dropping it from Library > Components > Qt Quick 3D > Qt Quick 3D to Scene in Navigator.

For more information, see the Loader3D QML type in the Qt Quick 3D documentation.

Loader3D Properties

Select the Loader3D component in Navigator to specify its properties in Properties > Loader3D.

"Loader3D specific properties"

The Active property is set to true by default, which makes the Loader3D currently active. Setting Active to false makes Loader3D inactive. If you change the Source or Source component of an inactive Loader3D, the component will not be instantiated until Loader3D is made active. Setting Loader3D inactive will also cause any item loaded by the loader to be released, but this will not affect the files or components defined as Source or Source component.

Use the dropdown menu of the Source property to define the URL of the 3D component to instantiate. To unload the currently loaded object, set this property to an empty string or set the Source component to undefined. Setting Source to a new URL will also cause the item created by the previous URL to be unloaded.

The Source component property defines the component for Loader3D to instantiate. Currently, the Source component needs to be defined in code using the Edit mode or Text Editor.

Set the Asynchronous property to define whether the component will be instantiated asynchronously. This property is set to false by default. When used in conjunction with the source property, loading and compilation will be performed in a background thread. Loading asynchronously creates the objects declared by the component across multiple frames and reduces the likelihood of glitches in animation. Setting the value of Asynchronous to false while an asynchronous load is in progress will force immediate synchronous completion. This allows an asynchronous loading to begin and then forces completion if the Loader3D content must be accessed before the asynchronous loading is completed.

To avoid seeing the components loading progressively, set the Visibility property for Loader3D appropriately in Binding Editor:

  1. In Properties > Loader3D, select the Asynchronous check box to set the property to true.
  2. In Node > Visibility, select to open the actions menu, and then select Set Binding.
  3. Type status === Loader3D.Ready into Binding Editor, as shown in the image below.
  4. Select OK.

"Setting Visibility in Binding Editor"

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.