From: Adeel Kazmi Date: Fri, 29 Sep 2017 10:04:24 +0000 (+0100) Subject: Moved some Animation Devel APIs to the Public API X-Git-Tag: dali_1.2.60~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec5b656de57a8a0606fd1624e3ed7ae1582523ee;p=platform%2Fcore%2Fuifw%2Fdali-core.git Moved some Animation Devel APIs to the Public API Change-Id: I00b44927867a3328d4fb59d7221c584eb3e453c6 --- diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index 9c2f9be..3327cb7 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -11375,7 +11375,7 @@ int UtcDaliAnimationPlayAfterP(void) animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); // Play animation after the initial delay time - DevelAnimation::PlayAfter( animation, 0.2f ); + animation.PlayAfter( 0.2f ); application.SendNotification(); application.Render(0); // start animation @@ -11435,7 +11435,7 @@ int UtcDaliAnimationPlayAfterP2(void) animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); // Play animation after the initial delay time - DevelAnimation::PlayAfter( animation, 0.2f ); + animation.PlayAfter( 0.2f ); application.SendNotification(); application.Render(0); // start animation @@ -11505,7 +11505,7 @@ int UtcDaliAnimationPlayAfterP3(void) animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) ); // When the delay time is negative value, it would treat as play immediately. - DevelAnimation::PlayAfter( animation, -2.0f ); + animation.PlayAfter( -2.0f ); application.SendNotification(); application.Render(0); // start animation @@ -11550,7 +11550,7 @@ int UtcDaliAnimationSetLoopingModeP(void) float durationSeconds( 1.0f ); Animation animation = Animation::New( durationSeconds ); - DALI_TEST_CHECK( DevelAnimation::GetLoopingMode( animation ) == DevelAnimation::RESTART ); + DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART ); Vector3 targetPosition(10.0f, 10.0f, 10.0f); animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); @@ -11584,8 +11584,8 @@ int UtcDaliAnimationSetLoopingModeP(void) Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); - DevelAnimation::SetLoopingMode( animation, DevelAnimation::LoopingMode::AUTO_REVERSE ); - DALI_TEST_CHECK( DevelAnimation::GetLoopingMode( animation ) == DevelAnimation::AUTO_REVERSE ); + animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE ); + DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); // Start the animation animation.Play(); @@ -11641,8 +11641,8 @@ int UtcDaliAnimationSetLoopingModeP(void) Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); - DevelAnimation::SetLoopingMode( animation, DevelAnimation::LoopingMode::AUTO_REVERSE ); - DALI_TEST_CHECK( DevelAnimation::GetLoopingMode( animation ) == DevelAnimation::AUTO_REVERSE ); + animation.SetLoopingMode( Animation::AUTO_REVERSE ); + DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); // Start the animation animation.Play(); @@ -11706,8 +11706,8 @@ int UtcDaliAnimationSetLoopingModeP2(void) Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); - DevelAnimation::SetLoopingMode( animation, DevelAnimation::LoopingMode::AUTO_REVERSE ); - DALI_TEST_CHECK( DevelAnimation::GetLoopingMode( animation ) == DevelAnimation::AUTO_REVERSE ); + animation.SetLoopingMode( Animation::AUTO_REVERSE ); + DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); // Start the animation animation.Play(); @@ -11771,8 +11771,8 @@ int UtcDaliAnimationSetLoopingModeP2(void) Vector3 targetPosition(100.0f, 100.0f, 100.0f); animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition ); - DevelAnimation::SetLoopingMode( animation, DevelAnimation::LoopingMode::AUTO_REVERSE ); - DALI_TEST_CHECK( DevelAnimation::GetLoopingMode( animation ) == DevelAnimation::AUTO_REVERSE ); + animation.SetLoopingMode( Animation::AUTO_REVERSE ); + DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); // Start the animation animation.Play(); @@ -11826,10 +11826,10 @@ int UtcDaliAnimationGetLoopingModeP(void) Animation animation = Animation::New(1.0f); // default mode - DALI_TEST_CHECK( DevelAnimation::GetLoopingMode( animation ) == DevelAnimation::RESTART ); + DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART ); - DevelAnimation::SetLoopingMode( animation, DevelAnimation::LoopingMode::AUTO_REVERSE ); - DALI_TEST_CHECK( DevelAnimation::GetLoopingMode( animation ) == DevelAnimation::AUTO_REVERSE ); + animation.SetLoopingMode( Animation::AUTO_REVERSE ); + DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE ); END_TEST; } diff --git a/dali/devel-api/animation/animation-devel.cpp b/dali/devel-api/animation/animation-devel.cpp index 79ebbb3..0840ae7 100644 --- a/dali/devel-api/animation/animation-devel.cpp +++ b/dali/devel-api/animation/animation-devel.cpp @@ -40,21 +40,6 @@ Animation::AnimationSignalType& ProgressReachedSignal( Animation animation ) return GetImplementation( animation ).ProgressReachedSignal(); } -void PlayAfter( Animation animation, float delaySeconds ) -{ - GetImplementation( animation ).PlayAfter( delaySeconds ); -} - -void SetLoopingMode( Animation animation, LoopingMode loopingMode ) -{ - GetImplementation( animation ).SetLoopingMode( loopingMode ); -} - -LoopingMode GetLoopingMode( Animation animation ) -{ - return GetImplementation(animation).GetLoopingMode(); -} - } // namespace DevelAnimation } // namespace Dali diff --git a/dali/devel-api/animation/animation-devel.h b/dali/devel-api/animation/animation-devel.h index 209b4b0..b106f6f 100644 --- a/dali/devel-api/animation/animation-devel.h +++ b/dali/devel-api/animation/animation-devel.h @@ -28,15 +28,6 @@ namespace DevelAnimation { /** - * @brief Enumeration for what looping mode is in. - */ -enum LoopingMode -{ - RESTART, ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning. - AUTO_REVERSE ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again. -}; - -/** * @brief Set progress percentage marker to trigger ProgressHasBeenReachedSignal * * @param[in] animation the animation object to perform this operation on @@ -60,33 +51,6 @@ DALI_IMPORT_API float GetProgressNotification( Animation animation ); */ DALI_IMPORT_API Animation::AnimationSignalType& ProgressReachedSignal( Animation animation ); -/** - * @brief Play the animation after a given delay time. - * - * The delay time is not included in the looping time. - * When the delay time is negative value, it would treat as play immediately. - * @param[in] animation The animation object to perform this operation on - * @param[in] delaySeconds The delay time - */ -DALI_IMPORT_API void PlayAfter( Animation animation, float delaySeconds ); - -/** - * @brief Sets the looping mode. - * - * Animation plays forwards and then restarts from the beginning or runs backwards again. - * @param[in] animation The animation object to perform this operation on - * @param[in] loopingMode The looping mode is one of RESTART and AUTO_REVERSE - */ -DALI_IMPORT_API void SetLoopingMode( Animation animation, LoopingMode loopingMode ); - -/** - * @brief Gets one of the current looping mode. - * - * @param[in] animation The animation object to perform this operation on - * @return The current looping mode - */ -DALI_IMPORT_API LoopingMode GetLoopingMode( Animation animation ); - } // namespace DevelAnimation } // namespace Dali diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index 7290bb3..876c7e6 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -1024,17 +1024,17 @@ Vector2 Animation::GetPlayRange() const return mPlayRange; } -void Animation::SetLoopingMode( DevelAnimation::LoopingMode loopingMode ) +void Animation::SetLoopingMode( Dali::Animation::LoopingMode loopingMode ) { - mAutoReverseEnabled = ( loopingMode == DevelAnimation::LoopingMode::AUTO_REVERSE ); + mAutoReverseEnabled = ( loopingMode == Dali::Animation::LoopingMode::AUTO_REVERSE ); // mAnimation is being used in a separate thread; queue a message to set play range SetLoopingModeMessage( mEventThreadServices, *mAnimation, mAutoReverseEnabled ); } -DevelAnimation::LoopingMode Animation::GetLoopingMode() +Dali::Animation::LoopingMode Animation::GetLoopingMode() const { - return mAutoReverseEnabled ? DevelAnimation::LoopingMode::AUTO_REVERSE : DevelAnimation::LoopingMode::RESTART; + return mAutoReverseEnabled ? Dali::Animation::AUTO_REVERSE : Dali::Animation::RESTART; } bool Animation::CompareConnectorEndTimes( const Animation::ConnectorTargetValues& lhs, const Animation::ConnectorTargetValues& rhs ) diff --git a/dali/internal/event/animation/animation-impl.h b/dali/internal/event/animation/animation-impl.h index 760ef02..ad61dba 100644 --- a/dali/internal/event/animation/animation-impl.h +++ b/dali/internal/event/animation/animation-impl.h @@ -398,12 +398,12 @@ public: /** * @copydoc Dali::Animation::SetLoopingMode() */ - void SetLoopingMode( Dali::DevelAnimation::LoopingMode loopingMode ); + void SetLoopingMode( Dali::Animation::LoopingMode loopingMode ); /** * @copydoc Dali::Animation::GetLoopingMode() */ - Dali::DevelAnimation::LoopingMode GetLoopingMode(); + Dali::Animation::LoopingMode GetLoopingMode() const; public: // For connecting animators to animations diff --git a/dali/public-api/animation/animation.cpp b/dali/public-api/animation/animation.cpp index 0e14bdb..980223d 100644 --- a/dali/public-api/animation/animation.cpp +++ b/dali/public-api/animation/animation.cpp @@ -139,6 +139,10 @@ void Animation::PlayFrom(float progress) GetImplementation(*this).PlayFrom(progress); } +void Animation::PlayAfter( float delaySeconds ) +{ + GetImplementation( *this ).PlayAfter( delaySeconds ); +} void Animation::Pause() { @@ -160,6 +164,16 @@ void Animation::Clear() GetImplementation(*this).Clear(); } +void Animation::SetLoopingMode( LoopingMode loopingMode ) +{ + GetImplementation( *this ).SetLoopingMode( loopingMode ); +} + +Animation::LoopingMode Animation::GetLoopingMode() const +{ + return GetImplementation( *this ).GetLoopingMode(); +} + Animation::AnimationSignalType& Animation::FinishedSignal() { return GetImplementation(*this).FinishedSignal(); diff --git a/dali/public-api/animation/animation.h b/dali/public-api/animation/animation.h index c73e2b0..715c8ea 100644 --- a/dali/public-api/animation/animation.h +++ b/dali/public-api/animation/animation.h @@ -1,5 +1,5 @@ -#ifndef __DALI_ANIMATION_H__ -#define __DALI_ANIMATION_H__ +#ifndef DALI_ANIMATION_H +#define DALI_ANIMATION_H /* * Copyright (c) 2017 Samsung Electronics Co., Ltd. @@ -161,6 +161,17 @@ public: }; /** + * @brief Enumeration for what looping mode is in. + * + * @SINCE_1_2.60 + */ + enum LoopingMode + { + RESTART, ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning. @SINCE_1_2.60 + AUTO_REVERSE ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again. @SINCE_1_2.60 + }; + + /** * @brief Creates an uninitialized Animation; this can be initialized with Animation::New(). * * Calling member functions with an uninitialized Animation handle is not allowed. @@ -419,6 +430,16 @@ public: void PlayFrom( float progress ); /** + * @brief Play the animation after a given delay time. + * + * The delay time is not included in the looping time. + * When the delay time is negative value, it would treat as play immediately. + * @SINCE_1_2.60 + * @param[in] delaySeconds The delay time + */ + void PlayAfter( float delaySeconds ); + + /** * @brief Pauses the animation. * @SINCE_1_0.0 */ @@ -446,6 +467,23 @@ public: void Clear(); /** + * @brief Sets the looping mode. + * + * Animation plays forwards and then restarts from the beginning or runs backwards again. + * @SINCE_1_2.60 + * @param[in] loopingMode The looping mode is one of RESTART and AUTO_REVERSE + */ + void SetLoopingMode( LoopingMode loopingMode ); + + /** + * @brief Gets one of the current looping mode. + * + * @SINCE_1_2.60 + * @return The current looping mode + */ + LoopingMode GetLoopingMode() const; + + /** * @brief Connects to this signal to be notified when an Animation's animations have finished. * * @SINCE_1_0.0 @@ -720,4 +758,4 @@ public: // Not intended for use by Application developers */ } // namespace Dali -#endif // __DALI_ANIMATION_H__ +#endif // DALI_ANIMATION_H