Stage member has been removed from actor.
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.cpp
index edbc52d..85dba95 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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,7 +22,6 @@
 #include <cmath>
 #include <algorithm>
 #include <cfloat>
-#include <cstring> // for strcmp
 
 // INTERNAL INCLUDES
 
@@ -32,7 +31,7 @@
 #include <dali/public-api/math/vector3.h>
 #include <dali/public-api/math/radian.h>
 #include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/scripting/scripting.h>
+#include <dali/devel-api/scripting/scripting.h>
 
 #include <dali/internal/common/internal-constants.h>
 #include <dali/internal/event/common/event-thread-services.h>
@@ -43,6 +42,7 @@
 #include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/event/common/type-info-impl.h>
 #include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
+#include <dali/internal/event/actor-attachments/renderer-attachment-impl.h>
 #include <dali/internal/event/animation/constraint-impl.h>
 #include <dali/internal/event/common/projection.h>
 #include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
@@ -54,7 +54,7 @@
 #include <dali/internal/common/message.h>
 #include <dali/integration-api/debug.h>
 
-#ifdef DYNAMICS_SUPPORT
+#ifdef DALI_DYNAMICS_SUPPORT
 #include <dali/internal/event/dynamics/dynamics-body-config-impl.h>
 #include <dali/internal/event/dynamics/dynamics-body-impl.h>
 #include <dali/internal/event/dynamics/dynamics-joint-impl.h>
