summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsanimationmanager.cpp
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@qt.io>2018-03-19 10:34:05 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-03-26 14:40:48 +0000
commit542c35465834eecc8545e3d2eb8431e9b191c95f (patch)
tree6abe862532383e8099c6db13fcbc450bd6899cc4 /src/runtime/q3dsanimationmanager.cpp
parent4aae8652041f122e1d8871c5e45e01868496cc11 (diff)
Support using Alias Nodes
Alias nodes are weird, and end just just being copies in practice. Anytime there is a Alias node in the scene, a copy of the referenced node's sub-tree is copied and instanced. This is recreating the behavior in runtime 1.x, but is also not so useful because changes to the original reference at runtime are not reflected by these references. There is also some unusual behavior when it comes to the states defined by the slide graph, because it is hard to define which states should be used by the new instances. This commit tries to recreate the behavior of runtime 1.x, however this is difficult because there is significant differences between how things look in the editor vs the runtime for 1.x already. Change-Id: I37446da8d0710ac43e9db2516f9c540201a51c5f Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/runtime/q3dsanimationmanager.cpp')
-rw-r--r--src/runtime/q3dsanimationmanager.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/runtime/q3dsanimationmanager.cpp b/src/runtime/q3dsanimationmanager.cpp
index 531c745..2fc0193 100644
--- a/src/runtime/q3dsanimationmanager.cpp
+++ b/src/runtime/q3dsanimationmanager.cpp
@@ -673,6 +673,7 @@ void Q3DSAnimationManager::updateAnimations(Q3DSSlide *slide)
AnimationTrackListMap<Q3DSTextNode *> textAnims;
AnimationTrackListMap<Q3DSImage *> imageAnims;
AnimationTrackListMap<Q3DSLayerNode *> layerAnims;
+ AnimationTrackListMap<Q3DSAliasNode *> aliasAnims;
const auto buildTrackListMap = [&](Q3DSSlide *slide, bool overwrite) {
if (!slide)
@@ -748,6 +749,12 @@ void Q3DSAnimationManager::updateAnimations(Q3DSSlide *slide)
insertTrack(layerAnims[layer3DS], animTrack, overwrite);
}
break;
+ case Q3DSGraphObject::Alias:
+ {
+ Q3DSAliasNode *alias3DS = static_cast<Q3DSAliasNode *>(animTrack.target());
+ insertTrack(aliasAnims[alias3DS], animTrack, overwrite);
+ }
+ break;
default:
break;
}
@@ -759,9 +766,9 @@ void Q3DSAnimationManager::updateAnimations(Q3DSSlide *slide)
buildTrackListMap(masterSlide, false);
buildTrackListMap(slide, true);
- qCDebug(lcScene, "Slide %s has %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d animated objects", slide->id().constData(),
+ qCDebug(lcScene, "Slide %s has %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d animated objects", slide->id().constData(),
defMatAnims.count(), customMatAnims.count(), effectAnims.count(), camAnims.count(), lightAnims.count(), modelAnims.count(), groupAnims.count(),
- compAnims.count(), textAnims.count(), imageAnims.count(), layerAnims.count());
+ compAnims.count(), textAnims.count(), imageAnims.count(), layerAnims.count(), aliasAnims.count());
if (m_defaultMaterialAnimatables.isEmpty())
gatherAnimatableMeta(QLatin1String("Material"), &m_defaultMaterialAnimatables);
@@ -818,6 +825,13 @@ void Q3DSAnimationManager::updateAnimations(Q3DSSlide *slide)
updateAnimationHelper(layerAnims, &m_layerAnimatables, slide);
+ if (m_aliasAnimatables.isEmpty()) {
+ gatherAnimatableMeta(QLatin1String("Node"), &m_aliasAnimatables);
+ gatherAnimatableMeta(QLatin1String("Alias"), &m_aliasAnimatables);
+ }
+
+ updateAnimationHelper(aliasAnims, &m_aliasAnimatables, slide);
+
// custom materials and effects need special handling due to their dynamic properties
if (!customMatAnims.isEmpty()) {
AnimatableTab customMaterialAnimatables;