Cleaning up the property framework; removal of duplicate methods and incorrect assers
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.cpp
index 8c3116b..d9a67fe 100644 (file)
@@ -1,18 +1,19 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/animation/constraint-impl.h>
 #include <dali/internal/event/common/projection.h>
 #include <dali/internal/update/common/animatable-property.h>
-#include <dali/internal/update/common/property-owner-messages.h>
 #include <dali/internal/update/nodes/node-messages.h>
 #include <dali/internal/update/nodes/node-declarations.h>
 #include <dali/internal/update/animation/scene-graph-constraint.h>
-#include <dali/internal/event/effects/shader-effect-impl.h>
+#include <dali/internal/event/events/actor-gesture-data.h>
 #include <dali/internal/common/message.h>
 #include <dali/integration-api/debug.h>
 
 #include <dali/internal/event/dynamics/dynamics-world-impl.h>
 #endif
 
-#include <dali/internal/event/events/pan-gesture-detector-impl.h>
-#include <dali/internal/event/events/pinch-gesture-detector-impl.h>
-#include <dali/internal/event/events/long-press-gesture-detector-impl.h>
-#include <dali/internal/event/events/tap-gesture-detector-impl.h>
-
 using Dali::Internal::SceneGraph::Node;
 using Dali::Internal::SceneGraph::AnimatableProperty;
 using Dali::Internal::SceneGraph::PropertyBase;
