Merge changes I84e1ce43,I76b93d51 into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / event / common / object-impl-helper.h
index aeae9c1..595baee 100644 (file)
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDEs
+#include <cstring>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/object/property.h> // Dali::Property
 #include <dali/public-api/object/property-index-ranges.h> // DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX
@@ -72,11 +75,11 @@ struct ObjectImplHelper
 
   void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
   {
-    indices.reserve( DEFAULT_PROPERTY_COUNT );
+    indices.Reserve( DEFAULT_PROPERTY_COUNT );
 
-    for( unsigned int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+    for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
     {
-      indices.push_back( DEFAULT_OBJECT_PROPERTY_START_INDEX + i );
+      indices.PushBack( DEFAULT_OBJECT_PROPERTY_START_INDEX + i );
     }
   }
 
@@ -96,12 +99,8 @@ struct ObjectImplHelper
   {
     Property::Index index = Property::INVALID_INDEX;
 
-    //@todo MESH_REWORK - Are we assuming that the index into the array is the
-    // same as the enumerated property? if enumIndex in the table was no longer
-    // debug only, wouldn't need to make this assumption.
-
     // Look for name in default properties
-    for( unsigned int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
+    for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
     {
       const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
       if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
@@ -176,7 +175,8 @@ struct ObjectImplHelper
       DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
       property = animatable->GetSceneGraphProperty();
     }
-    else if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
+    else if ( ( index > CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
+              ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
     {
       CustomPropertyMetadata* custom = (object->*findCustomPropertyMethod)( index );
       DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
@@ -193,7 +193,7 @@ struct ObjectImplHelper
   {
     const SceneGraph::PropertyOwner* sceneObject = object->GetSceneObject();
 
-    switch ( entry.type )
+    switch ( entry.GetType() )
     {
       case Property::BOOLEAN:
       {
@@ -201,7 +201,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<bool>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<bool>::Bake, value.Get<bool>() );
+        SceneGraph::AnimatablePropertyMessage<bool>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<bool>::Bake, value.Get<bool>() );
 
         break;
       }
@@ -212,7 +212,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<float>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<float>::Bake, value.Get<float>() );
+        SceneGraph::AnimatablePropertyMessage<float>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<float>::Bake, value.Get<float>() );
 
         break;
       }
@@ -223,7 +223,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<int>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<int>::Bake, value.Get<int>() );
+        SceneGraph::AnimatablePropertyMessage<int>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<int>::Bake, value.Get<int>() );
 
         break;
       }
@@ -234,7 +234,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<Vector2>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
+        SceneGraph::AnimatablePropertyMessage<Vector2>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
 
         break;
       }
@@ -245,7 +245,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<Vector3>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
+        SceneGraph::AnimatablePropertyMessage<Vector3>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
 
         break;
       }
@@ -256,7 +256,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<Vector4>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
+        SceneGraph::AnimatablePropertyMessage<Vector4>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
 
         break;
       }
@@ -267,7 +267,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<Quaternion>::Send( eventThreadServices, sceneObject, property,&SceneGraph::AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
+        SceneGraph::AnimatablePropertyMessage<Quaternion>::Send( eventThreadServices, sceneObject, property,&SceneGraph::AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
 
         break;
       }
@@ -278,7 +278,7 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<Matrix>::Send( eventThreadServices, sceneObject, property,&SceneGraph::AnimatableProperty<Matrix>::Bake,  value.Get<Matrix>() );
+        SceneGraph::AnimatablePropertyMessage<Matrix>::Send( eventThreadServices, sceneObject, property,&SceneGraph::AnimatableProperty<Matrix>::Bake,  value.Get<Matrix>() );
 
         break;
       }
@@ -289,25 +289,17 @@ struct ObjectImplHelper
         DALI_ASSERT_DEBUG( NULL != property );
 
         // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::PropertyMessage<Matrix3>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Matrix3>::Bake,  value.Get<Matrix3>() );
+        SceneGraph::AnimatablePropertyMessage<Matrix3>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Matrix3>::Bake,  value.Get<Matrix3>() );
 
         break;
       }
 
       default:
       {
-        DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should not come here
-        break;
+        // ignore non-scene-graph types
       }
     }
   }
-
-  int GetPropertyComponentIndex( Property::Index index ) const
-  {
-    // TODO: MESH_REWORK
-    DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
-    return 0;
-  }
 };