diff options
author | dpope <daniel.pope@nokia.com> | 2012-05-17 13:14:06 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-17 05:21:56 +0200 |
commit | a86a6d9585331d85dddb0c41338b20f2fdb46db4 (patch) | |
tree | 527be5273aac4109e5cf1db95d2509e44c3b6d49 /demos | |
parent | d5bfa74a90bdb6b04d92e3c9b690b27da5790ab9 (diff) |
Fix to teaservice demo for material colouring.
Objects were not being correctly highlit by mouse-over. This has been
rectified through more efficient use of materials and effects.
Change-Id: Id5f05aff579a22a377a907a1b0a25f5328590791
Reviewed-by: Sergey Dubitskiy <sergey.dubitskiy@nokia.com>
Diffstat (limited to 'demos')
-rw-r--r-- | demos/quick3d/tea_service/qml/TeaService.qml | 47 | ||||
-rw-r--r-- | demos/quick3d/tea_service/qml/Teacup.qml | 8 | ||||
-rw-r--r-- | demos/quick3d/tea_service/qml/Teaspoon.qml | 8 |
3 files changed, 38 insertions, 25 deletions
diff --git a/demos/quick3d/tea_service/qml/TeaService.qml b/demos/quick3d/tea_service/qml/TeaService.qml index b0820e967..fad643fd8 100644 --- a/demos/quick3d/tea_service/qml/TeaService.qml +++ b/demos/quick3d/tea_service/qml/TeaService.qml @@ -52,6 +52,28 @@ Viewport { eye: Qt.vector3d(0, 3, 10) } + Effect { + id: effect_china + material: china + } + + Effect { + id: effect_china_hightlight + material: china_highlight; + } + + Effect { + id: effect_metal + material: metal + } + + Effect { + id: effect_metal_highlight + material: metal_highlight; + } + + + Item3D { id: teapot transform: [ @@ -71,24 +93,20 @@ Viewport { Item3D { id: body mesh: Mesh { source: "teapot-body.bez" } - effect: Effect { - material: china - } + effect: effect_china - onHoverEnter: { effect.material = china_highlight } - onHoverLeave: { effect.material = china } + onHoverEnter: { effect = effect_china_hightlight } + onHoverLeave: { effect = effect_china } onClicked: { teapot.bounce = true } } Item3D { id: handle mesh: Mesh { source: "teapot-handle.bez" } - effect: Effect { - material: china - } + effect: effect_china - onHoverEnter: { effect.material = china_highlight } - onHoverLeave: { effect.material = china } + onHoverEnter: { effect = effect_china_hightlight } + onHoverLeave: { effect = effect_china } onClicked: { if (teapot.state == "facing_left" || teapot.state == "pour_left") { @@ -106,12 +124,11 @@ Viewport { Item3D { id: spout mesh: Mesh { source: "teapot-spout.bez" } - effect: Effect { - material: china - } + effect: effect_china + - onHoverEnter: { effect.material = china_highlight } - onHoverLeave: { effect.material = china } + onHoverEnter: { effect = effect_china_hightlight } + onHoverLeave: { effect = effect_china } onClicked: { if (teapot.state == "facing_left") { teapot.state = "pour_left"; diff --git a/demos/quick3d/tea_service/qml/Teacup.qml b/demos/quick3d/tea_service/qml/Teacup.qml index 230dfb0db..fd3e9fae6 100644 --- a/demos/quick3d/tea_service/qml/Teacup.qml +++ b/demos/quick3d/tea_service/qml/Teacup.qml @@ -49,12 +49,10 @@ Item3D { Item3D { mesh: teacup_mesh - effect: Effect { - material: china - } + effect: effect_china - onHoverEnter: { effect.material = china_highlight } - onHoverLeave: { effect.material = china } + onHoverEnter: { effect = effect_china_hightlight } + onHoverLeave: { effect = effect_china } onClicked: { top.bounce = true } y: top.spoonY diff --git a/demos/quick3d/tea_service/qml/Teaspoon.qml b/demos/quick3d/tea_service/qml/Teaspoon.qml index 880d29a6f..2aab89f94 100644 --- a/demos/quick3d/tea_service/qml/Teaspoon.qml +++ b/demos/quick3d/tea_service/qml/Teaspoon.qml @@ -54,13 +54,11 @@ Item3D { axis: Qt.vector3d(1, 0, 0) } mesh: teaspoon_mesh - effect: Effect { - material: metal - } + effect: effect_metal property bool bounce: false - onHoverEnter: { effect.material = metal_highlight } - onHoverLeave: { effect.material = metal } + onHoverEnter: { effect= effect_metal_highlight } + onHoverLeave: { effect = effect_metal } onClicked: { teaspoon1.bounce = true } SequentialAnimation on y_lift { |