-using Dali::Internal::SceneGraph::Shader;
-
-using namespace std;
 
 namespace Dali
 {
@@ -109,12 +101,11 @@ const Property::Index Actor::WORLD_MATRIX               = 34;
 const Property::Index Actor::NAME                       = 35;
 const Property::Index Actor::SENSITIVE                  = 36;
 const Property::Index Actor::LEAVE_REQUIRED             = 37;
-const Property::Index Actor::INHERIT_SHADER_EFFECT      = 38;
-const Property::Index Actor::INHERIT_ROTATION           = 39;
-const Property::Index Actor::INHERIT_SCALE              = 40;
-const Property::Index Actor::COLOR_MODE                 = 41;
-const Property::Index Actor::POSITION_INHERITANCE       = 42;
-const Property::Index Actor::DRAW_MODE                  = 43;
+const Property::Index Actor::INHERIT_ROTATION           = 38;
+const Property::Index Actor::INHERIT_SCALE              = 39;
+const Property::Index Actor::COLOR_MODE                 = 40;
+const Property::Index Actor::POSITION_INHERITANCE       = 41;
+const Property::Index Actor::DRAW_MODE                  = 42;
 
 namespace // unnamed namespace
 {
@@ -164,7 +155,6 @@ const Internal::PropertyDetails DEFAULT_PROPERTY_DETAILS[] =
   { "name",                   Property::STRING,   true,    false,   false },  // NAME
   { "sensitive",              Property::BOOLEAN,  true,    false,   false },  // SENSITIVE
   { "leave-required",         Property::BOOLEAN,  true,    false,   false },  // LEAVE_REQUIRED
-  { "inherit-shader-effect",  Property::BOOLEAN,  true,    false,   false },  // INHERIT_SHADER_EFFECT
   { "inherit-rotation",       Property::BOOLEAN,  true,    false,   false },  // INHERIT_ROTATION
   { "inherit-scale",          Property::BOOLEAN,  true,    false,   false },  // INHERIT_SCALE
   { "color-mode",             Property::STRING,   true,    false,   false },  // COLOR_MODE
@@ -181,90 +171,6 @@ namespace Internal
 unsigned int Actor::mActorCounter = 0;
 ActorContainer Actor::mNullChildren;
 
-// Encapsulate actor related gesture information
-struct GestureData
-{
-  /**
-   * Constructor
-   */
-  GestureData()
-  : gesturesRequired( Gesture::Type( 0 ) ),
-    panDetectors( NULL ),
-    pinchDetectors( NULL ),
-    longPressDetectors( NULL ),
-    tapDetectors( NULL )
-  {
-  }
-
-  /**
-   * Destructor
-   */
-  ~GestureData()
-  {
-    delete panDetectors;
-    delete pinchDetectors;
-    delete longPressDetectors;
-    delete tapDetectors;
-  }
-
-  /**
-   * Checks if the containers in GestureData are empty
-   */
-  bool Empty() const
-  {
-    return !panDetectors       &&
-           !pinchDetectors     &&
-           !longPressDetectors &&
-           !tapDetectors;
-  }
-
-  /**
-   * Template to add a detector to the appropriate container. Dynamically allocates the container
-   * only if it is used.
-   */
-  template< typename DetectorType, typename ContainerType >
-  void AddDetector( ContainerType*& containerPtr, GestureDetector* detector )
-  {
-    if ( NULL == containerPtr )
-    {
-      containerPtr = new ContainerType;
-    }
-
-    containerPtr->push_back( static_cast< DetectorType* >( detector ) );
-    gesturesRequired = Gesture::Type( gesturesRequired | detector->GetType() );
-  }
-
-  /**
-   * Template to remove a detector from the appropriate container. Deletes the container if it is
-   * no longer required.
-   */
-  template< typename ContainerType >
-  void RemoveDetector( ContainerType*& containerPtr, GestureDetector* detector )
-  {
-    if ( NULL != containerPtr )
-    {
-      ContainerType& container( *containerPtr );
-      typename ContainerType::iterator match( std::remove( container.begin(), container.end(), detector ) );
-      DALI_ASSERT_DEBUG( match != container.end() && "Actor does not have the detector" );
-      container.erase( match, container.end() );
-
-      if ( container.empty() )
-      {
-        gesturesRequired = Gesture::Type( gesturesRequired & ~detector->GetType() );
-        delete containerPtr;
-        containerPtr = NULL;
-      }
-    }
-  }
-
-  Gesture::Type gesturesRequired;
-
-  PanGestureDetectorContainer*       panDetectors;
-  PinchGestureDetectorContainer*     pinchDetectors;
-  LongPressGestureDetectorContainer* longPressDetectors;
-  TapGestureDetectorContainer*       tapDetectors;
-};
-
 #ifdef DYNAMICS_SUPPORT
 
 // Encapsulate actor related dynamics data
@@ -300,17 +206,16 @@ BaseHandle CreateActor()
 TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor );
 
 SignalConnectorType signalConnector1(mType, Dali::Actor::SIGNAL_TOUCHED,    &Actor::DoConnectSignal);
-SignalConnectorType signalConnector2(mType, Dali::Actor::SIGNAL_SET_SIZE,   &Actor::DoConnectSignal);
-SignalConnectorType signalConnector3(mType, Dali::Actor::SIGNAL_ON_STAGE,   &Actor::DoConnectSignal);
-SignalConnectorType signalConnector4(mType, Dali::Actor::SIGNAL_OFF_STAGE,  &Actor::DoConnectSignal);
+SignalConnectorType signalConnector2(mType, Dali::Actor::SIGNAL_HOVERED,    &Actor::DoConnectSignal);
+SignalConnectorType signalConnector3(mType, Dali::Actor::SIGNAL_SET_SIZE,   &Actor::DoConnectSignal);
+SignalConnectorType signalConnector4(mType, Dali::Actor::SIGNAL_ON_STAGE,   &Actor::DoConnectSignal);
+SignalConnectorType signalConnector5(mType, Dali::Actor::SIGNAL_OFF_STAGE,  &Actor::DoConnectSignal);
 
 TypeAction a1(mType, Dali::Actor::ACTION_SHOW, &Actor::DoAction);
 TypeAction a2(mType, Dali::Actor::ACTION_HIDE, &Actor::DoAction);
 
 }
 
-Actor::DefaultPropertyLookup* Actor::mDefaultPropertyLookup = NULL;
-
 ActorPtr Actor::New()
 {
   ActorPtr actor( new Actor( BASIC ) );
@@ -422,6 +327,46 @@ void Actor::Add(Actor& child)
   }
 }
 
