aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/qml2puppet/mockfiles/qt6/OverlayView3D.qml
blob: 71f2250b7ca5c7c94fc723827991bf0e39e0efc8 (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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQuick
import QtQuick3D
import MouseArea3D

View3D {
    id: overlayView

    property alias moveGizmo: moveGizmo
    property alias rotateGizmo: rotateGizmo
    property alias scaleGizmo: scaleGizmo
    property alias lightGizmo: lightGizmo

    property var viewRoot: null
    property View3D editView: null
    property bool isActive: viewRoot.overlayViews[viewRoot.activeSplit] === overlayView

    property var lightIconGizmos: []
    property var cameraGizmos: []
    property var particleSystemIconGizmos: []
    property var particleEmitterGizmos: []
    property var reflectionProbeGizmos: []

    signal commitObjectProperty(var objects, var propNames)
    signal changeObjectProperty(var objects, var propNames)

    camera: viewRoot.usePerspective ? overlayPerspectiveCamera : overlayOrthoCamera

    anchors.fill: parent
    z: 2
    clip: true

    environment: sceneEnv

    function addLightGizmo(scene, obj)
    {
        // Insert into first available gizmo if we don't already have gizmo for this object
        var slotFound = -1;
        for (var i = 0; i < lightIconGizmos.length; ++i) {
            if (!lightIconGizmos[i].targetNode) {
                slotFound = i;
            } else if (lightIconGizmos[i].targetNode === obj) {
                lightIconGizmos[i].scene = scene;
                return;
            }
        }

        if (slotFound !== -1) {
            lightIconGizmos[slotFound].scene = scene;
            lightIconGizmos[slotFound].targetNode = obj;
            lightIconGizmos[slotFound].locked = _generalHelper.isLocked(obj);
            lightIconGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
            return;
        }

        // No free gizmos available, create a new one
        var gizmoComponent = Qt.createComponent("LightIconGizmo.qml");
        if (gizmoComponent.status === Component.Ready) {
            var gizmo = gizmoComponent.createObject(overlayView,
                                                    {"view3D": overlayView,
                                                     "targetNode": obj,
                                                     "selectedNodes": viewRoot.selectedNodes,
                                                     "scene": scene,
                                                     "activeScene": viewRoot.activeScene,
                                                     "locked": _generalHelper.isLocked(obj),
                                                     "hidden": _generalHelper.isHidden(obj),
                                                     "globalShow": viewRoot.showIconGizmo});
            lightIconGizmos[lightIconGizmos.length] = gizmo;
            gizmo.clicked.connect(viewRoot.handleObjectClicked);
            gizmo.selectedNodes = Qt.binding(function() {return viewRoot.selectedNodes;});
            gizmo.activeScene = Qt.binding(function() {return viewRoot.activeScene;});
            gizmo.globalShow = Qt.binding(function() {return viewRoot.showIconGizmo;});
        }
    }

    function releaseLightGizmo(obj)
    {
        for (var i = 0; i < lightIconGizmos.length; ++i) {
            if (lightIconGizmos[i].targetNode === obj) {
                lightIconGizmos[i].scene = null;
                lightIconGizmos[i].targetNode = null;
                return;
            }
        }
    }

    function updateLightGizmoScene(scene, obj)
    {
        for (var i = 0; i < lightIconGizmos.length; ++i) {
            if (lightIconGizmos[i].targetNode === obj) {
                lightIconGizmos[i].scene = scene;
                return;
            }
        }
    }

    function addCameraGizmo(scene, obj)
    {
        // Insert into first available gizmo if we don't already have gizmo for this object
        var slotFound = -1;
        for (var i = 0; i < cameraGizmos.length; ++i) {
            if (!cameraGizmos[i].targetNode) {
                slotFound = i;
            } else if (cameraGizmos[i].targetNode === obj) {
                cameraGizmos[i].scene = scene;
                return;
            }
        }

        if (slotFound !== -1) {
            cameraGizmos[slotFound].scene = scene;
            cameraGizmos[slotFound].targetNode = obj;
            cameraGizmos[slotFound].locked = _generalHelper.isLocked(obj);
            cameraGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
            return;
        }

        // No free gizmos available, create a new one
        var gizmoComponent = Qt.createComponent("CameraGizmo.qml");
        var frustumComponent = Qt.createComponent("CameraFrustum.qml");
        if (gizmoComponent.status === Component.Ready && frustumComponent.status === Component.Ready) {
            var geometryName = _generalHelper.generateUniqueName("CameraGeometry");
            var frustum = frustumComponent.createObject(
                        sceneNode,
                        {"geometryName": geometryName, "viewPortRect": viewRoot.viewPortRect});
            var gizmo = gizmoComponent.createObject(
                        overlayView,
                        {"view3D": overlayView, "targetNode": obj,
                         "selectedNodes": viewRoot.selectedNodes, "scene": scene, "activeScene": viewRoot.activeScene,
                         "locked": _generalHelper.isLocked(obj), "hidden": _generalHelper.isHidden(obj),
                         "globalShow": viewRoot.showIconGizmo, "globalShowFrustum": viewRoot.showCameraFrustum});

            cameraGizmos[cameraGizmos.length] = gizmo;
            gizmo.clicked.connect(viewRoot.handleObjectClicked);
            gizmo.selectedNodes = Qt.binding(function() {return viewRoot.selectedNodes;});
            gizmo.activeScene = Qt.binding(function() {return viewRoot.activeScene;});
            gizmo.globalShow = Qt.binding(function() {return viewRoot.showIconGizmo;});
            gizmo.globalShowFrustum = Qt.binding(function() {return viewRoot.showCameraFrustum;});
            frustum.viewPortRect = Qt.binding(function() {return viewRoot.viewPortRect;});
            gizmo.connectFrustum(frustum);
        }
    }

    function releaseCameraGizmo(obj)
    {
        for (var i = 0; i < cameraGizmos.length; ++i) {
            if (cameraGizmos[i].targetNode === obj) {
                cameraGizmos[i].scene = null;
                cameraGizmos[i].targetNode = null;
                return;
            }
        }
    }

    function updateCameraGizmoScene(scene, obj)
    {
        for (var i = 0; i < cameraGizmos.length; ++i) {
            if (cameraGizmos[i].targetNode === obj) {
                cameraGizmos[i].scene = scene;
                return;
            }
        }
    }

    function addParticleSystemGizmo(scene, obj)
    {
        // Insert into first available gizmo if we don't already have gizmo for this object
        var slotFound = -1;
        for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
            if (!particleSystemIconGizmos[i].targetNode) {
                slotFound = i;
            } else if (particleSystemIconGizmos[i].targetNode === obj) {
                particleSystemIconGizmos[i].scene = scene;
                return;
            }
        }

        if (slotFound !== -1) {
            particleSystemIconGizmos[slotFound].scene = scene;
            particleSystemIconGizmos[slotFound].targetNode = obj;
            particleSystemIconGizmos[slotFound].locked = _generalHelper.isLocked(obj);
            particleSystemIconGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
            return;
        }

        // No free gizmos available, create a new one
        var gizmoComponent = Qt.createComponent("ParticleSystemGizmo.qml");
        if (gizmoComponent.status === Component.Ready) {
            var gizmo = gizmoComponent.createObject(overlayView,
                                                    {"view3D": overlayView,
                                                     "targetNode": obj,
                                                     "selectedNodes": viewRoot.selectedNodes,
                                                     "scene": scene,
                                                     "activeScene": viewRoot.activeScene,
                                                     "locked": _generalHelper.isLocked(obj),
                                                     "hidden": _generalHelper.isHidden(obj),
                                                     "globalShow": viewRoot.showIconGizmo,
                                                     "activeParticleSystem": viewRoot.activeParticleSystem});
            particleSystemIconGizmos[particleSystemIconGizmos.length] = gizmo;
            gizmo.clicked.connect(viewRoot.handleObjectClicked);
            gizmo.selectedNodes = Qt.binding(function() {return viewRoot.selectedNodes;});
            gizmo.activeScene = Qt.binding(function() {return viewRoot.activeScene;});
            gizmo.globalShow = Qt.binding(function() {return viewRoot.showIconGizmo;});
            gizmo.activeParticleSystem = Qt.binding(function() {return viewRoot.activeParticleSystem;});
        }
    }

    function releaseParticleSystemGizmo(obj)
    {
        for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
            if (particleSystemIconGizmos[i].targetNode === obj) {
                particleSystemIconGizmos[i].scene = null;
                particleSystemIconGizmos[i].targetNode = null;
                return;
            }
        }
    }

    function updateParticleSystemGizmoScene(scene, obj)
    {
        for (var i = 0; i < particleSystemIconGizmos.length; ++i) {
            if (particleSystemIconGizmos[i].targetNode === obj) {
                particleSystemIconGizmos[i].scene = scene;
                return;
            }
        }
    }

    function addParticleEmitterGizmo(scene, obj)
    {
        // Insert into first available gizmo if we don't already have gizmo for this object
        var slotFound = -1;
        for (var i = 0; i < particleEmitterGizmos.length; ++i) {
            if (!particleEmitterGizmos[i].targetNode) {
                slotFound = i;
            } else if (particleEmitterGizmos[i].targetNode === obj) {
                particleEmitterGizmos[i].scene = scene;
                return;
            }
        }

        if (slotFound !== -1) {
            particleEmitterGizmos[slotFound].scene = scene;
            particleEmitterGizmos[slotFound].targetNode = obj;
            particleEmitterGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
            particleEmitterGizmos[slotFound].systemHidden = _generalHelper.isHidden(obj.system);
            return;
        }

        // No free gizmos available, create a new one
        var gizmoComponent = Qt.createComponent("ParticleEmitterGizmo.qml");
        if (gizmoComponent.status === Component.Ready) {
            var gizmo = gizmoComponent.createObject(
                        overlayScene,
                        {"view3d": overlayView, "targetNode": obj, "selectedNodes": viewRoot.selectedNodes,
                         "activeParticleSystem": viewRoot.activeParticleSystem, "scene": scene,
                         "activeScene": viewRoot.activeScene, "hidden": _generalHelper.isHidden(obj),
                         "systemHidden": _generalHelper.isHidden(obj.system),
                         "globalShow": viewRoot.showParticleEmitter});

            particleEmitterGizmos[particleEmitterGizmos.length] = gizmo;
            gizmo.selectedNodes = Qt.binding(function() {return viewRoot.selectedNodes;});
            gizmo.activeParticleSystem = Qt.binding(function() {return viewRoot.activeParticleSystem;});
            gizmo.globalShow = Qt.binding(function() {return viewRoot.showParticleEmitter;});
            gizmo.activeScene = Qt.binding(function() {return viewRoot.activeScene;});
        }
    }

    function releaseParticleEmitterGizmo(obj)
    {
        for (var i = 0; i < particleEmitterGizmos.length; ++i) {
            if (particleEmitterGizmos[i].targetNode === obj) {
                particleEmitterGizmos[i].scene = null;
                particleEmitterGizmos[i].targetNode = null;
                return;
            }
        }
    }

    function updateParticleEmitterGizmoScene(scene, obj)
    {
        for (var i = 0; i < particleEmitterGizmos.length; ++i) {
            if (particleEmitterGizmos[i].targetNode === obj) {
                particleEmitterGizmos[i].scene = scene;
                return;
            }
        }
    }

    function addReflectionProbeGizmo(scene, obj)
    {
        // Insert into first available gizmo if we don't already have gizmo for this object
        var slotFound = -1;
        for (var i = 0; i < reflectionProbeGizmos.length; ++i) {
            if (!reflectionProbeGizmos[i].targetNode) {
                slotFound = i;
            } else if (reflectionProbeGizmos[i].targetNode === obj) {
                reflectionProbeGizmos[i].scene = scene;
                return;
            }
        }

        if (slotFound !== -1) {
            reflectionProbeGizmos[slotFound].scene = scene;
            reflectionProbeGizmos[slotFound].targetNode = obj;
            reflectionProbeGizmos[slotFound].locked = _generalHelper.isLocked(obj);
            reflectionProbeGizmos[slotFound].hidden = _generalHelper.isHidden(obj);
            return;
        }

        // No free gizmos available, create a new one
        var gizmoComponent = Qt.createComponent("ReflectionProbeGizmo.qml");
        if (gizmoComponent.status === Component.Ready) {
            var gizmo = gizmoComponent.createObject(overlayView,
                                                    {"view3D": overlayView,
                                                     "targetNode": obj,
                                                     "selectedNodes": viewRoot.selectedNodes,
                                                     "scene": scene,
                                                     "activeScene": viewRoot.activeScene,
                                                     "locked": _generalHelper.isLocked(obj),
                                                     "hidden": _generalHelper.isHidden(obj),
                                                     "globalShow": viewRoot.showIconGizmo});
            reflectionProbeGizmos[reflectionProbeGizmos.length] = gizmo;
            gizmo.clicked.connect(viewRoot.handleObjectClicked);
            gizmo.selectedNodes = Qt.binding(function() {return viewRoot.selectedNodes;});
            gizmo.activeScene = Qt.binding(function() {return viewRoot.activeScene;});
            gizmo.globalShow = Qt.binding(function() {return viewRoot.showIconGizmo;});
        }
    }

    function releaseReflectionProbeGizmo(obj)
    {
        for (var i = 0; i < reflectionProbeGizmos.length; ++i) {
            if (reflectionProbeGizmos[i].targetNode === obj) {
                reflectionProbeGizmos[i].scene = null;
                reflectionProbeGizmos[i].targetNode = null;
                return;
            }
        }
    }

    function updateReflectionProbeGizmoScene(scene, obj)
    {
        for (var i = 0; i < reflectionProbeGizmos.length; ++i) {
            if (reflectionProbeGizmos[i].targetNode === obj) {
                reflectionProbeGizmos[i].scene = scene;
                return;
            }
        }
    }

    function gizmoAt(x, y)
    {
        let i = 0;
        for (; i < lightIconGizmos.length; ++i) {
            if (lightIconGizmos[i].visible && lightIconGizmos[i].hasPoint(x, y))
                return lightIconGizmos[i].targetNode;
        }
        for (i = 0; i < cameraGizmos.length; ++i) {
            if (cameraGizmos[i].visible && cameraGizmos[i].hasPoint(x, y))
                return cameraGizmos[i].targetNode;
        }
        for (i = 0; i < particleSystemIconGizmos.length; ++i) {
            if (particleSystemIconGizmos[i].visible && particleSystemIconGizmos[i].hasPoint(x, y))
                return particleSystemIconGizmos[i].targetNode;
        }
        for (i = 0; i < reflectionProbeGizmos.length; ++i) {
            if (reflectionProbeGizmos[i].visible && reflectionProbeGizmos[i].hasPoint(x, y))
                return reflectionProbeGizmos[i].targetNode;
        }
        return null;
    }

    function handleLockedStateChange(node)
    {
        let i = 0;
        for (; i < lightIconGizmos.length; ++i) {
            if (lightIconGizmos[i].targetNode === node) {
                lightIconGizmos[i].locked = _generalHelper.isLocked(node);
                return;
            }
        }
        for (i = 0; i < cameraGizmos.length; ++i) {
            if (cameraGizmos[i].targetNode === node) {
                cameraGizmos[i].locked = _generalHelper.isLocked(node);
                return;
            }
        }
        for (i = 0; i < particleSystemIconGizmos.length; ++i) {
            if (particleSystemIconGizmos[i].targetNode === node) {
                particleSystemIconGizmos[i].locked = _generalHelper.isLocked(node);
                return;
            }
        }
        for (i = 0; i < reflectionProbeGizmos.length; ++i) {
            if (reflectionProbeGizmos[i].targetNode === node) {
                reflectionProbeGizmos[i].locked = _generalHelper.isLocked(node);
                return;
            }
        }
    }

    function handleHiddenStateChange(node)
    {
        let i = 0;
        for (; i < lightIconGizmos.length; ++i) {
            if (lightIconGizmos[i].targetNode === node) {
                lightIconGizmos[i].hidden = _generalHelper.isHidden(node);
                return;
            }
        }
        for (i = 0; i < cameraGizmos.length; ++i) {
            if (cameraGizmos[i].targetNode === node) {
                cameraGizmos[i].hidden = _generalHelper.isHidden(node);
                return;
            }
        }
        for (i = 0; i < particleSystemIconGizmos.length; ++i) {
            if (particleSystemIconGizmos[i].targetNode === node) {
                particleSystemIconGizmos[i].hidden = _generalHelper.isHidden(node);
                return;
            }
        }
        for (i = 0; i < particleEmitterGizmos.length; ++i) {
            if (particleEmitterGizmos[i].targetNode === node) {
                particleEmitterGizmos[i].hidden = _generalHelper.isHidden(node);
                return;
            } else if (particleEmitterGizmos[i].targetNode && particleEmitterGizmos[i].targetNode.system === node) {
                particleEmitterGizmos[i].systemHidden = _generalHelper.isHidden(node);
                return;
            }
        }
        for (i = 0; i < reflectionProbeGizmos.length; ++i) {
            if (reflectionProbeGizmos[i].targetNode === node) {
                reflectionProbeGizmos[i].hidden = _generalHelper.isHidden(node);
                return;
            }
        }
    }

    SceneEnvironment {
        id: sceneEnv
        antialiasingMode: SceneEnvironment.MSAA
        antialiasingQuality: SceneEnvironment.High
    }

    Node {
        id: sceneNode

        PerspectiveCamera {
            id: overlayPerspectiveCamera
            clipFar: overlayView.editView ? overlayView.editView.perspectiveCamera.clipFar : 1000
            clipNear: overlayView.editView ? overlayView.editView.perspectiveCamera.clipNear : 1
            position: overlayView.editView ? overlayView.editView.perspectiveCamera.position : Qt.vector3d(0, 0, 0)
            rotation: overlayView.editView ? overlayView.editView.perspectiveCamera.rotation : Qt.quaternion(1, 0, 0, 0)
        }

        OrthographicCamera {
            id: overlayOrthoCamera
            clipFar: overlayView.editView ? overlayView.editView.orthoCamera.clipFar : 1000
            clipNear: overlayView.editView ? overlayView.editView.orthoCamera.clipNear : 1
            position: overlayView.editView ? overlayView.editView.orthoCamera.position : Qt.vector3d(0, 0, 0)
            rotation: overlayView.editView ? overlayView.editView.orthoCamera.rotation : Qt.quaternion(1, 0, 0, 0)
            horizontalMagnification: overlayView.editView ? overlayView.editView.orthoCamera.horizontalMagnification : 1
            verticalMagnification: overlayView.editView ? overlayView.editView.orthoCamera.verticalMagnification : 1
        }

        MouseArea3D {
            id: gizmoDragHelper
            view3D: overlayView
        }

        AutoScaleHelper {
            id: autoScale
            view3D: overlayView
            position: moveGizmo.scenePosition
        }

        AutoScaleHelper {
            id: pivotAutoScale
            view3D: overlayView
            position: pivotLine.startPos
        }

        MoveGizmo {
            id: moveGizmo
            scale: autoScale.getScale(Qt.vector3d(5, 5, 5))
            highlightOnHover: true
            targetNode: viewRoot.selectedNode
            globalOrientation: viewRoot.globalOrientation
            visible: viewRoot.selectedNode && viewRoot.transformMode === EditView3D.TransformMode.Move
                     && overlayView.isActive
            view3D: overlayView
            dragHelper: gizmoDragHelper
            property var propertyNames: ["position"]

            onPositionCommit: {
                if (targetNode === viewRoot.multiSelectionNode)
                    overlayView.commitObjectProperty(_generalHelper.multiSelectionTargets(), propertyNames);
                else
                    overlayView.commitObjectProperty([viewRoot.selectedNode], propertyNames);
            }
            onPositionMove: {
                if (targetNode === viewRoot.multiSelectionNode)
                    overlayView.changeObjectProperty(_generalHelper.multiSelectionTargets(), propertyNames);
                else
                    overlayView.changeObjectProperty([viewRoot.selectedNode], propertyNames);
            }
        }

        ScaleGizmo {
            id: scaleGizmo
            scale: autoScale.getScale(Qt.vector3d(5, 5, 5))
            highlightOnHover: true
            targetNode: viewRoot.selectedNode
            visible: viewRoot.selectedNode && viewRoot.transformMode === EditView3D.TransformMode.Scale
                     && overlayView.isActive
            view3D: overlayView
            dragHelper: gizmoDragHelper
            property var propertyNames: ["scale"]
            property var propertyNamesMulti: ["position", "scale"]

            onScaleCommit: {
                if (targetNode === viewRoot.multiSelectionNode)
                    overlayView.commitObjectProperty(_generalHelper.multiSelectionTargets(), propertyNamesMulti);
                else
                    overlayView.commitObjectProperty([viewRoot.selectedNode], propertyNames);
            }
            onScaleChange: {
                if (targetNode === viewRoot.multiSelectionNode)
                    overlayView.changeObjectProperty(_generalHelper.multiSelectionTargets(), propertyNamesMulti);
                else
                    overlayView.changeObjectProperty([viewRoot.selectedNode], propertyNames);
            }
        }

        RotateGizmo {
            id: rotateGizmo
            scale: autoScale.getScale(Qt.vector3d(7, 7, 7))
            highlightOnHover: true
            targetNode: viewRoot.selectedNode
            globalOrientation: viewRoot.globalOrientation
            visible: viewRoot.selectedNode && viewRoot.transformMode === EditView3D.TransformMode.Rotate
                     && overlayView.isActive
            view3D: overlayView
            dragHelper: gizmoDragHelper
            property var propertyNames: ["eulerRotation"]
            property var propertyNamesMulti: ["position", "eulerRotation"]

            onRotateCommit: {
                if (targetNode === viewRoot.multiSelectionNode)
                    overlayView.commitObjectProperty(_generalHelper.multiSelectionTargets(), propertyNamesMulti);
                else
                    overlayView.commitObjectProperty([viewRoot.selectedNode], propertyNames);
            }
            onRotateChange: {
                if (targetNode === viewRoot.multiSelectionNode)
                    overlayView.changeObjectProperty(_generalHelper.multiSelectionTargets(), propertyNamesMulti);
                else
                    overlayView.changeObjectProperty([viewRoot.selectedNode], propertyNames);
            }
            onCurrentAngleChanged: rotateGizmoLabel.updateLabel()
        }

        LightGizmo {
            id: lightGizmo
            targetNode: viewRoot.selectedNode !== viewRoot.multiSelectionNode ? viewRoot.selectedNode : null
            view3D: overlayView
            dragHelper: gizmoDragHelper

            onPropertyValueCommit: (propName) => {
                overlayView.commitObjectProperty([targetNode], [propName]);
            }
            onPropertyValueChange: (propName) => {
                overlayView.changeObjectProperty([targetNode], [propName]);
            }
        }

        Line3D {
            id: pivotLine
            visible: viewRoot.selectedNode && viewRoot.selectedNode !== viewRoot.multiSelectionNode
                     && overlayView.isActive
            name: "3D Edit View Pivot Line"
            color: "#ddd600"

            startPos: viewRoot.selectedNode ? viewRoot.selectedNode.scenePosition
                                            : Qt.vector3d(0, 0, 0)

            Connections {
                target: viewRoot
                function onSelectedNodeChanged()
                {
                    pivotLine.endPos = gizmoDragHelper.pivotScenePosition(viewRoot.selectedNode);
                }
            }
            Connections {
                target: viewRoot.selectedNode
                function onSceneTransformChanged()
                {
                    pivotLine.endPos = gizmoDragHelper.pivotScenePosition(viewRoot.selectedNode);
                }
            }

            Model {
                id: pivotCap
                readonly property bool _edit3dLocked: true // Make this non-pickable
                source: "#Sphere"
                scale: pivotAutoScale.getScale(Qt.vector3d(0.03, 0.03, 0.03))
                position: pivotLine.startPos
                materials: [
                    DefaultMaterial {
                        id: lineMat
                        lighting: DefaultMaterial.NoLighting
                        cullMode: Material.NoCulling
                        diffuseColor: pivotLine.color
                    }
                ]
            }
        }
    }
}