From 0562086b4d28acd046b31012e070107680467795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Wed, 6 Jun 2018 12:50:36 +0200 Subject: 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 --- src/runtime/q3dsslideplayer.cpp | 9 ++++++--- 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()->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, -- cgit v1.2.3