+void Actor::Insert(unsigned int index, Actor& child)
+{
+  DALI_ASSERT_ALWAYS( this != &child && "Cannot add actor to itself" );
+  DALI_ASSERT_ALWAYS( !child.IsRoot() && "Cannot add root actor" );
+
+  if( !mChildren )
+  {
+    mChildren = new ActorContainer;
+  }
+
+  Actor* const oldParent( child.mParent );
+
+  // since an explicit position has been given, always insert, even if already a child
+  if( oldParent )
+  {
+    oldParent->Remove( child ); // This causes OnChildRemove callback
+  }
+
+  // Guard against Add() during previous OnChildRemove callback
+  if ( !child.mParent )
+  {
+    // Do this first, since user callbacks from within SetParent() may need to remove child
+    if (index < GetChildCount())
+    {
+      ActorIter it = mChildren->begin();
+      std::advance(it, index);
+      mChildren->insert(it, Dali::Actor(&child));
+    }
+    else
+    {
+      mChildren->push_back(Dali::Actor(&child));
+    }
+    // SetParent asserts that child can be added
+    child.SetParent(this, index);
+
+    // Notification for derived classes
+    OnChildAdd(child);
+  }
+}
+
 void Actor::Remove(Actor& child)
 {
   DALI_ASSERT_ALWAYS( this != &child && "Cannot remove actor from itself" );
@@ -1142,31 +1087,44 @@ void Actor::SetSize(float width, float height, float depth)
 
 void Actor::SetSize(const Vector2& size)
 {
-  Vector3 volume( size );
-  volume.z = std::min( size.width, size.height );
-  SetSize( volume );
+  SetSize( Vector3( size.width, size.height, CalculateSizeZ( size ) ) );
+}
+
+float Actor::CalculateSizeZ( const Vector2& size ) const
+{
+  return std::min( size.width, size.height );
 }
 
 void Actor::SetSize(const Vector3& size)
 {
   if( NULL != mNode )
   {
+    mSize = size;
+
     // mNode is being used in a separate thread; queue a message to set the value & base value
-    SceneGraph::NodePropertyMessage<Vector3>::Send( mStage->GetUpdateManager(), mNode, &mNode->mSize, &AnimatableProperty<Vector3>::Bake, size );
+    SceneGraph::NodePropertyMessage<Vector3>::Send( mStage->GetUpdateManager(), mNode, &mNode->mSize, &AnimatableProperty<Vector3>::Bake, mSize );
 
     // Notification for derived classes
-    OnSizeSet(size);
+    OnSizeSet( mSize );
 
     // Emit signal for application developer
 
     if( !mSetSizeSignalV2.Empty() )
     {
       Dali::Actor handle( this );
-      mSetSizeSignalV2.Emit( handle, size );
+      mSetSizeSignalV2.Emit( handle, mSize );
     }
   }
 }
 
+void Actor::NotifySizeAnimation(Animation& animation, const Vector3& targetSize)
+{
+  mSize = targetSize;
+
+  // Notify deriving classes
+  OnSizeAnimation( animation, targetSize );
+}
+
 void Actor::SetWidth( float width )
 {
   if( NULL != mNode )
@@ -1194,89 +1152,28 @@ void Actor::SetDepth( float depth )
   }
 }
 
-const Vector3& Actor::GetCurrentSize() const
-{
-  if( NULL != mNode )
-  {
-    // mNode is being used in a separate thread; copy the value from the previous update
-    return mNode->GetSize( mStage->GetEventBufferIndex() );
-  }
-
-  return Vector3::ZERO;
-}
-
-void Actor::SetInheritShaderEffect(bool inherit)
+const Vector3& Actor::GetSize() const
 {
-  if( NULL != mNode )
-  {
-    // mNode is being used in a separate thread; queue a message to set the value
-    SetInheritShaderMessage( mStage->GetUpdateInterface(), *mNode, inherit );
-  }
+  return mSize;
 }
 
