From 888c880c999ab505a3e67c5cc839bca9b72def49 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Wed, 17 May 2023 01:27:31 +0900 Subject: [PATCH] Set AnimatedVectorVisual play range by single marker Previously, we only accept when we insert array as PLAY_RANGE. Now let we allow to insert single stirng value. Change-Id: I3afbbf30cb5bdc211a06aeb0654c5359b28bc147 Signed-off-by: Eunki Hong --- .../utc-Dali-AnimatedVectorImageVisual.cpp | 26 ++++++++++++++++++++++ .../visuals/image-visual-properties-devel.h | 2 +- .../animated-vector-image-visual.cpp | 11 +++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp index 1c9daf7..92cc203 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp @@ -838,6 +838,7 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) ToolkitTestApplication application; tet_infoline("UtcDaliAnimatedVectorImageVisualPlayRangeMarker"); + // Set 1 marker as array Property::Array array; array.PushBack(VECTOR_ANIMATION_MARKER_NAME_1); @@ -884,6 +885,31 @@ int UtcDaliAnimatedVectorImageVisualPlayRangeMarker(void) DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION); DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_1, resultEndFrame, TEST_LOCATION); + // Set 1 marker as string + array.Clear(); + + attributes.Clear(); + attributes.Add(DevelImageVisual::Property::PLAY_RANGE, VECTOR_ANIMATION_MARKER_NAME_1); + DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelVisual::Action::UPDATE_PROPERTY, attributes); + + // To make event trigger + actor.SetProperty(Actor::Property::SIZE, Vector2(40.0f, 40.0f)); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION); + + map = actor.GetProperty(DummyControl::Property::TEST_VISUAL); + value = map.Find(DevelImageVisual::Property::PLAY_RANGE); + + result = value->GetArray(); + result->GetElementAt(0).Get(resultStartFrame); + result->GetElementAt(1).Get(resultEndFrame); + + DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_START_FRAME_1, resultStartFrame, TEST_LOCATION); + DALI_TEST_EQUALS(VECTOR_ANIMATION_MARKER_END_FRAME_1, resultEndFrame, TEST_LOCATION); + // Set 2 markers array.Clear(); array.PushBack(VECTOR_ANIMATION_MARKER_NAME_1); diff --git a/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h b/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h index 24cc113..9e6d199 100644 --- a/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h +++ b/dali-toolkit/devel-api/visuals/image-visual-properties-devel.h @@ -91,7 +91,7 @@ enum Type * Animation will play between the start frame and the end frame of the marker if one marker is specified. * Or animation will play between the start frame of the first marker and the end frame of the second marker if two markers are specified. * - * @details Name "playRange", Type Property::ARRAY of Property::INTEGER or Property::ARRAY of Property::STRING. + * @details Name "playRange", Type Property::ARRAY of Property::INTEGER or Property::ARRAY of Property::STRING or Property::STRING (one marker). * @note Default 0 and the total frame number. */ PLAY_RANGE = ORIENTATION_CORRECTION + 4, diff --git a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp index 1263fbd..5d987b9 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp @@ -294,6 +294,17 @@ void AnimatedVectorImageVisual::DoSetProperty(Property::Index index, const Prope mAnimationData.playRange = *array; mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_RANGE; } + else if(value.GetType() == Property::STRING) + { + std::string markerName; + if(value.Get(markerName)) + { + Property::Array array; + array.Add(markerName); + mAnimationData.playRange = std::move(array); + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_RANGE; + } + } break; } case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR: -- 2.7.4