diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-02-22 11:32:20 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-02-22 12:14:32 +0000 |
commit | 4afd6d3485a097000ad63f94b47886ee8bc9d17d (patch) | |
tree | b26298012a49e53ef05710a91a9ff6faf4136fa8 /tools | |
parent | 533a8b4e278204bb0b6bc3c0c29797eab9c383cf (diff) |
Avoid asserting for incomplete animation channels
The .uip always specifies all components but let's play nice with
programmatically created animations that fail to do this. Forcing the
values for the non-specified channels to 0 is better than getting an
assert.
Change-Id: I8a1f14229c056d50effacfc82eaee977d40ccb3e
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qt3dsexplorer/manualpresentationtest.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/qt3dsexplorer/manualpresentationtest.cpp b/tools/qt3dsexplorer/manualpresentationtest.cpp index 15124ab..0fc26be 100644 --- a/tools/qt3dsexplorer/manualpresentationtest.cpp +++ b/tools/qt3dsexplorer/manualpresentationtest.cpp @@ -90,13 +90,16 @@ QVector<Q3DSUipPresentation *> ManualPresentationTest::build() Q3DSAnimationTrack anim(Q3DSAnimationTrack::Linear, model1, QLatin1String("rotation.z")); anim.setKeyFrames({ { 0, 0 }, { 10, 360 } }); slide1->addAnimation(anim); - // there's a catch: channels must be fully specified, so add dummies for x and y - Q3DSAnimationTrack dummyX(Q3DSAnimationTrack::Linear, model1, QLatin1String("rotation.x")); - dummyX.setKeyFrames({ { 0, 30 }, { 10, 30 } }); - slide1->addAnimation(dummyX); - Q3DSAnimationTrack dummyY(Q3DSAnimationTrack::Linear, model1, QLatin1String("rotation.y")); - dummyY.setKeyFrames({ { 0, 40 }, { 10, 40 } }); - slide1->addAnimation(dummyY); + + // There's a catch: if a channel (rotation in thise case) is not fully + // specified, the unspecified channels (x and y here) will get dummy keyframes + // with value 0. Rather, let's rotate a bit around X and Y as well. + Q3DSAnimationTrack animX(Q3DSAnimationTrack::Linear, model1, QLatin1String("rotation.x")); + animX.setKeyFrames({ { 0, 30 } }); + slide1->addAnimation(animX); + Q3DSAnimationTrack animY(Q3DSAnimationTrack::Linear, model1, QLatin1String("rotation.y")); + animY.setKeyFrames({ { 0, 40 } }); + slide1->addAnimation(animY); // done, this is a full presentation with a layer, camera, a light and a cube |