-bool Actor::GetInheritShaderEffect() const
+const Vector3& Actor::GetCurrentSize() const
 {
   if( NULL != mNode )
   {
     // mNode is being used in a separate thread; copy the value from the previous update
-    return mNode->GetInheritShader();
+    return mNode->GetSize( mStage->GetEventBufferIndex() );
   }
 
-  return true;
+  return Vector3::ZERO;
 }
 
-void Actor::SetShaderEffect(ShaderEffect& effect)
+Vector3 Actor::GetNaturalSize() const
 {
-  if ( OnStage() )
-  {
-    if (mShaderEffect)
-    {
-      mShaderEffect->Disconnect();
-    }
-
-    mShaderEffect = ShaderEffectPtr(&effect);
-
-    const Shader& shader = dynamic_cast<const Shader&>( *mShaderEffect->GetSceneObject() );
-
-    if( NULL != mNode )
-    {
-      // mNode is being used in a separate thread; queue a message to apply shader
-      ApplyShaderMessage( mStage->GetUpdateInterface(), *mNode, shader );
-    }
-
-    mShaderEffect->Connect();
-  }
-  else
-  {
-    mShaderEffect = ShaderEffectPtr(&effect);
-  }
-  // Effects can only be applied when the Node is connected to scene-graph
+  // It is up to deriving classes to return the appropriate natural size
+  return Vector3( 0.0f, 0.0f, 0.0f );
 }
 
-ShaderEffectPtr Actor::GetShaderEffect() const
-{
-  return mShaderEffect;
-}
-
-void Actor::RemoveShaderEffect()
-{
-  if ( OnStage() )
-  {
-    if( NULL != mNode )
-    {
-      // mNode is being used in a separate thread; queue a message to remove shader
-      RemoveShaderMessage( mStage->GetUpdateInterface(), *mNode );
-    }
-
-    // Notify shader effect
-    if (mShaderEffect)
-    {
-      mShaderEffect->Disconnect();
-    }
-  }
-
-  mShaderEffect.Reset();
-}
 
 #ifdef DYNAMICS_SUPPORT
 
@@ -1962,6 +1859,11 @@ bool Actor::GetTouchRequired() const
   return !mTouchedSignalV2.Empty() || mDerivedRequiresTouch;
 }
 
+bool Actor::GetHoverRequired() const
+{
+  return !mHoveredSignalV2.Empty() || mDerivedRequiresHover;
+}
+
 bool Actor::GetMouseWheelEventRequired() const
 {
   return !mMouseWheelEventSignalV2.Empty() || mDerivedRequiresMouseWheelEvent;
@@ -1975,105 +1877,55 @@ bool Actor::IsHittable() const
          IsNodeConnected();
 }
 
-void Actor::AddGestureDetector( GestureDetector& detector )
+ActorGestureData& Actor::GetGestureData()
 {
+  // Likely scenario is that once gesture-data is created for this actor, the actor will require
+  // that gesture for its entire life-time so no need to destroy it until the actor is destroyed
   if ( NULL == mGestureData )
   {
-    mGestureData = new GestureData;
-  }
-
-  const Gesture::Type type( detector.GetType() );
-  switch ( type )
-  {
-    case Gesture::Pan:
-    {
-      mGestureData->AddDetector< PanGestureDetector, PanGestureDetectorContainer >( mGestureData->panDetectors, &detector );
-      break;
-    }
-
-    case Gesture::Pinch:
-    {
-      mGestureData->AddDetector< PinchGestureDetector, PinchGestureDetectorContainer >( mGestureData->pinchDetectors, &detector );
-      break;
-    }
-
-    case Gesture::LongPress:
-    {
-      mGestureData->AddDetector< LongPressGestureDetector, LongPressGestureDetectorContainer >( mGestureData->longPressDetectors, &detector );
-      break;
-    }
-
-    case Gesture::Tap:
-    {
-      mGestureData->AddDetector< TapGestureDetector, TapGestureDetectorContainer >( mGestureData->tapDetectors, &detector );
-      break;
-    }
+    mGestureData = new ActorGestureData;
   }
+  return *mGestureData;
 }
 