@@ -72,7 +72,8 @@ namespace ResizePolicy
 
 namespace
 {
-DALI_ENUM_TO_STRING_TABLE_BEGIN( Type )DALI_ENUM_TO_STRING( FIXED )
+DALI_ENUM_TO_STRING_TABLE_BEGIN( Type )
+DALI_ENUM_TO_STRING( FIXED )
 DALI_ENUM_TO_STRING( USE_NATURAL_SIZE )
 DALI_ENUM_TO_STRING( FILL_TO_PARENT )
 DALI_ENUM_TO_STRING( SIZE_RELATIVE_TO_PARENT )
@@ -90,7 +91,8 @@ namespace SizeScalePolicy
 namespace
 {
 // Enumeration to / from string conversion tables
-DALI_ENUM_TO_STRING_TABLE_BEGIN( Type )DALI_ENUM_TO_STRING( USE_SIZE_SET )
+DALI_ENUM_TO_STRING_TABLE_BEGIN( Type )
+DALI_ENUM_TO_STRING( USE_SIZE_SET )
 DALI_ENUM_TO_STRING( FIT_WITH_ASPECT_RATIO )
 DALI_ENUM_TO_STRING( FILL_WITH_ASPECT_RATIO )
 DALI_ENUM_TO_STRING_TABLE_END( Type )
@@ -101,7 +103,30 @@ namespace Internal
 {
 
 unsigned int Actor::mActorCounter = 0;
-ActorContainer Actor::mNullChildren;
+
+namespace
+{
+/// Using a function because of library initialisation order. Vector3::ONE may not have been initialised yet.
+inline const Vector3& GetDefaultSizeModeFactor()
+{
+  return Vector3::ONE;
+}
+
+/// Using a function because of library initialisation order. Vector2::ZERO may not have been initialised yet.
+inline const Vector2& GetDefaultPreferredSize()
+{
+  return Vector2::ZERO;
+}
+
+/// Using a function because of library initialisation order. Vector2::ZERO may not have been initialised yet.
+inline const Vector2& GetDefaultDimensionPadding()
+{
+  return Vector2::ZERO;
+}
+
+const SizeScalePolicy::Type DEFAULT_SIZE_SCALE_POLICY = SizeScalePolicy::USE_SIZE_SET;
+
+} // unnamed namespace
 
 /**
  * Struct to collect relayout variables
@@ -109,17 +134,17 @@ ActorContainer Actor::mNullChildren;
 struct Actor::RelayoutData
 {
   RelayoutData()
-      : sizeModeFactor( Vector3::ONE ), preferredSize( Vector2::ZERO ), sizeSetPolicy( SizeScalePolicy::USE_SIZE_SET ), relayoutEnabled( false ), insideRelayout( false )
+    : sizeModeFactor( GetDefaultSizeModeFactor() ), preferredSize( GetDefaultPreferredSize() ), sizeSetPolicy( DEFAULT_SIZE_SCALE_POLICY ), relayoutEnabled( false ), insideRelayout( false )
   {
     // Set size negotiation defaults
     for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      resizePolicies[ i ] = ResizePolicy::FIXED;
+      resizePolicies[ i ] = ResizePolicy::DEFAULT;
       negotiatedDimensions[ i ] = 0.0f;
       dimensionNegotiated[ i ] = false;
       dimensionDirty[ i ] = false;
       dimensionDependencies[ i ] = Dimension::ALL_DIMENSIONS;
-      dimensionPadding[ i ] = Vector2( 0.0f, 0.0f );
+      dimensionPadding[ i ] = GetDefaultDimensionPadding();
       minimumSize[ i ] = 0.0f;
       maximumSize[ i ] = FLT_MAX;
     }
@@ -149,7 +174,7 @@ struct Actor::RelayoutData
   bool insideRelayout :1;                    ///< Locking flag to prevent recursive relayouts on size set
 };
 
-#ifdef DYNAMICS_SUPPORT
+#ifdef DALI_DYNAMICS_SUPPORT
 
 // Encapsulate actor related dynamics data
 struct DynamicsData
@@ -169,7 +194,7 @@ struct DynamicsData
   SlotDelegate< Actor > slotDelegate;
 };
 
-#endif // DYNAMICS_SUPPORT
+#endif // DALI_DYNAMICS_SUPPORT
 
 namespace // unnamed namespace
 {
@@ -179,69 +204,68 @@ namespace // unnamed namespace
 /**
  * We want to discourage the use of property strings (minimize string comparisons),
  * particularly for the default properties.
- *              Name                   Type   writable animatable constraint-input  enum for index-checking
+ *              Name                Type   writable animatable constraint-input  enum for index-checking
  */
 DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "parent-origin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN )
-DALI_PROPERTY( "parent-origin-x", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X )
-DALI_PROPERTY( "parent-origin-y", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y )
-DALI_PROPERTY( "parent-origin-z", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z )
-DALI_PROPERTY( "anchor-point", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT )
-DALI_PROPERTY( "anchor-point-x", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X )
-DALI_PROPERTY( "anchor-point-y", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y )
-DALI_PROPERTY( "anchor-point-z", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z )
-DALI_PROPERTY( "size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE )
-DALI_PROPERTY( "size-width", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH )
-DALI_PROPERTY( "size-height", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT )
-DALI_PROPERTY( "size-depth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH )
-DALI_PROPERTY( "position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION )
-DALI_PROPERTY( "position-x", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X )
-DALI_PROPERTY( "position-y", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y )
-DALI_PROPERTY( "position-z", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z )
-DALI_PROPERTY( "world-position", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION )
-DALI_PROPERTY( "world-position-x", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X )
-DALI_PROPERTY( "world-position-y", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y )
-DALI_PROPERTY( "world-position-z", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z )
-DALI_PROPERTY( "orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION )
-DALI_PROPERTY( "world-orientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION )
-DALI_PROPERTY( "scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE )
-DALI_PROPERTY( "scale-x", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X )
-DALI_PROPERTY( "scale-y", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y )
-DALI_PROPERTY( "scale-z", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z )
-DALI_PROPERTY( "world-scale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE )
-DALI_PROPERTY( "visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE )
-DALI_PROPERTY( "color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR )
-DALI_PROPERTY( "color-red", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED )
-DALI_PROPERTY( "color-green", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN )
-DALI_PROPERTY( "color-blue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE )
-DALI_PROPERTY( "color-alpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA )
-DALI_PROPERTY( "world-color", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR )
-DALI_PROPERTY( "world-matrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX )
-DALI_PROPERTY( "name", STRING, true, false, false, Dali::Actor::Property::NAME )
-DALI_PROPERTY( "sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE )
-DALI_PROPERTY( "leave-required", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED )
-DALI_PROPERTY( "inherit-orientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION )
-DALI_PROPERTY( "inherit-scale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE )
-DALI_PROPERTY( "color-mode", STRING, true, false, false, Dali::Actor::Property::COLOR_MODE )
-DALI_PROPERTY( "position-inheritance", STRING, true, false, false, Dali::Actor::Property::POSITION_INHERITANCE )
-DALI_PROPERTY( "draw-mode", STRING, true, false, false, Dali::Actor::Property::DRAW_MODE )
-DALI_PROPERTY( "size-mode-factor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR )
-DALI_PROPERTY( "relayout-enabled", BOOLEAN, true, false, false, Dali::Actor::Property::RELAYOUT_ENABLED )
-DALI_PROPERTY( "width-resize-policy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY )
-DALI_PROPERTY( "height-resize-policy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY )
-DALI_PROPERTY( "size-scale-policy", STRING, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY )
-DALI_PROPERTY( "width-for-height", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT )
-DALI_PROPERTY( "height-for-width", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH )
-DALI_PROPERTY( "padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING )
-DALI_PROPERTY( "minimum-size", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE )
-DALI_PROPERTY( "maximum-size", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE )
+DALI_PROPERTY( "parent-origin",     VECTOR3,  true,  false, true,  Dali::Actor::Property::PARENT_ORIGIN )
+DALI_PROPERTY( "parent-origin-x",   FLOAT,    true,  false, true,  Dali::Actor::Property::PARENT_ORIGIN_X )
+DALI_PROPERTY( "parent-origin-y",   FLOAT,    true,  false, true,  Dali::Actor::Property::PARENT_ORIGIN_Y )
+DALI_PROPERTY( "parent-origin-z",   FLOAT,    true,  false, true,  Dali::Actor::Property::PARENT_ORIGIN_Z )
+DALI_PROPERTY( "anchor-point",      VECTOR3,  true,  false, true,  Dali::Actor::Property::ANCHOR_POINT )
+DALI_PROPERTY( "anchor-point-x",    FLOAT,    true,  false, true,  Dali::Actor::Property::ANCHOR_POINT_X )
+DALI_PROPERTY( "anchor-point-y",    FLOAT,    true,  false, true,  Dali::Actor::Property::ANCHOR_POINT_Y )
+DALI_PROPERTY( "anchor-point-z",    FLOAT,    true,  false, true,  Dali::Actor::Property::ANCHOR_POINT_Z )
+DALI_PROPERTY( "size",              VECTOR3,  true,  true,  true,  Dali::Actor::Property::SIZE )
+DALI_PROPERTY( "size-width",        FLOAT,    true,  true,  true,  Dali::Actor::Property::SIZE_WIDTH )
+DALI_PROPERTY( "size-height",       FLOAT,    true,  true,  true,  Dali::Actor::Property::SIZE_HEIGHT )
+DALI_PROPERTY( "size-depth",        FLOAT,    true,  true,  true,  Dali::Actor::Property::SIZE_DEPTH )
+DALI_PROPERTY( "position",          VECTOR3,  true,  true,  true,  Dali::Actor::Property::POSITION )
+DALI_PROPERTY( "position-x",        FLOAT,    true,  true,  true,  Dali::Actor::Property::POSITION_X )
+DALI_PROPERTY( "position-y",        FLOAT,    true,  true,  true,  Dali::Actor::Property::POSITION_Y )
+DALI_PROPERTY( "position-z",        FLOAT,    true,  true,  true,  Dali::Actor::Property::POSITION_Z )
+DALI_PROPERTY( "world-position",    VECTOR3,  false, false, true,  Dali::Actor::Property::WORLD_POSITION )
+DALI_PROPERTY( "world-position-x",  FLOAT,    false, false, true,  Dali::Actor::Property::WORLD_POSITION_X )
+DALI_PROPERTY( "world-position-y",  FLOAT,    false, false, true,  Dali::Actor::Property::WORLD_POSITION_Y )
+DALI_PROPERTY( "world-position-z",  FLOAT,    false, false, true,  Dali::Actor::Property::WORLD_POSITION_Z )
+DALI_PROPERTY( "orientation",       ROTATION, true,  true,  true,  Dali::Actor::Property::ORIENTATION )
+DALI_PROPERTY( "world-orientation", ROTATION, false, false, true,  Dali::Actor::Property::WORLD_ORIENTATION )
+DALI_PROPERTY( "scale",             VECTOR3,  true,  true,  true,  Dali::Actor::Property::SCALE )
+DALI_PROPERTY( "scale-x",           FLOAT,    true,  true,  true,  Dali::Actor::Property::SCALE_X )
+DALI_PROPERTY( "scale-y",           FLOAT,    true,  true,  true,  Dali::Actor::Property::SCALE_Y )
+DALI_PROPERTY( "scale-z",           FLOAT,    true,  true,  true,  Dali::Actor::Property::SCALE_Z )
+DALI_PROPERTY( "world-scale",       VECTOR3,  false, false, true,  Dali::Actor::Property::WORLD_SCALE )
+DALI_PROPERTY( "visible",           BOOLEAN,  true,  true,  true,  Dali::Actor::Property::VISIBLE )
+DALI_PROPERTY( "color",             VECTOR4,  true,  true,  true,  Dali::Actor::Property::COLOR )
+DALI_PROPERTY( "color-red",         FLOAT,    true,  true,  true,  Dali::Actor::Property::COLOR_RED )
+DALI_PROPERTY( "color-green",       FLOAT,    true,  true,  true,  Dali::Actor::Property::COLOR_GREEN )
+DALI_PROPERTY( "color-blue",        FLOAT,    true,  true,  true,  Dali::Actor::Property::COLOR_BLUE )
+DALI_PROPERTY( "color-alpha",       FLOAT,    true,  true,  true,  Dali::Actor::Property::COLOR_ALPHA )
+DALI_PROPERTY( "world-color",       VECTOR4,  false, false, true,  Dali::Actor::Property::WORLD_COLOR )
+DALI_PROPERTY( "world-matrix",      MATRIX,   false, false, true,  Dali::Actor::Property::WORLD_MATRIX )
+DALI_PROPERTY( "name",              STRING,   true,  false, false, Dali::Actor::Property::NAME )
+DALI_PROPERTY( "sensitive",         BOOLEAN,  true,  false, false, Dali::Actor::Property::SENSITIVE )
+DALI_PROPERTY( "leave-required",    BOOLEAN,  true,  false, false, Dali::Actor::Property::LEAVE_REQUIRED )
+DALI_PROPERTY( "inherit-orientation",BOOLEAN, true,  false, false, Dali::Actor::Property::INHERIT_ORIENTATION )
+DALI_PROPERTY( "inherit-scale",     BOOLEAN,  true,  false, false, Dali::Actor::Property::INHERIT_SCALE )
+DALI_PROPERTY( "color-mode",        STRING,   true,  false, false, Dali::Actor::Property::COLOR_MODE )
+DALI_PROPERTY( "position-inheritance",STRING, true,  false, false, Dali::Actor::Property::POSITION_INHERITANCE )
+DALI_PROPERTY( "draw-mode",         STRING,   true,  false, false, Dali::Actor::Property::DRAW_MODE )
+DALI_PROPERTY( "size-mode-factor",  VECTOR3,  true,  false, false, Dali::Actor::Property::SIZE_MODE_FACTOR )
+DALI_PROPERTY( "width-resize-policy",STRING,  true,  false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY )
+DALI_PROPERTY( "height-resize-policy",STRING, true,  false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY )
+DALI_PROPERTY( "size-scale-policy", STRING,   true,  false, false, Dali::Actor::Property::SIZE_SCALE_POLICY )
+DALI_PROPERTY( "width-for-height",  BOOLEAN,  true,  false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT )
+DALI_PROPERTY( "height-for-width",  BOOLEAN,  true,  false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH )
+DALI_PROPERTY( "padding",           VECTOR4,  true,  false, false, Dali::Actor::Property::PADDING )
+DALI_PROPERTY( "minimum-size",      VECTOR2,  true,  false, false, Dali::Actor::Property::MINIMUM_SIZE )
+DALI_PROPERTY( "maximum-size",      VECTOR2,  true,  false, false, Dali::Actor::Property::MAXIMUM_SIZE )
 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
 
 // Signals
 
 const char* const SIGNAL_TOUCHED = "touched";
 const char* const SIGNAL_HOVERED = "hovered";
-const char* const SIGNAL_MOUSE_WHEEL_EVENT = "mouse-wheel-event";
+const char* const SIGNAL_WHEEL_EVENT = "wheel-event";
 const char* const SIGNAL_ON_STAGE = "on-stage";
 const char* const SIGNAL_OFF_STAGE = "off-stage";
 
@@ -280,18 +304,15 @@ float GetDimensionValue( const Vector2& values, Dimension::Type dimension )
     {
       return values.width;
     }
-
     case Dimension::HEIGHT:
     {
       return values.height;
     }
-
     default:
     {
       break;
     }
   }
-
   return 0.0f;
 }
 
@@ -307,6 +328,7 @@ float GetDimensionValue( const Vector3& values, Dimension::Type dimension )
   return GetDimensionValue( values.GetVectorXY(), dimension );
 }
 
+
 } // unnamed namespace
 
 ActorPtr Actor::New()
@@ -558,28 +580,6 @@ Dali::Actor Actor::GetChildAt( unsigned int index ) const
   return ( ( mChildren ) ? ( *mChildren )[ index ] : Dali::Actor() );
 }
 
-ActorContainer Actor::GetChildren()
-{
-  if( NULL != mChildren )
-  {
-    return *mChildren;
-  }
-
-  // return copy of mNullChildren
-  return mNullChildren;
-}
-
-const ActorContainer& Actor::GetChildren() const
-{
-  if( NULL != mChildren )
-  {
-    return *mChildren;
-  }
-
-  // return const reference to mNullChildren
-  return mNullChildren;
-}
-
 ActorPtr Actor::FindChildByName( const std::string& actorName )
 {
   ActorPtr child = 0;
@@ -942,36 +942,7 @@ void Actor::SetScaleZ( float z )
   }
 }
 
-void Actor::SetInitialVolume( const Vector3& volume )
-{
-  if( NULL != mNode )
-  {
-    // mNode is being used in a separate thread; queue a message to set the value
-    SetInitialVolumeMessage( GetEventThreadServices(), *mNode, volume );
-  }
-}
-
-void Actor::SetTransmitGeometryScaling( bool transmitGeometryScaling )
-{
-  if( NULL != mNode )
-  {
-    // mNode is being used in a separate thread; queue a message to set the value
-    SetTransmitGeometryScalingMessage( GetEventThreadServices(), *mNode, transmitGeometryScaling );
-  }
-}
-
-bool Actor::GetTransmitGeometryScaling() const
-{
-  if( NULL != mNode )
-  {
-    // mNode is being used in a separate thread; copy the value from the previous update
-    return mNode->GetTransmitGeometryScaling();
-  }
-
-  return false;
-}
-
-void Actor::ScaleBy( const Vector3& relativeScale )
+void Actor::ScaleBy(const Vector3& relativeScale)
 {
   if( NULL != mNode )
   {
@@ -1157,9 +1128,12 @@ void Actor::SetSizeModeFactor( const Vector3& factor )
 
 const Vector3& Actor::GetSizeModeFactor() const
 {
-  EnsureRelayoutData();
+  if ( mRelayoutData )
+  {
+    return mRelayoutData->sizeModeFactor;
+  }
 
-  return mRelayoutData->sizeModeFactor;
+  return GetDefaultSizeModeFactor();
 }
 
 void Actor::SetColorMode( ColorMode colorMode )
@@ -1218,7 +1192,13 @@ void Actor::SetSize( const Vector3& size )
 
 void Actor::SetSizeInternal( const Vector3& size )
 {
-  if( NULL != mNode )
+  // dont allow recursive loop
+  DALI_ASSERT_ALWAYS( !mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet" );
+  // check that we have a node AND the new size width, height or depth is at least a little bit different from the old one
+  if( ( NULL != mNode )&&
+      ( ( fabsf( mTargetSize.width - size.width  ) > Math::MACHINE_EPSILON_1 )||
+        ( fabsf( mTargetSize.height- size.height ) > Math::MACHINE_EPSILON_1 )||
+        ( fabsf( mTargetSize.depth - size.depth  ) > Math::MACHINE_EPSILON_1 ) ) )
   {
     mTargetSize = size;
 
@@ -1226,7 +1206,9 @@ void Actor::SetSizeInternal( const Vector3& size )
     SceneGraph::NodePropertyMessage<Vector3>::Send( GetEventThreadServices(), mNode, &mNode->mSize, &AnimatableProperty<Vector3>::Bake, mTargetSize );
 
     // Notification for derived classes
+    mInsideOnSizeSet = true;
     OnSizeSet( mTargetSize );
+    mInsideOnSizeSet = false;
 
     // Raise a relayout request if the flag is not locked
     if( mRelayoutData && !mRelayoutData->insideRelayout )
@@ -1241,7 +1223,21 @@ void Actor::NotifySizeAnimation( Animation& animation, const Vector3& targetSize
   mTargetSize = targetSize;
 
   // Notify deriving classes
-  OnSizeAnimation( animation, targetSize );
+  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;
+  }
+  // Notify deriving classes
+  OnSizeAnimation( animation, mTargetSize );
 }
 
 void Actor::SetWidth( float width )
@@ -1318,6 +1314,9 @@ void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimensio
     }
   }
 
+  // If calling SetResizePolicy, assume we want relayout enabled
+  SetRelayoutEnabled( true );
+
   OnSetResizePolicy( policy, dimension );
 
   // Trigger relayout on this control
@@ -1326,18 +1325,19 @@ void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimensio
 
 ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
-
-  // If more than one dimension is requested, just return the first one found
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  if ( mRelayoutData )
   {
-    if( ( dimension & ( 1 << i ) ) )
+    // If more than one dimension is requested, just return the first one found
+    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      return mRelayoutData->resizePolicies[ i ];
+      if( ( dimension & ( 1 << i ) ) )
+      {
+        return mRelayoutData->resizePolicies[ i ];
+      }
     }
   }
 
-  return ResizePolicy::FIXED;   // Default
+  return ResizePolicy::DEFAULT;
 }
 
 void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
@@ -1349,9 +1349,12 @@ void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
 
 SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
 {
-  EnsureRelayoutData();
+  if ( mRelayoutData )
+  {
+    return mRelayoutData->sizeSetPolicy;
+  }
 
-  return mRelayoutData->sizeSetPolicy;
+  return DEFAULT_SIZE_SCALE_POLICY;
 }
 
 void Actor::SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency )
@@ -1369,14 +1372,15 @@ void Actor::SetDimensionDependency( Dimension::Type dimension, Dimension::Type d
 
 Dimension::Type Actor::GetDimensionDependency( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
-
-  // If more than one dimension is requested, just return the first one found
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  if ( mRelayoutData )
   {
-    if( ( dimension & ( 1 << i ) ) )
+    // If more than one dimension is requested, just return the first one found
+    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      return mRelayoutData->dimensionDependencies[ i ];
+      if( ( dimension & ( 1 << i ) ) )
+      {
+        return mRelayoutData->dimensionDependencies[ i ];
+      }
     }
   }
 
@@ -1417,13 +1421,14 @@ void Actor::SetLayoutDirty( bool dirty, Dimension::Type dimension )
 
 bool Actor::IsLayoutDirty( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
-
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  if ( mRelayoutData )
   {
-    if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionDirty[ i ] )
+    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      return true;
+      if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionDirty[ i ] )
+      {
+        return true;
+      }
     }
   }
 
@@ -1432,19 +1437,58 @@ bool Actor::IsLayoutDirty( Dimension::Type dimension ) const
 
 bool Actor::RelayoutPossible( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
-
-  return mRelayoutData->relayoutEnabled && !IsLayoutDirty( dimension );
+  return mRelayoutData && mRelayoutData->relayoutEnabled && !IsLayoutDirty( dimension );
 }
 
 bool Actor::RelayoutRequired( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
+  return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty( dimension );
+}
+
+unsigned int Actor::AddRenderer( Renderer& renderer )
+{
+  //TODO: MESH_REWORK : Add support for multiple renderers
+  if ( ! mAttachment )
+  {
+    mAttachment = RendererAttachment::New( GetEventThreadServices(), *mNode, renderer );
+  }
+
+  return 0;
+}
 
-  return mRelayoutData->relayoutEnabled && IsLayoutDirty( dimension );
+unsigned int Actor::GetRendererCount() const
+{
+  //TODO: MESH_REWORK : Add support for multiple renderers
+  RendererAttachment* attachment = dynamic_cast<RendererAttachment*>(mAttachment.Get());
+  return attachment ? 1u : 0u;
 }
 
-#ifdef DYNAMICS_SUPPORT
+Renderer& Actor::GetRendererAt( unsigned int index )
+{
+  //TODO: MESH_REWORK : Add support for multiple renderers
+  DALI_ASSERT_DEBUG( index == 0 && "Only one renderer is supported." );
+
+  //TODO: MESH_REWORK : Temporary code
+  RendererAttachment* attachment = dynamic_cast<RendererAttachment*>(mAttachment.Get());
+  DALI_ASSERT_ALWAYS( attachment && "Actor doesn't have a renderer" );
+
+  return attachment->GetRenderer();
+}
+
+void Actor::RemoveRenderer( Renderer& renderer )
+{
+  //TODO: MESH_REWORK : Add support for multiple renderers
+  mAttachment = NULL;
+}
+
+void Actor::RemoveRenderer( unsigned int index )
+{
+  //TODO: MESH_REWORK : Add support for multiple renderers
+  mAttachment = NULL;
+}
+
+
+#ifdef DALI_DYNAMICS_SUPPORT
 
 //--------------- Dynamics ---------------
 
@@ -1820,7 +1864,7 @@ void Actor::DisconnectDynamics()
   }
 }
 
-#endif // DYNAMICS_SUPPORT
+#endif // DALI_DYNAMICS_SUPPORT
 
 void Actor::SetOverlay( bool enable )
 {
@@ -1855,9 +1899,10 @@ DrawMode::Type Actor::GetDrawMode() const
 bool Actor::ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const
 {
   // only valid when on-stage
-  if( OnStage() )
+  StagePtr stage = Stage::GetCurrent();
+  if( stage && OnStage() )
   {
-    const RenderTaskList& taskList = Stage::GetCurrent()->GetRenderTaskList();
+    const RenderTaskList& taskList = stage->GetRenderTaskList();
 
     Vector2 converted( screenX, screenY );
 
@@ -2118,9 +2163,9 @@ bool Actor::GetHoverRequired() const
   return !mHoveredSignal.Empty() || mDerivedRequiresHover;
 }
 
-bool Actor::GetMouseWheelEventRequired() const
+bool Actor::GetWheelEventRequired() const
 {
-  return !mMouseWheelEventSignal.Empty() || mDerivedRequiresMouseWheelEvent;
+  return !mWheelEventSignal.Empty() || mDerivedRequiresWheelEvent;
 }
 
 bool Actor::IsHittable() const
@@ -2182,20 +2227,20 @@ bool Actor::EmitHoverEventSignal( const HoverEvent& event )
   return consumed;
 }
 
-bool Actor::EmitMouseWheelEventSignal( const MouseWheelEvent& event )
+bool Actor::EmitWheelEventSignal( const WheelEvent& event )
 {
   bool consumed = false;
 
-  if( !mMouseWheelEventSignal.Empty() )
+  if( !mWheelEventSignal.Empty() )
   {
     Dali::Actor handle( this );
-    consumed = mMouseWheelEventSignal.Emit( handle, event );
+    consumed = mWheelEventSignal.Emit( handle, event );
   }
 
   if( !consumed )
   {
     // Notification for derived classes
-    consumed = OnMouseWheelEvent( event );
+    consumed = OnWheelEvent( event );
   }
 
   return consumed;
@@ -2211,9 +2256,9 @@ Dali::Actor::HoverSignalType& Actor::HoveredSignal()
   return mHoveredSignal;
 }
 
-Dali::Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+Dali::Actor::WheelEventSignalType& Actor::WheelEventSignal()
 {
-  return mMouseWheelEventSignal;
+  return mWheelEventSignal;
 }
 
 Dali::Actor::OnStageSignalType& Actor::OnStageSignal()
@@ -2236,23 +2281,23 @@ bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra
   bool connected( true );
   Actor* actor = dynamic_cast< Actor* >( object );
 
-  if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) ) // don't want to convert char* to string
+  if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
   {
     actor->TouchedSignal().Connect( tracker, functor );
   }
-  else if( 0 == strcmp( signalName.c_str(), SIGNAL_HOVERED ) )
+  else if( 0 == signalName.compare( SIGNAL_HOVERED ) )
   {
     actor->HoveredSignal().Connect( tracker, functor );
   }
-  else if( 0 == strcmp( signalName.c_str(), SIGNAL_MOUSE_WHEEL_EVENT ) )
+  else if( 0 == signalName.compare( SIGNAL_WHEEL_EVENT ) )
   {
-    actor->MouseWheelEventSignal().Connect( tracker, functor );
+    actor->WheelEventSignal().Connect( tracker, functor );
   }
-  else if( 0 == strcmp( signalName.c_str(), SIGNAL_ON_STAGE ) )
+  else if( 0 == signalName.compare( SIGNAL_ON_STAGE ) )
   {
     actor->OnStageSignal().Connect( tracker, functor );
   }
-  else if( 0 == strcmp( signalName.c_str(), SIGNAL_OFF_STAGE ) )
+  else if( 0 == signalName.compare( SIGNAL_OFF_STAGE ) )
   {
     actor->OffStageSignal().Connect( tracker, functor );
   }
@@ -2272,11 +2317,33 @@ Actor::Actor( DerivedType derivedType )
   mParentOrigin( NULL ),
   mAnchorPoint( NULL ),
   mRelayoutData( NULL ),
-#ifdef DYNAMICS_SUPPORT
-        mDynamicsData( NULL ),
+#ifdef DALI_DYNAMICS_SUPPORT
+  mDynamicsData( NULL ),
 #endif
-        mGestureData( NULL ), mAttachment(), mTargetSize( 0.0f, 0.0f, 0.0f ), mName(), mId( ++mActorCounter ), // actor ID is initialised to start from 1, and 0 is reserved
-        mIsRoot( ROOT_LAYER == derivedType ), mIsRenderable( RENDERABLE == derivedType ), mIsLayer( LAYER == derivedType || ROOT_LAYER == derivedType ), mIsOnStage( false ), mIsDynamicsRoot( false ), mSensitive( true ), mLeaveRequired( false ), mKeyboardFocusable( false ), mDerivedRequiresTouch( false ), mDerivedRequiresHover( false ), mDerivedRequiresMouseWheelEvent( false ), mOnStageSignalled( false ), mInheritOrientation( true ), mInheritScale( true ), mDrawMode( DrawMode::NORMAL ), mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ), mColorMode( Node::DEFAULT_COLOR_MODE )
+  mGestureData( NULL ),
+  mAttachment(),
+  mTargetSize( 0.0f, 0.0f, 0.0f ),
+  mName(),
+  mId( ++mActorCounter ), // actor ID is initialised to start from 1, and 0 is reserved
+  mDepth( 0 ),
+  mIsRoot( ROOT_LAYER == derivedType ),
+  mIsRenderable( RENDERABLE == derivedType ),
+  mIsLayer( LAYER == derivedType || ROOT_LAYER == derivedType ),
+  mIsOnStage( false ),
+  mIsDynamicsRoot( false ),
+  mSensitive( true ),
+  mLeaveRequired( false ),
+  mKeyboardFocusable( false ),
+  mDerivedRequiresTouch( false ),
+  mDerivedRequiresHover( false ),
+  mDerivedRequiresWheelEvent( false ),
+  mOnStageSignalled( false ),
+  mInsideOnSizeSet( false ),
+  mInheritOrientation( true ),
+  mInheritScale( true ),
+  mDrawMode( DrawMode::NORMAL ),
+  mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ),
+  mColorMode( Node::DEFAULT_COLOR_MODE )
 {
 }
 
@@ -2320,7 +2387,7 @@ Actor::~Actor()
     GetEventThreadServices().UnregisterObject( this );
   }
 
-#ifdef DYNAMICS_SUPPORT
+#ifdef DALI_DYNAMICS_SUPPORT
   // Cleanup dynamics
   delete mDynamicsData;
 #endif
@@ -2339,14 +2406,15 @@ Actor::~Actor()
   }
 }
 
-void Actor::ConnectToStage( int index )
+void Actor::ConnectToStage( unsigned int parentDepth, int index )
 {
   // This container is used instead of walking the Actor hierachy.
   // It protects us when the Actor hierachy is modified during OnStageConnectionExternal callbacks.
   ActorContainer connectionList;
 
+
   // This stage is atomic i.e. not interrupted by user callbacks
-  RecursiveConnectToStage( connectionList, index );
+  RecursiveConnectToStage( connectionList, parentDepth+1, index );
 
   // Notify applications about the newly connected actors.
   const ActorIter endIter = connectionList.end();
@@ -2359,11 +2427,12 @@ void Actor::ConnectToStage( int index )
   RelayoutRequest();
 }
 
-void Actor::RecursiveConnectToStage( ActorContainer& connectionList, int index )
+void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned int depth, int index )
 {
   DALI_ASSERT_ALWAYS( !OnStage() );
 
   mIsOnStage = true;
+  mDepth = depth;
 
   ConnectToSceneGraph( index );
 
@@ -2380,7 +2449,7 @@ void Actor::RecursiveConnectToStage( ActorContainer& connectionList, int index )
     for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
     {
       Actor& actor = GetImplementation( *iter );
-      actor.RecursiveConnectToStage( connectionList );
+      actor.RecursiveConnectToStage( connectionList, depth+1 );
     }
   }
 }
@@ -2407,7 +2476,7 @@ void Actor::ConnectToSceneGraph( int index )
     mAttachment->Connect();
   }
 
-#ifdef DYNAMICS_SUPPORT
+#ifdef DALI_DYNAMICS_SUPPORT
   // Notify dynamics
   if( NULL != mDynamicsData )
   {
@@ -2429,7 +2498,7 @@ void Actor::NotifyStageConnection()
   if( OnStage() && !mOnStageSignalled )
   {
     // Notification for external (CustomActor) derived classes
-    OnStageConnectionExternal();
+    OnStageConnectionExternal( mDepth );
 
     if( !mOnStageSignal.Empty() )
     {
@@ -2504,7 +2573,7 @@ void Actor::DisconnectFromSceneGraph()
     mAttachment->Disconnect();
   }
 
-#ifdef DYNAMICS_SUPPORT
+#ifdef DALI_DYNAMICS_SUPPORT
   // Notify dynamics
   if( NULL != mDynamicsData )
   {
@@ -2560,11 +2629,11 @@ unsigned int Actor::GetDefaultPropertyCount() const
 
 void Actor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
 {
-  indices.reserve( DEFAULT_PROPERTY_COUNT );
+  indices.Reserve( DEFAULT_PROPERTY_COUNT );
 
   for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
   {
-    indices.push_back( i );
+    indices.PushBack( i );
   }
 }
 
@@ -2586,7 +2655,7 @@ Property::Index Actor::GetDefaultPropertyIndex( const std::string& name ) const
   for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
   {
     const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
-    if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
+    if( 0 == name.compare( property->name ) )
     {
       index = i;
       break;
@@ -2857,27 +2926,33 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
       break;
     }
 
-    case Dali::Actor::Property::RELAYOUT_ENABLED:
-    {
-      SetRelayoutEnabled( property.Get< bool >() );
-      break;
-    }
-
     case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
     {
-      SetResizePolicy( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount ), Dimension::WIDTH );
+      ResizePolicy::Type type;
+      if( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount, type ) )
+      {
+        SetResizePolicy( type, Dimension::WIDTH );
+      }
       break;
     }
 
     case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
     {
-      SetResizePolicy( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount ), Dimension::HEIGHT );
+      ResizePolicy::Type type;
+      if( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount, type ) )
+      {
+        SetResizePolicy( type, Dimension::HEIGHT );
+      }
       break;
     }
 
     case Dali::Actor::Property::SIZE_SCALE_POLICY:
     {
-      SetSizeScalePolicy( Scripting::GetEnumeration< SizeScalePolicy::Type >( property.Get< std::string >().c_str(), SizeScalePolicy::TypeTable, SizeScalePolicy::TypeTableCount ) );
+      SizeScalePolicy::Type type;
+      if( Scripting::GetEnumeration< SizeScalePolicy::Type >( property.Get< std::string >().c_str(), SizeScalePolicy::TypeTable, SizeScalePolicy::TypeTableCount, type ) )
+      {
+        SetSizeScalePolicy( type );
+      }
       break;
     }
 
@@ -2934,8 +3009,6 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 // TODO: This method needs to be removed
 void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value )
 {
-  OnPropertySet( index, value );
-
   switch( entry.type )
   {
     case Property::BOOLEAN:
@@ -2949,24 +3022,35 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       break;
     }
 
-    case Property::FLOAT:
+    case Property::INTEGER:
     {
-      const AnimatableProperty< float >* property = dynamic_cast< const AnimatableProperty< float >* >( entry.GetSceneGraphProperty() );
+      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<float>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<float>::Bake, value.Get<float>() );
+      SceneGraph::NodePropertyMessage<int>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<int>::Bake, value.Get<int>() );
 
       break;
     }
 
-    case Property::INTEGER:
+    case Property::UNSIGNED_INTEGER:
     {
-      const AnimatableProperty< int >* property = dynamic_cast< const AnimatableProperty< int >* >( entry.GetSceneGraphProperty() );
+      const AnimatableProperty< unsigned int >* property = dynamic_cast< const AnimatableProperty< unsigned 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(), mNode, property, &AnimatableProperty<int>::Bake, value.Get<int>() );
+      SceneGraph::NodePropertyMessage<unsigned int>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<unsigned int>::Bake, value.Get<unsigned 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(), mNode, property, &AnimatableProperty<float>::Bake, value.Get<float>() );
 
       break;
     }
