Merge changes I523a4ff5,Ic7d369c0 into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / event / common / type-info-impl.cpp
index b73d925..bae3a8a 100644 (file)
@@ -415,6 +415,22 @@ void TypeInfo::AddAnimatableProperty( const std::string& name, Property::Index i
   }
 }
 
+void TypeInfo::AddAnimatableProperty( const std::string& name, Property::Index index, const Property::Value& defaultValue )
+{
+  RegisteredPropertyContainer::iterator iter = find_if( mRegisteredProperties.begin(), mRegisteredProperties.end(),
+                                                        PairFinder< Property::Index, RegisteredPropertyPair>(index) );
+
+  if ( iter == mRegisteredProperties.end() )
+  {
+    mRegisteredProperties.push_back( RegisteredPropertyPair( index, RegisteredProperty( defaultValue.GetType(), NULL, NULL, name, Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX ) ) );
+    mPropertyDefaultValues.push_back( PropertyDefaultValuePair( index, defaultValue ) );
+  }
+  else
+  {
+    DALI_ASSERT_ALWAYS( ! "Property index already added to Type" );
+  }
+}
+
 void TypeInfo::AddAnimatablePropertyComponent( const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex )
 {
   Property::Type type = GetPropertyType( baseIndex );
@@ -586,6 +602,20 @@ Property::Type TypeInfo::GetPropertyType( Property::Index index ) const
   return type;
 }
 
+Property::Value TypeInfo::GetPropertyDefaultValue( Property::Index index ) const
+{
+  PropertyDefaultValueContainer::const_iterator iter = find_if( mPropertyDefaultValues.begin(), mPropertyDefaultValues.end(),
+                                                    PairFinder< Property::Index, PropertyDefaultValuePair >( index ) );
+  if( iter !=  mPropertyDefaultValues.end() )
+  {
+    return iter->second;
+  }
+  else
+  {
+    return Property::Value( GetPropertyType( index ) );
+  }
+}
+
 void TypeInfo::SetProperty( BaseObject *object, Property::Index index, const Property::Value& value ) const
 {
   RegisteredPropertyContainer::const_iterator iter = find_if( mRegisteredProperties.begin(), mRegisteredProperties.end(),