-void Actor::RemoveGestureDetector( GestureDetector& detector )
+bool Actor::IsGestureRequred( Gesture::Type type ) const
 {
-  if ( NULL != mGestureData )
-  {
-    switch ( detector.GetType() )
-    {
-      case Gesture::Pan:
-      {
-        mGestureData->RemoveDetector< PanGestureDetectorContainer >( mGestureData->panDetectors, &detector );
-        break;
-      }
-
-      case Gesture::Pinch:
-      {
-        mGestureData->RemoveDetector< PinchGestureDetectorContainer >( mGestureData->pinchDetectors, &detector );
-        break;
-      }
-
-      case Gesture::LongPress:
-      {
-        mGestureData->RemoveDetector< LongPressGestureDetectorContainer >( mGestureData->longPressDetectors, &detector );
-        break;
-      }
+  return mGestureData && mGestureData->IsGestureRequred( type );
+}
 
-      case Gesture::Tap:
-      {
-        mGestureData->RemoveDetector< TapGestureDetectorContainer >( mGestureData->tapDetectors, &detector );
-        break;
-      }
-    }
+bool Actor::EmitTouchEventSignal(const TouchEvent& event)
+{
+  bool consumed = false;
 
-    if ( mGestureData->Empty() )
-    {
-      delete mGestureData;
-      mGestureData = NULL;
-    }
+  if ( !mTouchedSignalV2.Empty() )
+  {
+    Dali::Actor handle( this );
+    consumed = mTouchedSignalV2.Emit( handle, event );
   }
-}
 
-bool Actor::IsGestureRequred( Gesture::Type type ) const
-{
-  bool required( false );
-  if ( NULL != mGestureData )
+  if (!consumed)
   {
-    required = type & mGestureData->gesturesRequired;
+    // Notification for derived classes
+    consumed = OnTouchEvent( event );
   }
-  return required;
+
+  return consumed;
 }
 
-bool Actor::EmitTouchEventSignal(const TouchEvent& event)
+bool Actor::EmitHoverEventSignal(const HoverEvent& event)
 {
   bool consumed = false;
 
-  if ( !mTouchedSignalV2.Empty() )
+  if ( !mHoveredSignalV2.Empty() )
   {
     Dali::Actor handle( this );
-    consumed = mTouchedSignalV2.Emit( handle, event );
+    consumed = mHoveredSignalV2.Emit( handle, event );
   }
 
   if (!consumed)
   {
     // Notification for derived classes
-    consumed = OnTouchEvent( event );
+    consumed = OnHoverEvent( event );
   }
 
   return consumed;
@@ -2103,6 +1955,11 @@ Dali::Actor::TouchSignalV2& Actor::TouchedSignal()
   return mTouchedSignalV2;
 }
 
+Dali::Actor::HoverSignalV2& Actor::HoveredSignal()
+{
+  return mHoveredSignalV2;
+}
+
 Dali::Actor::MouseWheelEventSignalV2& Actor::MouseWheelEventSignal()
 {
   return mMouseWheelEventSignalV2;
@@ -2132,6 +1989,10 @@ bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra
   {
     actor->TouchedSignal().Connect( tracker, functor );
   }
+  else if(Dali::Actor::SIGNAL_HOVERED == signalName)
+  {
+    actor->HoveredSignal().Connect( tracker, functor );
+  }
   else if(Dali::Actor::SIGNAL_MOUSE_WHEEL_EVENT == signalName)
   {
     actor->MouseWheelEventSignal().Connect( tracker, functor );
@@ -2169,7 +2030,7 @@ Actor::Actor( DerivedType derivedType )
 #endif
   mGestureData( NULL ),
   mAttachment(),
-  mShaderEffect(),
+  mSize( 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 ),
@@ -2181,6 +2042,7 @@ Actor::Actor( DerivedType derivedType )
   mLeaveRequired( false ),
   mKeyboardFocusable( false ),
   mDerivedRequiresTouch( false ),
+  mDerivedRequiresHover( false ),
   mDerivedRequiresMouseWheelEvent( false ),
   mOnStageSignalled( false ),
   mInheritRotation( true ),
@@ -2201,16 +2063,6 @@ void Actor::Initialize()
   AddNodeMessage( mStage->GetUpdateManager(), *node ); // Pass ownership to scene-graph
   mNode = node; // Keep raw-pointer to Node
 
-  if(!mDefaultPropertyLookup)
-  {
-    mDefaultPropertyLookup = new DefaultPropertyLookup();
-
-    for (int i=0; i<DEFAULT_PROPERTY_COUNT; ++i)
-    {
-      (*mDefaultPropertyLookup)[DEFAULT_PROPERTY_DETAILS[i].name] = i;
-    }
-  }
-
   OnInitialize();
 
   RegisterObject();
@@ -2256,14 +2108,14 @@ Actor::~Actor()
   delete mAnchorPoint;
 }
 
-void Actor::ConnectToStage( Stage& stage )
+void Actor::ConnectToStage( Stage& stage, 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( stage, connectionList );
+  RecursiveConnectToStage( stage, connectionList, index );
 
   // Notify applications about the newly connected actors.
   const ActorIter endIter = connectionList.end();
@@ -2274,13 +2126,13 @@ void Actor::ConnectToStage( Stage& stage )
   }
 }
 
-void Actor::RecursiveConnectToStage( Stage& stage, ActorContainer& connectionList )
+void Actor::RecursiveConnectToStage( Stage& stage, ActorContainer& connectionList, int index )
 {
   DALI_ASSERT_ALWAYS( !OnStage() );
 
   mIsOnStage = true;
 
-  ConnectToSceneGraph();
+  ConnectToSceneGraph(index);
 
   // Notification for internal derived classes
   OnStageConnectionInternal();
@@ -2306,7 +2158,7 @@ void Actor::RecursiveConnectToStage( Stage& stage, ActorContainer& connectionLis
  * The child must connect its Node to the parent's Node.
  * This is resursive; the child calls ConnectToStage() for its children.
  */
-void Actor::ConnectToSceneGraph()
+void Actor::ConnectToSceneGraph(int index)
 {
   DALI_ASSERT_DEBUG( mNode != NULL);
   DALI_ASSERT_DEBUG( mParent != NULL);
@@ -2315,21 +2167,7 @@ void Actor::ConnectToSceneGraph()
   if( NULL != mNode )
   {
     // Reparent Node in next Update
-    ConnectNodeMessage( mStage->GetUpdateManager(), *(mParent->mNode), *mNode );
-  }
-
-  if (mShaderEffect)
-  {
-    const Shader& shader = dynamic_cast<const Shader&>( *mShaderEffect->GetSceneObject() );
-
-    if( NULL != mNode )
-    {
-      // Effects can only be applied when the node is on-stage
-      ApplyShaderMessage( mStage->GetUpdateInterface(), *mNode, shader );
-    }
-
-    // Notify shader effect
-    mShaderEffect->Connect();
+    ConnectNodeMessage( mStage->GetUpdateManager(), *(mParent->mNode), *mNode, index );
   }
 
   // Notify attachment
@@ -2426,12 +2264,6 @@ void Actor::DisconnectFromSceneGraph()
   // Notification for ProxyObject::Observers
   OnSceneObjectRemove();
 
-  // Notify shader effect
-  if (mShaderEffect)
-  {
-    mShaderEffect->Disconnect();
-  }
-
   // Notify attachment
   if (mAttachment)
   {
@@ -2487,11 +2319,6 @@ bool Actor::IsNodeConnected() const
   return connected;
 }
 
-bool Actor::IsSceneObjectRemovable() const
-{
-  return false;
-}
-
 unsigned int Actor::GetDefaultPropertyCount() const
 {
   return DEFAULT_PROPERTY_COUNT;
@@ -2507,7 +2334,7 @@ void Actor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
   }
 }
 
-const std::string& Actor::GetDefaultPropertyName( Property::Index index ) const
+const char* Actor::GetDefaultPropertyName( Property::Index index ) const
 {
   if( index < DEFAULT_PROPERTY_COUNT )
   {
@@ -2515,8 +2342,7 @@ const std::string& Actor::GetDefaultPropertyName( Property::Index index ) const
   }
   else
   {
-    // index out of range..return empty string
-    return String::EMPTY;
+    return NULL;
   }
 }
 
@@ -2524,13 +2350,15 @@ Property::Index Actor::GetDefaultPropertyIndex(const std::string& name) const
 {
   Property::Index index = Property::INVALID_INDEX;
 
-  DALI_ASSERT_DEBUG( NULL != mDefaultPropertyLookup );
-
   // Look for name in default properties
-  DefaultPropertyLookup::const_iterator result = mDefaultPropertyLookup->find( name );
-  if ( mDefaultPropertyLookup->end() != result )
+  for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
   {
-    index = result->second;
+    const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
+    if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
+    {
+      index = i;
+      break;
+    }
   }
 
   return index;
@@ -2769,12 +2597,6 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
       break;
     }
 
-    case Dali::Actor::INHERIT_SHADER_EFFECT:
-    {
-      SetInheritShaderEffect( property.Get<bool>() );
-      break;
-    }
-
     case Dali::Actor::INHERIT_ROTATION:
     {
       SetInheritRotation( property.Get<bool>() );
@@ -2807,94 +2629,122 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
 
     default:
     {
-      DALI_ASSERT_ALWAYS(false && "Actor::Property is out of bounds"); // should not come here
+      // this can happen in the case of a non-animatable default property so just do nothing
       break;
     }
   }
 }
 
-void Actor::SetCustomProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value )
+// TODO: This method needs to be removed
+void Actor::SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value )
 {
-  // TODO: This should be deprecated
   OnPropertySet(index, value);
 
-  if(entry.IsAnimatable())
+  switch ( entry.type )
   {
-    // TODO: ADD MATRIX & MATRIX3 types
+    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( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<bool>::Bake, value.Get<bool>() );
 
-    switch ( entry.type )
+      break;
+    }
+
+    case Property::FLOAT:
     {
-      case Property::BOOLEAN:
-      {
-        AnimatableProperty<bool>* property = dynamic_cast< AnimatableProperty<bool>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+      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<bool>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<bool>::Bake, value.Get<bool>() );
+      // property is being used in a separate thread; queue a message to set the property
+      SceneGraph::NodePropertyMessage<float>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<float>::Bake, value.Get<float>() );
 
-        break;
-      }
+      break;
+    }
 
