(PropertyNotifications) Added incremental step notification 55/18255/7
authorJulien Heanley <j.heanley@partner.samsung.com>
Wed, 19 Mar 2014 11:42:56 +0000 (11:42 +0000)
committerJulien Heanley <j.heanley@partner.samsung.com>
Thu, 20 Mar 2014 16:59:56 +0000 (09:59 -0700)
[Issue#]   N/A
[Problem]  No simple notification for properties changing over time
[Cause]
[Solution] Added incremental step notification

Change-Id: I9ad819fb3b19b2f45f722b034412b294af038915
Signed-off-by: Julien Heanley <j.heanley@partner.samsung.com>
14 files changed:
automated-tests/dali-test-suite/property-notification/utc-Dali-PropertyNotification.cpp
capi/dali/public-api/object/property-conditions.h
capi/dali/public-api/object/property-notification.h
dali/internal/event/common/property-conditions-impl.h
dali/internal/file.list
dali/internal/update/common/property-condition-functions.cpp
dali/internal/update/common/property-condition-functions.h
dali/internal/update/common/property-condition-step-functions.cpp [new file with mode: 0644]
dali/internal/update/common/property-condition-step-functions.h [new file with mode: 0644]
dali/internal/update/common/property-condition-variable-step-functions.cpp [new file with mode: 0644]
dali/internal/update/common/property-condition-variable-step-functions.h [new file with mode: 0644]
dali/internal/update/common/scene-graph-property-notification.cpp
dali/internal/update/common/scene-graph-property-notification.h
dali/public-api/object/property-conditions.cpp

index 0eba8f7..d4bb938 100644 (file)
@@ -79,6 +79,8 @@ TEST_FUNCTION( UtcDaliPropertyNotificationVectorComponentInside, POSITIVE_TC_IDX
 TEST_FUNCTION( UtcDaliPropertyNotificationVectorComponentOutside, POSITIVE_TC_IDX );
 TEST_FUNCTION( UtcDaliPropertyConditionGetArguments, POSITIVE_TC_IDX );
 TEST_FUNCTION( UtcDaliPropertyConditionGetArgumentsConst, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPropertyNotificationStep, POSITIVE_TC_IDX );
+TEST_FUNCTION( UtcDaliPropertyNotificationVariableStep, POSITIVE_TC_IDX );
 
 class TestClass : public ConnectionTracker
 {
@@ -784,3 +786,75 @@ static void UtcDaliPropertyConditionGetArgumentsConst()
   Property::Value value = argumentsRef1[0];
   DALI_TEST_EQUALS( value.Get<float>(), 50.0f, TEST_LOCATION );
 }
+
+static void UtcDaliPropertyNotificationStep()
+{
+  TestApplication application;
+  tet_infoline(" UtcDaliPropertyNotificationStep");
+
+  Actor actor = Actor::New();
+  Stage::GetCurrent().Add(actor);
+
+  const float step = 100.0f;
+  // float
+  PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, StepCondition(step, 50.0f) );
+  notification.NotifySignal().Connect( &TestCallback );
+
+  // set initial position
+  actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
+  Wait(application, DEFAULT_WAIT_PERIOD);
+
+  // test both directions
+  for( int i = 1 ; i < 10 ; ++i )
+  {
+    // Move x to negative position
+    gCallBackCalled = false;
+    actor.SetPosition(Vector3((i * step), 0.0f, 0.0f));
+    Wait(application, DEFAULT_WAIT_PERIOD);
+    DALI_TEST_CHECK( gCallBackCalled );
+  }
+
+  for( int i = 1 ; i < 10 ; ++i )
+  {
+    // Move x to negative position
+    gCallBackCalled = false;
+    actor.SetPosition(Vector3(-(i * step), 0.0f, 0.0f));
+    Wait(application, DEFAULT_WAIT_PERIOD);
+    DALI_TEST_CHECK( gCallBackCalled );
+  }
+}
+
+static void UtcDaliPropertyNotificationVariableStep()
+{
+  TestApplication application;
+  tet_infoline(" UtcDaliPropertyNotificationStep");
+
+  Actor actor = Actor::New();
+  Stage::GetCurrent().Add(actor);
+
+  std::vector<float> values;
+
+  const float averageStep = 100.0f;
+
+  for( int i = 1 ; i < 10 ; i++ )
+  {
+    values.push_back(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f)));
+  }
+  // float
+  PropertyNotification notification = actor.AddPropertyNotification( Actor::POSITION, 0, VariableStepCondition(values) );
+  notification.NotifySignal().Connect( &TestCallback );
+
+  // set initial position lower than first position in list
+  actor.SetPosition(Vector3(values[0] - averageStep, 0.0f, 0.0f));
+  Wait(application, DEFAULT_WAIT_PERIOD);
+
+  for( int i = 0 ; i < values.size() - 1 ; ++i )
+  {
+    gCallBackCalled = false;
+    // set position half way between the current values
+    float position = values[i] + (0.5f * (values[i + 1] - values[i]));
+    actor.SetPosition(Vector3(position, 0.0f, 0.0f));
+    Wait(application, DEFAULT_WAIT_PERIOD);
+    DALI_TEST_CHECK( gCallBackCalled );
+  }
+}
index 30b4867..2a83861 100644 (file)
@@ -143,6 +143,33 @@ PropertyCondition InsideCondition(float arg0, float arg1);
  */
 PropertyCondition OutsideCondition(float arg0, float arg1);
 
