C
Studio3D QML Type
Qt 3D Studio presentation viewer. More...
Import Statement: | import QtStudio3D 2.4 |
Inherits: |
Properties
- error : string
- presentation : Presentation
- running : bool
Signals
Detailed Description
This type enables developers to embed Qt 3D Studio presentations in Qt Quick.
Example usage
Studio3D { id: studio3D anchors.fill: parent Presentation { source: "qrc:///presentation.uia" SceneElement { id: scene elementPath: "Scene" currentSlideIndex: 2 } Element { id: textLabel elementPath: "Scene.Layer.myLabel" } } ViewerSettings { showRenderStats: true } onRunningChanged: { console.log("Presentation ready!"); } }
Alternative usage
The above example shows the 3D content in the Studio3D item. Qt 3D Studio presentations consist of one or more layers, each of which is a 3D scene with its own camera and lights. The output of each layer is then composed together into a final image, taking layer position, size, and blending into account. Studio3D shows this final image by default.
In many cases it can be beneficial to follow a different model: instead of displaying the final, composed content in a single Studio3D item, it is also possible to manage the Qt 3D Studio layers individually as Qt Quick items, thus moving the layer composition into Qt Quick's domain. The 3D engine's final image is not generated at all in this case. The key enabler for this approach is the View3D type.
Studio3D { id: studio3D Presentation { source: "qrc:///presentation.uia" SceneElement { id: scene elementPath: "Scene" currentSlideIndex: 2 } Element { id: textLabel elementPath: "Scene.Layer.myLabel" } } onRunningChanged: { console.log("Presentation ready!"); } } View3D { engine: studio3D source: "LayerName" anchors.fill: parent }
In this modified example the Studio3D item does not display any content, while the View3D item displays only the content of a single layer, referenced by the name set in the Qt 3D Studio application. This approach enables creating interfaces where multiple different pieces of 3D content is blended with the 2D user interface, instead of being restricted to a single rectangular area defined by the Studio3D item.
Note: Multiple Studio3D items should be avoided. Prefer using View3D whenever there is a need to display 3D content in multiple areas of the screen.
Controlling the presentation
Like the example above suggests, Studio3D and the other types under the QtStudio3D import offer more than simply rendering the animated Qt 3D Studio presentation. They also offer scene manipulation, including
- querying and changing scene object properties (for example, the transform of a model, colors and other settings of a material, etc.) via Presentation::getAttribute(), Presentation::setAttribute(), Element, and DataInput,
- changing slides (and thus starting the relevant animations and applying the scene object property changes associated with the new slide) via Presentation::goToSlide(), SceneElement, and DataInput,
- and controlling the timeline (the current playback position for the key-frame based animations) both on the main scene and on individual Component nodes via Presentation::goToTime(), SceneElement, and DataInput.
See also View3D and Presentation.
Property Documentation
error : string |
Contains the text for the error message that was generated during the loading of the presentation. When no error occurred or there is no presentation loaded, the value is an empty string.
This property is read-only.
presentation : Presentation |
Accessor for the presentation. Applications are expected to create a single Presentation child object for Studio3D. If this is omitted, a presentation is created automatically.
This property is read-only.
running : bool |
The value of this property is true
when the presentation has been loaded and is ready to be shown.
This property is read-only.
Signal Documentation
This signal is emitted when the presentation has been loaded and is ready to be shown.
This signal is emitted when the presentation has fully initialized its 3D scene for the first frame.
The difference to presentationLoaded() is that this signal is emitted only when the asynchronous operations needed to build to 3D scene and the first frame have completed.
When implementing splash screens via Loader items and the Item::visible property, this is the signal that should be used to trigger hiding the splash screen.
Available under certain Qt licenses.
Find out more.