Added a Max Core Property Index so that a range can be defined in toolkit 98/80298/4
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 15 Jul 2016 15:05:48 +0000 (16:05 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 28 Jul 2016 17:39:07 +0000 (18:39 +0100)
Change-Id: I75c878357b86e509083783144cc84a7f18374e16

dali/internal/event/actors/actor-impl.cpp
dali/internal/event/common/object-impl-helper.h
dali/internal/event/common/object-impl.cpp
dali/internal/event/events/pan-gesture-detector-impl.cpp
dali/internal/event/rendering/shader-impl.cpp
dali/public-api/object/property-index-ranges.h

index f441277..5df7b5c 100644 (file)
@@ -3179,7 +3179,8 @@ const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index ind
 
     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 = FindCustomProperty( index );
     DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
@@ -3291,7 +3292,8 @@ const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index ind
 
     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 = FindCustomProperty( index );
     DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
index 3d7b09e..30d58fc 100644 (file)
@@ -175,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" );
index af52dc1..a9af750 100644 (file)
@@ -648,6 +648,8 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop
     const PropertyBase* property = newProperty.Get();
     if(index >= PROPERTY_CUSTOM_START_INDEX)
     {
+      DALI_ASSERT_ALWAYS( index <= PROPERTY_CUSTOM_MAX_INDEX && "Too many custom properties have been registered" );
+
       mCustomProperties.PushBack( new CustomPropertyMetadata( name, propertyValue.GetType(), property ) );
     }
     else
@@ -1282,10 +1284,9 @@ Object::~Object()
 CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) const
 {
   CustomPropertyMetadata* property( NULL );
-  int arrayIndex;
   if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
-    for ( arrayIndex = 0; arrayIndex < (int)mCustomProperties.Count(); arrayIndex++ )
+    for ( std::size_t arrayIndex = 0; arrayIndex < mCustomProperties.Count(); arrayIndex++ )
     {
       CustomPropertyMetadata* custom = static_cast<CustomPropertyMetadata*>( mCustomProperties[ arrayIndex ] );
       if( custom->childPropertyIndex == index )
@@ -1296,7 +1297,7 @@ CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) cons
   }
   else
   {
-    arrayIndex = index - PROPERTY_CUSTOM_START_INDEX;
+    int arrayIndex = index - PROPERTY_CUSTOM_START_INDEX;
     if( arrayIndex >= 0 )
     {
       if( arrayIndex < (int)mCustomProperties.Count() ) // we can only access the first 2 billion custom properties
index 0531670..c819a82 100644 (file)
@@ -538,7 +538,8 @@ const PropertyInputImpl* PanGestureDetector::GetSceneObjectInputProperty( Proper
     return property;
   }
 
-  if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
+  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" );
index 2eb7cf6..8ced511 100644 (file)
@@ -265,11 +265,12 @@ const PropertyInputImpl* Shader::GetSceneObjectInputProperty( Property::Index in
 {
   PropertyMetadata* property = NULL;
 
-  if(index >= PROPERTY_CUSTOM_START_INDEX )
+  if( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
+      ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
   {
     property = FindCustomProperty( index );
   }
-  else
+  else if( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     property = FindAnimatableProperty( index );
   }
index 548992c..da4ea01 100644 (file)
@@ -63,6 +63,9 @@ enum PropertyRanges
   CHILD_PROPERTY_REGISTRATION_MAX_INDEX         = 49999999,   ///< The maximum index supported when registering a child property @SINCE_1_1.35
 
   PROPERTY_CUSTOM_START_INDEX                   = 50000000,   ///< The index at which custom properties start (SceneGraph and Event side properties per instance) @SINCE_1_0.0
+  PROPERTY_CUSTOM_MAX_INDEX                     = 59999999,   ///< The maximum index supported for custom properties @SINCE_1_1.45
+
+  CORE_PROPERTY_MAX_INDEX                       = PROPERTY_CUSTOM_MAX_INDEX, ///< The maximum index that Core properties can go up to @SINCE_1_1.45
 };
 
 /**