summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2018-11-23 13:38:48 +0100
committerChristian Stromme <christian.stromme@qt.io>2018-11-26 11:35:08 +0000
commitf21784303bc4da85396bd87be0936911aa76331c (patch)
treedf1a91a325d79ce4002a103b43be743f05a1d160 /src
parent5f8f448e0304e5637fe7f2b64c05c93b3aa48410 (diff)
Fix dynamic keyframes
Don't generate dynamic kf on first entry to a slide, since there are no "from" values yet. Task-number: QT3DS-2209 Change-Id: Ib4e59968d9099b77ea6d11f1b627b77cad194a23 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/q3dsanimationmanager.cpp9
-rw-r--r--src/runtime/q3dsanimationmanager_p.h4
-rw-r--r--src/runtime/q3dsslideplayer.cpp2
3 files changed, 8 insertions, 7 deletions
diff --git a/src/runtime/q3dsanimationmanager.cpp b/src/runtime/q3dsanimationmanager.cpp
index 51a6c73..cdb6e5e 100644
--- a/src/runtime/q3dsanimationmanager.cpp
+++ b/src/runtime/q3dsanimationmanager.cpp
@@ -121,7 +121,8 @@ static int componentSuffixToIndex(const QString &s)
void Q3DSAnimationManager::updateAnimationHelper(const AnimationTrackListMap &targets,
Q3DSSlide *slide,
- bool editorMode)
+ bool editorMode,
+ bool updateDkf)
{
// QT3DS-2183: We'll use this to set dummy kf at the start and end of the clip.
// See code further down.
@@ -339,7 +340,7 @@ void Q3DSAnimationManager::updateAnimationHelper(const AnimationTrackListMap &ta
const bool isDynamic = animationTrack->isDynamic() && !editorMode;
// If track is marked as dynamic, update the first keyframe so it interpolates from
// the current position to the next.
- if (isDynamic)
+ if (isDynamic && updateDkf)
updateDynamicKeyFrame(keyFrames[0], target, prop);
// QT3DS-2183 - We add keyframes at the start and at the end of the clip
@@ -509,7 +510,7 @@ static void insertTrack(Q3DSAnimationManager::AnimationTrackList &trackList,
}
}
-void Q3DSAnimationManager::updateAnimations(Q3DSSlide *slide, bool editorMode)
+void Q3DSAnimationManager::updateAnimations(Q3DSSlide *slide, bool editorMode, bool updateDynamicKfs)
{
Q_ASSERT(slide);
@@ -544,7 +545,7 @@ void Q3DSAnimationManager::updateAnimations(Q3DSSlide *slide, bool editorMode)
buildTrackListMap(masterSlide, false);
buildTrackListMap(slide, true);
- updateAnimationHelper(trackListMap, slide, editorMode);
+ updateAnimationHelper(trackListMap, slide, editorMode, updateDynamicKfs);
}
void Q3DSAnimationManager::applyChanges()
diff --git a/src/runtime/q3dsanimationmanager_p.h b/src/runtime/q3dsanimationmanager_p.h
index 7c22489..ab6363b 100644
--- a/src/runtime/q3dsanimationmanager_p.h
+++ b/src/runtime/q3dsanimationmanager_p.h
@@ -56,7 +56,7 @@ public:
using AnimationTrackList = QVector<const Q3DSAnimationTrack *>;
using AnimationTrackListMap = QHash<Q3DSGraphObject *, AnimationTrackList>;
- void updateAnimations(Q3DSSlide *slide, bool editorMode = false);
+ void updateAnimations(Q3DSSlide *slide, bool editorMode = false, bool updateDynamicKfs = true);
void clearAnimations(Q3DSSlide *slide);
void applyChanges();
void clearPendingChanges();
@@ -69,7 +69,7 @@ public:
private:
void updateAnimationHelper(const AnimationTrackListMap &targets,
Q3DSSlide *slide,
- bool editorMode);
+ bool editorMode, bool updateDkf);
void buildClipAnimator(Q3DSSlide *slide);
diff --git a/src/runtime/q3dsslideplayer.cpp b/src/runtime/q3dsslideplayer.cpp
index 3dfd2d0..2b4819c 100644
--- a/src/runtime/q3dsslideplayer.cpp
+++ b/src/runtime/q3dsslideplayer.cpp
@@ -767,7 +767,7 @@ void Q3DSSlidePlayer::handleCurrentSlideChanged(Q3DSSlide *slide,
setSlideTime(slide, 0.0f, true);
processPropertyChanges(slide, previousSlide);
attatchPositionCallback(slide);
- m_animationManager->updateAnimations(slide, (m_mode == PlayerMode::Editor));
+ m_animationManager->updateAnimations(slide, (m_mode == PlayerMode::Editor), !forceUpdate);
Q3DSGraphObject *eventTarget = m_sceneManager->m_scene;
if (m_type != PlayerType::Scene)