+/**
+ * @brief Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount
+ *
+ * property type:
+ * float (float)
+ * vector2 (the 2D length)
+ * vector3 (the 3D length)
+ * vector4 (the 4D length)
+ * @param[in] stepAmount The step size required to trigger condition
+ * @param[in] initialValue The initial value to step from
+ * @return A property condition function object
+ */
+PropertyCondition StepCondition(float stepAmount, float initialValue = 0.0f);
+
+/**
+ * @brief Receive notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending
+ *
+ * property type:
+ * float (float)
+ * vector2 (the 2D length)
+ * vector3 (the 3D length)
+ * vector4 (the 4D length)
+ * @param[in] steps List of values to receive notifications for as a property crosses them
+ * @return A property condition function object
+ */
+PropertyCondition VariableStepCondition(const std::vector<float>& steps);
+
 } // namespace Dali
 
 /**
index 867fbc4..b0da282 100644 (file)
@@ -118,7 +118,7 @@ public:
    * @brief Sets the Notification mode. This determines how the property
    * notification should respond to the result of a condition.
    *
-   * @param[in] mode Notification mode
+   * @param[in] mode Notification mode (Default is PropertyNotification::NotifyOnTrue)
    */
   void SetNotifyMode( NotifyMode mode );
 
index dc42dda..589c6f4 100644 (file)
@@ -48,7 +48,9 @@ public:
     LessThan,             ///< Magnitude of type is less than float value (arg0).
     GreaterThan,          ///< Magnitude of type is greater than float value (arg0).
     Inside,               ///< Magnitude of type is within float values (arg0 & arg1).
-    Outside               ///< Magnitude of type is outside float values (arg0 & arg1).
+    Outside,              ///< Magnitude of type is outside float values (arg0 & arg1).
+    Step,                 ///< Value of type has crossed a step amount
+    VariableStep          ///< Similar to step, except user can define a list of steps from reference value
   };
 
   typedef Dali::PropertyCondition::ArgumentContainer ArgumentContainer;
index 10a2129..46866bc 100644 (file)
@@ -164,6 +164,8 @@ internal_src_files = \
   $(internal_src_dir)/update/common/discard-queue.cpp \
   $(internal_src_dir)/update/common/property-base.cpp \
   $(internal_src_dir)/update/common/property-condition-functions.cpp \
