diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-03-02 10:09:32 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-03-02 21:03:26 +0000 |
commit | 2519573517979f6a2995f9a445321ef7d62091e8 (patch) | |
tree | fe5ddcfd7b5e4127c5de029562c7bc30ab905a78 /tests/manual | |
parent | d024347bc358f8202465374ca3958738df580984 (diff) |
Split blend tree manual test out from simple key frame test
Change-Id: I9aba21499008980f3bd07efb14c912961090ecb1
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'tests/manual')
10 files changed, 620 insertions, 185 deletions
diff --git a/tests/manual/animation-keyframe-blendtree/DefaultSceneEntity.qml b/tests/manual/animation-keyframe-blendtree/DefaultSceneEntity.qml new file mode 100644 index 000000000..efffd44c9 --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/DefaultSceneEntity.qml @@ -0,0 +1,35 @@ +/************************************************************************* + * + * Copyright (c) 2016, Klaralvdalens Datakonsult AB (KDAB) + * All rights reserved. + * + * See the LICENSE.txt file shipped along with this file for the license. + * + *************************************************************************/ + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 +import Qt3D.Input 2.0 +import Qt3D.Extras 2.0 + +Entity { + id: root + property Camera camera + + components: [ + RenderSettings { + activeFrameGraph: ForwardRenderer { + camera: root.camera + } + }, + // Event Source will be set by the Qt3DQuickWindow + InputSettings { } + ] + + Entity { + components: [ + PointLight { intensity: 0.5 }, + Transform { translation: camera.position } + ] + } +} diff --git a/tests/manual/animation-keyframe-blendtree/animation-keyframe-blendtree.pro b/tests/manual/animation-keyframe-blendtree/animation-keyframe-blendtree.pro new file mode 100644 index 000000000..04db4207e --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/animation-keyframe-blendtree.pro @@ -0,0 +1,5 @@ +TEMPLATE = app +QT += 3dquickextras 3dquickanimation +SOURCES += main.cpp +RESOURCES += main.qrc +OTHER_FILES += main.qml DefaultSceneEntity.qml diff --git a/tests/manual/animation-keyframe-blendtree/cubeanimation.json b/tests/manual/animation-keyframe-blendtree/cubeanimation.json new file mode 100644 index 000000000..addf92907 --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/cubeanimation.json @@ -0,0 +1,87 @@ +{ + "animations": [ + { "object": "Cube", + "action": "CubeAction", + "range": [0.0, 60.0], + "groups": [ + { "group": "Location", + "channels": [ + { "name": "x", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.4717472394307454, 0.0], + "handle_right": [0.4717472394307454, 0.0]} + ,{ "co": [1.2083333333333333, 2.430499792098999], + "handle_left": [0.7365860939025879, 1.4711904525756836], + "handle_right": [1.696347713470459, 3.42288875579834]} + ,{ "co": [2.4583333333333335, 5.0], + "handle_left": [1.9703189531962078, 5.0], + "handle_right": [2.9463475545247397, 5.0]} + ]} + ,{ "name": "z", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.4717472394307454, 0.0], + "handle_right": [0.4717472394307454, 0.0]} + ,{ "co": [1.2083333333333333, 0.0], + "handle_left": [0.7365860939025879, 0.0], + "handle_right": [1.696347713470459, 0.0]} + ,{ "co": [2.4583333333333335, 0.0], + "handle_left": [1.9703189531962078, 0.0], + "handle_right": [2.9463475545247397, 0.0]} + ]} + ,{ "name": "y", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.4717472394307454, 0.0], + "handle_right": [0.4717472394307454, 0.0]} + ,{ "co": [1.2083333333333333, 3.0], + "handle_left": [0.7365860939025879, 3.0], + "handle_right": [1.696347713470459, 3.0]} + ,{ "co": [2.4583333333333335, 0.0], + "handle_left": [1.9703189531962078, 0.0], + "handle_right": [2.9463475545247397, 0.0]} + ]} + ]} + ,{ "group": "Rotation", + "channels": [ + { "name": "w", + "keyframes": [ + { "co": [0.0, 1.0], + "handle_left": [-0.9597616195678711, 1.0], + "handle_right": [0.9597616195678711, 1.0]} + ,{ "co": [2.4583333333333335, -4.371138828673793e-08], + "handle_left": [1.4985717137654622, -4.371138828673793e-08], + "handle_right": [3.4180949529012046, -4.371138828673793e-08]} + ]} + ,{ "name": "x", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.9597616195678711, 0.0], + "handle_right": [0.9597616195678711, 0.0]} + ,{ "co": [2.4583333333333335, 0.0], + "handle_left": [1.4985717137654622, 0.0], + "handle_right": [3.4180949529012046, 0.0]} + ]} + ,{ "name": "z", + "keyframes": [ + { "co": [0.0, -0.0], + "handle_left": [-0.9597616195678711, -0.0], + "handle_right": [0.9597616195678711, -0.0]} + ,{ "co": [2.4583333333333335, -1.0], + "handle_left": [1.4985717137654622, -1.0], + "handle_right": [3.4180949529012046, -1.0]} + ]} + ,{ "name": "y", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.9597616195678711, 0.0], + "handle_right": [0.9597616195678711, 0.0]} + ,{ "co": [2.4583333333333335, 0.0], + "handle_left": [1.4985717137654622, 0.0], + "handle_right": [3.4180949529012046, 0.0]} + ]} + ]} + ]} + ] +} diff --git a/tests/manual/animation-keyframe-blendtree/main.cpp b/tests/manual/animation-keyframe-blendtree/main.cpp new file mode 100644 index 000000000..fc48fc702 --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/main.cpp @@ -0,0 +1,25 @@ +/************************************************************************* + * + * Copyright (c) 2016, Klaralvdalens Datakonsult AB (KDAB) + * All rights reserved. + * + * See the LICENSE.txt file shipped along with this file for the license. + * + *************************************************************************/ + +#include <QGuiApplication> +#include <Qt3DAnimation/QAnimationAspect> +#include <Qt3DQuickExtras/Qt3DQuickWindow> +#include <Qt3DQuick/QQmlAspectEngine> +#include <QQmlEngine> +#include <QQmlContext> + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + Qt3DExtras::Quick::Qt3DQuickWindow view; + view.registerAspect(new Qt3DAnimation::QAnimationAspect()); + view.setSource(QUrl("qrc:/main.qml")); + view.show(); + return app.exec(); +} diff --git a/tests/manual/animation-keyframe-blendtree/main.qml b/tests/manual/animation-keyframe-blendtree/main.qml new file mode 100644 index 000000000..2c7be6879 --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/main.qml @@ -0,0 +1,260 @@ +/************************************************************************* + * + * Copyright (c) 2016, Klaralvdalens Datakonsult AB (KDAB) + * All rights reserved. + * + * See the LICENSE.txt file shipped along with this file for the license. + * + *************************************************************************/ + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 +import Qt3D.Input 2.0 +import Qt3D.Animation 2.9 +import Qt3D.Extras 2.0 + +DefaultSceneEntity { + id: scene + + Entity { + id: cube + + components: [ + Transform { + id: cubeTransform + + onTranslationChanged: console.log("t = " + translation) + }, + CuboidMesh { + }, + PhongMaterial { + id: cubeMaterial + ambient: Qt.rgba(0.02, 0.02, 0.02, 1.0) + diffuse: "blue" + shininess: 50 + }, + ObjectPicker { + onClicked: animator.running = true + }, + ClipAnimator { + id: animator + loops: 3 + onRunningChanged: console.log("running = " + running) + + clip: AnimationClip { + source: "cubeanimation.json" + onDurationChanged: console.log("duration = " + duration) + } + + // By default introspect parent Entity and try + // to map fcurve groups to properties of QTransform + // mapping: AutomaticAnimationMapping {} + + // To do more, we can be explicit + channelMapper: ChannelMapper { + mappings: [ + ChannelMapping { channelName: "Location"; target: cubeTransform; property: "translation" }, + ChannelMapping { channelName: "Rotation"; target: cubeTransform; property: "rotation" }, + ChannelMapping { channelName: "Diffuse Color"; target: cubeMaterial; property: "diffuse" } + ] + } + } + ] + } + + Entity { + id: sphere + + components: [ + Transform { + id: sphereTransform + translation: Qt.vector3d(5, 0, 0) + onTranslationChanged: console.log("t = " + translation) + }, + SphereMesh { + }, + PhongMaterial { + id: sphereMaterial + ambient: Qt.rgba(0.02, 0.02, 0.02, 1.0) + diffuse: "red" + shininess: 50 + }, + ObjectPicker { + onClicked: blendedAnimator.running = true + }, + BlendedClipAnimator { + id: blendedAnimator + loops: 2 + + onRunningChanged: console.log("running = " + running) + + blendTree: LerpBlend { + blendFactor: 0.5 + clips: [ + AnimationClip { + source: "cubeanimation.json" + onDurationChanged: console.log("duration = " + duration) + }, + AnimationClip { + source: "pulsing-moving-cube.json" + onDurationChanged: console.log("duration = " + duration) + }] + } + + + // By default introspect parent Entity and try + // to map fcurve groups to properties of QTransform + // mapping: AutomaticAnimationMapping {} + + // To do more, we can be explicit + channelMapper: ChannelMapper { + mappings: [ + ChannelMapping { channelName: "Location"; target: sphereTransform; property: "translation" }, + ChannelMapping { channelName: "Rotation"; target: sphereTransform; property: "rotation" }, + ChannelMapping { channelName: "Scaling"; target: sphereTransform; property: "scale3D" }, + ChannelMapping { channelName: "Diffuse Color"; target: sphereMaterial; property: "diffuse" } + ] + } + } + ] + } + + Entity { + id: cube2 + + components: [ + Transform { + id: cube2Transform + translation: Qt.vector3d(2.5, 0, 0) + onTranslationChanged: console.log("t = " + translation) + }, + CuboidMesh { + }, + PhongMaterial { + id: cube2Material + ambient: Qt.rgba(0.8, 0.8, 0.8, 1.0) + diffuse: Qt.rgba(0.7, 0.7, 0.7, 1.0) + shininess: 50 + }, + ObjectPicker { + onClicked: blendedAnimator2.running = true + }, + BlendedClipAnimator { + id: blendedAnimator2 + loops: 2 + + onRunningChanged: console.log("running = " + running) + + blendTree: AdditiveBlend { + blendFactor: 0.5 + clips: [ + AnimationClip { + source: "pulsing-moving-cube.json" + onDurationChanged: console.log("duration = " + duration) + }, + AnimationClip { + source: "pulsing-cube-additive.json" + onDurationChanged: console.log("duration = " + duration) + }] + } + + // By default introspect parent Entity and try + // to map fcurve groups to properties of QTransform + // mapping: AutomaticAnimationMapping {} + + // To do more, we can be explicit + channelMapper: ChannelMapper { + mappings: [ + ChannelMapping { channelName: "Location"; target: cube2Transform; property: "translation" }, + ChannelMapping { channelName: "Rotation"; target: cube2Transform; property: "rotation" }, + ChannelMapping { channelName: "Scaling"; target: cube2Transform; property: "scale3D" }, + ChannelMapping { channelName: "Diffuse Color"; target: cube2Transform; property: "diffuse" } + ] + } + } + ] + } + + Entity { + id: cube3 + + components: [ + Transform { + id: cube3Transform + translation: Qt.vector3d(2.5, 0, 2) + onTranslationChanged: console.log("t = " + translation) + }, + CuboidMesh { + }, + PhongMaterial { + id: cube3Material + ambient: Qt.rgba(0.8, 0.8, 0.8, 1.0) + diffuse: "green" + shininess: 50 + }, + ObjectPicker { + onClicked: blendedAnimator3.running = true + }, + BlendedClipAnimator { + id: blendedAnimator3 + loops: 2 + + onRunningChanged: console.log("running = " + running) + + blendTree: LerpBlend { + blendFactor: 0.5 + AdditiveBlend { + blendFactor: 0.5 + clips: [ + AnimationClip { + source: "pulsing-moving-cube.json" + onDurationChanged: console.log("duration = " + duration) + }, + AnimationClip { + source: "pulsing-cube-additive.json" + onDurationChanged: console.log("duration = " + duration) + }] + } + LerpBlend { + blendFactor: 0.5 + clips: [ + AnimationClip { + source: "cubeanimation.json" + onDurationChanged: console.log("duration = " + duration) + }, + AnimationClip { + source: "pulsing-moving-cube.json" + onDurationChanged: console.log("duration = " + duration) + }] + } + } + + // By default introspect parent Entity and try + // to map fcurve groups to properties of QTransform + // mapping: AutomaticAnimationMapping {} + + // To do more, we can be explicit + channelMapper: ChannelMapper { + mappings: [ + ChannelMapping { channelName: "Location"; target: cube3Transform; property: "translation" }, + ChannelMapping { channelName: "Rotation"; target: cube3Transform; property: "rotation" }, + ChannelMapping { channelName: "Scaling"; target: cube3Transform; property: "scale3D" }, + ChannelMapping { channelName: "Diffuse Color"; target: cube3Transform; property: "diffuse" } + ] + } + } + ] + } + + + camera: Camera { + position: Qt.vector3d(10, 3, 15) + viewCenter: Qt.vector3d(2.5, 1, 0) + } + + OrbitCameraController { + camera: scene.camera + linearSpeed: 8 + lookSpeed: 180 + } +} diff --git a/tests/manual/animation-keyframe-blendtree/main.qrc b/tests/manual/animation-keyframe-blendtree/main.qrc new file mode 100644 index 000000000..b59429895 --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/main.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>DefaultSceneEntity.qml</file> + <file>cubeanimation.json</file> + <file>pulsing-moving-cube.json</file> + <file>pulsing-cube-additive.json</file> + </qresource> +</RCC> diff --git a/tests/manual/animation-keyframe-blendtree/pulsing-cube-additive.json b/tests/manual/animation-keyframe-blendtree/pulsing-cube-additive.json new file mode 100644 index 000000000..1373a5002 --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/pulsing-cube-additive.json @@ -0,0 +1,84 @@ +{ + "animations": [ + { "object": "Cube", + "action": "CubeAction", + "range": [0.0, 60.0], + "groups": [ + { "group": "Scaling", + "channels": [ + { "name": "x", + "keyframes": [ + { "co": [0.0, 1.0], + "handle_left": [-0.1464043160279592, 1.0], + "handle_right": [0.14640430609385172, 1.0]} + ,{ "co": [0.375, 0.5], + "handle_left": [0.22859569390614828, 0.5], + "handle_right": [0.5376714468002319, 0.5]} + ,{ "co": [0.7916666666666666, 1.0], + "handle_left": [0.6289951801300049, 1.0], + "handle_right": [0.9543381532033285, 1.0]} + ,{ "co": [1.2083333333333333, 0.5], + "handle_left": [1.0456619262695312, 0.5], + "handle_right": [1.371035893758138, 0.5]} + ,{ "co": [1.625, 1.0], + "handle_left": [1.462328592936198, 1.0], + "handle_right": [1.787671407063802, 1.0]} + ,{ "co": [2.0416666666666665, 0.5], + "handle_left": [1.8789952596028645, 0.5], + "handle_right": [2.2043380737304688, 0.5]} + ,{ "co": [2.4583333333333335, 1.0], + "handle_left": [2.2956619262695312, 1.0], + "handle_right": [2.6210047403971353, 1.0]} + ]} + ,{ "name": "z", + "keyframes": [ + { "co": [0.0, 1.0], + "handle_left": [-0.1464043160279592, 1.0], + "handle_right": [0.14640430609385172, 1.0]} + ,{ "co": [0.375, 0.5], + "handle_left": [0.22859569390614828, 0.5], + "handle_right": [0.5376714468002319, 0.5]} + ,{ "co": [0.7916666666666666, 1.0], + "handle_left": [0.6289951801300049, 1.0], + "handle_right": [0.9543381532033285, 1.0]} + ,{ "co": [1.2083333333333333, 0.5], + "handle_left": [1.0456618467966716, 0.5], + "handle_right": [1.3710047403971355, 0.5]} + ,{ "co": [1.625, 1.0], + "handle_left": [1.462328592936198, 1.0], + "handle_right": [1.787671407063802, 1.0]} + ,{ "co": [2.0416666666666665, 0.5], + "handle_left": [1.8789952596028645, 0.5], + "handle_right": [2.2043380737304688, 0.5]} + ,{ "co": [2.4583333333333335, 1.0], + "handle_left": [2.2956619262695312, 1.0], + "handle_right": [2.6210047403971353, 1.0]} + ]} + ,{ "name": "y", + "keyframes": [ + { "co": [0.0, 1.0], + "handle_left": [-0.1464043160279592, 1.0], + "handle_right": [0.14640430609385172, 1.0]} + ,{ "co": [0.375, 0.5], + "handle_left": [0.22859569390614828, 0.5], + "handle_right": [0.5376714468002319, 0.5]} + ,{ "co": [0.7916666666666666, 1.0], + "handle_left": [0.6289951801300049, 1.0], + "handle_right": [0.9543381532033285, 1.0]} + ,{ "co": [1.2083333333333333, 0.5441937446594238], + "handle_left": [1.0456618467966716, 0.5441937446594238], + "handle_right": [1.3710047403971355, 0.5441937446594238]} + ,{ "co": [1.625, 1.0], + "handle_left": [1.462328592936198, 1.0], + "handle_right": [1.787671407063802, 1.0]} + ,{ "co": [2.0416666666666665, 0.5771476030349731], + "handle_left": [1.8789952596028645, 0.5771476030349731], + "handle_right": [2.2043380737304688, 0.5771476030349731]} + ,{ "co": [2.4583333333333335, 1.0], + "handle_left": [2.2956619262695312, 1.0], + "handle_right": [2.6210047403971353, 1.0]} + ]} + ]} + ]} + ] +} diff --git a/tests/manual/animation-keyframe-blendtree/pulsing-moving-cube.json b/tests/manual/animation-keyframe-blendtree/pulsing-moving-cube.json new file mode 100644 index 000000000..147c31e76 --- /dev/null +++ b/tests/manual/animation-keyframe-blendtree/pulsing-moving-cube.json @@ -0,0 +1,114 @@ +{ + "animations": [ + { "object": "Cube", + "action": "CubeAction", + "range": [0.0, 60.0], + "groups": [ + { "group": "Location", + "channels": [ + { "name": "x", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.9597616195678711, 0.0], + "handle_right": [0.9597616195678711, 0.0]} + ,{ "co": [2.4583333333333335, 5.0], + "handle_left": [1.4985717137654622, 5.0], + "handle_right": [3.4180949529012046, 5.0]} + ]} + ,{ "name": "z", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.9597616195678711, 0.0], + "handle_right": [0.9597616195678711, 0.0]} + ,{ "co": [2.4583333333333335, 0.0], + "handle_left": [1.4985717137654622, 0.0], + "handle_right": [3.4180949529012046, 0.0]} + ]} + ,{ "name": "y", + "keyframes": [ + { "co": [0.0, 0.0], + "handle_left": [-0.9597616195678711, 0.0], + "handle_right": [0.9597616195678711, 0.0]} + ,{ "co": [2.4583333333333335, 0.0], + "handle_left": [1.4985717137654622, 0.0], + "handle_right": [3.4180949529012046, 0.0]} + ]} + ]} + ,{ "group": "Scaling", + "channels": [ + { "name": "x", + "keyframes": [ + { "co": [0.0, 1.0], + "handle_left": [-0.1464043160279592, 1.0], + "handle_right": [0.14640430609385172, 1.0]} + ,{ "co": [0.375, 0.5], + "handle_left": [0.22859569390614828, 0.5], + "handle_right": [0.5376714468002319, 0.5]} + ,{ "co": [0.7916666666666666, 1.0], + "handle_left": [0.6289951801300049, 1.0], + "handle_right": [0.9543381532033285, 1.0]} + ,{ "co": [1.2083333333333333, 0.5], + "handle_left": [1.0456619262695312, 0.5], + "handle_right": [1.371035893758138, 0.5]} + ,{ "co": [1.625, 1.0], + "handle_left": [1.462328592936198, 1.0], + "handle_right": [1.787671407063802, 1.0]} + ,{ "co": [2.0416666666666665, 0.5], + "handle_left": [1.8789952596028645, 0.5], + "handle_right": [2.2043380737304688, 0.5]} + ,{ "co": [2.4583333333333335, 1.0], + "handle_left": [2.2956619262695312, 1.0], + "handle_right": [2.6210047403971353, 1.0]} + ]} + ,{ "name": "z", + "keyframes": [ + { "co": [0.0, 1.0], + "handle_left": [-0.1464043160279592, 1.0], + "handle_right": [0.14640430609385172, 1.0]} + ,{ "co": [0.375, 0.5], + "handle_left": [0.22859569390614828, 0.5], + "handle_right": [0.5376714468002319, 0.5]} + ,{ "co": [0.7916666666666666, 1.0], + "handle_left": [0.6289951801300049, 1.0], + "handle_right": [0.9543381532033285, 1.0]} + ,{ "co": [1.2083333333333333, 0.5], + "handle_left": [1.0456618467966716, 0.5], + "handle_right": [1.3710047403971355, 0.5]} + ,{ "co": [1.625, 1.0], + "handle_left": [1.462328592936198, 1.0], + "handle_right": [1.787671407063802, 1.0]} + ,{ "co": [2.0416666666666665, 0.5], + "handle_left": [1.8789952596028645, 0.5], + "handle_right": [2.2043380737304688, 0.5]} + ,{ "co": [2.4583333333333335, 1.0], + "handle_left": [2.2956619262695312, 1.0], + "handle_right": [2.6210047403971353, 1.0]} + ]} + ,{ "name": "y", + "keyframes": [ + { "co": [0.0, 1.0], + "handle_left": [-0.1464043160279592, 1.0], + "handle_right": [0.14640430609385172, 1.0]} + ,{ "co": [0.375, 0.5], + "handle_left": [0.22859569390614828, 0.5], + "handle_right": [0.5376714468002319, 0.5]} + ,{ "co": [0.7916666666666666, 1.0], + "handle_left": [0.6289951801300049, 1.0], + "handle_right": [0.9543381532033285, 1.0]} + ,{ "co": [1.2083333333333333, 0.5441937446594238], + "handle_left": [1.0456618467966716, 0.5441937446594238], + "handle_right": [1.3710047403971355, 0.5441937446594238]} + ,{ "co": [1.625, 1.0], + "handle_left": [1.462328592936198, 1.0], + "handle_right": [1.787671407063802, 1.0]} + ,{ "co": [2.0416666666666665, 0.5771476030349731], + "handle_left": [1.8789952596028645, 0.5771476030349731], + "handle_right": [2.2043380737304688, 0.5771476030349731]} + ,{ "co": [2.4583333333333335, 1.0], + "handle_left": [2.2956619262695312, 1.0], + "handle_right": [2.6210047403971353, 1.0]} + ]} + ]} + ]} + ] +} diff --git a/tests/manual/animation-keyframe-simple/main.qml b/tests/manual/animation-keyframe-simple/main.qml index 2c7be6879..17744209a 100644 --- a/tests/manual/animation-keyframe-simple/main.qml +++ b/tests/manual/animation-keyframe-simple/main.qml @@ -62,191 +62,6 @@ DefaultSceneEntity { ] } - Entity { - id: sphere - - components: [ - Transform { - id: sphereTransform - translation: Qt.vector3d(5, 0, 0) - onTranslationChanged: console.log("t = " + translation) - }, - SphereMesh { - }, - PhongMaterial { - id: sphereMaterial - ambient: Qt.rgba(0.02, 0.02, 0.02, 1.0) - diffuse: "red" - shininess: 50 - }, - ObjectPicker { - onClicked: blendedAnimator.running = true - }, - BlendedClipAnimator { - id: blendedAnimator - loops: 2 - - onRunningChanged: console.log("running = " + running) - - blendTree: LerpBlend { - blendFactor: 0.5 - clips: [ - AnimationClip { - source: "cubeanimation.json" - onDurationChanged: console.log("duration = " + duration) - }, - AnimationClip { - source: "pulsing-moving-cube.json" - onDurationChanged: console.log("duration = " + duration) - }] - } - - - // By default introspect parent Entity and try - // to map fcurve groups to properties of QTransform - // mapping: AutomaticAnimationMapping {} - - // To do more, we can be explicit - channelMapper: ChannelMapper { - mappings: [ - ChannelMapping { channelName: "Location"; target: sphereTransform; property: "translation" }, - ChannelMapping { channelName: "Rotation"; target: sphereTransform; property: "rotation" }, - ChannelMapping { channelName: "Scaling"; target: sphereTransform; property: "scale3D" }, - ChannelMapping { channelName: "Diffuse Color"; target: sphereMaterial; property: "diffuse" } - ] - } - } - ] - } - - Entity { - id: cube2 - - components: [ - Transform { - id: cube2Transform - translation: Qt.vector3d(2.5, 0, 0) - onTranslationChanged: console.log("t = " + translation) - }, - CuboidMesh { - }, - PhongMaterial { - id: cube2Material - ambient: Qt.rgba(0.8, 0.8, 0.8, 1.0) - diffuse: Qt.rgba(0.7, 0.7, 0.7, 1.0) - shininess: 50 - }, - ObjectPicker { - onClicked: blendedAnimator2.running = true - }, - BlendedClipAnimator { - id: blendedAnimator2 - loops: 2 - - onRunningChanged: console.log("running = " + running) - - blendTree: AdditiveBlend { - blendFactor: 0.5 - clips: [ - AnimationClip { - source: "pulsing-moving-cube.json" - onDurationChanged: console.log("duration = " + duration) - }, - AnimationClip { - source: "pulsing-cube-additive.json" - onDurationChanged: console.log("duration = " + duration) - }] - } - - // By default introspect parent Entity and try - // to map fcurve groups to properties of QTransform - // mapping: AutomaticAnimationMapping {} - - // To do more, we can be explicit - channelMapper: ChannelMapper { - mappings: [ - ChannelMapping { channelName: "Location"; target: cube2Transform; property: "translation" }, - ChannelMapping { channelName: "Rotation"; target: cube2Transform; property: "rotation" }, - ChannelMapping { channelName: "Scaling"; target: cube2Transform; property: "scale3D" }, - ChannelMapping { channelName: "Diffuse Color"; target: cube2Transform; property: "diffuse" } - ] - } - } - ] - } - - Entity { - id: cube3 - - components: [ - Transform { - id: cube3Transform - translation: Qt.vector3d(2.5, 0, 2) - onTranslationChanged: console.log("t = " + translation) - }, - CuboidMesh { - }, - PhongMaterial { - id: cube3Material - ambient: Qt.rgba(0.8, 0.8, 0.8, 1.0) - diffuse: "green" - shininess: 50 - }, - ObjectPicker { - onClicked: blendedAnimator3.running = true - }, - BlendedClipAnimator { - id: blendedAnimator3 - loops: 2 - - onRunningChanged: console.log("running = " + running) - - blendTree: LerpBlend { - blendFactor: 0.5 - AdditiveBlend { - blendFactor: 0.5 - clips: [ - AnimationClip { - source: "pulsing-moving-cube.json" - onDurationChanged: console.log("duration = " + duration) - }, - AnimationClip { - source: "pulsing-cube-additive.json" - onDurationChanged: console.log("duration = " + duration) - }] - } - LerpBlend { - blendFactor: 0.5 - clips: [ - AnimationClip { - source: "cubeanimation.json" - onDurationChanged: console.log("duration = " + duration) - }, - AnimationClip { - source: "pulsing-moving-cube.json" - onDurationChanged: console.log("duration = " + duration) - }] - } - } - - // By default introspect parent Entity and try - // to map fcurve groups to properties of QTransform - // mapping: AutomaticAnimationMapping {} - - // To do more, we can be explicit - channelMapper: ChannelMapper { - mappings: [ - ChannelMapping { channelName: "Location"; target: cube3Transform; property: "translation" }, - ChannelMapping { channelName: "Rotation"; target: cube3Transform; property: "rotation" }, - ChannelMapping { channelName: "Scaling"; target: cube3Transform; property: "scale3D" }, - ChannelMapping { channelName: "Diffuse Color"; target: cube3Transform; property: "diffuse" } - ] - } - } - ] - } - - camera: Camera { position: Qt.vector3d(10, 3, 15) viewCenter: Qt.vector3d(2.5, 1, 0) diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro index a7fe4b90d..a5f07b55d 100644 --- a/tests/manual/manual.pro +++ b/tests/manual/manual.pro @@ -43,6 +43,7 @@ SUBDIRS += \ render-qml-to-texture-qml \ video-texture-qml \ animation-keyframe-simple \ + animation-keyframe-blendtree \ distancefieldtext \ mesh-morphing \ anim-viewer |