forked from qt-creator/qt-creator
QmlDesigner: Add UX approved light icons for 3D editview
Light icons have a color overlay that indicates light color. Change-Id: I5f6d80f63d0916dd7cb7b2d5345d586aacd550ef Fixes: QDS-1209 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -31,21 +31,26 @@ IconGizmo {
|
|||||||
id: cameraGizmo
|
id: cameraGizmo
|
||||||
|
|
||||||
iconSource: "qrc:///qtquickplugin/mockfiles/images/editor_camera.png"
|
iconSource: "qrc:///qtquickplugin/mockfiles/images/editor_camera.png"
|
||||||
gizmoModel.geometry: cameraGeometry
|
|
||||||
property alias geometryName: cameraGeometry.name // Name must be unique for each geometry
|
property alias geometryName: cameraGeometry.name // Name must be unique for each geometry
|
||||||
property alias viewPortRect: cameraGeometry.viewPortRect
|
property alias viewPortRect: cameraGeometry.viewPortRect
|
||||||
|
|
||||||
|
Model {
|
||||||
|
id: gizmoModel
|
||||||
|
geometry: cameraGeometry
|
||||||
|
visible: cameraGizmo.visible
|
||||||
|
materials: [
|
||||||
|
DefaultMaterial {
|
||||||
|
id: defaultMaterial
|
||||||
|
emissiveColor: cameraGizmo.targetNode === cameraGizmo.selectedNode ? "#FF0000"
|
||||||
|
: "#555555"
|
||||||
|
lighting: DefaultMaterial.NoLighting
|
||||||
|
cullingMode: Material.DisableCulling
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
CameraGeometry {
|
CameraGeometry {
|
||||||
id: cameraGeometry
|
id: cameraGeometry
|
||||||
camera: cameraGizmo.targetNode
|
camera: cameraGizmo.targetNode
|
||||||
}
|
}
|
||||||
|
|
||||||
gizmoModel.materials: [
|
|
||||||
DefaultMaterial {
|
|
||||||
id: defaultMaterial
|
|
||||||
emissiveColor: cameraGizmo.targetNode === cameraGizmo.selectedNode ? "#FF0000" : "#555555"
|
|
||||||
lighting: DefaultMaterial.NoLighting
|
|
||||||
cullingMode: Material.DisableCulling
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick3D 1.0
|
import QtQuick3D 1.0
|
||||||
|
import QtGraphicalEffects 1.12
|
||||||
|
|
||||||
Node {
|
Node {
|
||||||
id: iconGizmo
|
id: iconGizmo
|
||||||
@@ -34,8 +35,8 @@ Node {
|
|||||||
property Node targetNode: null
|
property Node targetNode: null
|
||||||
property Node selectedNode: null
|
property Node selectedNode: null
|
||||||
|
|
||||||
property alias gizmoModel: gizmoModel
|
|
||||||
property alias iconSource: iconImage.source
|
property alias iconSource: iconImage.source
|
||||||
|
property alias overlayColor: colorOverlay.color
|
||||||
|
|
||||||
signal positionCommit()
|
signal positionCommit()
|
||||||
signal clicked(Node node)
|
signal clicked(Node node)
|
||||||
@@ -44,13 +45,9 @@ Node {
|
|||||||
rotation: targetNode ? targetNode.sceneRotation : Qt.vector3d(0, 0, 0)
|
rotation: targetNode ? targetNode.sceneRotation : Qt.vector3d(0, 0, 0)
|
||||||
visible: targetNode ? targetNode.visible : false
|
visible: targetNode ? targetNode.visible : false
|
||||||
|
|
||||||
Model {
|
|
||||||
id: gizmoModel
|
|
||||||
visible: iconGizmo.visible
|
|
||||||
}
|
|
||||||
Overlay2D {
|
Overlay2D {
|
||||||
id: gizmoLabel
|
id: iconOverlay
|
||||||
targetNode: gizmoModel
|
targetNode: iconGizmo
|
||||||
targetView: view3D
|
targetView: view3D
|
||||||
offsetX: 0
|
offsetX: 0
|
||||||
offsetY: 0
|
offsetY: 0
|
||||||
@@ -58,6 +55,7 @@ Node {
|
|||||||
parent: view3D
|
parent: view3D
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: iconRect
|
||||||
width: iconImage.width
|
width: iconImage.width
|
||||||
height: iconImage.height
|
height: iconImage.height
|
||||||
x: -width / 2
|
x: -width / 2
|
||||||
@@ -81,6 +79,15 @@ Node {
|
|||||||
? Qt.LeftButton : Qt.NoButton
|
? Qt.LeftButton : Qt.NoButton
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ColorOverlay {
|
||||||
|
id: colorOverlay
|
||||||
|
anchors.fill: parent
|
||||||
|
cached: true
|
||||||
|
source: iconImage
|
||||||
|
color: transparent
|
||||||
|
opacity: 0.6
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,14 +29,11 @@ import QtQuick3D 1.0
|
|||||||
IconGizmo {
|
IconGizmo {
|
||||||
id: lightGizmo
|
id: lightGizmo
|
||||||
|
|
||||||
iconSource: "qrc:///qtquickplugin/mockfiles/images/light-pick-icon.png"
|
iconSource: targetNode instanceof DirectionalLight
|
||||||
gizmoModel.source: "#Sphere"
|
? "qrc:///qtquickplugin/mockfiles/images/directional_light_gradient.png"
|
||||||
gizmoModel.scale: Qt.vector3d(0.10, 0.10, 0.10)
|
: targetNode instanceof AreaLight
|
||||||
gizmoModel.materials: [
|
? "qrc:///qtquickplugin/mockfiles/images/area_light_gradient.png"
|
||||||
DefaultMaterial {
|
: "qrc:///qtquickplugin/mockfiles/images/point_light_gradient.png"
|
||||||
id: defaultMaterial
|
|
||||||
emissiveColor: "yellow"
|
overlayColor: targetNode.color
|
||||||
lighting: DefaultMaterial.NoLighting
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@@ -54,5 +54,11 @@
|
|||||||
<file>mockfiles/images/scale_active@2x.png</file>
|
<file>mockfiles/images/scale_active@2x.png</file>
|
||||||
<file>mockfiles/images/scale_selected.png</file>
|
<file>mockfiles/images/scale_selected.png</file>
|
||||||
<file>mockfiles/images/scale_selected@2x.png</file>
|
<file>mockfiles/images/scale_selected@2x.png</file>
|
||||||
|
<file>mockfiles/images/directional_light_gradient.png</file>
|
||||||
|
<file>mockfiles/images/directional_light_gradient@2x.png</file>
|
||||||
|
<file>mockfiles/images/point_light_gradient.png</file>
|
||||||
|
<file>mockfiles/images/point_light_gradient@2x.png</file>
|
||||||
|
<file>mockfiles/images/area_light_gradient.png</file>
|
||||||
|
<file>mockfiles/images/area_light_gradient@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Reference in New Issue
Block a user