From: Richard Huang Date: Thu, 10 Dec 2015 16:18:31 +0000 (+0000) Subject: Return target size and position while retrieving default actor property value X-Git-Tag: dali_1.1.15~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F54001%2F6;p=platform%2Fcore%2Fuifw%2Fdali-core.git Return target size and position while retrieving default actor property value Change-Id: Ib8c947ce956dac73f059274a7f47db67cb6b08d9 --- diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index 72caae2..e38d61b 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -5472,7 +5472,6 @@ int UtcDaliAnimationAnimateToActorSizeWidthP(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentSize().width, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_WIDTH), fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5517,7 +5516,6 @@ int UtcDaliAnimationAnimateToActorSizeHeightP(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentSize().height, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_HEIGHT), fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5562,7 +5560,6 @@ int UtcDaliAnimationAnimateToActorSizeDepthP(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentSize().depth, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE_DEPTH), fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5760,9 +5757,6 @@ int UtcDaliAnimationAnimateToActorPositionXP(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition().x, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5811,9 +5805,6 @@ int UtcDaliAnimationAnimateToActorPositionYP(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition().y, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), startValue, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); @@ -5862,9 +5853,6 @@ int UtcDaliAnimationAnimateToActorPositionZP(void) application.SendNotification(); finishCheck.CheckSignalNotReceived(); DALI_TEST_EQUALS( actor.GetCurrentPosition().z, fiftyPercentProgress, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_X), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Y), startValue, TEST_LOCATION ); - DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::POSITION_Z), fiftyPercentProgress, TEST_LOCATION ); application.SendNotification(); application.Render(static_cast(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/); diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 614c6e4..244508b 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1143,10 +1143,35 @@ void Actor::NotifySizeAnimation( Animation& animation, float targetSize, Propert { mTargetSize.height = targetSize; } + else if ( Dali::Actor::Property::SIZE_DEPTH == property ) + { + mTargetSize.depth = targetSize; + } // Notify deriving classes OnSizeAnimation( animation, mTargetSize ); } +void Actor::NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition ) +{ + mTargetPosition = targetPosition; +} + +void Actor::NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property ) +{ + if ( Dali::Actor::Property::POSITION_X == property ) + { + mTargetPosition.x = targetPosition; + } + else if ( Dali::Actor::Property::POSITION_Y == property ) + { + mTargetPosition.y = targetPosition; + } + else if ( Dali::Actor::Property::POSITION_Z == property ) + { + mTargetPosition.z = targetPosition; + } +} + void Actor::SetWidth( float width ) { if( NULL != mNode ) @@ -2754,49 +2779,49 @@ Property::Value Actor::GetDefaultProperty( Property::Index index ) const case Dali::Actor::Property::SIZE: { - value = GetCurrentSize(); + value = GetTargetSize(); break; } case Dali::Actor::Property::SIZE_WIDTH: { - value = GetCurrentSize().width; + value = GetTargetSize().width; break; } case Dali::Actor::Property::SIZE_HEIGHT: { - value = GetCurrentSize().height; + value = GetTargetSize().height; break; } case Dali::Actor::Property::SIZE_DEPTH: { - value = GetCurrentSize().depth; + value = GetTargetSize().depth; break; } case Dali::Actor::Property::POSITION: { - value = GetCurrentPosition(); + value = GetTargetPosition(); break; } case Dali::Actor::Property::POSITION_X: { - value = GetCurrentPosition().x; + value = GetTargetPosition().x; break; } case Dali::Actor::Property::POSITION_Y: { - value = GetCurrentPosition().y; + value = GetTargetPosition().y; break; } case Dali::Actor::Property::POSITION_Z: { - value = GetCurrentPosition().z; + value = GetTargetPosition().z; break; } diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index 9e78b79..362b0b5 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -1454,10 +1454,11 @@ public: void NotifySizeAnimation( Animation& animation, const Vector3& targetSize ); /** - * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT property is animated. + * This should only be called by Animation, when the actors SIZE_WIDTH or SIZE_HEIGHT or SIZE_DEPTH property is animated. * * @param[in] animation The animation that resized the actor * @param[in] targetSize The new target size of the actor + * @param[in] property The index of the property being animated */ void NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property ); @@ -1469,6 +1470,23 @@ public: { } + /** + * This should only be called by Animation, when the actors POSITION property is animated. + * + * @param[in] animation The animation that repositioned the actor + * @param[in] targetPosition The new target position of the actor + */ + void NotifyPositionAnimation( Animation& animation, const Vector3& targetPosition ); + + /** + * This should only be called by Animation, when the actors POSITION_X or POSITION_Y or POSITION_Z property is animated. + * + * @param[in] animation The animation that repositioned the actor + * @param[in] targetPosition The new target position of the actor + * @param[in] property The index of the property being animated + */ + void NotifyPositionAnimation( Animation& animation, float targetPosition, Property::Index property ); + protected: enum DerivedType diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index 0c92623..04e9ac9 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -467,8 +467,9 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn case Property::FLOAT: { - if ( ( Dali::Actor::Property::SIZE_WIDTH == targetPropertyIndex )|| - ( Dali::Actor::Property::SIZE_HEIGHT == targetPropertyIndex ) ) + if ( ( Dali::Actor::Property::SIZE_WIDTH == targetPropertyIndex ) || + ( Dali::Actor::Property::SIZE_HEIGHT == targetPropertyIndex ) || + ( Dali::Actor::Property::SIZE_DEPTH == targetPropertyIndex ) ) { // Test whether this is actually an Actor Actor* maybeActor = dynamic_cast( &targetObject ); @@ -478,6 +479,19 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn maybeActor->NotifySizeAnimation( *this, destinationValue.Get(), targetPropertyIndex ); } } + else if ( ( Dali::Actor::Property::POSITION_X == targetPropertyIndex ) || + ( Dali::Actor::Property::POSITION_Y == targetPropertyIndex ) || + ( Dali::Actor::Property::POSITION_Z == targetPropertyIndex ) ) + { + // Test whether this is actually an Actor + Actor* maybeActor = dynamic_cast( &targetObject ); + if ( maybeActor ) + { + // Notify the actor that its position is being animated + maybeActor->NotifyPositionAnimation( *this, destinationValue.Get(), targetPropertyIndex ); + } + } + AddAnimatorConnector( AnimatorConnector::New( targetObject, targetPropertyIndex, componentIndex, @@ -510,6 +524,16 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn maybeActor->NotifySizeAnimation( *this, destinationValue.Get() ); } } + else if ( Dali::Actor::Property::POSITION == targetPropertyIndex ) + { + // Test whether this is actually an Actor + Actor* maybeActor = dynamic_cast( &targetObject ); + if ( maybeActor ) + { + // Notify the actor that its position is being animated + maybeActor->NotifyPositionAnimation( *this, destinationValue.Get() ); + } + } AddAnimatorConnector( AnimatorConnector::New( targetObject, targetPropertyIndex,