[Tizen] Disable property notification when the object is deleted
[platform/core/uifw/dali-core.git] / dali / internal / event / common / object-impl.cpp
index e435c7b..e9f5dbb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 #include <algorithm>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/object/handle-devel.h>
 #include <dali/integration-api/debug.h>
-#include <dali/internal/update/animation/scene-graph-constraint-base.h>
-#include <dali/internal/update/common/animatable-property.h>
-#include <dali/internal/update/common/property-owner-messages.h>
-#include <dali/internal/event/animation/active-constraint-base.h>
+#include <dali/internal/common/const-string.h>
 #include <dali/internal/event/animation/constraint-impl.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/property-helper.h>
 #include <dali/internal/event/common/property-notification-impl.h>
+#include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/event/common/type-registry-impl.h>
+#include <dali/internal/update/animation/scene-graph-constraint-base.h>
+#include <dali/internal/update/common/animatable-property.h>
+#include <dali/internal/update/common/property-owner-messages.h>
+#include <dali/internal/update/common/property-owner.h>
+#include <dali/internal/update/common/uniform-map.h>
 
 using Dali::Internal::SceneGraph::AnimatableProperty;
 using Dali::Internal::SceneGraph::PropertyBase;
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace // unnamed namespace
 {
-const int SUPPORTED_CAPABILITIES = Dali::Handle::DYNAMIC_PROPERTIES;  // Object provides this capability
-typedef Dali::Vector<Object::Observer*>::Iterator ObserverIter;
-typedef Dali::Vector<Object::Observer*>::ConstIterator ConstObserverIter;
+const int32_t SUPPORTED_CAPABILITIES = Dali::Handle::DYNAMIC_PROPERTIES; // Object provides this capability
 
 #if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_OBJECT" );
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_OBJECT");
 #endif
+
+constexpr Property::Index MAX_PER_CLASS_PROPERTY_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX;
+
 } // unnamed namespace
 
-Object::Object()
-: mEventThreadServices( *Stage::GetCurrent() ),
-  mTypeInfo( NULL ),
-  mConstraints( NULL ),
-  mPropertyNotifications( NULL )
+IntrusivePtr<Object> Object::New()
 {
+  return new Object(nullptr); // no scene object by default
 }
 
 void Object::AddObserver(Observer& observer)
 {
   // make sure an observer doesn't observe the same object twice
   // otherwise it will get multiple calls to OnSceneObjectAdd(), OnSceneObjectRemove() and ObjectDestroyed()
-  DALI_ASSERT_DEBUG( mObservers.End() == std::find( mObservers.Begin(), mObservers.End(), &observer));
+  DALI_ASSERT_DEBUG(mObservers.End() == std::find(mObservers.Begin(), mObservers.End(), &observer));
 
-  mObservers.PushBack( &observer );
+  mObservers.PushBack(&observer);
 }
 
 void Object::RemoveObserver(Observer& observer)
 {
   // Find the observer...
-  const ConstObserverIter endIter =  mObservers.End();
-  for( ObserverIter iter = mObservers.Begin(); iter != endIter; ++iter)
+  const auto endIter = mObservers.End();
+  for(auto iter = mObservers.Begin(); iter != endIter; ++iter)
   {
-    if( (*iter) == &observer)
+    if((*iter) == &observer)
     {
-      mObservers.Erase( iter );
+      mObservers.Erase(iter);
       break;
     }
   }
   DALI_ASSERT_DEBUG(endIter != mObservers.End());
 }
 
-void Object::OnSceneObjectAdd()
-{
-  // Notification for this object's constraints
-  if( mConstraints )
-  {
-    const ActiveConstraintConstIter endIter = mConstraints->end();
-    for ( ActiveConstraintIter iter = mConstraints->begin(); endIter != iter; ++iter )
-    {
-      ActiveConstraintBase& baseConstraint = GetImplementation( *iter );
-      baseConstraint.OnParentSceneObjectAdded();
-    }
-  }
-
-  // Notification for observers
-  for( ConstObserverIter iter = mObservers.Begin(),  endIter =  mObservers.End(); iter != endIter; ++iter)
-  {
-    (*iter)->SceneObjectAdded(*this);
-  }
-
-  // enable property notifications in scene graph
-  EnablePropertyNotifications();
-}
-
-void Object::OnSceneObjectRemove()
-{
-  // Notification for this object's constraints
-  if( mConstraints )
-  {
-    const ActiveConstraintConstIter endIter = mConstraints->end();
-    for ( ActiveConstraintIter iter = mConstraints->begin(); endIter != iter; ++iter )
-    {
-      ActiveConstraintBase& baseConstraint = GetImplementation( *iter );
-      baseConstraint.OnParentSceneObjectRemoved();
-    }
-  }
-
-  // Notification for observers
-  for( ConstObserverIter iter = mObservers.Begin(), endIter = mObservers.End(); iter != endIter; ++iter )
-  {
-    (*iter)->SceneObjectRemoved(*this);
-  }
-
-  // disable property notifications in scene graph
-  DisablePropertyNotifications();
-}
-
-int Object::GetPropertyComponentIndex( Property::Index index ) const
-{
-  return Property::INVALID_COMPONENT_INDEX;
-}
-
-bool Object::Supports( Capability capability ) const
+bool Object::Supports(Capability capability) const
 {
   return (capability & SUPPORTED_CAPABILITIES);
 }
 
-unsigned int Object::GetPropertyCount() const
+uint32_t Object::GetPropertyCount() const
 {
-  unsigned int count = GetDefaultPropertyCount();
-
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Default Properties: %d\n", count );
-
-  const TypeInfo* typeInfo( GetTypeInfo() );
-  if ( typeInfo )
+  uint32_t        count = 0u;
+  const TypeInfo* typeInfo(GetTypeInfo());
+  if(typeInfo)
   {
-    unsigned int manual( typeInfo->GetPropertyCount() );
-    count += manual;
+    count = typeInfo->GetPropertyCount();
 
-    DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Manual Properties:  %d\n", manual );
+    DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Registered Properties:  %d\n", count);
   }
 
-  unsigned int custom( mCustomProperties.Count() );
+  uint32_t custom = static_cast<uint32_t>(mCustomProperties.Count());
   count += custom;
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Custom Properties:  %d\n", custom );
+  DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Custom Properties:  %d\n", custom);
 
-  DALI_LOG_INFO( gLogFilter, Debug::Concise, "Total Properties:   %d\n", count );
+  DALI_LOG_INFO(gLogFilter, Debug::Concise, "Total Properties:   %d\n", count);
 
   return count;
 }
 
-std::string Object::GetPropertyName( Property::Index index ) const
+std::string_view Object::GetPropertyName(Property::Index index) const
 {
-  DALI_ASSERT_ALWAYS( index > Property::INVALID_INDEX && "Property index out of bounds" );
-
-  if ( index < DEFAULT_PROPERTY_MAX_COUNT )
-  {
-    return GetDefaultPropertyName( index );
-  }
+  DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index out of bounds");
 
-  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
+  // is this a per class or per instance property
+  if(index < MAX_PER_CLASS_PROPERTY_INDEX)
   {
-    const TypeInfo* typeInfo( GetTypeInfo() );
-    if ( typeInfo )
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
     {
-      return typeInfo->GetPropertyName( index );
+      return typeInfo->GetPropertyName(index);
     }
-    else
+  }
+  else // child property or custom property
+  {
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+    if(custom)
     {
-      DALI_ASSERT_ALWAYS( ! "Property index is invalid" );
+      return custom->name.GetStringView();
     }
   }
 
-  CustomProperty* custom = FindCustomProperty( index );
-  if( custom )
-  {
-    return custom->name;
-  }
-  return "";
+  DALI_LOG_ERROR("Property index %d not found\n", index);
+  return {};
 }
 
