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 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.
Select the Loader3D component in Navigator to specify its properties in Properties > Loader3D.
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.
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:
- In Properties > Loader3D, select the Asynchronous check box to set the property to true.
- In Node > Visibility, select to open the actions menu, and then select Set Binding.
status === Loader3D.Readyinto Binding Editor, as shown in the image below.
- Select OK.
Available under certain Qt licenses.
Find out more.