@@ -2977,7 +3061,18 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<Vector2>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
+      if(entry.componentIndex == 0)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector2>::BakeX, value.Get<float>() );
+      }
+      else if(entry.componentIndex == 1)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector2>::BakeY, value.Get<float>() );
+      }
+      else
+      {
+        SceneGraph::NodePropertyMessage<Vector2>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
+      }
 
       break;
     }
@@ -2988,7 +3083,22 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<Vector3>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
+      if(entry.componentIndex == 0)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector3>::BakeX, value.Get<float>() );
+      }
+      else if(entry.componentIndex == 1)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector3>::BakeY, value.Get<float>() );
+      }
+      else if(entry.componentIndex == 2)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector3>::BakeZ, value.Get<float>() );
+      }
+      else
+      {
+        SceneGraph::NodePropertyMessage<Vector3>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
+      }
 
       break;
     }
@@ -2999,7 +3109,26 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
+      if(entry.componentIndex == 0)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector4>::BakeX, value.Get<float>() );
+      }
+      else if(entry.componentIndex == 1)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector4>::BakeY, value.Get<float>() );
+      }
+      else if(entry.componentIndex == 2)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector4>::BakeZ, value.Get<float>() );
+      }
+      else if(entry.componentIndex == 3)
+      {
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector4>::BakeW, value.Get<float>() );
+      }
+      else
+      {
+        SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), mNode, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
+      }
 
       break;
     }
