diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-04-23 20:46:57 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-04-27 07:33:14 +0000 |
commit | 4f854ea58c68cd398319bfae4f8b56500b1e0794 (patch) | |
tree | aef0cb24829d6e0ffbf42e0b4358034999a88ed8 /examples | |
parent | 7ce5b5a07b838b42d88f333e6155b60a4b63e608 (diff) |
SubPresentationSettings and QmlStream
It is now possible to define QML subpresentation contents in-line inside
a SubPresentationSettings/QmlStream element inside the Studio3D.
Task-number: QT3DS-1487
Change-Id: I31665d939eb0e1c804c7ce54febe7df475e9ccba
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/3dstudioruntime2/simpleqml/main.qml | 27 | ||||
-rw-r--r-- | examples/3dstudioruntime2/simpleqml/presentation/barrel.uia | 32 | ||||
-rw-r--r-- | examples/3dstudioruntime2/simpleqml/presentation/barrel.uip | 5 |
3 files changed, 46 insertions, 18 deletions
diff --git a/examples/3dstudioruntime2/simpleqml/main.qml b/examples/3dstudioruntime2/simpleqml/main.qml index a79c183..4d47a47 100644 --- a/examples/3dstudioruntime2/simpleqml/main.qml +++ b/examples/3dstudioruntime2/simpleqml/main.qml @@ -98,6 +98,33 @@ Rectangle { id: barrelRef elementPath: "Barrel" // or Scene.Layer.Barrel but as long as it's unique the name's good enough } + + // Let's try out a QML subpresentation defined in-line, i.e. no separate .qml file. + SubPresentationSettings { + qmlStreams: [ + QmlStream { + presentationId: "embeddedQmlScene" + Rectangle { + color: "white" + Rectangle { + color: "red" + width: parent.width * 0.8 + height: parent.height * 0.8 + anchors.centerIn: parent + Text { + anchors.centerIn: parent + text: "Hello from\nembedded Qt Quick" + color: "white" + } + NumberAnimation on rotation { + from: 0; to: 360; duration: 10000 + loops: Animation.Infinite + } + } + } + } + ] + } } ignoredEvents: mouseEvCb.checked ? Studio3D.EnableAllEvents : (Studio3D.IgnoreMouseEvents | Studio3D.IgnoreWheelEvents) onRunningChanged: console.log("running: " + s3d.running) diff --git a/examples/3dstudioruntime2/simpleqml/presentation/barrel.uia b/examples/3dstudioruntime2/simpleqml/presentation/barrel.uia index 22494b1..71d8e26 100644 --- a/examples/3dstudioruntime2/simpleqml/presentation/barrel.uia +++ b/examples/3dstudioruntime2/simpleqml/presentation/barrel.uia @@ -1,17 +1,17 @@ -<?xml version="1.0" encoding="UTF-8"?> -<application xmlns="http://qt.io/qt3dstudio/uia"> - <assets initial="barrel"> - <presentation id="barrel" src="barrel.uip"/> - <dataInput name="di_text" type="String"/> - </assets> - - <statemachine ref="#logic"> - <visual-states> - <state ref="Initial"> - <enter> - <goto-slide element="main:Scene" rel="next"/> - </enter> - </state> - </visual-states> - </statemachine> +<?xml version="1.0" encoding="UTF-8" ?> +<application> + <assets initial="barrel"> + <dataInput name="di_text" type="String"/> + <presentation id="barrel" src="barrel.uip"/> + <presentation-qml id="embeddedQmlScene" args="dummy"/> + </assets> + <statemachine ref="#logic"> + <visual-states> + <state ref="Initial"> + <enter> + <goto-slide element="main:Scene" rel="next"/> + </enter> + </state> + </visual-states> + </statemachine> </application> diff --git a/examples/3dstudioruntime2/simpleqml/presentation/barrel.uip b/examples/3dstudioruntime2/simpleqml/presentation/barrel.uip index 4c58ed4..66b40c2 100644 --- a/examples/3dstudioruntime2/simpleqml/presentation/barrel.uip +++ b/examples/3dstudioruntime2/simpleqml/presentation/barrel.uip @@ -6,6 +6,7 @@ </ProjectSettings> <Graph > <Scene id="Scene" > + <Layer id="splayer" /> <Layer id="Layer" > <Camera id="Camera" /> <Light id="Light" /> @@ -24,10 +25,10 @@ </Graph> <Logic > <State name="Master Slide" component="#Scene" > - <Add ref="#Layer" /> <Add ref="#Camera" /> <Add ref="#Light" /> <State id="Scene-Slide1" name="Slide1" playmode="Looping" > + <Add ref="#splayer" name="splayer" height="30" sourcepath="embeddedQmlScene" top="50" width="30" /> <Add ref="#Barrel" name="Barrel" position="0 -42 -483" rotation="90 0 0" scale="100 100 100" sourcepath=".\barrel\meshes\Barrel.mesh#1" > <AnimationTrack property="opacity" type="EaseInOut" /> <AnimationTrack property="rotation.x" type="EaseInOut" >0 90 100 100 5 64 100 100 10 90 100 100</AnimationTrack> @@ -50,7 +51,7 @@ <AnimationTrack property="textcolor.y" type="EaseInOut" >0 1 100 100 5.009 0.235294 100 100 10 1 100 100</AnimationTrack> <AnimationTrack property="textcolor.z" type="EaseInOut" >0 0 100 100 5.009 0.333333 100 100 10 0 100 100</AnimationTrack> </Add> - <Add ref="#Text2" name="Text2" controlledproperty="di_text textstring" font="Arimo-Regular" position="435.899 267.025 0" /> + <Add ref="#Text2" name="Text2" controlledproperty="di_text textstring" font="Arimo-Regular" position="435.899 267.025 0" /> </State> </State> </Logic> |