diff options
author | Christian Strømme <christian.stromme@qt.io> | 2018-06-06 12:50:36 +0200 |
---|---|---|
committer | Christian Stromme <christian.stromme@qt.io> | 2018-06-06 11:06:05 +0000 |
commit | 0562086b4d28acd046b31012e070107680467795 (patch) | |
tree | 1d44806396646f6c0dd6d827a8f869305c92e8b6 | |
parent | 4a29723e1551fd59f46457a3baca7abd003f6e6a (diff) |
Fix visibility check for components
In the time update for component players we need to check if the
component is visible in parent.
Change-Id: I66d00e4f1cd0bdf56dbe8cd6e79068b2179a9cad
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | src/runtime/q3dsslideplayer.cpp | 9 | ||||
-rw-r--r-- | src/runtime/q3dsslideplayer_p.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/runtime/q3dsslideplayer.cpp b/src/runtime/q3dsslideplayer.cpp index a154292..6369f7b 100644 --- a/src/runtime/q3dsslideplayer.cpp +++ b/src/runtime/q3dsslideplayer.cpp @@ -801,12 +801,15 @@ static bool objectHasVisibilityTag(Q3DSGraphObject *object) return false; } -void Q3DSSlidePlayer::setSlideTime(Q3DSSlide *slide, float time, bool parentVisible) +void Q3DSSlidePlayer::setSlideTime(Q3DSSlide *slide, float time) { + // If this is a component player, then check if the component is visible in the parent. + const bool visibleInParent = (m_type == Q3DSSlidePlayer::PlayerType::ComponentSlide) ? (m_component->attached()->visibilityTag == Q3DSGraphObjectAttached::Visible) + : true; // We force an update if we are at the beginning (0.0f) or the end (-1.0f) // to ensure the scenemanager has correct global values for visibility during // slide changes - const bool forceUpdate = parentVisible && + const bool forceUpdate = visibleInParent && (qFuzzyCompare(time, 0.0f) || qFuzzyCompare(time, -1.0f)); const auto updateObjects = [=](Q3DSSlide *s) { if (!s) @@ -828,7 +831,7 @@ void Q3DSSlidePlayer::setSlideTime(Q3DSSlide *slide, float time, bool parentVisi const bool nodeActive = (node && node->flags().testFlag(Q3DSNode::Active) && node->attached<Q3DSNodeAttached>()->globalVisibility); const bool otherActive = !node && (obj->attached()->visibilityTag == Q3DSGraphObjectAttached::Visible); - const bool shouldBeVisible = parentVisible + const bool shouldBeVisible = visibleInParent && time >= obj->startTime() && time <= obj->endTime() && (nodeActive || otherActive); diff --git a/src/runtime/q3dsslideplayer_p.h b/src/runtime/q3dsslideplayer_p.h index 1a7e29d..41a8c3f 100644 --- a/src/runtime/q3dsslideplayer_p.h +++ b/src/runtime/q3dsslideplayer_p.h @@ -136,7 +136,7 @@ private: void setInternalState(PlayerState state); void onDurationChanged(float duration); void onSlideFinished(Q3DSSlide *slide); - void setSlideTime(Q3DSSlide *slide, float time, bool parentVisible = true); + void setSlideTime(Q3DSSlide *slide, float time); void handleCurrentSlideChanged(Q3DSSlide *slide, Q3DSSlide *previousSlide, |