+  $(internal_src_dir)/update/common/property-condition-step-functions.cpp \
+  $(internal_src_dir)/update/common/property-condition-variable-step-functions.cpp \
   $(internal_src_dir)/update/common/property-owner.cpp \
   $(internal_src_dir)/update/common/scene-graph-buffers.cpp \
   $(internal_src_dir)/update/common/scene-graph-property-notification.cpp \
index 301061c..7478d29 100644 (file)
@@ -73,37 +73,37 @@ ConditionFunction LessThan::GetFunction(Property::Type valueType)
   return function;
 }
 
-bool LessThan::EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool LessThan::EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetBoolean() < arg0);
 }
 
-bool LessThan::EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool LessThan::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetFloat() < arg0);
 }
 
-bool LessThan::EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool LessThan::EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetVector2().LengthSquared() < arg0 * arg0);
 }
 
-bool LessThan::EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool LessThan::EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetVector3().LengthSquared() < arg0 * arg0);
 }
 
-bool LessThan::EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool LessThan::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetVector4().LengthSquared() < arg0 * arg0);
 }
 
-bool LessThan::EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool LessThan::EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   return false;
 }
@@ -151,37 +151,37 @@ ConditionFunction GreaterThan::GetFunction(Property::Type valueType)
   return function;
 }
 
-bool GreaterThan::EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool GreaterThan::EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetBoolean() > arg0);
 }
 
-bool GreaterThan::EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool GreaterThan::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetFloat() > arg0);
 }
 
-bool GreaterThan::EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool GreaterThan::EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetVector2().LengthSquared() > arg0 * arg0);
 }
 
-bool GreaterThan::EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool GreaterThan::EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetVector3().LengthSquared() > arg0 * arg0);
 }
 
-bool GreaterThan::EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool GreaterThan::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float arg0 = arg[0];
   return (value.GetVector4().LengthSquared() > arg0 * arg0);
 }
 
-bool GreaterThan::EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool GreaterThan::EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   return false;
 }
@@ -229,37 +229,37 @@ ConditionFunction Inside::GetFunction(Property::Type valueType)
   return function;
 }
 
-bool Inside::EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Inside::EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const bool valueBoolean = value.GetBoolean();
   return ( (valueBoolean > arg[0]) && (valueBoolean < arg[1]) );
 }
 
-bool Inside::EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Inside::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float valueFloat = value.GetFloat();
   return ( (valueFloat > arg[0]) && (valueFloat < arg[1]) );
 }
 
-bool Inside::EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Inside::EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float length2 = value.GetVector2().LengthSquared();
   return ( (length2 > arg[0]*arg[0]) && (length2 < arg[1]*arg[1]) );
 }
 
-bool Inside::EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Inside::EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float length2 = value.GetVector3().LengthSquared();
   return ( (length2 > arg[0]*arg[0]) && (length2 < arg[1]*arg[1]) );
 }
 
-bool Inside::EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Inside::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float length2 = value.GetVector4().LengthSquared();
   return ( (length2 > arg[0]*arg[0]) && (length2 < arg[1]*arg[1]) );
 }
 
-bool Inside::EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Inside::EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   return false;
 }
@@ -307,37 +307,37 @@ ConditionFunction Outside::GetFunction(Property::Type valueType)
   return function;
 }
 
-bool Outside::EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Outside::EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const bool valueBoolean = value.GetBoolean();
   return ( (valueBoolean < arg[0]) || (valueBoolean > arg[1]) );
 }
 
-bool Outside::EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Outside::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float valueFloat = value.GetFloat();
   return ( (valueFloat < arg[0]) || (valueFloat > arg[1]) );
 }
 
-bool Outside::EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Outside::EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float length2 = value.GetVector2().LengthSquared();
   return ( (length2 < arg[0]*arg[0]) || (length2 > arg[1]*arg[1]) );
 }
 
