Implement 3D edit view top controls UI
Implement global/local, projection type, and default light controls UI. Also small tweaks: - Fixed ortho. camera near clipping - Grid color darkened a bit - Selection rect color changed to yellow Task-number: QDS-1250 Change-Id: I03cf2023ee1b8a6a0768e4dbf7d6fee621a25ce2 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
@@ -38,8 +38,8 @@ Window {
|
|||||||
flags: Qt.WindowStaysOnTopHint | Qt.Window | Qt.WindowTitleHint | Qt.WindowCloseButtonHint
|
flags: Qt.WindowStaysOnTopHint | Qt.Window | Qt.WindowTitleHint | Qt.WindowCloseButtonHint
|
||||||
|
|
||||||
property alias scene: editView.importScene
|
property alias scene: editView.importScene
|
||||||
property alias showEditLight: editLightCheckbox.checked
|
property alias showEditLight: btnEditViewLight.toggled
|
||||||
property alias usePerspective: usePerspectiveCheckbox.checked
|
property alias usePerspective: btnPerspective.toggled
|
||||||
|
|
||||||
property Node selectedNode: null
|
property Node selectedNode: null
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ Window {
|
|||||||
targetNode: viewWindow.selectedNode
|
targetNode: viewWindow.selectedNode
|
||||||
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
||||||
: Qt.vector3d(0, 0, 0)
|
: Qt.vector3d(0, 0, 0)
|
||||||
globalOrientation: globalControl.checked
|
globalOrientation: btnLocalGlobal.toggled
|
||||||
visible: selectedNode && btnMove.selected
|
visible: selectedNode && btnMove.selected
|
||||||
view3D: overlayView
|
view3D: overlayView
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ Window {
|
|||||||
targetNode: viewWindow.selectedNode
|
targetNode: viewWindow.selectedNode
|
||||||
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
|
||||||
: Qt.vector3d(0, 0, 0)
|
: Qt.vector3d(0, 0, 0)
|
||||||
globalOrientation: globalControl.checked
|
globalOrientation: btnLocalGlobal.toggled
|
||||||
visible: selectedNode && btnRotate.selected
|
visible: selectedNode && btnRotate.selected
|
||||||
view3D: overlayView
|
view3D: overlayView
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ Window {
|
|||||||
y: 600
|
y: 600
|
||||||
rotation.x: 45
|
rotation.x: 45
|
||||||
clipFar: 100000
|
clipFar: 100000
|
||||||
clipNear: 1
|
clipNear: -10000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,39 +399,43 @@ Window {
|
|||||||
selectedNode : viewWindow.selectedNode ? selectionBox.model : null
|
selectedNode : viewWindow.selectedNode ? selectionBox.model : null
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Rectangle { // top controls bar
|
||||||
|
color: "#aa000000"
|
||||||
|
width: 265
|
||||||
|
height: btnPerspective.height + 10
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 100
|
||||||
|
|
||||||
|
ToggleButton {
|
||||||
|
id: btnPerspective
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 5
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.bottom: parent.bottom
|
anchors.leftMargin: 5
|
||||||
width: 200
|
tooltip: qsTr("Toggle Perspective / Orthographic Projection")
|
||||||
height: 120
|
states: [{iconId: "ortho", text: qsTr("Orthographic")}, {iconId: "persp", text: qsTr("Perspective")}]
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "white"
|
|
||||||
opacity: 0.3
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
ToggleButton {
|
||||||
|
id: btnLocalGlobal
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 5
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.bottom: parent.bottom
|
anchors.leftMargin: 100
|
||||||
CheckBox {
|
tooltip: qsTr("Toggle Global / Local Orientation")
|
||||||
id: editLightCheckbox
|
states: [{iconId: "local", text: qsTr("Local")}, {iconId: "global", text: qsTr("Global")}]
|
||||||
checked: false
|
|
||||||
text: qsTr("Use Edit View Light")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
ToggleButton {
|
||||||
id: usePerspectiveCheckbox
|
id: btnEditViewLight
|
||||||
checked: true
|
anchors.top: parent.top
|
||||||
text: qsTr("Use Perspective Projection")
|
anchors.topMargin: 5
|
||||||
onCheckedChanged: _generalHelper.requestOverlayUpdate()
|
anchors.left: parent.left
|
||||||
}
|
anchors.leftMargin: 165
|
||||||
|
toggleBackground: true
|
||||||
CheckBox {
|
tooltip: qsTr("Toggle Edit Light")
|
||||||
id: globalControl
|
states: [{iconId: "edit_light_off", text: qsTr("Edit Light Off")}, {iconId: "edit_light_on", text: qsTr("Edit Light On")}]
|
||||||
checked: true
|
|
||||||
text: qsTr("Use Global Orientation")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ Node {
|
|||||||
materials: [
|
materials: [
|
||||||
DefaultMaterial {
|
DefaultMaterial {
|
||||||
id: mainGridMaterial
|
id: mainGridMaterial
|
||||||
emissiveColor: "#e6e6e6"
|
emissiveColor: "#cccccc"
|
||||||
lighting: DefaultMaterial.NoLighting
|
lighting: DefaultMaterial.NoLighting
|
||||||
cullingMode: Material.DisableCulling
|
cullingMode: Material.DisableCulling
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ Node {
|
|||||||
|
|
||||||
materials: [
|
materials: [
|
||||||
DefaultMaterial {
|
DefaultMaterial {
|
||||||
emissiveColor: "#e5009e"
|
emissiveColor: "#fff600"
|
||||||
lighting: DefaultMaterial.NoLighting
|
lighting: DefaultMaterial.NoLighting
|
||||||
cullingMode: Material.DisableCulling
|
cullingMode: Material.DisableCulling
|
||||||
}
|
}
|
||||||
|
70
share/qtcreator/qml/qmlpuppet/mockfiles/ToggleButton.qml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2019 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.12
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
property bool toggled: false
|
||||||
|
property string tooltip
|
||||||
|
property bool toggleBackground: false // show a black background for the toggled state
|
||||||
|
property var states: [] // array of 2 state-objects, idx 0: untoggled, idx 1: toggled
|
||||||
|
|
||||||
|
id: root
|
||||||
|
color: toggleBackground && toggled ? "#aa000000" : mouseArea.containsMouse ? "#44000000" : "#00000000"
|
||||||
|
width: img.width + txt.width + 5
|
||||||
|
height: img.height
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: img
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
source: "qrc:///qtquickplugin/mockfiles/images/" + root.states[toggled ? 1 : 0].iconId + ".png"
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: txt
|
||||||
|
color: "#b5b5b5"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: img.right
|
||||||
|
text: root.states[toggled ? 1 : 0].text
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolTip {
|
||||||
|
text: tooltip
|
||||||
|
visible: mouseArea.containsMouse
|
||||||
|
delay: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
cursorShape: "PointingHandCursor"
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: root.toggled = !root.toggled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/edit_light_on.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.7 KiB |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/global.png
Normal file
After Width: | Height: | Size: 433 B |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/global@2x.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/local.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/local@2x.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/ortho.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/ortho@2x.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/persp.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
share/qtcreator/qml/qmlpuppet/mockfiles/images/persp@2x.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
@@ -24,6 +24,7 @@
|
|||||||
<file>mockfiles/ScaleRod.qml</file>
|
<file>mockfiles/ScaleRod.qml</file>
|
||||||
<file>mockfiles/ScaleGizmo.qml</file>
|
<file>mockfiles/ScaleGizmo.qml</file>
|
||||||
<file>mockfiles/ToolBarButton.qml</file>
|
<file>mockfiles/ToolBarButton.qml</file>
|
||||||
|
<file>mockfiles/ToggleButton.qml</file>
|
||||||
<file>mockfiles/RotateGizmo.qml</file>
|
<file>mockfiles/RotateGizmo.qml</file>
|
||||||
<file>mockfiles/RotateRing.qml</file>
|
<file>mockfiles/RotateRing.qml</file>
|
||||||
<file>mockfiles/SelectionBox.qml</file>
|
<file>mockfiles/SelectionBox.qml</file>
|
||||||
@@ -68,5 +69,17 @@
|
|||||||
<file>mockfiles/images/fit_active@2x.png</file>
|
<file>mockfiles/images/fit_active@2x.png</file>
|
||||||
<file>mockfiles/images/fit_selected.png</file>
|
<file>mockfiles/images/fit_selected.png</file>
|
||||||
<file>mockfiles/images/fit_selected@2x.png</file>
|
<file>mockfiles/images/fit_selected@2x.png</file>
|
||||||
|
<file>mockfiles/images/local.png</file>
|
||||||
|
<file>mockfiles/images/local@2x.png</file>
|
||||||
|
<file>mockfiles/images/global.png</file>
|
||||||
|
<file>mockfiles/images/global@2x.png</file>
|
||||||
|
<file>mockfiles/images/ortho.png</file>
|
||||||
|
<file>mockfiles/images/ortho@2x.png</file>
|
||||||
|
<file>mockfiles/images/persp.png</file>
|
||||||
|
<file>mockfiles/images/persp@2x.png</file>
|
||||||
|
<file>mockfiles/images/edit_light_off.png</file>
|
||||||
|
<file>mockfiles/images/edit_light_off@2x.png</file>
|
||||||
|
<file>mockfiles/images/edit_light_on.png</file>
|
||||||
|
<file>mockfiles/images/edit_light_on@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|