@@ -3315,12 +3444,6 @@ Property::Value Actor::GetDefaultProperty( Property::Index index ) const
       break;
     }
 
-    case Dali::Actor::Property::RELAYOUT_ENABLED:
-    {
-      value = IsRelayoutEnabled();
-      break;
-    }
-
     case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
     {
       value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( GetResizePolicy( Dimension::WIDTH ), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount );
@@ -3406,18 +3529,7 @@ const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index ind
 
   if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
   {
-    AnimatablePropertyMetadata* animatable = FindAnimatableProperty( index );
-    if( !animatable )
-    {
-      const TypeInfo* typeInfo( GetTypeInfo() );
-      if ( typeInfo )
-      {
-        if( Property::INVALID_INDEX != RegisterSceneGraphProperty( typeInfo->GetPropertyName( index ), index, Property::Value( typeInfo->GetPropertyType( index ) ) ) )
-        {
-          animatable = FindAnimatableProperty( index );
-        }
-      }
-    }
+    AnimatablePropertyMetadata* animatable = RegisterAnimatableProperty( index );
     DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
 
     property = animatable->GetSceneGraphProperty();
@@ -3529,18 +3641,7 @@ const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index ind
 
   if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
   {
-    AnimatablePropertyMetadata* animatable = FindAnimatableProperty( index );
-    if( !animatable )
-    {
-      const TypeInfo* typeInfo( GetTypeInfo() );
-      if ( typeInfo )
-      {
-        if( Property::INVALID_INDEX != RegisterSceneGraphProperty( typeInfo->GetPropertyName( index ), index, Property::Value( typeInfo->GetPropertyType( index ) ) ) )
-        {
-          animatable = FindAnimatableProperty( index );
-        }
-      }
-    }
+    AnimatablePropertyMetadata* animatable = RegisterAnimatableProperty( index );
     DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
 
     property = animatable->GetSceneGraphProperty();
@@ -3707,54 +3808,66 @@ int Actor::GetPropertyComponentIndex( Property::Index index ) const
 {
   int componentIndex( Property::INVALID_COMPONENT_INDEX );
 
-  switch( index )
+  if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_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:
+    // check whether the animatable property is registered already, if not then register one.
+    AnimatablePropertyMetadata* animatableProperty = RegisterAnimatableProperty(index);
+    if( animatableProperty )
     {
-      componentIndex = 0;
-      break;
+      componentIndex = animatableProperty->componentIndex;
     }
-
-    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:
+  }
+  else
+  {
+    switch( index )
     {
-      componentIndex = 1;
-      break;
-    }
+      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_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::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::COLOR_ALPHA:
-    {
-      componentIndex = 3;
-      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;
+      }
 
-    default:
-    {
-      // Do nothing
-      break;
+      case Dali::Actor::Property::COLOR_ALPHA:
+      {
+        componentIndex = 3;
+        break;
+      }
+
+      default:
+      {
+        // Do nothing
+        break;
+      }
     }
   }
 
@@ -3773,7 +3886,7 @@ void Actor::SetParent( Actor* parent, int index )
          parent->OnStage() )
     {
       // Instruct each actor to create a corresponding node in the scene graph
-      ConnectToStage( index );
+      ConnectToStage( parent->GetDepth(), index );
     }
   }
   else // parent being set to NULL
@@ -3804,19 +3917,19 @@ SceneGraph::Node* Actor::CreateNode() const
   return Node::New();
 }
 