-      case Property::FLOAT:
-      {
-        AnimatableProperty<float>* property = dynamic_cast< AnimatableProperty<float>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+    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<float>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<float>::Bake, value.Get<float>() );
+      // property is being used in a separate thread; queue a message to set the property
+      SceneGraph::NodePropertyMessage<int>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<int>::Bake, value.Get<int>() );
 
-        break;
-      }
+      break;
+    }
 
-      case Property::VECTOR2:
-      {
-        AnimatableProperty<Vector2>* property = dynamic_cast< AnimatableProperty<Vector2>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+    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
-        SceneGraph::NodePropertyMessage<Vector2>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
+      // property is being used in a separate thread; queue a message to set the property
+      SceneGraph::NodePropertyMessage<Vector2>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
 
-        break;
-      }
+      break;
+    }
 
-      case Property::VECTOR3:
-      {
-        AnimatableProperty<Vector3>* property = dynamic_cast< AnimatableProperty<Vector3>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+    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
-        SceneGraph::NodePropertyMessage<Vector3>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
+      // property is being used in a separate thread; queue a message to set the property
+      SceneGraph::NodePropertyMessage<Vector3>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
 
-        break;
-      }
+      break;
+    }
 
-      case Property::VECTOR4:
-      {
-        AnimatableProperty<Vector4>* property = dynamic_cast< AnimatableProperty<Vector4>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+    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
-        SceneGraph::NodePropertyMessage<Vector4>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
+      // property is being used in a separate thread; queue a message to set the property
+      SceneGraph::NodePropertyMessage<Vector4>::Send( mStage->GetUpdateManager(), mNode, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
 
-        break;
-      }
+      break;
+    }
 
