- case Dali::Actor::Property::COLOR:
- {
- SetColor( property.Get< Vector4 >() );
- break;
- }
-
- case Dali::Actor::Property::COLOR_RED:
- {
- SetColorRed( property.Get< float >() );
- break;
- }
-
- case Dali::Actor::Property::COLOR_GREEN:
- {
- SetColorGreen( property.Get< float >() );
- break;
- }
-
- case Dali::Actor::Property::COLOR_BLUE:
- {
- SetColorBlue( property.Get< float >() );
- break;
- }
-
- case Dali::Actor::Property::COLOR_ALPHA:
- case Dali::DevelActor::Property::OPACITY:
- {
- float value;
- if( property.Get( value ) )
- {
- SetOpacity( value );
- }
- break;
- }
-
- case Dali::Actor::Property::NAME:
- {
- SetName( property.Get< std::string >() );
- break;
- }
-
- case Dali::Actor::Property::SENSITIVE:
- {
- SetSensitive( property.Get< bool >() );
- break;
- }
-
- case Dali::Actor::Property::LEAVE_REQUIRED:
- {
- SetLeaveRequired( property.Get< bool >() );
- break;
- }
-
- case Dali::Actor::Property::INHERIT_POSITION:
- {
- SetInheritPosition( property.Get< bool >() );
- break;
- }
-
- case Dali::Actor::Property::INHERIT_ORIENTATION:
- {
- SetInheritOrientation( property.Get< bool >() );
- break;
- }
-
- case Dali::Actor::Property::INHERIT_SCALE:
- {
- SetInheritScale( property.Get< bool >() );
- break;
- }
-
- case Dali::Actor::Property::COLOR_MODE:
- {
- ColorMode mode = mColorMode;
- if ( Scripting::GetEnumerationProperty< ColorMode >( property, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode ) )
- {
- SetColorMode( mode );
- }
- break;
- }
-
- case Dali::Actor::Property::DRAW_MODE:
- {
- DrawMode::Type mode = mDrawMode;
- if( Scripting::GetEnumerationProperty< DrawMode::Type >( property, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode ) )
- {
- SetDrawMode( mode );
- }
- break;
- }
-
- case Dali::Actor::Property::SIZE_MODE_FACTOR:
- {
- SetSizeModeFactor( property.Get< Vector3 >() );
- break;
- }
-
- case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
- {
- ResizePolicy::Type type = GetResizePolicy( Dimension::WIDTH );
- if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
- {
- SetResizePolicy( type, Dimension::WIDTH );
- }
- break;
- }
-
- case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
- {
- ResizePolicy::Type type = GetResizePolicy( Dimension::HEIGHT );
- if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
- {
- SetResizePolicy( type, Dimension::HEIGHT );
- }
- break;
- }
-
- case Dali::Actor::Property::SIZE_SCALE_POLICY:
- {
- SizeScalePolicy::Type type = GetSizeScalePolicy();
- if( Scripting::GetEnumeration< SizeScalePolicy::Type >( property.Get< std::string >().c_str(), SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT, type ) )
- {
- SetSizeScalePolicy( type );
- }
- break;
- }
-
- case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
- {
- if( property.Get< bool >() )
- {
- SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH );
- }
- break;
- }
-
- case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
- {
- if( property.Get< bool >() )
- {
- SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
- }
- break;
- }
-
- case Dali::Actor::Property::PADDING:
- {
- Vector4 padding = property.Get< Vector4 >();
- SetPadding( Vector2( padding.x, padding.y ), Dimension::WIDTH );
- SetPadding( Vector2( padding.z, padding.w ), Dimension::HEIGHT );
- break;
- }
-
- case Dali::Actor::Property::MINIMUM_SIZE:
- {
- Vector2 size = property.Get< Vector2 >();
- SetMinimumSize( size.x, Dimension::WIDTH );
- SetMinimumSize( size.y, Dimension::HEIGHT );
- break;
- }
-
- case Dali::Actor::Property::MAXIMUM_SIZE:
- {
- Vector2 size = property.Get< Vector2 >();
- SetMaximumSize( size.x, Dimension::WIDTH );
- SetMaximumSize( size.y, Dimension::HEIGHT );
- break;
- }
-
- case Dali::DevelActor::Property::SIBLING_ORDER:
- {
- int value;
-
- if( property.Get( value ) )
- {
- SetSiblingOrder( value );
- }
- break;
- }
-
- case Dali::Actor::Property::CLIPPING_MODE:
- {
- ClippingMode::Type convertedValue = mClippingMode;
- if( Scripting::GetEnumerationProperty< ClippingMode::Type >( property, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, convertedValue ) )
- {
- mClippingMode = convertedValue;
- SetClippingModeMessage( GetEventThreadServices(), GetNode(), mClippingMode );
- }
- break;
- }
-
- case Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT:
- {
- bool value = false;
- if( property.Get( value ) && value != mPositionUsesAnchorPoint )
- {
- mPositionUsesAnchorPoint = value;
- SetPositionUsesAnchorPointMessage( GetEventThreadServices(), GetNode(), mPositionUsesAnchorPoint );
- }
- break;
- }
-
- case Dali::Actor::Property::LAYOUT_DIRECTION:
- {
- Dali::LayoutDirection::Type direction = mLayoutDirection;
- mInheritLayoutDirection = false;
-
- if( Scripting::GetEnumerationProperty< LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) )
- {
- InheritLayoutDirectionRecursively( this, direction, true );
- }
- break;
- }
-
- case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION:
- {
- bool value = false;
- if( property.Get( value ) )
- {
- SetInheritLayoutDirection( value );
- }
- break;
- }
-
- default:
- {
- // this can happen in the case of a non-animatable default property so just do nothing
- break;
- }
- }
-}
-
-// TODO: This method needs to be removed
-void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value )
-{
- switch( entry.GetType() )
- {
- case Property::BOOLEAN:
- {
- const AnimatableProperty< bool >* property = dynamic_cast< const AnimatableProperty< bool >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<bool>::Bake, value.Get<bool>() );
-
- break;
- }
-
- case Property::INTEGER:
- {
- const AnimatableProperty< int >* property = dynamic_cast< const AnimatableProperty< int >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<int>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<int>::Bake, value.Get<int>() );
-
- break;
- }
-
- case Property::FLOAT:
- {
- const AnimatableProperty< float >* property = dynamic_cast< const AnimatableProperty< float >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<float>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<float>::Bake, value.Get<float>() );
-
- break;
- }
-
- case Property::VECTOR2:
- {
- const AnimatableProperty< Vector2 >* property = dynamic_cast< const AnimatableProperty< Vector2 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- if(entry.componentIndex == 0)
- {
- SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector2>::BakeX, value.Get<float>() );
- }
- else if(entry.componentIndex == 1)
- {
- SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector2>::BakeY, value.Get<float>() );
- }
- else
- {
- SceneGraph::NodePropertyMessage<Vector2>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
- }
-
- break;
- }
-
- case Property::VECTOR3:
- {
- const AnimatableProperty< Vector3 >* property = dynamic_cast< const AnimatableProperty< Vector3 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- if(entry.componentIndex == 0)
- {
- SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::BakeX, value.Get<float>() );
- }
- else if(entry.componentIndex == 1)
- {
- SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::BakeY, value.Get<float>() );
- }
- else if(entry.componentIndex == 2)
- {
- SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::BakeZ, value.Get<float>() );
- }
- else
- {
- SceneGraph::NodePropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
- }
-
- break;
- }
-
- case Property::VECTOR4:
- {
- const AnimatableProperty< Vector4 >* property = dynamic_cast< const AnimatableProperty< Vector4 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- if(entry.componentIndex == 0)
- {
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeX, value.Get<float>() );
- }
- else if(entry.componentIndex == 1)
- {
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeY, value.Get<float>() );
- }
- else if(entry.componentIndex == 2)
- {
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeZ, value.Get<float>() );
- }
- else if(entry.componentIndex == 3)
- {
- SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeW, value.Get<float>() );
- }
- else
- {
- SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
- }
-
- break;
- }
-
- case Property::ROTATION:
- {
- const AnimatableProperty< Quaternion >* property = dynamic_cast< const AnimatableProperty< Quaternion >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<Quaternion>::Send( GetEventThreadServices(), &GetNode(), property,&AnimatableProperty<Quaternion>::Bake, value.Get<Quaternion>() );
-
- break;
- }
-
- case Property::MATRIX:
- {
- const AnimatableProperty< Matrix >* property = dynamic_cast< const AnimatableProperty< Matrix >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<Matrix>::Send( GetEventThreadServices(), &GetNode(), property,&AnimatableProperty<Matrix>::Bake, value.Get<Matrix>() );
-
- break;
- }
-
- case Property::MATRIX3:
- {
- const AnimatableProperty< Matrix3 >* property = dynamic_cast< const AnimatableProperty< Matrix3 >* >( entry.GetSceneGraphProperty() );
- DALI_ASSERT_DEBUG( NULL != property );
-
- // property is being used in a separate thread; queue a message to set the property
- SceneGraph::NodePropertyMessage<Matrix3>::Send( GetEventThreadServices(), &GetNode(), property,&AnimatableProperty<Matrix3>::Bake, value.Get<Matrix3>() );
-
- break;
- }
-
- default:
- {
- // nothing to do for other types
- }
- } // entry.GetType
-}
-
-Property::Value Actor::GetDefaultProperty( Property::Index index ) const
-{
- Property::Value value;
-
- if( ! GetCachedPropertyValue( index, value ) )
- {
- // If property value is not stored in the event-side, then it must be a scene-graph only property
- GetCurrentPropertyValue( index, value );
- }
-
- return value;
-}
-
-Property::Value Actor::GetDefaultPropertyCurrentValue( Property::Index index ) const
-{
- Property::Value value;
-
- if( ! GetCurrentPropertyValue( index, value ) )
- {
- // If unable to retrieve scene-graph property value, then it must be an event-side only property
- GetCachedPropertyValue( index, value );
- }
-
- 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 PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index index ) const
-{
- const PropertyBase* property( NULL );
-
- switch( index )
- {
- case Dali::Actor::Property::SIZE: // FALLTHROUGH
- case Dali::Actor::Property::SIZE_WIDTH: // FALLTHROUGH
- case Dali::Actor::Property::SIZE_HEIGHT: // FALLTHROUGH
- case Dali::Actor::Property::SIZE_DEPTH:
- {
- property = &GetNode().mSize;
- break;
- }
- case Dali::Actor::Property::POSITION: // FALLTHROUGH
- case Dali::Actor::Property::POSITION_X: // FALLTHROUGH
- case Dali::Actor::Property::POSITION_Y: // FALLTHROUGH
- case Dali::Actor::Property::POSITION_Z:
- {
- property = &GetNode().mPosition;
- break;
- }
- case Dali::Actor::Property::ORIENTATION:
- {
- property = &GetNode().mOrientation;
- break;
- }
- case Dali::Actor::Property::SCALE: // FALLTHROUGH
- case Dali::Actor::Property::SCALE_X: // FALLTHROUGH
- case Dali::Actor::Property::SCALE_Y: // FALLTHROUGH
- case Dali::Actor::Property::SCALE_Z:
- {
- property = &GetNode().mScale;
- break;
- }
- case Dali::Actor::Property::VISIBLE:
- {
- property = &GetNode().mVisible;
- break;
- }
- case Dali::Actor::Property::COLOR: // FALLTHROUGH
- case Dali::Actor::Property::COLOR_RED: // FALLTHROUGH
- case Dali::Actor::Property::COLOR_GREEN: // FALLTHROUGH
- case Dali::Actor::Property::COLOR_BLUE: // FALLTHROUGH
- case Dali::Actor::Property::COLOR_ALPHA: // FALLTHROUGH
- case Dali::DevelActor::Property::OPACITY:
- {
- property = &GetNode().mColor;
- break;
- }
- default:
- {
- break;
- }
- }
- if( !property )
- {
- // not our property, ask base
- property = Object::GetSceneObjectAnimatableProperty( index );
- }
-
- return property;
-}
-
-const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index index ) const
-{
- const PropertyInputImpl* property( NULL );
-
- switch( index )
- {
- case Dali::Actor::Property::PARENT_ORIGIN: // FALLTHROUGH
- case Dali::Actor::Property::PARENT_ORIGIN_X: // FALLTHROUGH
- case Dali::Actor::Property::PARENT_ORIGIN_Y: // FALLTHROUGH
- case Dali::Actor::Property::PARENT_ORIGIN_Z:
- {
- property = &GetNode().mParentOrigin;
- break;
- }
- case Dali::Actor::Property::ANCHOR_POINT: // FALLTHROUGH
- case Dali::Actor::Property::ANCHOR_POINT_X: // FALLTHROUGH
- case Dali::Actor::Property::ANCHOR_POINT_Y: // FALLTHROUGH
- case Dali::Actor::Property::ANCHOR_POINT_Z:
- {
- property = &GetNode().mAnchorPoint;
- break;
- }
- case Dali::Actor::Property::WORLD_POSITION: // FALLTHROUGH
- case Dali::Actor::Property::WORLD_POSITION_X: // FALLTHROUGH
- case Dali::Actor::Property::WORLD_POSITION_Y: // FALLTHROUGH
- case Dali::Actor::Property::WORLD_POSITION_Z:
- {
- property = &GetNode().mWorldPosition;
- break;
- }
- case Dali::Actor::Property::WORLD_ORIENTATION:
- {
- property = &GetNode().mWorldOrientation;
- break;
- }
- case Dali::Actor::Property::WORLD_SCALE:
- {
- property = &GetNode().mWorldScale;
- break;
- }
- case Dali::Actor::Property::WORLD_COLOR:
- {
- property = &GetNode().mWorldColor;
- break;
- }
- case Dali::Actor::Property::WORLD_MATRIX:
- {
- property = &GetNode().mWorldMatrix;
- break;
- }
- case Dali::DevelActor::Property::CULLED:
- {
- property = &GetNode().mCulled;
- break;
- }
- default:
- {
- break;
- }
- }
- if( !property )
- {
- // reuse animatable property getter as animatable properties are inputs as well
- // animatable property chains back to Object::GetSceneObjectInputProperty() so all properties get covered
- property = GetSceneObjectAnimatableProperty( index );
- }
-
- return property;
-}
-
-int32_t Actor::GetPropertyComponentIndex( Property::Index index ) const
-{
- int32_t componentIndex = Property::INVALID_COMPONENT_INDEX;
-
- 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;
- }
- }
- if( Property::INVALID_COMPONENT_INDEX == componentIndex )
- {
- // ask base
- componentIndex = Object::GetPropertyComponentIndex( index );
- }
-
- return componentIndex;
-}
-
-void Actor::SetParent( Actor* parent )
-{
- if( parent )
- {
- DALI_ASSERT_ALWAYS( !mParent && "Actor cannot have 2 parents" );
-
- mParent = parent;
-
- mScene = parent->mScene;
-
- 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() )
- {
- // Disconnect the Node & its children from the scene-graph.
- DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() );
-
- // Instruct each actor to discard pointers to the scene-graph
- DisconnectFromStage();
- }
-
- mScene = nullptr;
- }
-}
-
-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;
-}
-
-Rect<> Actor::CalculateScreenExtents( ) const
-{
- auto screenPosition = GetCurrentScreenPosition();
- Vector3 size = GetCurrentSize() * GetCurrentWorldScale();
- Vector3 anchorPointOffSet = size * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT );
- Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y );
- return { position.x, position.y, size.x, size.y };
-}
-
-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;
- }
-
- case Dali::Actor::Property::ANCHOR_POINT_X:
- {
- value = GetCurrentAnchorPoint().x;
- break;
- }
-
- case Dali::Actor::Property::ANCHOR_POINT_Y:
- {
- value = GetCurrentAnchorPoint().y;
- break;
- }
-
- case Dali::Actor::Property::ANCHOR_POINT_Z:
- {
- value = GetCurrentAnchorPoint().z;
- break;
- }
-
- case Dali::Actor::Property::SIZE:
- {
- value = GetTargetSize();
- break;
- }
-
- case Dali::Actor::Property::SIZE_WIDTH:
- {
- value = GetTargetSize().width;
- break;
- }
-
- case Dali::Actor::Property::SIZE_HEIGHT:
- {
- value = GetTargetSize().height;
- break;
- }
-
- case Dali::Actor::Property::SIZE_DEPTH:
- {
- value = GetTargetSize().depth;
- break;
- }
-
- case Dali::Actor::Property::POSITION:
- {
- value = GetTargetPosition();
- break;
- }
-
- case Dali::Actor::Property::POSITION_X:
- {
- value = GetTargetPosition().x;
- break;
- }
-
- case Dali::Actor::Property::POSITION_Y:
- {
- value = GetTargetPosition().y;
- break;
- }
-
- case Dali::Actor::Property::POSITION_Z:
- {
- value = GetTargetPosition().z;
- break;
- }
-
- case Dali::Actor::Property::ORIENTATION:
- {
- value = mTargetOrientation;
- break;
- }
-
- case Dali::Actor::Property::SCALE:
- {
- value = mTargetScale;
- break;
- }
-
- case Dali::Actor::Property::SCALE_X:
- {
- value = mTargetScale.x;
- break;
- }
-
- case Dali::Actor::Property::SCALE_Y:
- {
- value = mTargetScale.y;
- break;
- }
-
- case Dali::Actor::Property::SCALE_Z:
- {
- value = mTargetScale.z;
- break;
- }
-
- case Dali::Actor::Property::VISIBLE:
- {
- value = mVisible;
- break;
- }
-
- case Dali::Actor::Property::COLOR:
- {
- value = mTargetColor;
- break;
- }
-
- case Dali::Actor::Property::COLOR_RED:
- {
- value = mTargetColor.r;
- break;
- }
-
- case Dali::Actor::Property::COLOR_GREEN:
- {
- value = mTargetColor.g;
- break;
- }
-
- case Dali::Actor::Property::COLOR_BLUE:
- {
- value = mTargetColor.b;
- break;
- }
-
- case Dali::Actor::Property::COLOR_ALPHA:
- case Dali::DevelActor::Property::OPACITY:
- {
- value = mTargetColor.a;
- break;
- }
-
- case Dali::Actor::Property::NAME:
- {
- value = GetName();
- break;
- }
-
- case Dali::Actor::Property::SENSITIVE:
- {
- value = IsSensitive();
- break;
- }
-
- case Dali::Actor::Property::LEAVE_REQUIRED:
- {
- value = GetLeaveRequired();
- break;
- }
-
- case Dali::Actor::Property::INHERIT_POSITION:
- {
- value = IsPositionInherited();
- break;
- }
-
- case Dali::Actor::Property::INHERIT_ORIENTATION:
- {
- value = IsOrientationInherited();
- break;
- }
-
- case Dali::Actor::Property::INHERIT_SCALE:
- {
- value = IsScaleInherited();
- break;
- }
-
- case Dali::Actor::Property::COLOR_MODE:
- {
- value = Scripting::GetLinearEnumerationName< ColorMode >( GetColorMode(), COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT );
- break;
- }
-
- case Dali::Actor::Property::DRAW_MODE:
- {
- value = Scripting::GetEnumerationName< DrawMode::Type >( GetDrawMode(), DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT );
- break;
- }
-
- case Dali::Actor::Property::SIZE_MODE_FACTOR:
- {
- value = GetSizeModeFactor();
- break;
- }
-
- case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
- {
- value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( GetResizePolicy( Dimension::WIDTH ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
- break;
- }
-
- case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
- {
- value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( GetResizePolicy( Dimension::HEIGHT ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
- break;
- }
-
- case Dali::Actor::Property::SIZE_SCALE_POLICY:
- {
- value = Scripting::GetLinearEnumerationName< SizeScalePolicy::Type >( GetSizeScalePolicy(), SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT );
- break;
- }
-
- case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
- {
- value = ( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( Dimension::WIDTH ) == Dimension::HEIGHT );
- break;
- }
-
- case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
- {
- value = ( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( Dimension::HEIGHT ) == Dimension::WIDTH );
- break;
- }
-
- case Dali::Actor::Property::PADDING:
- {
- Vector2 widthPadding = GetPadding( Dimension::WIDTH );
- Vector2 heightPadding = GetPadding( Dimension::HEIGHT );
- value = Vector4( widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y );
- break;
- }
-
- case Dali::Actor::Property::MINIMUM_SIZE:
- {
- value = Vector2( GetMinimumSize( Dimension::WIDTH ), GetMinimumSize( Dimension::HEIGHT ) );
- break;
- }
-
- case Dali::Actor::Property::MAXIMUM_SIZE:
- {
- value = Vector2( GetMaximumSize( Dimension::WIDTH ), GetMaximumSize( Dimension::HEIGHT ) );
- break;
- }
-
- case Dali::Actor::Property::CLIPPING_MODE:
- {
- value = mClippingMode;
- break;
- }
-
- case Dali::DevelActor::Property::SIBLING_ORDER:
- {
- value = static_cast<int>( GetSiblingOrder() );
- break;
- }
-
- case Dali::DevelActor::Property::SCREEN_POSITION:
- {
- value = GetCurrentScreenPosition();
- break;
- }
-
- case Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT:
- {
- value = mPositionUsesAnchorPoint;
- break;
- }
-
- case Dali::Actor::Property::LAYOUT_DIRECTION:
- {
- value = mLayoutDirection;
- break;
- }
-
- case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION:
- {
- value = IsLayoutDirectionInherited();
- break;
- }
-
- default:
- {
- // Must be a scene-graph only property
- valueSet = false;
- break;
- }
- }
-
- return valueSet;
-}
-
-bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const
-{
- bool valueSet = true;
-
- switch( index )
- {
- case Dali::Actor::Property::SIZE:
- {
- value = GetCurrentSize();
- break;
- }
-
- case Dali::Actor::Property::SIZE_WIDTH:
- {
- value = GetCurrentSize().width;
- break;
- }
-
- case Dali::Actor::Property::SIZE_HEIGHT:
- {
- value = GetCurrentSize().height;
- break;
- }
-
- case Dali::Actor::Property::SIZE_DEPTH:
- {
- value = GetCurrentSize().depth;
- break;
- }
-
- case Dali::Actor::Property::POSITION:
- {
- value = GetCurrentPosition();
- break;
- }
-
- case Dali::Actor::Property::POSITION_X:
- {
- value = GetCurrentPosition().x;
- break;
- }
-
- case Dali::Actor::Property::POSITION_Y:
- {
- value = GetCurrentPosition().y;
- break;
- }
-
- case Dali::Actor::Property::POSITION_Z:
- {
- value = GetCurrentPosition().z;
- break;
- }
-
- case Dali::Actor::Property::WORLD_POSITION:
- {
- value = GetCurrentWorldPosition();
- break;
- }
-
- case Dali::Actor::Property::WORLD_POSITION_X:
- {
- value = GetCurrentWorldPosition().x;
- break;
- }
-
- case Dali::Actor::Property::WORLD_POSITION_Y:
- {
- value = GetCurrentWorldPosition().y;
- break;
- }
-
- case Dali::Actor::Property::WORLD_POSITION_Z:
- {
- value = GetCurrentWorldPosition().z;
- break;
- }
-
- case Dali::Actor::Property::ORIENTATION:
- {
- value = GetCurrentOrientation();
- break;
- }
-
- case Dali::Actor::Property::WORLD_ORIENTATION:
- {
- value = GetCurrentWorldOrientation();
- break;
- }
-
- case Dali::Actor::Property::SCALE:
- {
- value = GetCurrentScale();
- break;
- }
-
- case Dali::Actor::Property::SCALE_X:
- {
- value = GetCurrentScale().x;
- break;
- }
-
- case Dali::Actor::Property::SCALE_Y:
- {
- value = GetCurrentScale().y;
- break;
- }
-
- case Dali::Actor::Property::SCALE_Z:
- {
- value = GetCurrentScale().z;
- break;
- }
-
- case Dali::Actor::Property::WORLD_SCALE:
- {
- value = GetCurrentWorldScale();
- break;
- }
-
- case Dali::Actor::Property::COLOR:
- {
- value = GetCurrentColor();
- break;
- }
-
- case Dali::Actor::Property::COLOR_RED:
- {
- value = GetCurrentColor().r;
- break;
- }
-
- case Dali::Actor::Property::COLOR_GREEN:
- {
- value = GetCurrentColor().g;
- break;
- }
-
- case Dali::Actor::Property::COLOR_BLUE:
- {
- value = GetCurrentColor().b;
- break;
- }
-
- case Dali::Actor::Property::COLOR_ALPHA:
- case Dali::DevelActor::Property::OPACITY:
- {
- value = GetCurrentColor().a;
- break;
- }
-
- case Dali::Actor::Property::WORLD_COLOR:
- {
- value = GetCurrentWorldColor();
- break;
- }
-
- case Dali::Actor::Property::WORLD_MATRIX:
- {
- value = GetCurrentWorldMatrix();
- break;
- }
-
- case Dali::Actor::Property::VISIBLE:
- {
- value = IsVisible();
- break;
- }
-
- case DevelActor::Property::CULLED:
- {
- value = GetNode().IsCulled( GetEventThreadServices().GetEventBufferIndex() );
- break;
- }
-
- default:
- {
- // Must be an event-side only property
- valueSet = false;
- break;
- }
- }
-
- return valueSet;
-}
-
-void Actor::EnsureRelayoutData()
-{
- // Assign relayout data.
- if( !mRelayoutData )
- {
- mRelayoutData = new RelayoutData();
- }
-}
-
-bool Actor::RelayoutDependentOnParent( Dimension::Type dimension )
-{
- // Check if actor is dependent on parent
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
- {
- if( ( dimension & ( 1 << i ) ) )
- {
- const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) );
- if( resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT )
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool Actor::RelayoutDependentOnChildren( Dimension::Type dimension )
-{
- // Check if actor is dependent on children
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
- {
- if( ( dimension & ( 1 << i ) ) )
- {
- const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) );
- switch( resizePolicy )
- {
- case ResizePolicy::FIT_TO_CHILDREN:
- case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children
- {
- return true;
- }
-
- default:
- {
- break;
- }
- }
- }
- }
-
- return false;
-}
-
-bool Actor::RelayoutDependentOnChildrenBase( Dimension::Type dimension )
-{
- return Actor::RelayoutDependentOnChildren( dimension );
-}
-
-bool Actor::RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension )
-{
- // Check each possible dimension and see if it is dependent on the input one
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
- {
- if( dimension & ( 1 << i ) )
- {
- return mRelayoutData->resizePolicies[ i ] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[ i ] == dependentDimension;
- }
- }
-
- return false;
-}
-
-void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension )
-{
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
- {
- if( dimension & ( 1 << i ) )
- {
- mRelayoutData->negotiatedDimensions[ i ] = negotiatedDimension;
- }
- }
-}
-
-float Actor::GetNegotiatedDimension( Dimension::Type dimension ) const
-{
- // If more than one dimension is requested, just return the first one found
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
- {
- if( ( dimension & ( 1 << i ) ) )
- {
- return mRelayoutData->negotiatedDimensions[ i ];
- }
- }
-
- return 0.0f; // Default
-}
-
-void Actor::SetPadding( const Vector2& padding, Dimension::Type dimension )
-{
- EnsureRelayoutData();
-
- for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
- {
- if( dimension & ( 1 << i ) )
- {
- mRelayoutData->dimensionPadding[ i ] = padding;
- }