-bool Actor::DoAction( BaseObject* object, const std::string& actionName, const std::vector< Property::Value >& attributes )
+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 == strcmp( actionName.c_str(), ACTION_SHOW ) ) // dont want to convert char* to string
+    if( 0 == actionName.compare( ACTION_SHOW ) )
     {
       actor->SetVisible( true );
       done = true;
     }
-    else if( 0 == strcmp( actionName.c_str(), ACTION_HIDE ) )
+    else if( 0 == actionName.compare( ACTION_HIDE ) )
     {
       actor->SetVisible( false );
       done = true;
@@ -3826,7 +3939,7 @@ bool Actor::DoAction( BaseObject* object, const std::string& actionName, const s
   return done;
 }
 
-void Actor::EnsureRelayoutData() const
+void Actor::EnsureRelayoutData()
 {
   // Assign relayout data.
   if( !mRelayoutData )
@@ -3939,22 +4052,25 @@ void Actor::SetPadding( const Vector2& padding, Dimension::Type dimension )
 
 Vector2 Actor::GetPadding( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
-
-  // If more than one dimension is requested, just return the first one found
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  if ( mRelayoutData )
   {
-    if( ( dimension & ( 1 << i ) ) )
+    // If more than one dimension is requested, just return the first one found
+    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      return mRelayoutData->dimensionPadding[ i ];
+      if( ( dimension & ( 1 << i ) ) )
+      {
+        return mRelayoutData->dimensionPadding[ i ];
+      }
     }
   }
 
-  return Vector2( 0.0f, 0.0f );   // Default
+  return GetDefaultDimensionPadding();
 }
 
 void Actor::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension )
 {
+  EnsureRelayoutData();
+
   for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
   {
     if( dimension & ( 1 << i ) )
@@ -3966,21 +4082,52 @@ void Actor::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension )
 
 bool Actor::IsLayoutNegotiated( Dimension::Type dimension ) const
 {
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  if ( mRelayoutData )
   {
-    if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionNegotiated[ i ] )
+    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      return true;
+      if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionNegotiated[ i ] )
+      {
+        return true;
+      }
     }
   }
 
   return false;
 }
 