-      case Property::ROTATION:
-      {
-        AnimatableProperty<Quaternion>* property = dynamic_cast< AnimatableProperty<Quaternion>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+    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( mStage->GetUpdateManager(), mNode, property,&AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
+      // property is being used in a separate thread; queue a message to set the property
+      SceneGraph::NodePropertyMessage<Quaternion>::Send( mStage->GetUpdateManager(), mNode, property,&AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
 
-        break;
-      }
+      break;
+    }
 
-      default:
-      {
-        DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should not come here
-        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( mStage->GetUpdateManager(), mNode, 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( mStage->GetUpdateManager(), mNode, property,&AnimatableProperty<Matrix3>::Bake,  value.Get<Matrix3>() );
+
+      break;
+    }
+
+    default:
+    {
+      DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should not come here
+      break;
     }
   }
 }
@@ -3133,12 +2983,6 @@ Property::Value Actor::GetDefaultProperty(Property::Index index) const
       break;
     }
 
-    case Dali::Actor::INHERIT_SHADER_EFFECT:
-    {
-      value = GetInheritShaderEffect();
-      break;
-    }
-
     case Dali::Actor::INHERIT_ROTATION:
     {
       value = IsRotationInherited();
@@ -3179,13 +3023,9 @@ Property::Value Actor::GetDefaultProperty(Property::Index index) const
   return value;
 }
 
