+ return value;
+}
+
+void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
+{
+ switch( animationType )
+ {
+ case Animation::TO:
+ case Animation::BETWEEN:
+ {
+ 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;
+ }
+ }
+ break;
+ }
+
+ case Animation::BY:
+ {
+ switch( index )
+ {
+ case Dali::Actor::Property::SIZE:
+ {
+ if( AdjustValue< Vector3 >( mTargetSize, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_WIDTH:
+ {
+ if( AdjustValue< float >( mTargetSize.width, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ {
+ if( AdjustValue< float >( mTargetSize.height, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_DEPTH:
+ {
+ if( AdjustValue< float >( mTargetSize.depth, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION:
+ {
+ AdjustValue< Vector3 >( mTargetPosition, value );
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_X:
+ {
+ AdjustValue< float >( mTargetPosition.x, value );
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_Y:
+ {
+ AdjustValue< float >( mTargetPosition.y, value );
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_Z:
+ {
+ AdjustValue< float >( mTargetPosition.z, value );
+ break;
+ }
+
+ case Dali::Actor::Property::ORIENTATION:
+ {
+ Quaternion relativeValue;
+ if( value.Get( relativeValue ) )
+ {
+ mTargetOrientation *= relativeValue;
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE:
+ {
+ AdjustValue< Vector3 >( mTargetScale, value );
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_X:
+ {
+ AdjustValue< float >( mTargetScale.x, value );
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_Y:
+ {
+ AdjustValue< float >( mTargetScale.y, value );
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_Z:
+ {
+ AdjustValue< float >( mTargetScale.z, value );
+ break;
+ }
+
+ case Dali::Actor::Property::VISIBLE:
+ {
+ bool relativeValue = false;
+ if( value.Get( relativeValue ) )
+ {
+ bool visible = mVisible || relativeValue;
+ SetVisibleInternal( visible, SendMessage::FALSE );
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR:
+ {
+ AdjustValue< Vector4 >( mTargetColor, value );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_RED:
+ {
+ AdjustValue< float >( mTargetColor.r, value );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_GREEN:
+ {
+ AdjustValue< float >( mTargetColor.g, value );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_BLUE:
+ {
+ AdjustValue< float >( mTargetColor.b, value );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ {
+ AdjustValue< float >( mTargetColor.a, value );
+ break;
+ }
+
+ default:
+ {
+ // Not an animatable property. Do nothing.
+ break;
+ }
+ }
+ break;
+ }
+ }
+}
+
+const SceneGraph::PropertyOwner* Actor::GetPropertyOwner() const
+{
+ return mNode;
+}
+
+const SceneGraph::PropertyOwner* Actor::GetSceneObject() const
+{
+ // This method should only return an object connected to the scene-graph
+ return OnStage() ? mNode : NULL;
+}
+
+const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index index ) const
+{
+ DALI_ASSERT_ALWAYS( IsPropertyAnimatable( index ) && "Property is not animatable" );
+
+ const PropertyBase* property( NULL );
+
+ // This method should only return a property of an object connected to the scene-graph
+ if( !OnStage() )
+ {
+ return property;
+ }
+
+ if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
+ {
+ AnimatablePropertyMetadata* animatable = RegisterAnimatableProperty( index );
+ DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
+
+ property = animatable->GetSceneGraphProperty();
+ }
+ else if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
+ ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
+ {
+ CustomPropertyMetadata* custom = FindCustomProperty( index );
+ DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
+
+ property = custom->GetSceneGraphProperty();
+ }
+ else if( NULL != mNode )
+ {
+ switch( index )
+ {
+ case Dali::Actor::Property::SIZE:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::SIZE_WIDTH:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::SIZE_DEPTH:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::POSITION:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::POSITION_X:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::POSITION_Y:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::POSITION_Z:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::ORIENTATION:
+ property = &mNode->mOrientation;
+ break;
+
+ case Dali::Actor::Property::SCALE:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::SCALE_X:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::SCALE_Y:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::SCALE_Z:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::VISIBLE:
+ property = &mNode->mVisible;
+ break;
+
+ case Dali::Actor::Property::COLOR:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_RED:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_GREEN:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_BLUE:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ property = &mNode->mColor;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return property;
+}
+
+const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index index ) const
+{
+ const PropertyInputImpl* property( NULL );
+
+ // This method should only return a property of an object connected to the scene-graph
+ if( !OnStage() )
+ {
+ return property;
+ }
+
+ if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
+ {
+ AnimatablePropertyMetadata* animatable = RegisterAnimatableProperty( index );
+ DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
+
+ property = animatable->GetSceneGraphProperty();
+ }
+ else if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
+ ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
+ {
+ CustomPropertyMetadata* custom = FindCustomProperty( index );
+ DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
+ property = custom->GetSceneGraphProperty();
+ }
+ else if( NULL != mNode )
+ {
+ switch( index )
+ {
+ case Dali::Actor::Property::PARENT_ORIGIN:
+ property = &mNode->mParentOrigin;
+ break;
+
+ case Dali::Actor::Property::PARENT_ORIGIN_X:
+ property = &mNode->mParentOrigin;
+ break;
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Y:
+ property = &mNode->mParentOrigin;
+ break;
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Z:
+ property = &mNode->mParentOrigin;
+ break;
+
+ case Dali::Actor::Property::ANCHOR_POINT:
+ property = &mNode->mAnchorPoint;
+ break;
+
+ case Dali::Actor::Property::ANCHOR_POINT_X:
+ property = &mNode->mAnchorPoint;
+ break;
+
+ case Dali::Actor::Property::ANCHOR_POINT_Y:
+ property = &mNode->mAnchorPoint;
+ break;
+
+ case Dali::Actor::Property::ANCHOR_POINT_Z:
+ property = &mNode->mAnchorPoint;
+ break;
+
+ case Dali::Actor::Property::SIZE:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::SIZE_WIDTH:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::SIZE_DEPTH:
+ property = &mNode->mSize;
+ break;
+
+ case Dali::Actor::Property::POSITION:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::POSITION_X:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::POSITION_Y:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::POSITION_Z:
+ property = &mNode->mPosition;
+ break;
+
+ case Dali::Actor::Property::WORLD_POSITION:
+ property = &mNode->mWorldPosition;
+ break;
+
+ case Dali::Actor::Property::WORLD_POSITION_X:
+ property = &mNode->mWorldPosition;
+ break;
+
+ case Dali::Actor::Property::WORLD_POSITION_Y:
+ property = &mNode->mWorldPosition;
+ break;
+
+ case Dali::Actor::Property::WORLD_POSITION_Z:
+ property = &mNode->mWorldPosition;
+ break;
+
+ case Dali::Actor::Property::ORIENTATION:
+ property = &mNode->mOrientation;
+ break;
+
+ case Dali::Actor::Property::WORLD_ORIENTATION:
+ property = &mNode->mWorldOrientation;
+ break;
+
+ case Dali::Actor::Property::SCALE:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::SCALE_X:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::SCALE_Y:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::SCALE_Z:
+ property = &mNode->mScale;
+ break;
+
+ case Dali::Actor::Property::WORLD_SCALE:
+ property = &mNode->mWorldScale;
+ break;
+
+ case Dali::Actor::Property::VISIBLE:
+ property = &mNode->mVisible;
+ break;
+
+ case Dali::Actor::Property::COLOR:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_RED:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_GREEN:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_BLUE:
+ property = &mNode->mColor;
+ break;
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ {
+ property = &mNode->mColor;
+ break;
+ }
+
+ case Dali::Actor::Property::WORLD_COLOR:
+ property = &mNode->mWorldColor;
+ break;
+
+ case Dali::Actor::Property::WORLD_MATRIX:
+ property = &mNode->mWorldMatrix;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return property;
+}
+
+int Actor::GetPropertyComponentIndex( Property::Index index ) const
+{
+ int componentIndex( Property::INVALID_COMPONENT_INDEX );
+
+ if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
+ {
+ // check whether the animatable property is registered already, if not then register one.
+ AnimatablePropertyMetadata* animatableProperty = RegisterAnimatableProperty(index);
+ if( animatableProperty )
+ {
+ componentIndex = animatableProperty->componentIndex;
+ }
+ }
+ else
+ {
+ switch( index )
+ {
+ case Dali::Actor::Property::PARENT_ORIGIN_X:
+ case Dali::Actor::Property::ANCHOR_POINT_X:
+ case Dali::Actor::Property::SIZE_WIDTH:
+ case Dali::Actor::Property::POSITION_X:
+ case Dali::Actor::Property::WORLD_POSITION_X:
+ case Dali::Actor::Property::SCALE_X:
+ case Dali::Actor::Property::COLOR_RED:
+ {
+ componentIndex = 0;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Y:
+ case Dali::Actor::Property::ANCHOR_POINT_Y:
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ case Dali::Actor::Property::POSITION_Y:
+ case Dali::Actor::Property::WORLD_POSITION_Y:
+ case Dali::Actor::Property::SCALE_Y:
+ case Dali::Actor::Property::COLOR_GREEN:
+ {
+ componentIndex = 1;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Z:
+ case Dali::Actor::Property::ANCHOR_POINT_Z:
+ case Dali::Actor::Property::SIZE_DEPTH:
+ case Dali::Actor::Property::POSITION_Z:
+ case Dali::Actor::Property::WORLD_POSITION_Z:
+ case Dali::Actor::Property::SCALE_Z:
+ case Dali::Actor::Property::COLOR_BLUE:
+ {
+ componentIndex = 2;
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ {
+ componentIndex = 3;
+ break;
+ }
+
+ default:
+ {
+ // Do nothing
+ break;
+ }
+ }
+ }
+
+ return componentIndex;
+}
+
+void Actor::SetParent( Actor* parent )
+{
+ if( parent )
+ {
+ DALI_ASSERT_ALWAYS( !mParent && "Actor cannot have 2 parents" );
+
+ mParent = parent;
+
+ if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ parent->OnStage() )
+ {
+ // Instruct each actor to create a corresponding node in the scene graph
+ ConnectToStage( parent->GetHierarchyDepth() );
+ }
+
+ // Resolve the name and index for the child properties if any
+ ResolveChildProperties();
+ }
+ else // parent being set to NULL
+ {
+ DALI_ASSERT_ALWAYS( mParent != NULL && "Actor should have a parent" );
+
+ mParent = NULL;
+
+ if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ OnStage() )
+ {
+ DALI_ASSERT_ALWAYS( mNode != NULL );
+
+ if( NULL != mNode )
+ {
+ // Disconnect the Node & its children from the scene-graph.
+ DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), *mNode );
+ }
+
+ // Instruct each actor to discard pointers to the scene-graph
+ DisconnectFromStage();
+ }
+ }
+}
+
+SceneGraph::Node* Actor::CreateNode() const
+{
+ return Node::New();
+}
+
+bool Actor::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */ )
+{
+ bool done = false;
+ Actor* actor = dynamic_cast< Actor* >( object );
+
+ if( actor )
+ {
+ if( 0 == actionName.compare( ACTION_SHOW ) )
+ {
+ actor->SetVisible( true );
+ done = true;
+ }
+ else if( 0 == actionName.compare( ACTION_HIDE ) )
+ {
+ actor->SetVisible( false );
+ done = true;
+ }
+ }
+
+ return done;
+}
+
+bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
+{
+ bool valueSet = true;
+
+ switch( index )
+ {
+ case Dali::Actor::Property::PARENT_ORIGIN:
+ {
+ value = GetCurrentParentOrigin();
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_X:
+ {
+ value = GetCurrentParentOrigin().x;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Y:
+ {
+ value = GetCurrentParentOrigin().y;
+ break;
+ }
+
+ case Dali::Actor::Property::PARENT_ORIGIN_Z:
+ {
+ value = GetCurrentParentOrigin().z;
+ break;
+ }
+
+ case Dali::Actor::Property::ANCHOR_POINT:
+ {
+ value = GetCurrentAnchorPoint();
+ break;
+ }