-float Actor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
+float Actor::GetHeightForWidthBase( float width )
 {
-  // Could be overridden in derived classes.
-  return CalculateChildSizeBase( child, dimension );
+  float height = 0.0f;
+
+  const Vector3 naturalSize = GetNaturalSize();
+  if( naturalSize.width > 0.0f )
+  {
+    height = naturalSize.height * width / naturalSize.width;
+  }
+  else // we treat 0 as 1:1 aspect ratio
+  {
+    height = width;
+  }
+
+  return height;
+}
+
+float Actor::GetWidthForHeightBase( float height )
+{
+  float width = 0.0f;
+
+  const Vector3 naturalSize = GetNaturalSize();
+  if( naturalSize.height > 0.0f )
+  {
+    width = naturalSize.width * height / naturalSize.height;
+  }
+  else // we treat 0 as 1:1 aspect ratio
+  {
+    width = height;
+  }
+
+  return width;
 }
 
 float Actor::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
@@ -4010,32 +4157,22 @@ float Actor::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type d
   }
 }
 
-float Actor::GetHeightForWidth( float width )
+float Actor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
 {
-  // Could be overridden in derived classes.
-  float height = 0.0f;
-
-  const Vector3 naturalSize = GetNaturalSize();
-  if( naturalSize.width > 0.0f )
-  {
-    height = naturalSize.height * width / naturalSize.width;
-  }
+  // Can be overridden in derived class
+  return CalculateChildSizeBase( child, dimension );
+}
 