-bool Outside::EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Outside::EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float length2 = value.GetVector3().LengthSquared();
   return ( (length2 < arg[0]*arg[0]) || (length2 > arg[1]*arg[1]) );
 }
 
-bool Outside::EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Outside::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   const float length2 = value.GetVector4().LengthSquared();
   return ( (length2 < arg[0]*arg[0]) || (length2 > arg[1]*arg[1]) );
 }
 
-bool Outside::EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg )
+bool Outside::EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
 {
   return false;
 }
index d5cd340..a7bb417 100644 (file)
 #include <dali/public-api/object/property-value.h>
 #include <dali/internal/update/common/scene-graph-property-notification.h>
 
+// OTHER CONDITITION INCLUDES
+#include <dali/internal/update/common/property-condition-step-functions.h>
+#include <dali/internal/update/common/property-condition-variable-step-functions.h>
+
 namespace Dali
 {
 
@@ -65,7 +69,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if float is LessThan
@@ -73,7 +77,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector2.Length() is LessThan
@@ -81,7 +85,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector3.Length() is LessThan
@@ -89,7 +93,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector4.Length() is LessThan
@@ -97,7 +101,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Default check for other types
@@ -105,7 +109,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
 };
 
@@ -116,7 +120,7 @@ private:
  * Checks if a Property is "Greater Than" the argument:
  *
  * bool       => false (0.0) or true (1.0) is greater than arg0.
- * float      => value is grVector2eater than arg0.
+ * float      => value is greater than arg0.
  * Vector2    => 2 dimensional length of vector is greater than arg0.
  * Vector3    => 3 dimensional length of vector is greater than arg0.
  * Vector4    => 4 dimensional length of vector is greater than arg0.
@@ -141,7 +145,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if float is GreaterThan
@@ -149,7 +153,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector2.Length() is GreaterThan
@@ -157,7 +161,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector3.Length() is GreaterThan
@@ -165,7 +169,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector4.Length() is GreaterThan
@@ -173,7 +177,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Default check for other types.
@@ -181,7 +185,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
 };
 
@@ -192,10 +196,10 @@ private:
  * Checks if a Property is "Inside" the two arguments:
  *
  * bool       => false (0.0) or true (1.0) is inside arg0.
- * float      => value is inside arg0.
- * Vector2    => 2 dimensional length of vector is inside arg0.
- * Vector3    => 3 dimensional length of vector is inside arg0.
- * Vector4    => 4 dimensional length of vector is inside arg0.
+ * float      => value is between arg0 and arg1.
+ * Vector2    => 2 dimensional length of vector is between arg0 and arg1.
+ * Vector3    => 3 dimensional length of vector is between arg0 and arg1.
+ * Vector4    => 4 dimensional length of vector is between arg0 and arg1.
  * Default    => return false.
  */
 class Inside
@@ -217,7 +221,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if float is Inside
@@ -225,7 +229,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector2.Length() is Inside
@@ -233,7 +237,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector3.Length() is Inside
@@ -241,7 +245,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector4.Length() is Inside
@@ -249,7 +253,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Default check for other types.
@@ -257,7 +261,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
 };
 
@@ -268,10 +272,10 @@ private:
  * Checks if a Property is "Outside" the two arguments:
  *
  * bool       => false (0.0) or true (1.0) is outside arg0.
- * float      => value is inside arg0.
- * Vector2    => 2 dimensional length of vector is outside arg0.
- * Vector3    => 3 dimensional length of vector is outside arg0.
- * Vector4    => 4 dimensional length of vector is outside arg0.
+ * float      => value is outside arg0 and arg1.
+ * Vector2    => 2 dimensional length of vector is outside arg0 and arg1.
+ * Vector3    => 3 dimensional length of vector is outside arg0 and arg1.
+ * Vector4    => 4 dimensional length of vector is outside arg0 and arg1.
  * Default    => return false.
  */
 class Outside
