Ensure cached values of properties animated using AnimateTo are updated
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.cpp
index 6ca8901..8df598e 100644 (file)
@@ -1056,19 +1056,7 @@ Matrix Actor::GetCurrentWorldMatrix() const
 
 void Actor::SetVisible( bool visible )
 {
-  if( mVisible != visible )
-  {
-    if( NULL != mNode )
-    {
-      // mNode is being used in a separate thread; queue a message to set the value & base value
-      SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), mNode, &mNode->mVisible, &AnimatableProperty<bool>::Bake, visible );
-    }
-
-    mVisible = visible;
-
-    // Emit the signal on this actor and all its children
-    EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF );
-  }
+  SetVisibleInternal( visible, SendMessage::TRUE );
 }
 
 bool Actor::IsVisible() const
@@ -1290,53 +1278,6 @@ void Actor::SetSizeInternal( const Vector3& size )
   }
 }
 
-void Actor::NotifySizeAnimation( Animation& animation, const Vector3& targetSize )
-{
-  mTargetSize = targetSize;
-
-  // Notify deriving classes
-  OnSizeAnimation( animation, mTargetSize );
-}
-
-void Actor::NotifySizeAnimation( Animation& animation, float targetSize, Property::Index property )
-{
-  if ( Dali::Actor::Property::SIZE_WIDTH == property )
-  {
-    mTargetSize.width = targetSize;
-  }
-  else if ( Dali::Actor::Property::SIZE_HEIGHT == property )
-  {
-    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( IsRelayoutEnabled() && !mRelayoutData->insideRelayout )
@@ -3301,6 +3242,149 @@ Property::Value Actor::GetDefaultPropertyCurrentValue( Property::Index index ) c
   return value;
 }
 
+void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
+{
+  switch( index )
+  {
+    case Dali::Actor::Property::SIZE:
+    {
+      if( value.Get( mTargetSize ) )
+      {
+        // Notify deriving classes
+        OnSizeAnimation( animation, mTargetSize );
+      }
+      break;
+    }
+
+    case Dali::Actor::Property::SIZE_WIDTH:
+    {
+      if( value.Get( mTargetSize.width ) )
+      {
+        // Notify deriving classes
+        OnSizeAnimation( animation, mTargetSize );
+      }
+      break;
+    }
+
+    case Dali::Actor::Property::SIZE_HEIGHT:
+    {
+      if( value.Get( mTargetSize.height ) )
+      {
+        // Notify deriving classes
+        OnSizeAnimation( animation, mTargetSize );
+      }
+      break;
+    }
+
+    case Dali::Actor::Property::SIZE_DEPTH:
+    {
+      if( value.Get( mTargetSize.depth ) )
+      {
+        // Notify deriving classes
+        OnSizeAnimation( animation, mTargetSize );
+      }
+      break;
+    }
+
+    case Dali::Actor::Property::POSITION:
+    {
+      value.Get( mTargetPosition );
+      break;
+    }
+
+    case Dali::Actor::Property::POSITION_X:
+    {
+      value.Get( mTargetPosition.x );
+      break;
+    }
+
+    case Dali::Actor::Property::POSITION_Y:
+    {
+      value.Get( mTargetPosition.y );
+      break;
+    }
+
+    case Dali::Actor::Property::POSITION_Z:
+    {
+      value.Get( mTargetPosition.z );
+      break;
+    }
+
+    case Dali::Actor::Property::ORIENTATION:
+    {
+      value.Get( mTargetOrientation );
+      break;
+    }
+
+    case Dali::Actor::Property::SCALE:
+    {
+      value.Get( mTargetScale );
+      break;
+    }
+
+    case Dali::Actor::Property::SCALE_X:
+    {
+      value.Get( mTargetScale.x );
+      break;
+    }
+
+    case Dali::Actor::Property::SCALE_Y:
+    {
+      value.Get( mTargetScale.y );
+      break;
+    }
+
+    case Dali::Actor::Property::SCALE_Z:
+    {
+      value.Get( mTargetScale.z );
+      break;
+    }
+
+    case Dali::Actor::Property::VISIBLE:
+    {
+      SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE );
+      break;
+    }
+
+    case Dali::Actor::Property::COLOR:
+    {
+      value.Get( mTargetColor );
+      break;
+    }
+
+    case Dali::Actor::Property::COLOR_RED:
+    {
+      value.Get( mTargetColor.r );
+      break;
+    }
+
+    case Dali::Actor::Property::COLOR_GREEN:
+    {
+      value.Get( mTargetColor.g );
+      break;
+    }
+
+    case Dali::Actor::Property::COLOR_BLUE:
+    {
+      value.Get( mTargetColor.b );
+      break;
+    }
+
+    case Dali::Actor::Property::COLOR_ALPHA:
+    case Dali::DevelActor::Property::OPACITY:
+    {
+      value.Get( mTargetColor.a );
+      break;
+    }
+
+    default:
+    {
+      // Not an animatable property. Do nothing.
+      break;
+    }
+  }
+}
+
 const SceneGraph::PropertyOwner* Actor::GetPropertyOwner() const
 {
   return mNode;
@@ -4223,6 +4307,12 @@ bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& val
       break;
     }
 
+    case Dali::Actor::Property::VISIBLE:
+    {
+      value = IsVisible();
+      break;
+    }
+
     default:
     {
       // Must be an event-side only property
@@ -4979,6 +5069,23 @@ Object* Actor::GetParentObject() const
   return mParent;
 }
 
+void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage )
+{
+  if( mVisible != visible )
+  {
+    if( sendMessage == SendMessage::TRUE && NULL != mNode )
+    {
+      // mNode is being used in a separate thread; queue a message to set the value & base value
+      SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), mNode, &mNode->mVisible, &AnimatableProperty<bool>::Bake, visible );
+    }
+
+    mVisible = visible;
+
+    // Emit the signal on this actor and all its children
+    EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF );
+  }
+}
+
 void Actor::SetSiblingOrder( unsigned int order )
 {
   mSiblingOrder = std::min( order, static_cast<unsigned int>( DevelLayer::SIBLING_ORDER_MULTIPLIER ) );