-Property::Index Object::GetPropertyIndex(const std::string& name) const
+Property::Index Object::GetPropertyIndex(KeyRef key) const
 {
-  Property::Index index = GetDefaultPropertyIndex( name );
+  Property::Index index = Property::INVALID_INDEX;
 
-  if ( index == Property::INVALID_INDEX )
+  if(key.mType == Property::Key::STRING)
   {
-    const TypeInfo* typeInfo( GetTypeInfo() );
-    if ( typeInfo )
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
     {
-      index = typeInfo->GetPropertyIndex( name );
+      index = typeInfo->GetPropertyIndex(key.mString);
     }
   }
 
-  if( ( index == Property::INVALID_INDEX )&&( mCustomProperties.Count() > 0 ) )
+  if((index == Property::INVALID_INDEX) && (mCustomProperties.Count() > 0))
   {
     Property::Index count = PROPERTY_CUSTOM_START_INDEX;
-    const CustomPropertyLookup::ConstIterator end = mCustomProperties.End();
-    for( CustomPropertyLookup::ConstIterator iter = mCustomProperties.Begin(); iter != end; ++iter, ++count )
+    const auto      end   = mCustomProperties.End();
+    for(auto iter = mCustomProperties.Begin(); iter != end; ++iter, ++count)
     {
-      CustomProperty* custom = *iter;
-      if ( custom->name == name )
+      CustomPropertyMetadata* custom = static_cast<CustomPropertyMetadata*>(*iter);
+
+      if((key.mType == Property::Key::STRING && custom->name == key.mString) ||
+         (key.mType == Property::Key::INDEX && custom->key == key.mIndex))
       {
-        index = count;
+        if(custom->childPropertyIndex != Property::INVALID_INDEX)
+        {
+          // If it is a child property, return the child property index
+          index = custom->childPropertyIndex;
+        }
+        else
+        {
+          index = count;
+        }
         break;
       }
     }
@@ -225,460 +176,515 @@ Property::Index Object::GetPropertyIndex(const std::string& name) const
   return index;
 }
 
-bool Object::IsPropertyWritable( Property::Index index ) const
+bool Object::IsPropertyWritable(Property::Index index) const
 {
   DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
 
-  if ( index < DEFAULT_PROPERTY_MAX_COUNT )
-  {
-    return IsDefaultPropertyWritable( index );
-  }
+  bool writable = false;
 
-  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
+  // is this a per class or per instance property
+  if(index < MAX_PER_CLASS_PROPERTY_INDEX)
   {
-    const TypeInfo* typeInfo( GetTypeInfo() );
-    if ( typeInfo )
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
     {
-      return typeInfo->IsPropertyWritable( index );
+      writable = typeInfo->IsPropertyWritable(index);
     }
-    else
+  }
+  else
+  {
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+    if(custom)
     {
-      DALI_ASSERT_ALWAYS( ! "Invalid property index" );
+      writable = custom->IsWritable();
     }
   }
 
-  CustomProperty* custom = FindCustomProperty( index );
-  if( custom )
-  {
-    return custom->IsWritable();
-  }
-  return false;
+  return writable;
 }
 
-bool Object::IsPropertyAnimatable( Property::Index index ) const
+bool Object::IsPropertyAnimatable(Property::Index index) const
 {
   DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
 
-  if ( index < DEFAULT_PROPERTY_MAX_COUNT )
-  {
-    return IsDefaultPropertyAnimatable( index );
-  }
+  bool animatable = false;
 
-  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
+  // is this a per class or per instance property
+  if(index < MAX_PER_CLASS_PROPERTY_INDEX)
   {
-    // Type Registry event-thread only properties are not animatable.
-    return false;
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
+    {
+      animatable = typeInfo->IsPropertyAnimatable(index);
+    }
   }
-
-  CustomProperty* custom = FindCustomProperty( index );
-  if( custom )
+  else
   {
-    return custom->IsAnimatable();
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+    if(custom)
+    {
+      animatable = custom->IsAnimatable();
+    }
   }
-  return false;
+
+  return animatable;
 }
 
-bool Object::IsPropertyAConstraintInput( Property::Index index ) const
+bool Object::IsPropertyAConstraintInput(Property::Index index) const
 {
   DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
 
-  if ( index < DEFAULT_PROPERTY_MAX_COUNT )
+  bool isConstraintInput = false;
+
+  // is this a per class or per instance property
+  if(index < MAX_PER_CLASS_PROPERTY_INDEX)
+  {
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
+    {
+      isConstraintInput = typeInfo->IsPropertyAConstraintInput(index);
+    }
+  }
+  else
   {
-    return IsDefaultPropertyAConstraintInput( index );
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+    if(custom)
+    {
+      // ... custom properties can be used as input to a constraint.
+      isConstraintInput = true;
+    }
   }
 
-  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
+  return isConstraintInput;
+}
+
+Property::Type Object::GetPropertyType(Property::Index index) const
+{
+  DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
+
+  // is this a per class or per instance property
+  if(index < MAX_PER_CLASS_PROPERTY_INDEX)
   {
-    // Type Registry event-thread only properties cannot be used as an input to a constraint.
-    return false;
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
+    {
+      return typeInfo->GetPropertyType(index);
+    }
   }
 
-  CustomProperty* custom = FindCustomProperty( index );
-  if( custom )
+  CustomPropertyMetadata* custom = FindCustomProperty(index);
+  if(custom)
   {
-    // ... custom properties can be used as input to a constraint.
-    return true;
+    return custom->GetType();
   }
-  return false;
+
+  return Property::NONE;
 }
 
-Property::Type Object::GetPropertyType( Property::Index index ) const
+void Object::SetProperty(Property::Index index, Property::Value propertyValue)
 {
-  DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds" );
+  DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
 
-  if ( index < DEFAULT_PROPERTY_MAX_COUNT )
+  bool propertySet(true);
+
+  if(index < DEFAULT_PROPERTY_MAX_COUNT)
+  {
+    SetDefaultProperty(index, propertyValue);
+  }
+  else if((index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX))
   {
-    return GetDefaultPropertyType( index );
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
+    {
+      typeInfo->SetProperty(this, index, propertyValue);
+    }
+    else
+    {
+      // cannot register this property as there is no setter for it.
+      // event side properties must have a setter for now so need to be registered
+      DALI_LOG_ERROR("Property index %d not found\n", index);
+      propertySet = false;
+    }
   }
+  else if((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX))
+  {
+    // check whether the animatable property is registered already, if not then register one.
+    AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty(index, &propertyValue);
+    if(!animatableProperty)
+    {
+      DALI_LOG_ERROR("Property index %d not found\n", index);
+      propertySet = false;
+    }
+    else
+    {
+      // update the cached property value
+      animatableProperty->SetPropertyValue(propertyValue);
 
-  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
+      // set the scene graph property value
+      SetSceneGraphProperty(index, *animatableProperty, propertyValue);
+    }
+  }
+  else
   {
-    const TypeInfo* typeInfo( GetTypeInfo() );
-    if ( typeInfo )
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+
+    if((index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX))
+    {
+      if(!custom)
+      {
+        // If the child property is not registered yet, register it.
+        custom = new CustomPropertyMetadata({}, propertyValue, Property::READ_WRITE);
+        mCustomProperties.PushBack(custom);
+      }
+
+      custom->childPropertyIndex = index;
+
+      // Resolve name for the child property
+      Object* parent = GetParentObject();
+      if(parent)
+      {
+        const TypeInfo* parentTypeInfo(parent->GetTypeInfo());
+        if(parentTypeInfo)
+        {
+          custom->name = ConstString(parentTypeInfo->GetChildPropertyName(index));
+        }
+      }
+    }
+
+    if(custom)
     {
-      return typeInfo->GetPropertyType( index );
+      if(custom->IsAnimatable())
+      {
+        // update the cached property value
+        custom->SetPropertyValue(propertyValue);
+
+        // set the scene graph property value
+        SetSceneGraphProperty(index, *custom, propertyValue);
+      }
+      else if(custom->IsWritable())
+      {
+        // update the cached property value
+        custom->SetPropertyValue(propertyValue);
+      }
+      else
+      {
+        // trying to set value on read only property is no-op
+        propertySet = false;
+      }
     }
     else
     {
-      DALI_ASSERT_ALWAYS( ! "Cannot find property index" );
+      DALI_LOG_ERROR("Property index %d not found\n", index);
+      propertySet = false;
     }
   }
 
-  CustomProperty* custom = FindCustomProperty( index );
-  if( custom )
+  // Let derived classes know that a property has been set
+  // TODO: We should not call this for read-only properties, SetDefaultProperty() && TypeInfo::SetProperty() should return a bool, which would be true if the property is set
+  if(propertySet)
   {
-    return custom->type;
+    OnPropertySet(index, propertyValue);
+    if(!mPropertySetSignal.Empty())
+    {
+      Dali::Handle handle(this);
+      mPropertySetSignal.Emit(handle, index, propertyValue);
+    }
   }
-  return Property::NONE;
 }
 
-void Object::SetProperty( Property::Index index, const Property::Value& propertyValue )
+Property::Value Object::GetProperty(Property::Index index) const
 {
-  DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds" );
+  DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
+
+  Property::Value value;
 
-  if ( index < DEFAULT_PROPERTY_MAX_COUNT )
+  if(index < DEFAULT_PROPERTY_MAX_COUNT)
   {
-    SetDefaultProperty( index, propertyValue );
+    value = GetDefaultProperty(index);
   }
-  else if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
+  else if((index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX))
   {
-    const TypeInfo* typeInfo( GetTypeInfo() );
-    if ( typeInfo )
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
     {
-      typeInfo->SetProperty( this, index, propertyValue );
+      value = typeInfo->GetProperty(this, index);
     }
     else
     {
-      DALI_ASSERT_ALWAYS( ! "Cannot find property index" );
+      DALI_LOG_ERROR("Property index %d not found\n", index);
     }
   }
-  else
+  else if((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX))
   {
-    CustomProperty* custom = FindCustomProperty( index );
-    DALI_ASSERT_ALWAYS( custom && "Invalid property index" );
-    if( custom->IsAnimatable() )
+    // check whether the animatable property is registered already, if not then register one.
+    // this is needed because property value may have been set as full property and get as a property component
+    AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty(index, nullptr);
+    if(animatableProperty)
     {
-      // set the scene graph property value
-      SetSceneGraphProperty( index, *custom, propertyValue );
+      // get the cached animatable property value
+      value = animatableProperty->GetPropertyValue();
     }
-    else if( custom->IsWritable() )
+    else
     {
-      custom->value = propertyValue;
-      OnPropertySet(index, propertyValue);
+      DALI_LOG_ERROR("Property index %d not found\n", index);
     }
-    // trying to set value on read only property is no-op
   }
+  else if(mCustomProperties.Count() > 0)
+  {
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+    if(custom)
+    {
+      // get the cached custom property value
+      value = custom->GetPropertyValue();
+    }
+    else
+    {
+      DALI_LOG_ERROR("Property index %d not found\n", index);
+    }
+  } // if custom
+
+  return value;
 }
 
-Property::Value Object::GetProperty(Property::Index index) const
+Property::Value Object::GetCurrentProperty(Property::Index index) const
 {
-  DALI_ASSERT_ALWAYS( index > Property::INVALID_INDEX && "Property index is out of bounds" );
+  DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
 
   Property::Value value;
 
-  if ( index < DEFAULT_PROPERTY_MAX_COUNT )
+  if(index < DEFAULT_PROPERTY_MAX_COUNT)
   {
-    value = GetDefaultProperty( index );
+    value = GetDefaultPropertyCurrentValue(index);
   }
-  else if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
+  else if((index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX))
   {
-    const TypeInfo* typeInfo( GetTypeInfo() );
-    if ( typeInfo )
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
     {
-      value = typeInfo->GetProperty( this, index );
+      value = typeInfo->GetProperty(this, index);
     }
     else
     {
-      DALI_ASSERT_ALWAYS( ! "Cannot find property index" );
+      DALI_LOG_ERROR("Property index %d not found\n", index);
     }
   }
-  else if( mCustomProperties.Count() > 0 )
+  else if((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX))
   {
-    CustomProperty* custom = FindCustomProperty( index );
-    DALI_ASSERT_ALWAYS( custom && "Invalid property index" );
-
-    if( !custom->IsAnimatable() )
+    // check whether the animatable property is registered already, if not then register one.
+    // this is needed because property value may have been set as full property and get as a property component
+    AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty(index, nullptr);
+    if(animatableProperty)
     {
-      value = custom->value;
+      // get the animatable property value
+      value = GetCurrentPropertyValue(*animatableProperty);
     }
     else
     {
-      BufferIndex bufferIndex( GetEventThreadServices().GetEventBufferIndex() );
-
-      switch ( custom->type )
-      {
-        case Property::BOOLEAN:
-        {
-          const AnimatableProperty<bool>* property = dynamic_cast< const AnimatableProperty<bool>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::FLOAT:
-        {
-          const AnimatableProperty<float>* property = dynamic_cast< const AnimatableProperty<float>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::INTEGER:
-        {
-          const AnimatableProperty<int>* property = dynamic_cast< const AnimatableProperty<int>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::VECTOR2:
-        {
-          const AnimatableProperty<Vector2>* property = dynamic_cast< const AnimatableProperty<Vector2>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::VECTOR3:
-        {
-          const AnimatableProperty<Vector3>* property = dynamic_cast< const AnimatableProperty<Vector3>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::VECTOR4:
-        {
-          const AnimatableProperty<Vector4>* property = dynamic_cast< const AnimatableProperty<Vector4>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::MATRIX:
-        {
-          const AnimatableProperty<Matrix>* property = dynamic_cast< const AnimatableProperty<Matrix>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::MATRIX3:
-        {
-          const AnimatableProperty<Matrix3>* property = dynamic_cast< const AnimatableProperty<Matrix3>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        case Property::ROTATION:
-        {
-          const AnimatableProperty<Quaternion>* property = dynamic_cast< const AnimatableProperty<Quaternion>* >( custom->GetSceneGraphProperty() );
-          DALI_ASSERT_DEBUG( NULL != property );
-
-          value = (*property)[ bufferIndex ];
-          break;
-        }
-
-        default:
-        {
-          DALI_ASSERT_ALWAYS( false && "PropertyType enumeration is out of bounds" );
-          break;
-        }
-      } // switch(type)
-    } // if animatable
-
+      DALI_LOG_ERROR("Property index %d not found\n", index);
+    }
+  }
+  else if(mCustomProperties.Count() > 0)
+  {
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+    if(custom)
+    {
+      // get the custom property value
+      value = GetCurrentPropertyValue(*custom);
+    }
+    else
+    {
+      DALI_LOG_ERROR("Property index %d not found\n", index);
+    }
   } // if custom
 
   return value;
 }
 
-void Object::GetPropertyIndices( Property::IndexContainer& indices ) const
+void Object::GetPropertyIndices(Property::IndexContainer& indices) const
 {
-  indices.clear();
-
-  // Default Properties
-  GetDefaultPropertyIndices( indices );
+  indices.Clear();
 
   // Manual Properties
-  const TypeInfo* typeInfo( GetTypeInfo() );
-  if ( typeInfo )
+  const TypeInfo* typeInfo(GetTypeInfo());
+  if(typeInfo)
   {
-    typeInfo->GetPropertyIndices( indices );
+    typeInfo->GetPropertyIndices(indices);
   }
 
   // Custom Properties
-  if ( mCustomProperties.Count() > 0 )
+  if(mCustomProperties.Count() > 0)
   {
-    indices.reserve( indices.size() + mCustomProperties.Count() );
+    indices.Reserve(indices.Size() + mCustomProperties.Count());
 
-    CustomPropertyLookup::ConstIterator iter = mCustomProperties.Begin();
-    const CustomPropertyLookup::ConstIterator endIter = mCustomProperties.End();
-    int i=0;
-    for ( ; iter != endIter; ++iter, ++i )
+    auto       iter    = mCustomProperties.Begin();
+    const auto endIter = mCustomProperties.End();
+    int32_t    i       = 0;
+    for(; iter != endIter; ++iter, ++i)
     {
-      indices.push_back( PROPERTY_CUSTOM_START_INDEX + i );
+      CustomPropertyMetadata* custom = static_cast<CustomPropertyMetadata*>(*iter);
+      if(custom->childPropertyIndex != Property::INVALID_INDEX)
+      {
+        // If it is a child property, add the child property index
+        indices.PushBack(custom->childPropertyIndex);
+      }
+      else
+      {
+        indices.PushBack(PROPERTY_CUSTOM_START_INDEX + i);
+      }
     }
   }
 }
 
-Property::Index Object::RegisterProperty( const std::string& name, const Property::Value& propertyValue)
+Property::Index Object::RegisterProperty(std::string_view name, Property::Value propertyValue)
 {
-  // Create a new property
-  Dali::Internal::OwnerPointer<PropertyBase> newProperty;
+  return RegisterProperty(name, Property::INVALID_KEY, std::move(propertyValue), Property::ANIMATABLE);
+}
+
+Property::Index Object::RegisterProperty(std::string_view name, Property::Index key, Property::Value propertyValue)
+{
+  return RegisterProperty(name, key, std::move(propertyValue), Property::ANIMATABLE);
+}
 
-  switch ( propertyValue.GetType() )
+void Object::SetProperties(const Property::Map& properties)
+{
+  const auto count = properties.Count();
+  for(auto position = 0u; position < count; ++position)
   {
-    case Property::BOOLEAN:
-    {
-      newProperty = new AnimatableProperty<bool>( propertyValue.Get<bool>() );
-      break;
-    }
+    // GetKeyAt and GetValue both return references which means no potential copying of maps/arrays.
+    // Iterating twice to get the value we want should still be fairly quick in a Property::Map.
 
-    case Property::FLOAT:
-    {
-      newProperty = new AnimatableProperty<float>( propertyValue.Get<float>() );
-      break;
-    }
+    const auto& key           = properties.GetKeyAt(position);
+    const auto  propertyIndex = (key.type == Property::Key::INDEX) ? key.indexKey : GetPropertyIndex(key);
 
-    case Property::INTEGER:
+    if(propertyIndex != Property::INVALID_INDEX)
     {
-      newProperty = new AnimatableProperty<int>( propertyValue.Get<int>() );
-      break;
+      const auto& value = properties.GetValue(position);
+      SetProperty(propertyIndex, value);
     }
+  }
+}
 
-    case Property::VECTOR2:
-    {
-      newProperty = new AnimatableProperty<Vector2>( propertyValue.Get<Vector2>() );
-      break;
-    }
+void Object::GetProperties(Property::Map& properties)
+{
+  properties.Clear();
 
-    case Property::VECTOR3:
-    {
-      newProperty = new AnimatableProperty<Vector3>( propertyValue.Get<Vector3>() );
-      break;
-    }
+  Property::IndexContainer indexContainer;
+  GetPropertyIndices(indexContainer);
 
-    case Property::VECTOR4:
-    {
-      newProperty = new AnimatableProperty<Vector4>( propertyValue.Get<Vector4>() );
-      break;
-    }
+  for(auto index : indexContainer)
+  {
+    properties[index] = GetProperty(index);
+  }
+}
 
-    case Property::MATRIX:
-    {
-      newProperty = new AnimatableProperty<Matrix>( propertyValue.Get<Matrix>() );
-      break;
-    }
-
-    case Property::MATRIX3:
-    {
-      newProperty = new AnimatableProperty<Matrix3>( propertyValue.Get<Matrix3>() );
-      break;
-    }
+Property::Index Object::RegisterProperty(std::string_view     name,
+                                         Property::Value      propertyValue,
+                                         Property::AccessMode accessMode)
+{
+  return RegisterProperty(name, Property::INVALID_KEY, std::move(propertyValue), accessMode);
+}
 
-    case Property::ROTATION:
-    {
-      newProperty = new AnimatableProperty<Quaternion>( propertyValue.Get<Quaternion>() );
-      break;
-    }
+Property::Index Object::RegisterProperty(std::string_view     name,
+                                         Property::Index      key,
+                                         Property::Value      propertyValue,
+                                         Property::AccessMode accessMode)
+{
+  auto constString = ConstString(name);
+  // If property with the required key already exists, then just set it.
+  Property::Index index = Property::INVALID_INDEX;
+  if(key != Property::INVALID_KEY) // Try integer key first if it's valid
+  {
+    index = GetPropertyIndex(key);
+  }
+  if(index == Property::INVALID_INDEX) // If it wasn't valid, or doesn't exist, try name
+  {
+    index = GetPropertyIndex(constString);
+  }
 
-    case Property::UNSIGNED_INTEGER:
-    case Property::RECTANGLE:
-    case Property::STRING:
-    case Property::ARRAY:
-    case Property::MAP:
+  if(index != Property::INVALID_INDEX) // If there was a valid index found by either key, set it.
+  {
+    SetProperty(index, std::move(propertyValue));
+  }
+  else
+  {
+    // Otherwise register the property
+    if(Property::ANIMATABLE == accessMode)
     {
-      DALI_LOG_WARNING( "Property Type %d\n", propertyValue.GetType() );
-      DALI_ASSERT_ALWAYS( !"PropertyType is not animatable" );
-      break;
+      index = RegisterSceneGraphProperty(
+        constString,
+        key,
+        PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>(mCustomProperties.Count()),
+        std::move(propertyValue));
+      AddUniformMapping(index, constString);
     }
-
-    default:
+    else
     {
-      DALI_LOG_WARNING( "Property Type %d\n", propertyValue.GetType() );
-      DALI_ASSERT_ALWAYS( !"PropertyType enumeration is out of bounds" );
-      break;
-    }
-  }
+      // Add entry to the property lookup
+      index = PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>(mCustomProperties.Count());
 
-  // get the scene property owner from derived class
-  const SceneGraph::PropertyOwner* scenePropertyOwner = GetPropertyOwner();
-  Property::Index index = PROPERTY_CUSTOM_START_INDEX + mCustomProperties.Count();
-  // we can only pass properties to scene graph side if there is a scene object
-  if( scenePropertyOwner )
-  {
-    // keep a local pointer to the property as the OwnerPointer will pass its copy to the message
-    const PropertyBase* property = newProperty.Get();
-    mCustomProperties.PushBack( new CustomProperty( name, propertyValue.GetType(), property ) );
+      CustomPropertyMetadata* customProperty =
+        new CustomPropertyMetadata(constString, std::move(propertyValue), accessMode);
 
-    // queue a message to add the property
-    InstallCustomPropertyMessage( GetEventThreadServices(), *scenePropertyOwner, newProperty.Release() ); // Message takes ownership
+      // Resolve index for the child property
+      Object* parent = GetParentObject();
+      if(parent)
+      {
+        const TypeInfo* parentTypeInfo(parent->GetTypeInfo());
+        if(parentTypeInfo)
+        {
+          Property::Index childPropertyIndex = parentTypeInfo->GetChildPropertyIndex(customProperty->name);
+          if(childPropertyIndex != Property::INVALID_INDEX)
+          {
+            customProperty->childPropertyIndex = childPropertyIndex;
+            index                              = childPropertyIndex;
+          }
+        }
+      }
 
-    // notify the derived class (optional) method in case it needs to do some more work on the new property
-    // note! have to use the local pointer as OwnerPointer now points to NULL as it handed over its ownership
-    NotifyScenePropertyInstalled( *property, name, index );
-  }
-  else
-  {
-    // property was orphaned and killed so return invalid index
-    index = Property::INVALID_INDEX;
+      mCustomProperties.PushBack(customProperty);
+    }
   }
 
   return index;
 }
 
-Property::Index Object::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode)
+bool Object::DoesCustomPropertyExist(Property::Index index)
 {
-  Property::Index index = Property::INVALID_INDEX;
-
-  if(Property::ANIMATABLE == accessMode)
-  {
-    index = RegisterProperty(name, propertyValue);
-  }
-  else
-  {
-    // Add entry to the property lookup
-    index = PROPERTY_CUSTOM_START_INDEX + mCustomProperties.Count();
-    mCustomProperties.PushBack( new CustomProperty( name, propertyValue, accessMode ) );
-  }
-
-  return index;
+  auto metadata = FindCustomProperty(index);
+  return metadata != nullptr;
 }
 
-Dali::PropertyNotification Object::AddPropertyNotification(Property::Index index,
-                                                                int componentIndex,
-                                                                const Dali::PropertyCondition& condition)
+Dali::PropertyNotification Object::AddPropertyNotification(Property::Index                index,
+                                                           int32_t                        componentIndex,
+                                                           const Dali::PropertyCondition& condition)
 {
-  if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
+  if(index >= DEFAULT_PROPERTY_MAX_COUNT)
   {
-    if ( index <= PROPERTY_REGISTRATION_MAX_INDEX )
+    if(index <= PROPERTY_REGISTRATION_MAX_INDEX)
+    {
+      DALI_ABORT("Property notification added to event side only property.");
+    }
+    else if((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX))
     {
-      DALI_ASSERT_ALWAYS( false && "Property notification added to event side only property." );
+      // check whether the animatable property is registered already, if not then register one.
+      AnimatablePropertyMetadata* animatable = GetSceneAnimatableProperty(index, nullptr);
+      DALI_ASSERT_ALWAYS(animatable && "Property index is invalid");
     }
-    else if ( mCustomProperties.Count() > 0 )
+    else if(mCustomProperties.Count() > 0)
     {
-      CustomProperty* custom = FindCustomProperty( index );
-      DALI_ASSERT_ALWAYS( custom && "Invalid property index" );
-      DALI_ASSERT_ALWAYS( custom->IsAnimatable() && "Property notification added to event side only property." );
+      CustomPropertyMetadata* custom = FindCustomProperty(index);
+      DALI_ASSERT_ALWAYS(custom && "Invalid property index");
+      DALI_ASSERT_ALWAYS(custom->IsAnimatable() && "Property notification added to event side only property.");
     }
   }
 
   Dali::Handle self(this);
-  Property target( self, index );
+  Property     target(self, index);
 
-  PropertyNotificationPtr internal = PropertyNotification::New( target, componentIndex, condition );
+  PropertyNotificationPtr    internal = PropertyNotification::New(target, componentIndex, condition);
   Dali::PropertyNotification propertyNotification(internal.Get());
 
-  if( !mPropertyNotifications )
+  if(!mPropertyNotifications)
   {
     mPropertyNotifications = new PropertyNotificationContainer;
   }
@@ -689,10 +695,10 @@ Dali::PropertyNotification Object::AddPropertyNotification(Property::Index index
 
 void Object::RemovePropertyNotification(Dali::PropertyNotification propertyNotification)
 {
-  if( mPropertyNotifications )
+  if(mPropertyNotifications)
   {
-    PropertyNotificationContainerIter iter = mPropertyNotifications->begin();
-    while(iter != mPropertyNotifications->end() )
+    auto iter = mPropertyNotifications->begin();
+    while(iter != mPropertyNotifications->end())
     {
       if(*iter == propertyNotification)
       {
@@ -709,10 +715,10 @@ void Object::RemovePropertyNotification(Dali::PropertyNotification propertyNotif
 
 void Object::RemovePropertyNotifications()
 {
-  if( mPropertyNotifications )
+  if(mPropertyNotifications)
   {
-    PropertyNotificationContainerIter iter = mPropertyNotifications->begin();
-    while(iter != mPropertyNotifications->end() )
+    auto iter = mPropertyNotifications->begin();
+    while(iter != mPropertyNotifications->end())
     {
       // As we can't ensure all references are removed, we can just disable
       // the notification.
@@ -724,306 +730,869 @@ void Object::RemovePropertyNotifications()
   }
 }
 
-void Object::EnablePropertyNotifications()
+void Object::NotifyPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType)
 {
-  if( mPropertyNotifications )
+  if(index < DEFAULT_PROPERTY_MAX_COUNT)
+  {
+    OnNotifyDefaultPropertyAnimation(animation, index, value, animationType);
+  }
+  else
   {
-    PropertyNotificationContainerIter iter = mPropertyNotifications->begin();
-    PropertyNotificationContainerIter endIter = mPropertyNotifications->end();
+    PropertyMetadata* propertyMetadata = nullptr;
+    if((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX))
+    {
+      propertyMetadata = FindAnimatableProperty(index);
+    }
+    else
+    {
+      CustomPropertyMetadata* custom = FindCustomProperty(index);
+      if(custom && custom->IsAnimatable())
+      {
+        propertyMetadata = custom;
+      }
+    }
 
-    for( ; iter != endIter; ++iter )
+    if(propertyMetadata)
     {
-      GetImplementation(*iter).Enable();
+      switch(animationType)
+      {
+        case Animation::TO:
+        case Animation::BETWEEN:
+        {
+          // Update the cached property value
+          propertyMetadata->SetPropertyValue(value);
+          break;
+        }
+        case Animation::BY:
+        {
+          // Adjust the cached property value
+          propertyMetadata->AdjustPropertyValueBy(value);
+          break;
+        }
+      }
     }
   }
 }
 
-void Object::DisablePropertyNotifications()
+void Object::AddUniformMapping(Property::Index propertyIndex, ConstString uniformName) const
 {
-  if( mPropertyNotifications )
+  // Get the address of the property if it's a scene property
+  const PropertyInputImpl* propertyPtr = GetSceneObjectInputProperty(propertyIndex);
+
+  // Check instead for newly registered properties
+  if(propertyPtr == nullptr)
   {
-    PropertyNotificationContainerIter iter = mPropertyNotifications->begin();
-    PropertyNotificationContainerIter endIter = mPropertyNotifications->end();
+    PropertyMetadata* animatable = FindAnimatableProperty(propertyIndex);
+    if(animatable)
+    {
+      propertyPtr = animatable->GetSceneGraphProperty();
+    }
+  }
 
-    for( ; iter != endIter; ++iter )
+  if(propertyPtr == nullptr)
+  {
+    PropertyMetadata* custom = FindCustomProperty(propertyIndex);
+    if(custom)
     {
-      GetImplementation(*iter).Disable();
+      propertyPtr = custom->GetSceneGraphProperty();
     }
   }
+
+  if(propertyPtr)
+  {
+    const SceneGraph::PropertyOwner& sceneObject = GetSceneObject();
+
+    SceneGraph::UniformPropertyMapping map(uniformName, propertyPtr);
+    // Message takes ownership of Uniform map (and will delete it after copy)
+    AddUniformMapMessage(const_cast<EventThreadServices&>(GetEventThreadServices()), sceneObject, map);
+  }
 }
 
-Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint )
+void Object::RemoveUniformMapping(const std::string& uniformName) const
 {
-  return Dali::ActiveConstraint( DoApplyConstraint( constraint, Dali::Handle() ) );
+  const SceneGraph::PropertyOwner& sceneObject = GetSceneObject();
+  RemoveUniformMapMessage(const_cast<EventThreadServices&>(GetEventThreadServices()), sceneObject, ConstString(uniformName));
 }
 
-Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint, Dali::Handle weightObject )
+void Object::ApplyConstraint(ConstraintBase& constraint)
 {
-  return Dali::ActiveConstraint( DoApplyConstraint( constraint, weightObject ) );
+  if(!mConstraints)
+  {
+    mConstraints = new ConstraintContainer;
+  }
+  mConstraints->push_back(Dali::Constraint(&constraint));
 }
 
-ActiveConstraintBase* Object::DoApplyConstraint( Constraint& constraint, Dali::Handle weightObject )
+void Object::RemoveConstraint(ConstraintBase& constraint)
 {
-  ActiveConstraintBase* activeConstraintImpl = constraint.CreateActiveConstraint();
-  DALI_ASSERT_DEBUG( NULL != activeConstraintImpl );
+  // nullptr if the Constraint sources are destroyed before Constraint::Apply()
+  if(mConstraints)
+  {
+    ConstraintIter it(std::find(mConstraints->begin(), mConstraints->end(), Dali::Constraint(&constraint)));
+    if(it != mConstraints->end())
+    {
+      mConstraints->erase(it);
+    }
+  }
+}
 
-  Dali::ActiveConstraint activeConstraint( activeConstraintImpl );
+void Object::RemoveConstraints()
+{
+  // guard against constraint sending messages during core destruction
+  if(mConstraints && Stage::IsInstalled())
+  {
+    for(auto&& item : *mConstraints)
+    {
+      GetImplementation(item).RemoveInternal();
+    }
 
-  if( weightObject )
+    delete mConstraints;
+    mConstraints = nullptr;
+  }
+}
+
+void Object::RemoveConstraints(uint32_t tag)
+{
+  // guard against constraint sending messages during core destruction
+  if(mConstraints && Stage::IsInstalled())
   {
-    Object& weightObjectImpl = GetImplementation( weightObject );
-    Property::Index weightIndex = weightObjectImpl.GetPropertyIndex( "weight" );
+    auto iter(mConstraints->begin());
+    while(iter != mConstraints->end())
+    {
+      ConstraintBase& constraint = GetImplementation(*iter);
+      if(constraint.GetTag() == tag)
+      {
+        GetImplementation(*iter).RemoveInternal();
+        iter = mConstraints->erase(iter);
+      }
+      else
+      {
+        ++iter;
+      }
+    }
 
-    if( Property::INVALID_INDEX != weightIndex )
+    if(mConstraints->empty())
     {
-      activeConstraintImpl->SetCustomWeightObject( weightObjectImpl, weightIndex );
+      delete mConstraints;
+      mConstraints = nullptr;
     }
   }
+}
 
-  if( !mConstraints )
+void Object::SetTypeInfo(const TypeInfo* typeInfo)
+{
+  mTypeInfo = typeInfo;
+}
+
+const SceneGraph::PropertyOwner& Object::GetSceneObject() const
+{
+  if(!mUpdateObject)
   {
-    mConstraints = new ActiveConstraintContainer;
+    auto                                    sceneObject = SceneGraph::PropertyOwner::New();
+    OwnerPointer<SceneGraph::PropertyOwner> transferOwnership(sceneObject);
+    mUpdateObject = sceneObject;
+    AddObjectMessage(const_cast<EventThreadServices&>(GetEventThreadServices()).GetUpdateManager(), transferOwnership);
   }
-  mConstraints->push_back( activeConstraint );
+  DALI_ASSERT_DEBUG(mUpdateObject && "there must always be a scene object");
+  return *mUpdateObject;
+}
 
-  activeConstraintImpl->FirstApply( *this, constraint.GetApplyTime() );
+const PropertyBase* Object::GetSceneObjectAnimatableProperty(Property::Index index) const
+{
+  const SceneGraph::PropertyBase* property = nullptr;
+  if(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)
+  {
+    AnimatablePropertyMetadata* animatable = GetSceneAnimatableProperty(index, nullptr);
+    DALI_ASSERT_ALWAYS(animatable && "Property index is invalid");
 
-  return activeConstraintImpl;
+    property = animatable->GetSceneGraphProperty();
+  }
+  else if((index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && // Child properties are also stored as custom properties
+          (index <= PROPERTY_CUSTOM_MAX_INDEX))
+  {
+    CustomPropertyMetadata* custom = FindCustomProperty(index);
+    DALI_ASSERT_ALWAYS(custom && "Property index is invalid");
+
+    property = custom->GetSceneGraphProperty();
+  }
+  return property;
+}
+
+const PropertyInputImpl* Object::GetSceneObjectInputProperty(Property::Index index) const
+{
+  // reuse animatable version as they are inputs as well
+  return GetSceneObjectAnimatableProperty(index);
 }
 
-void Object::SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value )
+int32_t Object::GetPropertyComponentIndex(Property::Index index) const
 {
-  switch ( entry.type )
+  int32_t componentIndex = Property::INVALID_COMPONENT_INDEX;
+
+  if((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX))
   {
-    case Property::BOOLEAN:
+    // check whether the animatable property is registered already, if not then register one.
+    AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty(index, nullptr);
+    if(animatableProperty)
     {
-      const AnimatableProperty<bool>* property = dynamic_cast< const AnimatableProperty<bool>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      componentIndex = animatableProperty->componentIndex;
+    }
+  }
+  if(Property::INVALID_COMPONENT_INDEX == componentIndex)
+  {
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
+    {
+      componentIndex = typeInfo->GetComponentIndex(index);
+    }
+  }
 
-      // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<bool>( GetEventThreadServices(), *property, value.Get<bool>() );
-      break;
+  return componentIndex;
+}
+
+Handle::PropertySetSignalType& Object::PropertySetSignal()
+{
+  return mPropertySetSignal;
+}
+
+Object::Object(const SceneGraph::PropertyOwner* sceneObject)
+: mEventThreadServices(EventThreadServices::Get()),
+  mUpdateObject(sceneObject),
+  mTypeInfo(nullptr),
+  mConstraints(nullptr),
+  mPropertyNotifications(nullptr)
+{
+}
+
+Object::~Object()
+{
+  // Notification for observers
+  for(auto&& item : mObservers)
+  {
+    item->ObjectDestroyed(*this);
+  }
+
+  // Disable property notifications in scene graph
+  DisablePropertyNotifications();
+
+  delete mConstraints;
+  delete mPropertyNotifications;
+
+  // Guard to allow handle destruction after Core has been destroyed
+  if(Stage::IsInstalled())
+  {
+    if(nullptr != mUpdateObject)
+    {
+      RemoveObjectMessage(GetEventThreadServices().GetUpdateManager(), mUpdateObject);
     }
+  }
+}
 
-    case Property::FLOAT:
+void Object::OnSceneObjectAdd()
+{
+  // Notification for observers
+  for(auto&& item : mObservers)
+  {
+    item->SceneObjectAdded(*this);
+  }
+
+  // enable property notifications in scene graph
+  EnablePropertyNotifications();
+}
+
+void Object::OnSceneObjectRemove()
+{
+  // Notification for observers
+  for(auto&& item : mObservers)
+  {
+    item->SceneObjectRemoved(*this);
+  }
+
+  // disable property notifications in scene graph
+  DisablePropertyNotifications();
+}
+
+const TypeInfo* Object::GetTypeInfo() const
+{
+  if(!mTypeInfo)
+  {
+    // This uses a dynamic_cast so can be quite expensive so we only really want to do it once
+    // especially as the type-info does not change during the life-time of an application
+
+    TypeRegistry::TypeInfoPointer typeInfoHandle = TypeRegistry::Get()->GetTypeInfo(this);
+    if(typeInfoHandle)
     {
-      const AnimatableProperty<float>* property = dynamic_cast< const AnimatableProperty<float>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      mTypeInfo = typeInfoHandle.Get(); // just a raw pointer to use, ownership is kept
+    }
+  }
 
-      // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<float>( GetEventThreadServices(), *property, value.Get<float>() );
+  return mTypeInfo;
+}
+
+CustomPropertyMetadata* Object::FindCustomProperty(Property::Index index) const
+{
+  CustomPropertyMetadata* property = nullptr;
+  if((index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX))
+  {
+    for(std::size_t arrayIndex = 0; arrayIndex < mCustomProperties.Count(); arrayIndex++)
+    {
+      CustomPropertyMetadata* custom = static_cast<CustomPropertyMetadata*>(mCustomProperties[arrayIndex]);
+      if(custom->childPropertyIndex == index)
+      {
+        property = custom;
+      }
+    }
+  }
+  else
+  {
+    int32_t arrayIndex = index - PROPERTY_CUSTOM_START_INDEX;
+    if(arrayIndex >= 0)
+    {
+      if(arrayIndex < static_cast<int32_t>(mCustomProperties.Count())) // we can only access the first 2 billion custom properties
+      {
+        property = static_cast<CustomPropertyMetadata*>(mCustomProperties[arrayIndex]);
+      }
+    }
+  }
+  return property;
+}
+
+AnimatablePropertyMetadata* Object::FindAnimatableProperty(Property::Index index) const
+{
+  for(auto&& entry : mAnimatableProperties)
+  {
+    AnimatablePropertyMetadata* property = static_cast<AnimatablePropertyMetadata*>(entry);
+    if(property->index == index)
+    {
+      return property;
+    }
+  }
+  return nullptr;
+}
+
+Property::Index Object::RegisterSceneGraphProperty(ConstString name, Property::Index key, Property::Index index, Property::Value propertyValue) const
+{
+  // Create a new property
+  Dali::Internal::OwnerPointer<PropertyBase> newProperty;
+
+  switch(propertyValue.GetType())
+  {
+    case Property::BOOLEAN:
+    {
+      newProperty = new AnimatableProperty<bool>(propertyValue.Get<bool>());
       break;
     }
 
     case Property::INTEGER:
     {
-      const AnimatableProperty<int>* property = dynamic_cast< const AnimatableProperty<int>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      newProperty = new AnimatableProperty<int32_t>(propertyValue.Get<int32_t>());
+      break;
+    }
 
-      // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<int>( GetEventThreadServices(), *property, value.Get<int>() );
+    case Property::FLOAT:
+    {
+      newProperty = new AnimatableProperty<float>(propertyValue.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
-      BakeMessage<Vector2>( GetEventThreadServices(), *property, value.Get<Vector2>() );
+      newProperty = new AnimatableProperty<Vector2>(propertyValue.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
-      BakeMessage<Vector3>( GetEventThreadServices(), *property, value.Get<Vector3>() );
+      newProperty = new AnimatableProperty<Vector3>(propertyValue.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
-      BakeMessage<Vector4>( GetEventThreadServices(), *property, value.Get<Vector4>() );
+      newProperty = new AnimatableProperty<Vector4>(propertyValue.Get<Vector4>());
       break;
     }
 
-    case Property::ROTATION:
+    case Property::MATRIX:
     {
-      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
-      BakeMessage<Quaternion>( GetEventThreadServices(), *property, value.Get<Quaternion>() );
+      newProperty = new AnimatableProperty<Matrix>(propertyValue.Get<Matrix>());
       break;
     }
 
-    case Property::MATRIX:
+    case Property::MATRIX3:
     {
-      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
-      BakeMessage<Matrix>( GetEventThreadServices(), *property, value.Get<Matrix>() );
+      newProperty = new AnimatableProperty<Matrix3>(propertyValue.Get<Matrix3>());
       break;
     }
 
-    case Property::MATRIX3:
+    case Property::ROTATION:
     {
-      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
-      BakeMessage<Matrix3>( GetEventThreadServices(), *property, value.Get<Matrix3>() );
+      newProperty = new AnimatableProperty<Quaternion>(propertyValue.Get<Quaternion>());
       break;
     }
 
-    default:
+    case Property::RECTANGLE:
+    case Property::STRING:
+    case Property::ARRAY:
+    case Property::MAP:
+    case Property::EXTENTS:
+    case Property::NONE:
     {
-      // non-animatable scene graph property, do nothing
+      DALI_ASSERT_ALWAYS(!"Property type is not animatable");
+      break;
     }
   }
-}
 
-const TypeInfo* Object::GetTypeInfo() const
-{
-  if ( !mTypeInfo )
+  // get the scene property owner
+  const SceneGraph::PropertyOwner& scenePropertyOwner = GetSceneObject();
+  // keep a local pointer to the property as the OwnerPointer will pass its copy to the message
+  const PropertyBase* property = newProperty.Get();
+  if(index >= PROPERTY_CUSTOM_START_INDEX)
   {
-    // This uses a dynamic_cast so can be quite expensive so we only really want to do it once
-    // especially as the type-info does not change during the life-time of an application
+    DALI_ASSERT_ALWAYS(index <= PROPERTY_CUSTOM_MAX_INDEX && "Too many custom properties have been registered");
 
-    Dali::TypeInfo typeInfoHandle = TypeRegistry::Get()->GetTypeInfo( this );
-    if ( typeInfoHandle )
-    {
-      mTypeInfo = &GetImplementation( typeInfoHandle );
-    }
+    mCustomProperties.PushBack(new CustomPropertyMetadata(name, key, std::move(propertyValue), property));
+  }
+  else
+  {
+    mAnimatableProperties.PushBack(new AnimatablePropertyMetadata(index, std::move(propertyValue), property));
   }
 
-  return mTypeInfo;
+  // queue a message to add the property
+  InstallCustomPropertyMessage(const_cast<EventThreadServices&>(GetEventThreadServices()), scenePropertyOwner, newProperty); // Message takes ownership
+
+  return index;
 }
 
-void Object::RemoveConstraint( ActiveConstraint& constraint, bool isInScenegraph )
+void Object::RegisterAnimatableProperty(const TypeInfo&        typeInfo,
+                                        Property::Index        index,
+                                        const Property::Value* value) const
 {
-  // guard against constraint sending messages during core destruction
-  if ( Stage::IsInstalled() )
+  // If the property is not a component of a base property, register the whole property itself.
+  auto            propertyName = ConstString(typeInfo.GetPropertyName(index));
+  Property::Value initialValue;
+  if(value)
   {
-    if( isInScenegraph )
-    {
-      ActiveConstraintBase& baseConstraint = GetImplementation( constraint );
-      baseConstraint.BeginRemove();
-    }
+    initialValue = *value;
   }
-}
-
-void Object::RemoveConstraint( Dali::ActiveConstraint activeConstraint )
-{
-  // guard against constraint sending messages during core destruction
-  if( mConstraints && Stage::IsInstalled() )
+  else
   {
-    bool isInSceneGraph( NULL != GetSceneObject() );
-
-    ActiveConstraintIter it( std::find( mConstraints->begin(), mConstraints->end(), activeConstraint ) );
-    if( it !=  mConstraints->end() )
+    initialValue = typeInfo.GetPropertyDefaultValue(index); // recurses type hierarchy
+    if(Property::NONE == initialValue.GetType())
     {
-      RemoveConstraint( *it, isInSceneGraph );
-      mConstraints->erase( it );
+      initialValue = Property::Value(typeInfo.GetPropertyType(index)); // recurses type hierarchy
     }
   }
+  RegisterSceneGraphProperty(propertyName, Property::INVALID_KEY, index, initialValue);
+  AddUniformMapping(index, propertyName);
 }
 
-void Object::RemoveConstraints( unsigned int tag )
+AnimatablePropertyMetadata* Object::GetSceneAnimatableProperty(Property::Index index, const Property::Value* value) const
 {
-  // guard against constraint sending messages during core destruction
-  if( mConstraints && Stage::IsInstalled() )
+  // property range already checked by calling methods
+  // check whether the animatable property is registered already, if not then register one.
+  AnimatablePropertyMetadata* animatableProperty = FindAnimatableProperty(index);
+  if(!animatableProperty)
   {
-    bool isInSceneGraph( NULL != GetSceneObject() );
-
-    ActiveConstraintIter iter( mConstraints->begin() );
-    while(iter != mConstraints->end() )
+    const TypeInfo* typeInfo(GetTypeInfo());
+    if(typeInfo)
     {
-      ActiveConstraintBase& constraint = GetImplementation( *iter );
-      if( constraint.GetTag() == tag )
+      Property::Index basePropertyIndex = typeInfo->GetBasePropertyIndex(index);
+      if(basePropertyIndex == Property::INVALID_INDEX)
       {
-        RemoveConstraint( *iter, isInSceneGraph );
-        iter = mConstraints->erase( iter );
+        // If the property is not a component of a base property, register the whole property itself.
+        RegisterAnimatableProperty(*typeInfo, index, value);
       }
       else
       {
-        ++iter;
+        // Since the property is a component of a base property, check whether the base property is registered.
+        animatableProperty = FindAnimatableProperty(basePropertyIndex);
+        if(!animatableProperty)
+        {
+          // If the base property is not registered yet, register the base property first.
+          RegisterAnimatableProperty(*typeInfo, basePropertyIndex, value);
+          animatableProperty = static_cast<AnimatablePropertyMetadata*>(mAnimatableProperties[mAnimatableProperties.Size() - 1]);
+        }
+
+        // Create the metadata for the property component.
+        mAnimatableProperties.PushBack(new AnimatablePropertyMetadata(index, typeInfo->GetComponentIndex(index), animatableProperty->value, animatableProperty->GetSceneGraphProperty()));
       }
+
+      // The metadata has just been added and therefore should be in the end of the vector.
+      animatableProperty = static_cast<AnimatablePropertyMetadata*>(mAnimatableProperties[mAnimatableProperties.Size() - 1]);
     }
   }
+
+  return animatableProperty;
 }
 
-void Object::RemoveConstraints()
+void Object::ResolveChildProperties()
 {
-  // guard against constraint sending messages during core destruction
-  if( mConstraints && Stage::IsInstalled() )
+  // Resolve index for the child property
+  Object* parent = GetParentObject();
+  if(parent)
   {
-    // If we have nothing in the scene-graph, just clear constraint containers
-    const SceneGraph::PropertyOwner* propertyOwner = GetSceneObject();
-    if ( NULL != propertyOwner )
+    const TypeInfo* parentTypeInfo(parent->GetTypeInfo());
+    if(parentTypeInfo)
     {
-      const ActiveConstraintConstIter endIter = mConstraints->end();
-      for ( ActiveConstraintIter iter = mConstraints->begin(); endIter != iter; ++iter )
+      // Go through each custom property
+      for(auto&& entry : mCustomProperties)
       {
-        RemoveConstraint( *iter, true );
+        CustomPropertyMetadata* customProperty = static_cast<CustomPropertyMetadata*>(entry);
+
+        if(customProperty->name.IsEmpty())
+        {
+          if(customProperty->childPropertyIndex != Property::INVALID_INDEX)
+          {
+            // Resolve name for any child property with no name
+            customProperty->name = ConstString(parentTypeInfo->GetChildPropertyName(customProperty->childPropertyIndex));
+          }
+        }
+        else
+        {
+          Property::Index childPropertyIndex = parentTypeInfo->GetChildPropertyIndex(customProperty->name);
+          if(childPropertyIndex != Property::INVALID_INDEX)
+          {
+            // Resolve index for any property with a name that matches the parent's child property name
+            customProperty->childPropertyIndex = childPropertyIndex;
+          }
+        }
       }
     }
-
-    delete mConstraints;
-    mConstraints = NULL;
   }
 }
 
-void Object::SetTypeInfo( const TypeInfo* typeInfo )
+void Object::SetDefaultProperty(Property::Index index, const Property::Value& property)
 {
-  mTypeInfo = typeInfo;
+  // do nothing
 }
 
-Object::~Object()
+Property::Value Object::GetDefaultProperty(Property::Index index) const
 {
-  // Notification for this object's constraints
-  // (note that the ActiveConstraint handles may outlive the Object)
-  if( mConstraints )
+  return Property::Value();
+}
+
+Property::Value Object::GetDefaultPropertyCurrentValue(Property::Index index) const
+{
+  return GetDefaultProperty(index);
+}
+
+void Object::EnablePropertyNotifications()
+{
+  if(mPropertyNotifications)
   {
-    const ActiveConstraintConstIter endIter = mConstraints->end();
-    for ( ActiveConstraintIter iter = mConstraints->begin(); endIter != iter; ++iter )
+    for(auto&& element : *mPropertyNotifications)
     {
-      ActiveConstraintBase& baseConstraint = GetImplementation( *iter );
-      baseConstraint.OnParentDestroyed();
+      GetImplementation(element).Enable();
     }
   }
+}
 
-  // Notification for observers
-  for( ConstObserverIter iter = mObservers.Begin(), endIter =  mObservers.End(); iter != endIter; ++iter)
+void Object::DisablePropertyNotifications()
+{
+  if(mPropertyNotifications)
   {
-    (*iter)->ObjectDestroyed(*this);
+    for(auto&& element : *mPropertyNotifications)
+    {
+      GetImplementation(element).Disable();
+    }
   }
+}
 
-  delete mConstraints;
-  delete mPropertyNotifications;
+Property::Value Object::GetCurrentPropertyValue(const PropertyMetadata& entry) const
+{
+  Property::Value value;
+
+  if(!entry.IsAnimatable())
+  {
+    value = entry.GetPropertyValue();
+  }
+  else
+  {
+    BufferIndex bufferIndex(GetEventThreadServices().GetEventBufferIndex());
+
+    switch(entry.GetType())
+    {
+      case Property::BOOLEAN:
+      {
+        const AnimatableProperty<bool>* property = static_cast<const AnimatableProperty<bool>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        value = (*property)[bufferIndex];
+        break;
+      }
+
+      case Property::INTEGER:
+      {
+        const AnimatableProperty<int32_t>* property = static_cast<const AnimatableProperty<int32_t>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        value = (*property)[bufferIndex];
+        break;
+      }
+
+      case Property::FLOAT:
+      {
+        const AnimatableProperty<float>* property = static_cast<const AnimatableProperty<float>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        value = (*property)[bufferIndex];
+        break;
+      }
+
+      case Property::VECTOR2:
+      {
+        const AnimatableProperty<Vector2>* property = static_cast<const AnimatableProperty<Vector2>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        if(entry.componentIndex == 0)
+        {
+          value = (*property)[bufferIndex].x;
+        }
+        else if(entry.componentIndex == 1)
+        {
+          value = (*property)[bufferIndex].y;
+        }
+        else
+        {
+          value = (*property)[bufferIndex];
+        }
+        break;
+      }
+
+      case Property::VECTOR3:
+      {
+        const AnimatableProperty<Vector3>* property = static_cast<const AnimatableProperty<Vector3>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        if(entry.componentIndex == 0)
+        {
+          value = (*property)[bufferIndex].x;
+        }
+        else if(entry.componentIndex == 1)
+        {
+          value = (*property)[bufferIndex].y;
+        }
+        else if(entry.componentIndex == 2)
+        {
+          value = (*property)[bufferIndex].z;
+        }
+        else
+        {
+          value = (*property)[bufferIndex];
+        }
+        break;
+      }
+
+      case Property::VECTOR4:
+      {
+        const AnimatableProperty<Vector4>* property = static_cast<const AnimatableProperty<Vector4>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        if(entry.componentIndex == 0)
+        {
+          value = (*property)[bufferIndex].x;
+        }
+        else if(entry.componentIndex == 1)
+        {
+          value = (*property)[bufferIndex].y;
+        }
+        else if(entry.componentIndex == 2)
+        {
+          value = (*property)[bufferIndex].z;
+        }
+        else if(entry.componentIndex == 3)
+        {
+          value = (*property)[bufferIndex].w;
+        }
+        else
+        {
+          value = (*property)[bufferIndex];
+        }
+        break;
+      }
+
+      case Property::MATRIX:
+      {
+        const AnimatableProperty<Matrix>* property = static_cast<const AnimatableProperty<Matrix>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        value = (*property)[bufferIndex];
+        break;
+      }
+
+      case Property::MATRIX3:
+      {
+        const AnimatableProperty<Matrix3>* property = static_cast<const AnimatableProperty<Matrix3>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        value = (*property)[bufferIndex];
+        break;
+      }
+
+      case Property::ROTATION:
+      {
+        const AnimatableProperty<Quaternion>* property = static_cast<const AnimatableProperty<Quaternion>*>(entry.GetSceneGraphProperty());
+        DALI_ASSERT_DEBUG(property);
+
+        value = (*property)[bufferIndex];
+        break;
+      }
+
+      default:
+      {
+        // unreachable code due to higher level logic
+      }
+    } // switch(type)
+  }   // if animatable
+
+  return value;
 }
 
-CustomProperty* Object::FindCustomProperty( Property::Index index ) const
+void Object::SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value)
 {
-  CustomProperty* property( NULL );
-  int arrayIndex = index - PROPERTY_CUSTOM_START_INDEX;
-  if( arrayIndex >= 0 )
+  switch(entry.GetType())
   {
-    if( arrayIndex < (int)mCustomProperties.Count() ) // we can only access the first 2 billion custom properties
+    case Property::BOOLEAN:
+    {
+      const AnimatableProperty<bool>* property = dynamic_cast<const AnimatableProperty<bool>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      BakeMessage<bool>(GetEventThreadServices(), *property, value.Get<bool>());
+      break;
+    }
+
+    case Property::INTEGER:
+    {
+      const AnimatableProperty<int32_t>* property = dynamic_cast<const AnimatableProperty<int32_t>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      BakeMessage<int32_t>(GetEventThreadServices(), *property, value.Get<int32_t>());
+      break;
+    }
+
+    case Property::FLOAT:
+    {
+      const AnimatableProperty<float>* property = dynamic_cast<const AnimatableProperty<float>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      BakeMessage<float>(GetEventThreadServices(), *property, value.Get<float>());
+      break;
+    }
+
+    case Property::VECTOR2:
+    {
+      const AnimatableProperty<Vector2>* property = dynamic_cast<const AnimatableProperty<Vector2>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      if(entry.componentIndex == 0)
+      {
+        SetXComponentMessage<Vector2>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else if(entry.componentIndex == 1)
+      {
+        SetYComponentMessage<Vector2>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else
+      {
+        BakeMessage<Vector2>(GetEventThreadServices(), *property, value.Get<Vector2>());
+      }
+      break;
+    }
+
+    case Property::VECTOR3:
     {
-      property = mCustomProperties[ arrayIndex ];
+      const AnimatableProperty<Vector3>* property = dynamic_cast<const AnimatableProperty<Vector3>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      if(entry.componentIndex == 0)
+      {
+        SetXComponentMessage<Vector3>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else if(entry.componentIndex == 1)
+      {
+        SetYComponentMessage<Vector3>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else if(entry.componentIndex == 2)
+      {
+        SetZComponentMessage<Vector3>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else
+      {
+        BakeMessage<Vector3>(GetEventThreadServices(), *property, value.Get<Vector3>());
+      }
+
+      break;
+    }
+
+    case Property::VECTOR4:
+    {
+      const AnimatableProperty<Vector4>* property = dynamic_cast<const AnimatableProperty<Vector4>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      if(entry.componentIndex == 0)
+      {
+        SetXComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else if(entry.componentIndex == 1)
+      {
+        SetYComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else if(entry.componentIndex == 2)
+      {
+        SetZComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else if(entry.componentIndex == 3)
+      {
+        SetWComponentMessage<Vector4>(GetEventThreadServices(), *property, value.Get<float>());
+      }
+      else
+      {
+        BakeMessage<Vector4>(GetEventThreadServices(), *property, value.Get<Vector4>());
+      }
+      break;
+    }
+
+    case Property::ROTATION:
+    {
+      const AnimatableProperty<Quaternion>* property = dynamic_cast<const AnimatableProperty<Quaternion>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      BakeMessage<Quaternion>(GetEventThreadServices(), *property, value.Get<Quaternion>());
+      break;
+    }
+
+    case Property::MATRIX:
+    {
+      const AnimatableProperty<Matrix>* property = dynamic_cast<const AnimatableProperty<Matrix>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      BakeMessage<Matrix>(GetEventThreadServices(), *property, value.Get<Matrix>());
+      break;
+    }
+
+    case Property::MATRIX3:
+    {
+      const AnimatableProperty<Matrix3>* property = dynamic_cast<const AnimatableProperty<Matrix3>*>(entry.GetSceneGraphProperty());
+      DALI_ASSERT_DEBUG(property);
+
+      // property is being used in a separate thread; queue a message to set the property
+      BakeMessage<Matrix3>(GetEventThreadServices(), *property, value.Get<Matrix3>());
+      break;
+    }
+
+    default:
+    {
+      // non-animatable scene graph property, do nothing
     }
   }
-  return property;
 }
 
 } // namespace Internal