Merge "Add UniformNameCache to keep track of unique uniform ids to avoid calculating...
[platform/core/uifw/dali-core.git] / dali / internal / event / common / object-impl.cpp
index b2696f3..501775d 100644 (file)
@@ -50,6 +50,8 @@ typedef Dali::Vector<Object::Observer*>::ConstIterator ConstObserverIter;
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_OBJECT" );
 #endif
+
+
 } // unnamed namespace
 
 Object::Object()
@@ -356,7 +358,7 @@ Property::Type Object::GetPropertyType( Property::Index index ) const
   CustomPropertyMetadata* custom = FindCustomProperty( index );
   if( custom )
   {
-    return custom->type;
+    return custom->GetType();
   }
   return Property::NONE;
 }
@@ -489,7 +491,7 @@ Property::Value Object::GetProperty(Property::Index index) const
 
 void Object::GetPropertyIndices( Property::IndexContainer& indices ) const
 {
-  indices.clear();
+  indices.Clear();
 
   // Default Properties
   GetDefaultPropertyIndices( indices );
@@ -504,14 +506,14 @@ void Object::GetPropertyIndices( Property::IndexContainer& indices ) const
   // Custom Properties
   if ( mCustomProperties.Count() > 0 )
   {
-    indices.reserve( indices.size() + mCustomProperties.Count() );
+    indices.Reserve( indices.Size() + mCustomProperties.Count() );
 
     PropertyMetadataLookup::ConstIterator iter = mCustomProperties.Begin();
     const PropertyMetadataLookup::ConstIterator endIter = mCustomProperties.End();
     int i=0;
     for ( ; iter != endIter; ++iter, ++i )
     {
-      indices.push_back( PROPERTY_CUSTOM_START_INDEX + i );
+      indices.PushBack( PROPERTY_CUSTOM_START_INDEX + i );
     }
   }
 }
@@ -535,12 +537,6 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop
       break;
     }
 
-    case Property::UNSIGNED_INTEGER:
-    {
-      newProperty = new AnimatableProperty<unsigned int>( propertyValue.Get<unsigned int>() );
-      break;
-    }
-
     case Property::FLOAT:
     {
       newProperty = new AnimatableProperty<float>( propertyValue.Get<float>() );
@@ -587,18 +583,11 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop
     case Property::STRING:
     case Property::ARRAY:
     case Property::MAP:
+    case Property::NONE:
     {
-      DALI_LOG_WARNING( "Property Type %d\n", propertyValue.GetType() );
       DALI_ASSERT_ALWAYS( !"PropertyType is not animatable" );
       break;
     }
-
-    default:
-    {
-      DALI_LOG_WARNING( "Property Type %d\n", propertyValue.GetType() );
-      DALI_ASSERT_ALWAYS( !"PropertyType enumeration is out of bounds" );
-      break;
-    }
   }
 
   // get the scene property owner from derived class
@@ -635,7 +624,12 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop
 
 Property::Index Object::RegisterProperty( const std::string& name, const Property::Value& propertyValue)
 {
-  return RegisterSceneGraphProperty(name, PROPERTY_CUSTOM_START_INDEX + mCustomProperties.Count(), propertyValue);
+  Property::Index index = RegisterSceneGraphProperty(name, PROPERTY_CUSTOM_START_INDEX + mCustomProperties.Count(), propertyValue);
+
+  /// @todo: don't keep a table of mappings per handle.
+  AddUniformMapping(index, name);
+
+  return index;
 }
 
 Property::Index Object::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode)
@@ -825,7 +819,7 @@ Property::Value Object::GetPropertyValue( const PropertyMetadata* entry ) const
   {
     BufferIndex bufferIndex( GetEventThreadServices().GetEventBufferIndex() );
 
-    switch ( entry->type )
+    switch ( entry->GetType() )
     {
       case Property::BOOLEAN:
       {
@@ -845,15 +839,6 @@ Property::Value Object::GetPropertyValue( const PropertyMetadata* entry ) const
         break;
       }
 
-      case Property::UNSIGNED_INTEGER:
-      {
-        const AnimatableProperty<unsigned int>* property = dynamic_cast< const AnimatableProperty<unsigned int>* >( entry->GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        value = (*property)[ bufferIndex ];
-        break;
-      }
-
       case Property::FLOAT:
       {
         const AnimatableProperty<float>* property = dynamic_cast< const AnimatableProperty<float>* >( entry->GetSceneGraphProperty() );
@@ -975,7 +960,7 @@ Property::Value Object::GetPropertyValue( const PropertyMetadata* entry ) const
 
 void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value )
 {
-  switch ( entry.type )
+  switch ( entry.GetType() )
   {
     case Property::BOOLEAN:
     {
@@ -997,16 +982,6 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
       break;
     }
 
-    case Property::UNSIGNED_INTEGER:
-    {
-      const AnimatableProperty<unsigned int>* property = dynamic_cast< const AnimatableProperty<unsigned int>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
-
-      // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<unsigned int>( GetEventThreadServices(), *property, value.Get<unsigned int>() );
-      break;
-    }
-
     case Property::FLOAT:
     {
       const AnimatableProperty<float>* property = dynamic_cast< const AnimatableProperty<float>* >( entry.GetSceneGraphProperty() );
@@ -1293,8 +1268,11 @@ AnimatablePropertyMetadata* Object::RegisterAnimatableProperty(Property::Index i
           }
         }
 
-        // Create the metadata for the property component.
-        mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( index, typeInfo->GetComponentIndex(index), animatableProperty->type, animatableProperty->GetSceneGraphProperty() ) );
+        if(animatableProperty)
+        {
+          // Create the metadata for the property component.
+          mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( index, typeInfo->GetComponentIndex(index), animatableProperty->GetType(), animatableProperty->GetSceneGraphProperty() ) );
+        }
       }
 
       // The metadata has just been added and therefore should be in the end of the vector.