aboutsummaryrefslogtreecommitdiffstats
path: root/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-loader-3d.qdoc
blob: fcc543e94f004cae209305e0d3ba83a50159a39f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page studio-3d-loader-3d.html
    \previouspage studio-3d-repeater-3d.html
    \nextpage quick-component-instances.html

    \title Loader3D

    \note The \uicontrol Loader3D component is released as a tech preview
    feature in \QDS 2.2, and its functionality will be improved in future
    releases.

    \uicontrol Loader3D is a loader component used to dynamically load 3D
    components. It can load a QML file using the \uicontrol Source property or a
    component using the \uicontrol {Source component} property. \uicontrol 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.

    For more information, see the \l{https://doc.qt.io/qt/qml-qtquick3d-loader3d.html}
    {Loader3D QML type} in the \uicontrol {Qt Quick 3D} documentation.

    \section1 Loader3D Properties

    \section2 Active

    The \uicontrol Active property is set to \uicontrol true by default, which
    makes the \uicontrol Loader3D currently active. Setting \uicontrol Active to
    \uicontrol false makes \uicontrol Loader3D inactive. If you change the
    \uicontrol Source or \uicontrol {Source component} of an inactive
    \uicontrol Loader3D, the component will not be instantiated until
    \uicontrol Loader3D is made active. Setting \uicontrol 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 \uicontrol Source or
    \uicontrol {Source component}.

    \section2 Source

    The \uicontrol Source property defines the URL of
    the 3D component to instantiate. To unload the currently loaded object, set
    this property to an empty string or set the \uicontrol {Source component} to
    undefined. Setting \uicontrol Source to a new URL will also cause the item
    created by the previous URL to be unloaded.

    \section2 Source Component

    The \uicontrol {Source Component} property defines the component for
    \uicontrol Loader3D to instantiate. Currently, the
    \uicontrol {Source component} needs to be defined in code using the
    \l {Working in Edit Mode}{Edit} mode or \l {Text Editor}.

    \section2 Asynchronous

    The \uicontrol Asynchronous property defines whether the component
    will be instantiated asynchronously. This property is set to \uicontrol 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
    \uicontrol Asynchronous to \uicontrol 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
    \uicontrol Loader3D content must be accessed before the asynchronous
    loading is completed.

    \section1 Setting the Loader3D to Load a QML File

    To add a Loader3D component and set it to load a QML file:
    \list 1
      \li From \uicontrol {Components}, drag a Loader3D component to
      \e scene in \uicontrol Navigator or to \uicontrol {3D Editor}.
      \li In \uicontrol {Navigator}, select \e{loader3D}.
      \image loader3d-navigator.png
      \li In \uicontrol {Properties}, select \uicontrol{Source} and select a
      QML file.
      \image loader3d-select-source.png
    \endlist

    \section1 Setting the Loader3D  to Load a Component3D Component

    To add a Loader3D component and set it to load a Component3D component:
    \list 1
      \li From \uicontrol {Components}, drag a Loader3D Component to
      \e scene in \uicontrol Navigator or to \uicontrol {3D Editor}.
      \li From \uicontrol {Components}, drag a Component3D component to
      \e scene in \uicontrol {Navigator}.
      \li In \uicontrol {Navigator}, select the filter icon and clear
      \uicontrol {Show Only Visible Components}. This makes the Component3D
      component visible in \uicontrol Navigator.
      \image navigator-show-all-loader.png
      \li In \uicontrol {Navigator}, select \e{loader3D}.
      \li In \uicontrol {Properties}, select \uicontrol{Source Component}
      and select \e {component3D}.

      \image loader3d-select-source-component.png
    \endlist

    \section1 Setting the Visibility of Loading Components

    To avoid seeing the components loading progressively, set the \uicontrol
    Visibility property for \uicontrol Loader3D appropriately in
    \uicontrol {Binding Editor}:
        \list 1
            \li In \uicontrol Properties > \uicontrol Loader3D, select the
                \uicontrol Asynchronous check box.
                \image loader3d-visibility.png
            \li In \uicontrol {Visibility},
                select \inlineimage icons/action-icon.png
                to open the actions menu, and then select \uicontrol {Set Binding}.
            \li Type \c {status === Loader3D.Ready} into \uicontrol {Binding Editor}.
                \image studio-3d-loader3d-binding-editor.png "Setting Visibility in Binding Editor"
            \li Select \uicontrol OK.
        \endlist

*/