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 f4412774b41c48ad4e1bc095fb198b6477ffe668..5df7b5c6a740f7ada195d9e6d0a761f30d859472 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 3d7b09eabaac827b9065d36defe5aec2bf0efa50..30d58fcf151babd49c3fce93d82f85d22cc3bd66 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 af52dc120e9d24d4e61c9348c28d6516f1c01ed4..a9af75062da72b80a2f0e45e8f7d369f53c27b88 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 0531670b3c79d5dd39a0847d0f1a456420b5a658..c819a82afda01738bc332470655efa3d40b81f4a 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 2eb7cf67e5a0e7597f70b037ced097c3237d4f14..8ced51198ef0b33d73b901fea7dc443d56061d8d 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 548992cc4bee9de8689fb9c61680304ef97e85ba..da4ea0120fde18d1dae3f2e57bb64cfe7a3a3cff 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
 };
 
 /**