From 9786f3aa9dd25f27c776201ccce2de1e54e34aad Mon Sep 17 00:00:00 2001 From: Tomi Korpipaa <tomi.korpipaa@qt.io> Date: Wed, 25 Apr 2018 13:40:14 +0300 Subject: [PATCH] Update kria cluster to 2.0 API --- .../presentation/contentPresentation.uip | 2 +- .../presentation/digitalSpeed.uip | 4 +-- .../presentation/digitalTacho.uip | 2 +- .../presentation/mainPresentation.uia | 15 ++++---- .../presentation/mainPresentation.uip | 10 +++--- .../presentation/speedBackground.uip | 4 +-- .../presentation/tachoBackground.uip | 2 +- kria-cluster-3d-demo/qml/OverlayContainer.qml | 12 +++---- kria-cluster-3d-demo/qml/SimuData.qml | 4 +-- kria-cluster-3d-demo/qml/main.qml | 35 +++---------------- 10 files changed, 33 insertions(+), 57 deletions(-) diff --git a/kria-cluster-3d-demo/presentation/contentPresentation.uip b/kria-cluster-3d-demo/presentation/contentPresentation.uip index 6ebf074..e686072 100644 --- a/kria-cluster-3d-demo/presentation/contentPresentation.uip +++ b/kria-cluster-3d-demo/presentation/contentPresentation.uip @@ -75,7 +75,7 @@ <Add ref="#CarBottom" diffuse="0.101961 0.101961 0.101961" importfile=".\Car\Car.import" shaderlighting="None" /> <Add ref="#Interior" diffuse="0.0901961 0.0901961 0.0901961" importfile=".\Car\Car.import" /> <Add ref="#body" importfile=".\Car\Car.import" /> - <Add ref="#lambert2" bumpamount="1" diffuse="0.870588 0 0" fresnelPower="5" importfile=".\Car\Car.import" normalmap="#lambert2_normalmap" opacity="100" specularamount="2" specularmodel="Default" specularroughness="0.001" speculartint="0.298039 0.298039 0.298039" /> + <Add ref="#lambert2" bumpamount="1" controlledproperty="$displayColor diffuse" diffuse="0.870588 0 0" fresnelPower="5" importfile=".\Car\Car.import" normalmap="#lambert2_normalmap" opacity="100" specularamount="2" specularmodel="Default" specularroughness="0.001" speculartint="0.298039 0.298039 0.298039" /> <Add ref="#lambert2_normalmap" sourcepath=".\Car\maps\outUV_normals.png" /> <Add ref="#Wheel_Back_Left" importfile=".\Car\Car.import" scale="90 38.141 38.141" > <AnimationTrack property="rotation.x" type="EaseInOut" >0 720 0 0 8 0 0 0</AnimationTrack> diff --git a/kria-cluster-3d-demo/presentation/digitalSpeed.uip b/kria-cluster-3d-demo/presentation/digitalSpeed.uip index 8d0fa4a..5b0f73c 100644 --- a/kria-cluster-3d-demo/presentation/digitalSpeed.uip +++ b/kria-cluster-3d-demo/presentation/digitalSpeed.uip @@ -18,8 +18,8 @@ <Add ref="#Layer" background="SolidColor" /> <Add ref="#Camera" orthographic="True" /> <State id="Scene-Slide1" name="Slide1" > - <Add ref="#speed" name="speed" font="TitilliumWeb-Regular" position="0 40 0" size="90" textstring="0" /> - <Add ref="#kmh" name="kmh" font="TitilliumWeb-Regular" position="0 -40 0" size="30" textstring="kph" /> + <Add ref="#speed" name="speed" controlledproperty="$speedText textstring" font="TitilliumWeb-Regular" position="0 40 0" size="90" textstring="0" /> + <Add ref="#kmh" name="kmh" controlledproperty="$speedUnitSlide textstring" font="TitilliumWeb-Regular" position="0 -40 0" size="30" textstring="kph" /> </State> </State> </Logic> diff --git a/kria-cluster-3d-demo/presentation/digitalTacho.uip b/kria-cluster-3d-demo/presentation/digitalTacho.uip index d15488e..cbdea9b 100644 --- a/kria-cluster-3d-demo/presentation/digitalTacho.uip +++ b/kria-cluster-3d-demo/presentation/digitalTacho.uip @@ -19,7 +19,7 @@ <Add ref="#Camera" orthographic="True" /> <State id="Scene-Slide1" name="Slide1" > <Add ref="#rpm" name="rpm" font="TitilliumWeb-Regular" position="0 -40 0" rotation="0 0 0" size="30" textstring="rpm x 1000" /> - <Add ref="#tacho" name="tacho" font="TitilliumWeb-Regular" opacity="99" position="0 40 0" size="90" textstring="0.0" /> + <Add ref="#tacho" name="tacho" controlledproperty="$tachoText textstring" font="TitilliumWeb-Regular" opacity="99" position="0 40 0" size="90" textstring="0.0" /> </State> </State> </Logic> diff --git a/kria-cluster-3d-demo/presentation/mainPresentation.uia b/kria-cluster-3d-demo/presentation/mainPresentation.uia index ef69b3d..3a6b97b 100644 --- a/kria-cluster-3d-demo/presentation/mainPresentation.uia +++ b/kria-cluster-3d-demo/presentation/mainPresentation.uia @@ -1,13 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <application> <assets initial="mainPresentation"> - <presentation id="mainPresentation" src="mainPresentation.uip"/> - <presentation id="contentPresentation" src="contentPresentation.uip"/> - <presentation id="digitalSpeed" src="digitalSpeed.uip"/> - <presentation id="digitalTacho" src="digitalTacho.uip"/> - <presentation id="SpeedBackground" src="speedBackground.uip"/> - <presentation id="TachoBackground" src="tachoBackground.uip"/> - <presentation-qml id="navigationStream" args="../qml/Navigation.qml"/> <dataInput name="mainSlide" type="String"/> <dataInput name="carSlide" type="String"/> <dataInput name="colorSlide" type="String"/> @@ -16,6 +9,14 @@ <dataInput name="speed" type="Ranged Number" min="0" max="260"/> <dataInput name="speedText" type="String"/> <dataInput name="tachoText" type="String"/> + <dataInput name="displayColor" type="Vector3"/> + <presentation id="mainPresentation" src="mainPresentation.uip"/> + <presentation id="contentPresentation" src="contentPresentation.uip"/> + <presentation id="digitalSpeed" src="digitalSpeed.uip"/> + <presentation id="digitalTacho" src="digitalTacho.uip"/> + <presentation id="SpeedBackground" src="speedBackground.uip"/> + <presentation id="TachoBackground" src="tachoBackground.uip"/> + <presentation-qml id="navigationStream" args="../qml/Navigation.qml"/> </assets> <statemachine ref="#logic"> <visual-states> diff --git a/kria-cluster-3d-demo/presentation/mainPresentation.uip b/kria-cluster-3d-demo/presentation/mainPresentation.uip index e4de2e9..6594cf7 100644 --- a/kria-cluster-3d-demo/presentation/mainPresentation.uip +++ b/kria-cluster-3d-demo/presentation/mainPresentation.uip @@ -8,7 +8,7 @@ <Effect id="VignetteEffect" name="VignetteEffect" sourcepath=".\VignetteEffect.effect" /> </Classes> <Graph > - <Scene id="Scene" backgroundcolor="0 0 0" controlledproperty="mainSlide @slide" > + <Scene id="Scene" backgroundcolor="0 0 0" controlledproperty="$mainSlide @slide" > <Layer id="Layer" > <Camera id="Camera" /> <Group id="Gaugesvol2" importid="__import__root__" > @@ -105,7 +105,7 @@ </Add> <Add ref="#tachomat" bumpamount="1" diffusemap="#tachomat_diffusemap" emissivecolor="0 0 0" fresnelPower="1" importfile=".\Gauges\Gauges.import" shaderlighting="Pixel" specularamount="0.2" specularmodel="Default" specularroughness="0.001" speculartint="0.0627451 0.0627451 0.0627451" /> <Add ref="#tachomat_diffusemap" sourcepath="Gauges/maps/tacho_new.jpg" subpresentation="TachoBackground" /> - <Add ref="#tachoNeedle" name="tachoNeedle" controlledproperty="tacho @timeline" endtime="1000" opacity="100" position="0 1 0" > + <Add ref="#tachoNeedle" name="tachoNeedle" controlledproperty="$tacho @timeline" endtime="1000" opacity="100" position="0 1 0" > <AnimationTrack property="opacity" type="EaseInOut" >0 100 0 0</AnimationTrack> </Add> <Add ref="#centerTacho" endtime="1000" importfile=".\Gauges\Gauges.import" position="0 1 -0" rotation="0 -0 0" sourcepath="GaugeCenter/meshes/centerTacho.mesh" > @@ -176,7 +176,7 @@ <AnimationTrack property="scale.z" type="EaseInOut" >0 1 0 0</AnimationTrack> </Add> <Add ref="#lambert8_001" name="lambert8" endtime="1000" referencedmaterial="#lambert8" /> - <Add ref="#speedNeedle" name="speedNeedle" controlledproperty="speed @timeline" endtime="1000" opacity="100" position="0 1 0" scale="1 1 1" > + <Add ref="#speedNeedle" name="speedNeedle" controlledproperty="$speed @timeline" endtime="1000" opacity="100" position="0 1 0" scale="1 1 1" > <AnimationTrack property="opacity" type="EaseInOut" >0 100 0 0</AnimationTrack> <AnimationTrack property="scale.x" type="EaseInOut" >0 1 0 0</AnimationTrack> <AnimationTrack property="scale.y" type="EaseInOut" >0 1 0 0</AnimationTrack> @@ -201,12 +201,12 @@ <Add ref="#Light_002" name="Light" brightness="250" castshadow="True" endtime="1000" expfade="0" lightambient="0.427451 0.427451 0.427451" lightdiffuse="0.901961 0.901961 0.901961" lightspecular="0.113725 0.109804 0.14902" lighttype="Point" linearfade="9.25926" position="0 48 -110" scale="4 1 1" shdwbias="0.032" shdwfactor="79.8333" shdwfilter="4.66667" shdwmapfar="1500" shdwmapres="10" /> <Add ref="#Map" name="Content_Layer" background="Transparent" height="70" left="15" top="17" width="72" /> <Add ref="#Camera_002" orthographic="True" /> - <Add ref="#Car" name="Car" controlledproperty="carSlide @slide" /> + <Add ref="#Car" name="Car" controlledproperty="$carSlide @slide" /> <Add ref="#map" name="Navigation" opacity="100" scale="25.9751 9.54456 1" sourcepath="#Rectangle" > <AnimationTrack property="opacity" type="EaseInOut" >0 100 0 0</AnimationTrack> </Add> <Add ref="#Material_001" diffusemap="#Material_001_diffusemap" shaderlighting="None" /> - <Add ref="#Material_001_diffusemap" sourcepath=".\Gauges\maps\map.jpg" subpresentation="navigationStream" /> + <Add ref="#Material_001_diffusemap" sourcepath="Gauges/maps/map.jpg" subpresentation="navigationStream" /> <Add ref="#VignetteEffect_001" name="VignetteEffect" vig_color="0 0 0" vig_radius="1.01626" vig_strenght="15" /> <State id="Scene-2D" name="2D" playmode="Play Through To..." > <Set ref="#Layer" endtime="1000" /> diff --git a/kria-cluster-3d-demo/presentation/speedBackground.uip b/kria-cluster-3d-demo/presentation/speedBackground.uip index d5ab524..f84c9cb 100644 --- a/kria-cluster-3d-demo/presentation/speedBackground.uip +++ b/kria-cluster-3d-demo/presentation/speedBackground.uip @@ -9,7 +9,7 @@ <ImageBuffer sourcepath="Gauges/maps/gaugespeed_mph.png" hasTransparency="True" /> </BufferData> <Graph > - <Scene id="Scene" controlledproperty="speedUnitSlide @slide" > + <Scene id="Scene" controlledproperty="$speedUnitSlide @slide" > <Layer id="Layer" > <Camera id="Camera" /> <Model id="speed_mph_new" > @@ -46,7 +46,7 @@ </Add> <Add ref="#Material_001" diffusemap="#Material_001_diffusemap" shaderlighting="None" /> <Add ref="#Material_001_diffusemap" sourcepath="Gauges/maps/gaugespeed_kph.png" /> - <Add ref="#gaugespeed_background" name="gaugespeed_background" controlledproperty="colorSlide @slide" /> + <Add ref="#gaugespeed_background" name="gaugespeed_background" controlledproperty="$colorSlide @slide" /> <State id="Scene-kph" name="kph" playmode="Stop at end" > <Set ref="#Layer" endtime="1000" /> <Set ref="#Camera" endtime="1000" /> diff --git a/kria-cluster-3d-demo/presentation/tachoBackground.uip b/kria-cluster-3d-demo/presentation/tachoBackground.uip index 9c1c023..414cf32 100644 --- a/kria-cluster-3d-demo/presentation/tachoBackground.uip +++ b/kria-cluster-3d-demo/presentation/tachoBackground.uip @@ -35,7 +35,7 @@ </Add> <Add ref="#Material" diffusemap="#Material_diffusemap" shaderlighting="None" /> <Add ref="#Material_diffusemap" sourcepath="Gauges/maps/gaugetacho.png" /> - <Add ref="#gaugespeed_background" name="gaugetacho_background" controlledproperty="colorSlide @slide" /> + <Add ref="#gaugespeed_background" name="gaugetacho_background" controlledproperty="$colorSlide @slide" /> <State id="Scene-Tacho" name="Tacho" playmode="Stop at end" > <Set ref="#Layer" endtime="1000" /> <Set ref="#Camera" endtime="1000" /> diff --git a/kria-cluster-3d-demo/qml/OverlayContainer.qml b/kria-cluster-3d-demo/qml/OverlayContainer.qml index 375b06b..406fe7b 100644 --- a/kria-cluster-3d-demo/qml/OverlayContainer.qml +++ b/kria-cluster-3d-demo/qml/OverlayContainer.qml @@ -54,12 +54,12 @@ OverlayContainerForm { id: indicatorContainer // Safety critical icons - property bool parkBrake: startupAnimation ? true : false - property bool flatTire: startupAnimation ? true : false - property bool fuelLevel: startupAnimation ? true : false - property bool seatbelt: startupAnimation ? true : false - property bool oilLevel: startupAnimation ? true : false - property bool brakeFailure: startupAnimation ? true : false + property bool parkBrake: mainview.startupAnimation ? true : false + property bool flatTire: mainview.startupAnimation ? true : false + property bool fuelLevel: mainview.startupAnimation ? true : false + property bool seatbelt: mainview.startupAnimation ? true : false + property bool oilLevel: mainview.startupAnimation ? true : false + property bool brakeFailure: mainview.startupAnimation ? true : false // Icon colors property string offIconColor: "#222324" diff --git a/kria-cluster-3d-demo/qml/SimuData.qml b/kria-cluster-3d-demo/qml/SimuData.qml index d609a01..4e7b8bd 100644 --- a/kria-cluster-3d-demo/qml/SimuData.qml +++ b/kria-cluster-3d-demo/qml/SimuData.qml @@ -62,7 +62,7 @@ Item { SequentialAnimation { id: animation - running: !startupAnimation + running: !mainview.startupAnimation loops: Animation.Infinite PropertyAnimation { @@ -85,7 +85,7 @@ Item { } Timer { - running: !startupAnimation + running: !mainview.startupAnimation property bool turnLeft: true repeat: true interval: 5000 diff --git a/kria-cluster-3d-demo/qml/main.qml b/kria-cluster-3d-demo/qml/main.qml index 73d721b..34cb14d 100644 --- a/kria-cluster-3d-demo/qml/main.qml +++ b/kria-cluster-3d-demo/qml/main.qml @@ -110,42 +110,38 @@ Item { } DataInput { - id: tachometerNeedle name: "tacho" value: simuData.rpm } DataInput { - id: tachometerText name: "tachoText" value: (simuData.rpm / 1000.0).toFixed(1) } DataInput { - id: speedometerNeedle name: "speed" value: simuData.speed } DataInput { - id: speedometerText name: "speedText" value: useMetric ? simuData.speed.toFixed(0) : (simuData.speed / 1.625).toFixed(0) } DataInput { - id: displayColor name: "colorSlide" + value: redTheme ? "red" : "blue" } DataInput { - id: speedometerUnit name: "speedUnitSlide" + value: useMetric ? "kph" : "mph" } - Element { - id: carBodyMaterial - elementPath: "contentPresentation:Scene.Layer.Car.Car.body.lambert2" + DataInput { + name: "displayColor" + value: redTheme ? Qt.vector3d(0.855, 0.14, 0.144) : Qt.vector3d(0.08, 0.08, 1.0) } SubPresentationSettings { @@ -194,27 +190,6 @@ Item { visible: false } - onRedThemeChanged: { - if (redTheme) { - carBodyMaterial.setAttribute("diffuse.r", 0.855); - carBodyMaterial.setAttribute("diffuse.g", 0.14); - carBodyMaterial.setAttribute("diffuse.b", 0.144); - displayColor.setValue("red"); - } else { - carBodyMaterial.setAttribute("diffuse.r", 0.08); - carBodyMaterial.setAttribute("diffuse.g", 0.08); - carBodyMaterial.setAttribute("diffuse.b", 1.0); - displayColor.setValue("blue"); - } - } - - onUseMetricChanged: { - if (useMetric) - speedometerUnit.setValue("kph"); - else - speedometerUnit.setValue("mph"); - } - Keys.onRightPressed: { userActivity(); menuSelect(true); -- GitLab