Merge "Changed log message to inform number of textures != than active sampler from...
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.cpp
index 00d0f45..2e9add2 100644 (file)
@@ -24,6 +24,7 @@
 #include <cfloat>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/actors/layer-devel.h>
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/common/constants.h>
 #include <dali/public-api/events/touch-data.h>
@@ -200,6 +201,7 @@ DALI_PROPERTY( "maximumSize",         VECTOR2,  true,  false, false, Dali::Actor
 DALI_PROPERTY( "inheritPosition",     BOOLEAN,  true,  false, false, Dali::Actor::Property::INHERIT_POSITION )
 DALI_PROPERTY( "clippingMode",        STRING,   true,  false, false, Dali::Actor::Property::CLIPPING_MODE )
 DALI_PROPERTY( "batchParent",         BOOLEAN,  true,  false, false, Dali::DevelActor::Property::BATCH_PARENT )
+DALI_PROPERTY( "siblingOrder",        INTEGER,  true,  false, false, Dali::DevelActor::Property::SIBLING_ORDER )
 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
 
 // Signals
@@ -355,6 +357,10 @@ float GetDimensionValue( const Vector3& values, Dimension::Type dimension )
   return GetDimensionValue( values.GetVectorXY(), dimension );
 }
 
+unsigned int GetDepthIndex( uint16_t depth, uint16_t siblingOrder )
+{
+  return depth * Dali::DevelLayer::TREE_DEPTH_MULTIPLIER + siblingOrder * Dali::DevelLayer::SIBLING_ORDER_MULTIPLIER;
+}
 
 } // unnamed namespace
 
@@ -1970,6 +1976,7 @@ Actor::Actor( DerivedType derivedType )
   mName(),
   mId( ++mActorCounter ), // actor ID is initialised to start from 1, and 0 is reserved
   mDepth( 0u ),
+  mSiblingOrder(0u),
   mIsRoot( ROOT_LAYER == derivedType ),
   mIsLayer( LAYER == derivedType || ROOT_LAYER == derivedType ),
   mIsOnStage( false ),
@@ -2071,6 +2078,7 @@ void Actor::RecursiveConnectToStage( ActorContainer& connectionList, unsigned in
 
   mIsOnStage = true;
   mDepth = depth;
+  SetDepthIndexMessage( GetEventThreadServices(), *mNode, GetDepthIndex( mDepth, mSiblingOrder ) );
 
   ConnectToSceneGraph();
 
@@ -2677,6 +2685,24 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
       break;
     }
 
+    case Dali::DevelActor::Property::SIBLING_ORDER:
+    {
+      int value;
+
+      if( property.Get( value ) )
+      {
+        if( static_cast<unsigned int>(value) != mSiblingOrder )
+        {
+          mSiblingOrder = value;
+          if( mIsOnStage )
+          {
+            SetDepthIndexMessage( GetEventThreadServices(), *mNode, GetDepthIndex( mDepth, mSiblingOrder ) );
+          }
+        }
+      }
+      break;
+    }
+
     case Dali::Actor::Property::CLIPPING_MODE:
     {
       ClippingMode::Type convertedValue = mClippingMode;
@@ -2850,8 +2876,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
 
     default:
     {
-      DALI_ASSERT_ALWAYS( false && "Property type enumeration out of bounds" ); // should not come here
-      break;
+      // nothing to do for other types
     }
   } // entry.GetType
 }
@@ -2860,6 +2885,11 @@ Property::Value Actor::GetDefaultProperty( Property::Index index ) const
 {
   Property::Value value;
 
+  if( index >= DEFAULT_PROPERTY_COUNT )
+  {
+    return value;
+  }
+
   switch( index )
   {
     case Dali::Actor::Property::PARENT_ORIGIN:
@@ -3188,15 +3218,15 @@ Property::Value Actor::GetDefaultProperty( Property::Index index ) const
       break;
     }
 
-    case Dali::Actor::Property::CLIPPING_MODE:
+    case Dali::DevelActor::Property::SIBLING_ORDER:
     {
-      value = mClippingMode;
+      value = static_cast<int>(mSiblingOrder);
       break;
     }
 
-    default:
+    case Dali::Actor::Property::CLIPPING_MODE:
     {
-      DALI_ASSERT_ALWAYS( false && "Actor Property index invalid" ); // should not come here
+      value = mClippingMode;
       break;
     }
   }