-  return height;
+float Actor::GetHeightForWidth( float width )
+{
+  // Can be overridden in derived class
+  return GetHeightForWidthBase( width );
 }
 
 float Actor::GetWidthForHeight( float height )
 {
-  // Could be overridden in derived classes.
-  float width = 0.0f;
-
-  const Vector3 naturalSize = GetNaturalSize();
-  if( naturalSize.height > 0.0f )
-  {
-    width = naturalSize.width * height / naturalSize.height;
-  }
-
-  return width;
+  // Can be overridden in derived class
+  return GetWidthForHeightBase( height );
 }
 
 float Actor::GetLatestSize( Dimension::Type dimension ) const
@@ -4152,7 +4289,7 @@ float Actor::CalculateSize( Dimension::Type dimension, const Vector2& maximumSiz
   return 0.0f;  // Default
 }
 
-float Actor::ConstrainDimension( float size, Dimension::Type dimension )
+float Actor::ClampDimension( float size, Dimension::Type dimension )
 {
   const float minSize = GetMinimumSize( dimension );
   const float maxSize = GetMaximumSize( dimension );
@@ -4220,7 +4357,7 @@ void Actor::NegotiateDimension( Dimension::Type dimension, const Vector2& alloca
       OnCalculateRelayoutSize( dimension );
 
       // All dependencies checked, calculate the size and set negotiated flag
-      const float newSize = ConstrainDimension( CalculateSize( dimension, allocatedSize ), dimension );
+      const float newSize = ClampDimension( CalculateSize( dimension, allocatedSize ), dimension );
 
       SetNegotiatedDimension( newSize, dimension );
       SetLayoutNegotiated( true, dimension );
@@ -4380,26 +4517,6 @@ void Actor::RelayoutRequest( Dimension::Type dimension )
   }
 }
 