-void Actor::InstallSceneObjectProperty( PropertyBase& newProperty, const std::string& name, unsigned int index )
+const SceneGraph::PropertyOwner* Actor::GetPropertyOwner() const
 {
-  if( NULL != mNode )
-  {
-    // mNode is being used in a separate thread; queue a message to add the property
-    InstallCustomPropertyMessage( mStage->GetUpdateInterface(), *mNode, newProperty ); // Message takes ownership
-  }
+  return mNode;
 }
 
 const SceneGraph::PropertyOwner* Actor::GetSceneObject() const
@@ -3208,11 +3048,10 @@ const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index ind
 
   if ( static_cast<unsigned int>(index) >= DEFAULT_PROPERTY_MAX_COUNT )
   {
-    CustomPropertyLookup::const_iterator entry = GetCustomPropertyLookup().find( index );
-
-    DALI_ASSERT_ALWAYS( GetCustomPropertyLookup().end() != entry && "index is invalid" );
+    CustomProperty* custom = FindCustomProperty( index );
+    DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
 
-    property = dynamic_cast<const PropertyBase*>( entry->second.GetSceneGraphProperty() );
+    property = custom->GetSceneGraphProperty();
   }
   else if( NULL != mNode )
   {
@@ -3314,11 +3153,9 @@ const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index ind
 
   if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
   {
-    CustomPropertyLookup::const_iterator entry = GetCustomPropertyLookup().find( index );
-
-    DALI_ASSERT_ALWAYS( GetCustomPropertyLookup().end() != entry && "property index is invalid" );
-
-    property = entry->second.GetSceneGraphProperty();
+    CustomProperty* custom = FindCustomProperty( index );
+    DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
+    property = custom->GetSceneGraphProperty();
   }
   else if( NULL != mNode )
   {
@@ -3530,7 +3367,7 @@ int Actor::GetPropertyComponentIndex( Property::Index index ) const
   return componentIndex;
 }
 
-void Actor::SetParent(Actor* parent)
+void Actor::SetParent(Actor* parent, int index)
 {
   if( parent )
   {
@@ -3544,7 +3381,7 @@ void Actor::SetParent(Actor* parent)
       StagePtr stage = parent->mStage;
 
       // Instruct each actor to create a corresponding node in the scene graph
-      ConnectToStage(*stage);
+      ConnectToStage(*stage, index);
     }
   }
   else // parent being set to NULL