@@ -293,7 +297,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if float is Outside
@@ -301,7 +305,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector2.Length() is Outside
@@ -309,7 +313,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector3.Length() is Outside
@@ -317,7 +321,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Checks if Vector4.Length() is Outside
@@ -325,7 +329,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
   /**
    * Default check for other types.
@@ -333,7 +337,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
 
 };
 
diff --git a/dali/internal/update/common/property-condition-step-functions.cpp b/dali/internal/update/common/property-condition-step-functions.cpp
new file mode 100644 (file)
index 0000000..813247d
--- /dev/null
@@ -0,0 +1,129 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/object/property-input.h>
+#include <dali/internal/update/common/property-condition-step-functions.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace SceneGraph
+{
+
+namespace
+{
+
+const int ARGINDEX_REF_VALUE = 0;
+const int ARGINDEX_STEP_SIZE = 1;
+const int ARGINDEX_CURRENT_STEP = 2;
+
+} // namespace
+
+ConditionFunction Step::GetFunction(Property::Type valueType)
+{
+  ConditionFunction function = NULL;
+
+  switch(valueType)
+  {
+    case Property::FLOAT:
+    {
+      function = EvalFloat;
+      break;
+    }
+    case Property::VECTOR2:
+    {
+      function = EvalVector2;
+      break;
+    }
+    case Property::VECTOR3:
+    {
+      function = EvalVector3;
+      break;
+    }
+    case Property::VECTOR4:
+    {
+      function = EvalVector4;
+      break;
+    }
+    default:
+    {
+      function = EvalDefault;
+      break;
+    }
+  } // end switch
+
+  return function;
+}
+
+bool Step::Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg )
+{
+  const float refValue = arg[ARGINDEX_REF_VALUE];
+  const float step = arg[ARGINDEX_STEP_SIZE];
+  const int currentStep = static_cast<int>(arg[ARGINDEX_CURRENT_STEP]);
+  const float distance = (propertyValue - refValue);
+  // step is actual 1.0f / step so can multiply instead of dividing
+  const int newStep = static_cast<int>(floorf(distance * step));
+
+  if( newStep != currentStep )
+  {
+    // in new section
+    arg[ARGINDEX_CURRENT_STEP] = static_cast<float>(newStep);
+    return true;
+  }
+  return false;
+}
+
+bool Step::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  const float propertyValue = value.GetFloat();
+  return Evaluate( propertyValue, arg );
+}
+
+bool Step::EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  const float propertyValue = value.GetVector2().LengthSquared();
+  return Evaluate( propertyValue, arg );
+}
+
+bool Step::EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  float propertyValue = value.GetVector3().LengthSquared();
+  return Evaluate( propertyValue, arg );
+}
+
+bool Step::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  const float propertyValue = value.GetVector4().LengthSquared();
+  return Evaluate( propertyValue, arg );
+}
+
+bool Step::EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  return false;
+}
+
+} // namespace SceneGraph
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/update/common/property-condition-step-functions.h b/dali/internal/update/common/property-condition-step-functions.h
new file mode 100644 (file)
index 0000000..4c66c07
--- /dev/null
@@ -0,0 +1,109 @@
+#ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H__
+#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/property-value.h>
+#include <dali/internal/update/common/scene-graph-property-notification.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class ProxyObject;
+class PropertyNotification;
+
+namespace SceneGraph
+{
+
+/**
+ * Step condition class,
+ * Checks if a Property has stepped a certain amount from the reference point
+ *
+ * float      => value has stepped arg1 amount from arg0.
+ * Vector2    => 2 dimensional length of vector has stepped arg1 amount from arg0.
+ * Vector3    => 3 dimensional length of vector has stepped arg1 amount from arg0.
+ * Vector4    => 4 dimensional length of vector has stepped arg1 amount from arg0.
+ * Default    => return false.
+ */
+class Step
+{
+
+public:
+
+  /**
+   * @return function pointer to the correct condition function, based on
+   * the type of value being examined.
+   */
+  static ConditionFunction GetFunction( Property::Type valueType );
+
+private:
+
+  static bool Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if float is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if Vector2.Length() is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if Vector3.Length() is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if Vector4.Length() is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Default check for other types.
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+};
+
+} // namespace SceneGraph
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H__
diff --git a/dali/internal/update/common/property-condition-variable-step-functions.cpp b/dali/internal/update/common/property-condition-variable-step-functions.cpp
new file mode 100644 (file)
index 0000000..eb09c36
--- /dev/null
@@ -0,0 +1,178 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/object/property-input.h>
+#include <dali/internal/update/common/property-condition-variable-step-functions.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace SceneGraph
+{
+
+namespace
+{
+
+const int ARGINDEX_STEP_INDEX = 0;
+const int ARGINDEX_LIST_SIZE = 1;
+const int ARGINDEX_LIST_START = 2;
+
+}
+
+ConditionFunction VariableStep::GetFunction( Property::Type valueType )
+{
+  ConditionFunction function = NULL;
+
+  switch( valueType )
+  {
+    case Property::FLOAT:
+    {
+      function = EvalFloat;
+      break;
+    }
+    case Property::VECTOR2:
+    {
+      function = EvalVector2;
+      break;
+    }
+    case Property::VECTOR3:
+    {
+      function = EvalVector3;
+      break;
+    }
+    case Property::VECTOR4:
+    {
+      function = EvalVector4;
+      break;
+    }
+    default:
+    {
+      function = EvalDefault;
+      break;
+    }
+  } // end switch
+
+  return function;
+}
+
+bool VariableStep::Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg )
+{
+  const int currentIndex = arg[ARGINDEX_STEP_INDEX];
+  const int numSteps = arg[ARGINDEX_LIST_SIZE];
+  const float first = arg[ARGINDEX_LIST_START];
+  const float last = arg[ARGINDEX_LIST_START + (numSteps - 1)];
+  const bool ascending = (last > first) ? true : false;
+  int newIndex = currentIndex;
+
+  // avoid loop if property currently not within any of the range values
+  if( ascending )
+  {
+    if( propertyValue < first )
+    {
+      newIndex = -1;
+    }
+    else if( propertyValue >= last )
+    {
+      newIndex = numSteps - 1;
+    }
+  }
+  else
+  {
+    // increments are in negative direction
+    if( propertyValue > first )
+    {
+      newIndex = -1;
+    }
+    else if( propertyValue <= last )
+    {
+      newIndex = numSteps - 1;
+    }
+  }
+  int i = 0;
+  for( i = 0 ; i < numSteps - 1 ; ++i )
+  {
+    const float arg1 = arg[ARGINDEX_LIST_START + i];
+    const float arg2 = arg[ARGINDEX_LIST_START + (i + 1)];
+    if( ascending )
+    {
+      if( ( propertyValue >= arg1 )
+          && ( propertyValue < arg2 ) )
+      {
+        newIndex = i;
+        break;
+      }
+    }
+    else
+    {
+      // increments are in negative direction
+      if( ( propertyValue > arg2 )
+          && ( propertyValue <= arg1 ) )
+      {
+        newIndex = i;
+        break;
+      }
+    }
+  }
+  if( newIndex != currentIndex )
+  {
+    // have changed to new step
+    arg[ARGINDEX_STEP_INDEX] = static_cast<float>(newIndex);
+    return true;
+  }
+  return false;
+}
+
+bool VariableStep::EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  const float propertyValue = value.GetFloat();
+  return Evaluate( propertyValue, arg );
+}
+
+bool VariableStep::EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  const float propertyValue = value.GetVector2().LengthSquared();
+  return Evaluate( propertyValue, arg );
+}
+
+bool VariableStep::EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  float propertyValue = value.GetVector3().LengthSquared();
+  return Evaluate( propertyValue, arg );
+}
+
+bool VariableStep::EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  const float propertyValue = value.GetVector4().LengthSquared();
+  return Evaluate( propertyValue, arg );
+}
+
+bool VariableStep::EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg )
+{
+  return false;
+}
+
+} // namespace SceneGraph
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/update/common/property-condition-variable-step-functions.h b/dali/internal/update/common/property-condition-variable-step-functions.h
new file mode 100644 (file)
index 0000000..76260c8
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_VARIABLE_STEP_FUNCTIONS_H__
+#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_VARIABLE_STEP_FUNCTIONS_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/property-value.h>
+#include <dali/internal/update/common/scene-graph-property-notification.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class ProxyObject;
+class PropertyNotification;
+
+namespace SceneGraph
+{
+
+/**
+ * VariableStep condition class,
+ * Uses a list of values, this condition notifies when the Property crosses between different values
+ *
+ * float      => value has stepped arg1 amount from arg0.
+ * Vector2    => 2 dimensional length of vector has stepped arg1 amount from arg0.
+ * Vector3    => 3 dimensional length of vector has stepped arg1 amount from arg0.
+ * Vector4    => 4 dimensional length of vector has stepped arg1 amount from arg0.
+ * Default    => return false.
+ */
+class VariableStep
+{
+
+public:
+
+  /**
+   * @return function pointer to the correct condition function, based on
+   * the type of value being examined.
+   */
+  static ConditionFunction GetFunction( Property::Type valueType );
+
+private:
+
+  /**
+   * Helper function used to evaluate our property
+   *
+   *
+   */
+  static bool Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if float is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if Vector2.Length() is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if Vector3.Length() is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Checks if Vector4.Length() is Outside
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+  /**
+   * Default check for other types.
+   * @param[in] value The value being examined.
+   * @param[in] arg The supplied arguments for the condition.
+   * @return Condition result (true if condition met, false if not)
+   */
+  static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
+
+};
+
+} // namespace SceneGraph
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_VARIABLE_STEP_FUNCTIONS_H__
index 4eb512b..2fad63b 100644 (file)
@@ -39,7 +39,7 @@ PropertyNotification* PropertyNotification::New(ProxyObject& proxy,
                                                 Property::Type propertyType,
                                                 int componentIndex,
                                                 ConditionType condition,
-                                                const RawArgumentContainer& arguments,
+                                                RawArgumentContainer& arguments,
                                                 NotifyMode notifyMode)
 {
   return new PropertyNotification( proxy, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode );
@@ -51,7 +51,7 @@ PropertyNotification::PropertyNotification(ProxyObject& proxy,
                                            Property::Type propertyType,
                                            int componentIndex,
                                            ConditionType condition,
-                                           const RawArgumentContainer& arguments,
+                                           RawArgumentContainer& arguments,
                                            NotifyMode notifyMode)
 : mProxy(&proxy),
   mPropertyIndex(propertyIndex),
@@ -86,6 +86,16 @@ PropertyNotification::PropertyNotification(ProxyObject& proxy,
       mConditionFunction = Outside::GetFunction(mPropertyType);
       break;
     }
+    case PropertyCondition::Step:
+    {
+      mConditionFunction = Step::GetFunction(mPropertyType);
+      break;
+    }
+    case PropertyCondition::VariableStep:
+    {
+      mConditionFunction = VariableStep::GetFunction(mPropertyType);
+      break;
+    }
     case PropertyCondition::False:
     {
       mConditionFunction = PropertyNotification::EvalFalse;
@@ -111,7 +121,7 @@ PropertyNotification::~PropertyNotification()
 {
 }
 
-bool PropertyNotification::EvalFalse( const Dali::PropertyInput& value, const RawArgumentContainer& arg )
+bool PropertyNotification::EvalFalse( const Dali::PropertyInput& value, RawArgumentContainer& arg )
 {
   return false;
 }
index 67e211f..6cb9ebc 100644 (file)
@@ -42,7 +42,7 @@ class PropertyNotification;
 typedef OwnerContainer< PropertyNotification* > PropertyNotificationContainer;
 typedef PropertyNotificationContainer::Iterator PropertyNotificationIter;
 typedef PropertyNotificationContainer::ConstIterator PropertyNotificationConstIter;
-typedef bool(*ConditionFunction)(const Dali::PropertyInput& value, const Dali::Internal::PropertyNotification::RawArgumentContainer& args);
+typedef bool(*ConditionFunction)(const Dali::PropertyInput& value, Dali::Internal::PropertyNotification::RawArgumentContainer& args);
 
 /**
  * PropertyNotifications are used to inspect properties of scene graph objects, as part of a scene
@@ -73,7 +73,7 @@ public:
                                    Property::Type propertyType,
                                    int componentIndex,
                                    ConditionType condition,
-                                   const RawArgumentContainer& arguments,
+                                   RawArgumentContainer& arguments,
                                    NotifyMode notifyMode);
 
   /**
@@ -121,7 +121,7 @@ protected:
                        Property::Type propertyType,
                        int componentIndex,
                        ConditionType condition,
-                       const RawArgumentContainer& arguments,
+                       RawArgumentContainer& arguments,
                        NotifyMode notifyMode);
 
 private:
@@ -132,7 +132,7 @@ private:
    * @param[in] arg The supplied arguments for the condition.
    * @return Condition result (true if condition met, false if not)
    */
-  static bool EvalFalse( const Dali::PropertyInput& value, const Dali::Internal::PropertyNotification::RawArgumentContainer& arg );
+  static bool EvalFalse( const Dali::PropertyInput& value, Dali::Internal::PropertyNotification::RawArgumentContainer& arg );
 
   // Undefined
   PropertyNotification(const PropertyNotification&);
@@ -148,7 +148,7 @@ protected:
   const PropertyInputImpl* mProperty;           ///< The scene graph property
   int mComponentIndex;                          ///< Used for accessing float components of Vector3/4
   ConditionType mConditionType;                 ///< The ConditionType
-  const RawArgumentContainer mArguments;        ///< The arguments.
+  RawArgumentContainer mArguments;              ///< The arguments.
   bool mValid;                                  ///< Whether this property notification is currently valid or not.
   char mNotifyValidity[2];                      ///< Whether to notify on invalid and/or valid
   ConditionFunction mConditionFunction;         ///< The Condition Function pointer to be evaluated.
index d24388e..1bfc175 100644 (file)
@@ -83,4 +83,30 @@ PropertyCondition OutsideCondition(float arg0, float arg1)
   return condition;
 }
 
+PropertyCondition StepCondition(float stepAmount, float referenceValue)
+{
+  PropertyCondition condition;
+  GetImplementation(condition).type = Internal::PropertyCondition::Step;
+  GetImplementation(condition).arguments.push_back(Property::Value(referenceValue));
+  GetImplementation(condition).arguments.push_back(Property::Value(1.0f / stepAmount));
+  GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
+
+  return condition;
+}
+
+PropertyCondition VariableStepCondition(const std::vector<float>& stepAmount)
+{
+  PropertyCondition condition;
+  GetImplementation(condition).type = Internal::PropertyCondition::VariableStep;
+  GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
+  int size = stepAmount.size();
+  GetImplementation(condition).arguments.push_back(Property::Value(static_cast<float>(size))); // store number of steps
+  for( std::vector<float>::const_iterator it = stepAmount.begin(), endIt = stepAmount.end(); it != endIt; ++it )
+  {
+    GetImplementation(condition).arguments.push_back(Property::Value( *it ));
+  }
+
+  return condition;
+}
+
 } // namespace Dali