-void Actor::RelayoutRequestTree()
-{
-  Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get();
-  if( relayoutController )
-  {
-    Dali::Actor self( this );
-    relayoutController->RequestRelayoutTree( self );
-  }
-}
-
-void Actor::PropagateRelayoutFlags()
-{
-  Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get();
-  if( relayoutController )
-  {
-    Dali::Actor self( this );
-    relayoutController->PropagateFlags( self );
-  }
-}
-
 void Actor::OnCalculateRelayoutSize( Dimension::Type dimension )
 {
 }
@@ -4429,9 +4546,12 @@ void Actor::SetPreferredSize( const Vector2& size )
 
 Vector2 Actor::GetPreferredSize() const
 {
-  EnsureRelayoutData();
+  if ( mRelayoutData )
+  {
+    return mRelayoutData->preferredSize;
+  }
 
-  return mRelayoutData->preferredSize;
+  return GetDefaultPreferredSize();
 }
 
 void Actor::SetMinimumSize( float size, Dimension::Type dimension )
@@ -4451,13 +4571,14 @@ void Actor::SetMinimumSize( float size, Dimension::Type dimension )
 
 float Actor::GetMinimumSize( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
-
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  if ( mRelayoutData )
   {
-    if( dimension & ( 1 << i ) )
+    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      return mRelayoutData->minimumSize[ i ];
+      if( dimension & ( 1 << i ) )
+      {
+        return mRelayoutData->minimumSize[ i ];
+      }
     }
   }
 
@@ -4481,17 +4602,18 @@ void Actor::SetMaximumSize( float size, Dimension::Type dimension )
 
 float Actor::GetMaximumSize( Dimension::Type dimension ) const
 {
-  EnsureRelayoutData();
-
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  if ( mRelayoutData )
   {
-    if( dimension & ( 1 << i ) )
+    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
-      return mRelayoutData->maximumSize[ i ];
+      if( dimension & ( 1 << i ) )
+      {
+        return mRelayoutData->maximumSize[ i ];
+      }
     }
   }
 
-  return 0.0f;  // Default
+  return FLT_MAX;  // Default
 }
 
 } // namespace Internal