X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fanimation%2Fanimation-impl.cpp;h=c27f31b3740b3aae0db2b0f82bc2a92c21da96ce;hb=641ea9391fdfc25a6836ffaa86b5c74e2a1f425c;hp=ec1a6ca4104ebf95f06fb34892286c11a76efafb;hpb=845ea811bca7bd0fd32b94eb8c50bd6b4ebd176d;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index ec1a6ca..c27f31b 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,20 +22,19 @@ // EXTERNAL INCLUDES // INTERNAL INCLUDES -#include #include #include #include #include #include #include -#include #include #include #include #include #include #include +#include #include using Dali::Internal::SceneGraph::UpdateManager; @@ -266,6 +265,39 @@ void Animation::Play() mState = Dali::Animation::PLAYING; + if( mEndAction != EndAction::Discard ) // If the animation is discarded, then we do not want to change the target values + { + unsigned int connectorTargetValuesIndex( 0 ); + unsigned int numberOfConnectorTargetValues = mConnectorTargetValues.size(); + + /* + * Loop through all Animator connectors, if connector index matches the current index stored in mConnectorTargetValues container then + * should apply target values for this index to the object. + */ + for ( unsigned int connectorIndex = 0; connectorIndex < mConnectors.Count(); connectorIndex ++) + { + // Use index to check if the current connector is next in the mConnectorTargetValues container, meaning targetValues have been pushed in AnimateXXFunction + if ( connectorTargetValuesIndex < numberOfConnectorTargetValues ) + { + ConnectorTargetValues& connectorPair = mConnectorTargetValues[ connectorTargetValuesIndex ]; + + if ( connectorPair.connectorIndex == connectorIndex ) + { + // Current connector index matches next in the stored connectors with target values so apply target value. + connectorTargetValuesIndex++; // Found a match for connector so increment index to next one + + AnimatorConnectorBase* connector = mConnectors[ connectorIndex ]; + + Object* object = connector->GetObject(); + if( object ) + { + object->NotifyPropertyAnimation( *this, connector->GetPropertyIndex(), connectorPair.targetValue ); + } + } + } + } + } + // mAnimation is being used in a separate thread; queue a Play message PlayAnimationMessage( mEventThreadServices, *mAnimation ); } @@ -312,6 +344,9 @@ void Animation::Clear() // Remove all the connectors mConnectors.Clear(); + // Reset the connector target values + mConnectorTargetValues.clear(); + // Replace the old scene-object with a new one DestroySceneObject(); CreateSceneObject(); @@ -474,6 +509,12 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn ExtendDuration( period ); + // Store data to later notify the object that its property is being animated + ConnectorTargetValues connectorPair; + connectorPair.targetValue = destinationValue; + connectorPair.connectorIndex = mConnectors.Count(); + mConnectorTargetValues.push_back( connectorPair ); + switch ( destinationType ) { case Property::BOOLEAN: @@ -500,31 +541,6 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn case Property::FLOAT: { - 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 ); - if ( maybeActor ) - { - // Notify the actor that its size is being animated - 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, @@ -547,27 +563,6 @@ void Animation::AnimateTo(Object& targetObject, Property::Index targetPropertyIn case Property::VECTOR3: { - if ( Dali::Actor::Property::SIZE == targetPropertyIndex ) - { - // Test whether this is actually an Actor - Actor* maybeActor = dynamic_cast( &targetObject ); - if ( maybeActor ) - { - // Notify the actor that its size is being animated - 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, componentIndex,