File: VertexColorMaskFlagsControl.qml

package info (click to toggle)
qt6-quick3d 6.8.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 140,860 kB
  • sloc: cpp: 380,464; ansic: 36,078; xml: 252; sh: 241; makefile: 29
file content (222 lines) | stat: -rw-r--r-- 7,177 bytes parent folder | download | duplicates (2)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick3D
import QtQuick.Dialogs

import Example

RowLayout {
    property bool specularGlossyMode: false
    property int principledMaterialMask: PrincipledMaterial.NoMask
    property int specularGlossyMaterialMask: SpecularGlossyMaterial.NoMask

    ListModel {
        id: mdlPrincipledMaterialLeft
        ListElement {
            name: "Roughness"
            number: PrincipledMaterial.RoughnessMask
        }
        ListElement {
            name: "Normal Strength"
            number: PrincipledMaterial.NormalStrengthMask
        }
        ListElement {
            name: "Specular Amount"
            number: PrincipledMaterial.SpecularAmountMask
        }
        ListElement {
            name: "Clearcoat Amount"
            number: PrincipledMaterial.ClearcoatAmountMask
        }
        ListElement {
            name: "Clearcoat Roughness Amount"
            number: PrincipledMaterial.ClearcoatRoughnessAmountMask
        }
        ListElement {
            name: "Clearcoat Normal Strength"
            number: PrincipledMaterial.ClearcoatNormalStrengthMask
        }
        ListElement {
            name: "Height Amount"
            number: PrincipledMaterial.HeightAmountMask
        }
        ListElement {
            name: "Metalness"
            number: PrincipledMaterial.MetalnessMask
        }
        ListElement {
            name: "Occlusion Amount"
            number: PrincipledMaterial.OcclusionAmountMask
        }
        ListElement {
            name: "Thickness Factor"
            number: PrincipledMaterial.ThicknessFactorMask
        }
        ListElement {
            name: "Transmission Factor"
            number: PrincipledMaterial.TransmissionFactorMask
        }
    }
    ListModel {
        id: mdlSpecularGlossyMaterialLeft
        ListElement {
            name: "Glossiness"
            number: SpecularGlossyMaterial.GlossinessMask
        }
        ListElement {
            name: "Normal Strength"
            number: SpecularGlossyMaterial.NormalStrengthMask
        }
        ListElement {
            name: "Clearcoat Amount"
            number: SpecularGlossyMaterial.ClearcoatAmountMask
        }
        ListElement {
            name: "Clearcoat Roughness Amount"
            number: SpecularGlossyMaterial.ClearcoatRoughnessAmountMask
        }
        ListElement {
            name: "Clearcoat Normal Strength"
            number: SpecularGlossyMaterial.ClearcoatNormalStrengthMask
        }
        ListElement {
            name: "Height Amount"
            number: SpecularGlossyMaterial.HeightAmountMask
        }
        ListElement {
            name: "Occlusion Amount"
            number: SpecularGlossyMaterial.OcclusionAmountMask
        }
        ListElement {
            name: "Thickness Factor"
            number: SpecularGlossyMaterial.ThicknessFactorMask
        }
        ListElement {
            name: "Transmission Factor"
            number: SpecularGlossyMaterial.TransmissionFactorMask
        }
    }

    ListModel {
        id: mdlPrincipledMaterialRight
    }
    ListModel {
        id: mdlSpecularGlossyMaterialRight
    }

    ListView {
        id: listLeft
        Rectangle {
            z: -1
            anchors.fill: parent
            color:"gray"
        }
        boundsBehavior: Flickable.StopAtBounds
        width: 170
        height: 11 * 20
        model: rootView.specularGlossyMode ? mdlSpecularGlossyMaterialLeft : mdlPrincipledMaterialLeft
        delegate: Rectangle {
            width: ListView.view.width
            height: 20
            color: ListView.isCurrentItem ? "lightsteelblue" :
                                            ( (index % 2) ? "darkgray" : "lightgray" )
            MouseArea {
                anchors.fill: parent
                onClicked:{
                    parent.ListView.view.currentIndex = index
                }
            }
            Text {
                id: contactInfo
                anchors.fill: parent
                anchors.leftMargin: 5
                color: parent.ListView.isCurrentItem ? "white" : "black"
                text: name
            }
        }
    }

    ColumnLayout {
        Button {
            id: addButton
            text: ">>"
            onPressed: {
                if ( listLeft.count > 0
                        && listLeft.currentIndex >= 0
                        && listLeft.currentIndex < listLeft.count ) {
                    let item = listLeft.model.get(listLeft.currentIndex)
                    listRight.model.append( item )
                    if ( specularGlossyMode )
                        specularGlossyMaterialMask |= item.number
                    else
                        principledMaterialMask |= item.number
                    listLeft.model.remove( listLeft.currentIndex, 1 )
                }
            }
            background: Rectangle {
                implicitWidth: 20
                implicitHeight: 50
                opacity: enabled ? 1 : 0.3
                color: parent.down ? "#d0d0d0" : "#e0e0e0"
            }
        }
        Button {
            id: removeButton
            text: "<<"
            onPressed: {
                if ( listRight.count > 0
                        && listRight.currentIndex >= 0
                        && listRight.currentIndex < listRight.count ) {
                    let item = listRight.model.get(listRight.currentIndex)
                    listLeft.model.append( item )
                    if ( specularGlossyMode )
                        specularGlossyMaterialMask &= ~(item.number)
                    else
                        principledMaterialMask &= ~(item.number)
                    listRight.model.remove( listRight.currentIndex, 1 )
                }
            }
            background: Rectangle {
                implicitWidth: 20
                implicitHeight: 50
                opacity: enabled ? 1 : 0.3
                color: parent.down ? "#d0d0d0" : "#e0e0e0"
            }
        }
    }

    ListView {
        id: listRight
        Rectangle {
            z: -1
            anchors.fill: parent
            color:"gray"
        }
        boundsBehavior: Flickable.StopAtBounds
        width: 170
        height: 11 * 20
        model: rootView.specularGlossyMode ? mdlSpecularGlossyMaterialRight : mdlPrincipledMaterialRight
        delegate: Rectangle {
            width: ListView.view.width
            height: 20
            color: ListView.isCurrentItem ? "lightsteelblue" :
                                            ( (index % 2) ? "darkgray" : "lightgray" )
            MouseArea {
                anchors.fill: parent
                onClicked:{
                    parent.ListView.view.currentIndex = index
                }
            }
            Text {
                anchors.fill: parent
                anchors.leftMargin: 5
                color: parent.ListView.isCurrentItem ? "white" : "black"
                text: name
            }
        }
    }
}