Using New Constraints 72/37872/3
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 7 Apr 2015 14:36:00 +0000 (15:36 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 8 Apr 2015 15:56:15 +0000 (16:56 +0100)
 - ItemView: Use an animation instead of the constraint weight
 - Changes following new constraints

Change-Id: I6b61f69751288d7bbd1dc01ba1c190a4a917e33f

42 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h
automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp
automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp
automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp
build/tizen/plugins/Makefile.am
dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp
dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp
dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp
dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp
dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h
dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp
dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp
dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp
dali-toolkit/internal/shader-effects/page-turn-effect-impl.cpp
dali-toolkit/internal/shader-effects/page-turn-effect-impl.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp
dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h
dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.cpp
dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.h
dali-toolkit/public-api/controls/view/view.h
dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp
dali-toolkit/public-api/shader-effects/motion-stretch-effect.cpp
dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.cpp
dali-toolkit/public-api/shader-effects/soft-button-effect.cpp

index cc16ab0..92d1390 100644 (file)
@@ -287,7 +287,7 @@ ConstraintAppliedCheck::ConstraintAppliedCheck( bool& signalReceived )
 {
 }
 
-void ConstraintAppliedCheck::operator()( ActiveConstraint& constraint )
+void ConstraintAppliedCheck::operator()( Constraint& constraint )
 {
   mSignalReceived = true;
 }
index 98fc629..4217d55 100644 (file)
@@ -371,7 +371,7 @@ inline void DALI_TEST_PRINT_ASSERT( DaliException& e )
 struct ConstraintAppliedCheck
 {
   ConstraintAppliedCheck( bool& signalReceived );
-  void operator()( ActiveConstraint& constraint );
+  void operator()( Constraint& constraint );
   void Reset();
   void CheckSignalReceived();
   void CheckSignalNotReceived();
index 662502c..39af3d3 100644 (file)
@@ -207,25 +207,13 @@ struct TestSumConstraint
 
   /**
    * @param[in] current The current base value
-   * @param[in] property The property to be added to current.
+   * @param[in] inputs Contains the property to be added to current.
    * @return The new current Vector.
    */
-  Vector3 operator()(const Vector3& current)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    gConstraintResult = current + mOffset;
-    return gConstraintResult;
-  }
-
-  /**
-   * @param[in] current The current base value
-   * @param[in] property The property to be added to current.
-   * @return The new current Vector.
-   */
-  Vector3 operator()(const Vector3&    current,
-                    const PropertyInput& property)
-  {
-    gConstraintResult = current + property.GetVector3() + mOffset;
-    return gConstraintResult;
+    gConstraintResult = current + inputs[0]->GetVector3() + mOffset;
+    current = gConstraintResult;
   }
 
   Vector3 mOffset;
@@ -814,9 +802,8 @@ int UtcDaliScrollViewConstraints(void)
   a.SetPosition( TEST_ACTOR_POSITION );
   Wait(application);
 
-  Constraint constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                                       Source(scrollView, ScrollView::Property::SCROLL_POSITION),
-                                                       TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+  Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+  constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
   constraint.SetRemoveAction(Constraint::Discard);
   scrollView.ApplyConstraintToChildren(constraint);
   Wait(application);
@@ -862,10 +849,8 @@ int UtcDaliScrollViewBind(void)
   Wait(application);
 
   // apply this constraint to scrollview
-  Constraint constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                                       Source(scrollView, ScrollView::Property::SCROLL_POSITION),
-                                                       TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
-
+  Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, TestSumConstraint( TEST_CONSTRAINT_OFFSET ) );
+  constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
   constraint.SetRemoveAction(Constraint::Discard);
   scrollView.ApplyConstraintToChildren(constraint);
 
index 5cda497..1b6f1c6 100644 (file)
@@ -137,11 +137,17 @@ static void OnScrollComplete( const Vector3& position )
 
 ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
 {
+  Constraint constraint;
+
   ScrollView scrollView = ScrollView::New();
   scrollView.SetSize(size);
   scrollView.SetAnchorPoint(AnchorPoint::CENTER);
   scrollView.SetParentOrigin(ParentOrigin::CENTER);
-  scrollView.ApplyConstraint( Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::EqualToConstraint() ) );
+
+  constraint = Constraint::New<Dali::Vector3>( scrollView, Dali::Actor::Property::SIZE, Dali::EqualToConstraint() );
+  constraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
+  constraint.Apply();
+
   scrollView.SetWrapMode(false);
   scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
   scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
@@ -175,7 +181,10 @@ ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
   container.SetAnchorPoint(AnchorPoint::CENTER);
   container.SetSize( size );
   scrollView.Add( container );
-  container.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ) );
+
+  constraint = Constraint::New<Vector3>( container, Actor::Property::SIZE, EqualToConstraint() );
+  constraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
+  constraint.Apply();
 
   gPages.clear();
   for(int row = 0;row<rows;row++)
@@ -183,7 +192,10 @@ ScrollView SetupTestScrollView(int rows, int columns, Vector2 size)
     for(int column = 0;column<columns;column++)
     {
       Actor page = Actor::New();
-      page.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ) );
+
+      constraint = Constraint::New<Vector3>( page, Actor::Property::SIZE, EqualToConstraint() );
+      constraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
+      constraint.Apply();
       page.SetParentOrigin( ParentOrigin::CENTER );
       page.SetAnchorPoint( AnchorPoint::CENTER );
       page.SetPosition( column * size.x, row * size.y );
@@ -322,7 +334,10 @@ int UtcDaliScrollViewSpiralEffectTest(void)
   {
     Actor page = *pageIter;
     page.RemoveConstraints();
-    page.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ) );
+
+    Constraint constraint = Constraint::New<Vector3>( page, Actor::Property::SIZE, EqualToConstraint() );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.Apply();
     effect.ApplyToPage(page, Vector2(Math::PI_2, 0.0f));
   }
   Wait(application);
@@ -431,7 +446,9 @@ int UtcDaliScrollViewPageCubeEffectTest(void)
   {
     Actor page = *pageIter;
     page.RemoveConstraints();
-    page.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ) );
+    Constraint constraint = Constraint::New<Vector3>( page, Actor::Property::SIZE, EqualToConstraint() );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.Apply();
     effect.ApplyToPage(page, Vector2(Math::PI_2, 0.0f));
   }
   Wait(application);
@@ -466,7 +483,9 @@ int UtcDaliScrollViewPageCarouselEffectTest(void)
   {
     Actor page = *pageIter;
     page.RemoveConstraints();
-    page.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ) );
+    Constraint constraint = Constraint::New<Vector3>( page, Actor::Property::SIZE, EqualToConstraint() );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.Apply();
     effect.ApplyToPage(page);
   }
   Wait(application);
index 0e99819..dc6b0af 100644 (file)
@@ -58,9 +58,9 @@ struct Constraint100
   /**
    * function operator to apply the parent size
    */
-  Dali::Vector3 operator()(const Dali::Vector3& current)
+  void operator()( Dali::Vector3& current, const PropertyInputContainer& /* inputs */ )
   {
-    return Dali::Vector3( 100.0f, 100.0f, 100.0f );
+    current.x = current.y = current.z = 100.0f;
   }
 };
 
@@ -642,7 +642,8 @@ int UtcDaliTableViewCustomProperties(void)
 
   // Create a 10x10 table-view
   TableView tableView = TableView::New(10,10);
-  tableView.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::SIZE, Constraint100() ) );
+  Constraint constraint = Constraint::New<Vector3>( tableView, Actor::Property::SIZE, Constraint100() );
+  constraint.Apply();
   DALI_TEST_CHECK( tableView );
 
   // Create a child actor with the custom properties
index bb89f6c..557c8c2 100644 (file)
@@ -46,6 +46,7 @@ libdali_script_plugin_v8_la_CXXFLAGS = -DDALI_COMPILATION \
                             $(DALI_CFLAGS) \
                             $(DLOG_CFLAGS) \
                             $(script_plugin_v8_includes) \
+                            $(V8_CFLAGS) \
                             -Werror -Wall
 
 libdali_script_plugin_v8_la_LIBADD = \
index 0221785..df9b6ed 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <sstream>
 #include <iomanip>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
@@ -459,18 +458,6 @@ void BloomView::Deactivate()
 }
 
 /**
- * EqualToConstraintFloat
- *
- * f(current, property) = property
- */
-struct EqualToConstraintFloat
-{
-  EqualToConstraintFloat(){}
-
-  float operator()(const float current, const PropertyInput& property) {return property.GetFloat();}
-};
-
-/**
  * RecipOneMinusConstraint
  *
  * f(current, property) = property
@@ -479,9 +466,9 @@ struct RecipOneMinusConstraint
 {
   RecipOneMinusConstraint(){}
 
-  float operator()(const float current, const PropertyInput& property)
+  void operator()( float& current, const PropertyInputContainer& inputs )
   {
-    return 1.0f / (1.0f - property.GetFloat());
+    current = 1.0f / ( 1.0f - inputs[0]->GetFloat() );
   }
 };
 
@@ -502,13 +489,15 @@ void BloomView::SetupProperties()
   // Register a property that the user can control to change the bloom threshold
   mBloomThresholdPropertyIndex = self.RegisterProperty(BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT);
   Property::Index shaderBloomThresholdPropertyIndex = mBloomExtractShader.GetPropertyIndex(BLOOM_THRESHOLD_PROPERTY_NAME);
-  Constraint bloomThresholdConstraint = Constraint::New<float>(shaderBloomThresholdPropertyIndex, Source(self, mBloomThresholdPropertyIndex), EqualToConstraintFloat());
-  mBloomExtractShader.ApplyConstraint(bloomThresholdConstraint);
+  Constraint bloomThresholdConstraint = Constraint::New<float>( mBloomExtractShader, shaderBloomThresholdPropertyIndex, EqualToConstraint());
+  bloomThresholdConstraint.AddSource( Source(self, mBloomThresholdPropertyIndex) );
+  bloomThresholdConstraint.Apply();
 
   // precalc 1.0 / (1.0 - threshold) on CPU to save shader insns, using constraint to tie to the normal threshold property
   Property::Index shaderRecipOneMinusBloomThresholdPropertyIndex = mBloomExtractShader.GetPropertyIndex(RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME);
-  Constraint thresholdConstraint = Constraint::New<float>( shaderRecipOneMinusBloomThresholdPropertyIndex, LocalSource(shaderBloomThresholdPropertyIndex), RecipOneMinusConstraint());
-  mBloomExtractShader.ApplyConstraint(thresholdConstraint);
+  Constraint thresholdConstraint = Constraint::New<float>( mBloomExtractShader, shaderRecipOneMinusBloomThresholdPropertyIndex, RecipOneMinusConstraint());
+  thresholdConstraint.AddSource( LocalSource(shaderBloomThresholdPropertyIndex) );
+  thresholdConstraint.Apply();
 
 
   ////////////////////////////////////////////
@@ -516,8 +505,9 @@ void BloomView::SetupProperties()
 
   // Register a property that the user can control to fade the blur in / out via internal GaussianBlurView object
   mBlurStrengthPropertyIndex = self.RegisterProperty(BLOOM_BLUR_STRENGTH_PROPERTY_NAME, BLOOM_BLUR_STRENGTH_DEFAULT);
-  Constraint blurStrengthConstraint = Constraint::New<float>( mGaussianBlurView.GetBlurStrengthPropertyIndex(), Source(self, mBlurStrengthPropertyIndex), EqualToConstraintFloat());
-  mGaussianBlurView.ApplyConstraint(blurStrengthConstraint);
+  Constraint blurStrengthConstraint = Constraint::New<float>( mGaussianBlurView, mGaussianBlurView.GetBlurStrengthPropertyIndex(), EqualToConstraint());
+  blurStrengthConstraint.AddSource( Source(self, mBlurStrengthPropertyIndex) );
+  blurStrengthConstraint.Apply();
 
 
   ////////////////////////////////////////////
@@ -527,8 +517,9 @@ void BloomView::SetupProperties()
   mBloomIntensityPropertyIndex = self.RegisterProperty(BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT);
   mCompositeShader.SetUniform( BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT );
   Property::Index shaderBloomIntensityPropertyIndex = mCompositeShader.GetPropertyIndex(BLOOM_INTENSITY_PROPERTY_NAME);
-  Constraint bloomIntensityConstraint = Constraint::New<float>( shaderBloomIntensityPropertyIndex, Source(self, mBloomIntensityPropertyIndex), EqualToConstraintFloat());
-  mCompositeShader.ApplyConstraint(bloomIntensityConstraint);
+  Constraint bloomIntensityConstraint = Constraint::New<float>( mCompositeShader, shaderBloomIntensityPropertyIndex, EqualToConstraint());
+  bloomIntensityConstraint.AddSource( Source(self, mBloomIntensityPropertyIndex) );
+  bloomIntensityConstraint.Apply();
 
 
   ////////////////////////////////////////////
@@ -538,8 +529,9 @@ void BloomView::SetupProperties()
   mBloomSaturationPropertyIndex = self.RegisterProperty(BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT);
   mCompositeShader.SetUniform( BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT );
   Property::Index shaderBloomSaturationPropertyIndex = mCompositeShader.GetPropertyIndex(BLOOM_SATURATION_PROPERTY_NAME);
-  Constraint bloomSaturationConstraint = Constraint::New<float>( shaderBloomSaturationPropertyIndex, Source(self, mBloomSaturationPropertyIndex), EqualToConstraintFloat());
-  mCompositeShader.ApplyConstraint(bloomSaturationConstraint);
+  Constraint bloomSaturationConstraint = Constraint::New<float>( mCompositeShader, shaderBloomSaturationPropertyIndex, EqualToConstraint());
+  bloomSaturationConstraint.AddSource( Source(self, mBloomSaturationPropertyIndex) );
+  bloomSaturationConstraint.Apply();
 
 
   ////////////////////////////////////////////
@@ -549,8 +541,9 @@ void BloomView::SetupProperties()
   mImageIntensityPropertyIndex = self.RegisterProperty(IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT);
   mCompositeShader.SetUniform( IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT );
   Property::Index shaderImageIntensityPropertyIndex = mCompositeShader.GetPropertyIndex(IMAGE_INTENSITY_PROPERTY_NAME);
-  Constraint imageIntensityConstraint = Constraint::New<float>( shaderImageIntensityPropertyIndex, Source(self, mImageIntensityPropertyIndex), EqualToConstraintFloat());
-  mCompositeShader.ApplyConstraint(imageIntensityConstraint);
+  Constraint imageIntensityConstraint = Constraint::New<float>( mCompositeShader, shaderImageIntensityPropertyIndex, EqualToConstraint());
+  imageIntensityConstraint.AddSource( Source(self, mImageIntensityPropertyIndex) );
+  imageIntensityConstraint.Apply();
 
 
   ////////////////////////////////////////////
@@ -560,8 +553,9 @@ void BloomView::SetupProperties()
   mImageSaturationPropertyIndex = self.RegisterProperty(IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT);
   mCompositeShader.SetUniform( IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT );
   Property::Index shaderImageSaturationPropertyIndex = mCompositeShader.GetPropertyIndex(IMAGE_SATURATION_PROPERTY_NAME);
-  Constraint imageSaturationConstraint = Constraint::New<float>( shaderImageSaturationPropertyIndex, Source(self, mImageSaturationPropertyIndex), EqualToConstraintFloat());
-  mCompositeShader.ApplyConstraint(imageSaturationConstraint);
+  Constraint imageSaturationConstraint = Constraint::New<float>( mCompositeShader, shaderImageSaturationPropertyIndex, EqualToConstraint());
+  imageSaturationConstraint.AddSource( Source(self, mImageSaturationPropertyIndex) );
+  imageSaturationConstraint.Apply();
 }
 
 } // namespace Internal
index d229ceb..21b6e23 100644 (file)
@@ -19,7 +19,6 @@
 #include "effects-view-impl.h"
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
@@ -271,8 +270,14 @@ void EffectsView::SetupProperties()
   mEffectStrengthPropertyIndex = self.RegisterProperty(EFFECT_STRENGTH_PROPERTY_NAME, EFFECT_STRENGTH_DEFAULT, Property::READ_WRITE);
   mEffectOffsetPropertyIndex   = self.RegisterProperty(EFFECT_OFFSET_PROPERTY_NAME, EFFECT_OFFSET_DEFAULT);
   mEffectColorPropertyIndex    = self.RegisterProperty(EFFECT_COLOR_PROPERTY_NAME, EFFECT_COLOR_DEFAULT);
-  mActorPostFilter.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::POSITION, Source( self, mEffectOffsetPropertyIndex ), EqualToConstraint() ) );
-  mActorPostFilter.ApplyConstraint( Constraint::New<Vector4>( Actor::Property::COLOR, Source( self, mEffectColorPropertyIndex ), EqualToConstraint() ) );
+
+  Constraint positionConstraint = Constraint::New<Vector3>( mActorPostFilter, Actor::Property::POSITION, EqualToConstraint() );
+  positionConstraint.AddSource( Source( self, mEffectOffsetPropertyIndex ) );
+  positionConstraint.Apply();
+
+  Constraint colorConstraint = Constraint::New<Vector4>( mActorPostFilter, Actor::Property::COLOR, EqualToConstraint() );
+  colorConstraint.AddSource( Source( self, mEffectColorPropertyIndex ) );
+  colorConstraint.Apply();
 }
 
 void EffectsView::SetBackgroundColor( const Vector4& color )
index 5a5e501..4ca5be5 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <sstream>
 #include <iomanip>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
@@ -242,18 +241,6 @@ Vector4 GaussianBlurView::GetBackgroundColor() const
 // Private methods
 //
 
-/**
- * EqualToConstraintFloat
- *
- * f(current, property) = property
- */
-struct EqualToConstraintFloat
-{
-  EqualToConstraintFloat(){}
-
-  float operator()(const float current, const PropertyInput& property) {return property.GetFloat();}
-};
-
 void GaussianBlurView::OnInitialize()
 {
   // root actor to parent all user added actors, needed to allow us to set that subtree as exclusive for our child render task
@@ -300,8 +287,9 @@ void GaussianBlurView::OnInitialize()
     mImageActorComposite.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
     mImageActorComposite.SetOpacity(GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_STRENGTH); // ensure alpha is enabled for this object and set default value
 
-    Constraint blurStrengthConstraint = Constraint::New<float>( Actor::Property::COLOR_ALPHA, ParentSource(mBlurStrengthPropertyIndex), EqualToConstraintFloat());
-    mImageActorComposite.ApplyConstraint(blurStrengthConstraint);
+    Constraint blurStrengthConstraint = Constraint::New<float>( mImageActorComposite, Actor::Property::COLOR_ALPHA, EqualToConstraint());
+    blurStrengthConstraint.AddSource( ParentSource(mBlurStrengthPropertyIndex) );
+    blurStrengthConstraint.Apply();
 
     // Create an ImageActor for holding final result, i.e. the blurred image. This will get rendered to screen later, via default / user render task
     mTargetActor = ImageActor::New();
index 2dc796c..97c4053 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <sstream>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
@@ -98,11 +97,6 @@ const char* const MASKED_IMAGE_VIEW_FRAGMENT_SOURCE =
   "  gl_FragColor = texture2D(sTexture, vTexCoord) * vec4(1,1,1,mask.a);                                         \n"
   "}";
 
-Vector2 EqualToConstraintVector2( const Vector2& current, const PropertyInput& property )
-{
-  return property.GetVector2();
-}
-
 Vector2 GetSizeForAspectRatio( const Vector2& targetSize, float aspectRatio )
 {
   Vector2 sizeToKeepAspectRatio( targetSize );
@@ -545,9 +539,10 @@ void MaskedImageView::Initialize( unsigned int targetWidth,
   mRenderTask.SetInputEnabled( false );
   mRenderTask.SetExclusive( true );
   mRenderTask.SetClearEnabled( true );
-  mRenderTask.ApplyConstraint( Constraint::New<Vector4>( RenderTask::Property::CLEAR_COLOR,
-                                                         Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::BACKGROUND_COLOR ] ),
-                                                         EqualToConstraint() ) );
+
+  Constraint clearColorConstraint = Constraint::New<Vector4>( mRenderTask, RenderTask::Property::CLEAR_COLOR, EqualToConstraint() );
+  clearColorConstraint.AddSource( Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::BACKGROUND_COLOR ] ) );
+  clearColorConstraint.Apply();
   mRenderTask.FinishedSignal().Connect( this, &MaskedImageView::OnRenderTaskFinished );
 
   // Edit mode initialization
@@ -585,22 +580,26 @@ void MaskedImageView::ApplyMaskedImageShader( ImageRotation rotation )
                                            ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ) );
 
   shader.SetUniform( "uTargetSize", mTargetSize );
+
   shader.SetUniform( "uSourceSize", mTargetSize );
-  shader.ApplyConstraint( Constraint::New<Vector2>( shader.GetPropertyIndex( "uSourceSize" ),
-                                                    Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::SOURCE_SIZE ] ),
-                                                    EqualToConstraintVector2 ) );
+  Constraint sourceSizeConstraint = Constraint::New<Vector2>( shader, shader.GetPropertyIndex( "uSourceSize" ), EqualToConstraint() );
+  sourceSizeConstraint.AddSource( Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::SOURCE_SIZE ] ) );
+  sourceSizeConstraint.Apply();
+
   shader.SetUniform( "uSourceOffset", Vector2::ZERO );
-  shader.ApplyConstraint( Constraint::New<Vector2>( shader.GetPropertyIndex( "uSourceOffset" ),
-                                                    Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::SOURCE_OFFSET ] ),
-                                                    EqualToConstraintVector2 ) );
+  Constraint sourceOffsetConstraint = Constraint::New<Vector2>( shader, shader.GetPropertyIndex( "uSourceOffset" ), EqualToConstraint() );
+  sourceOffsetConstraint.AddSource( Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::SOURCE_OFFSET ] ) );
+  sourceOffsetConstraint.Apply();
+
   shader.SetUniform( "uMaskSize", mTargetSize );
-  shader.ApplyConstraint( Constraint::New<Vector2>( shader.GetPropertyIndex( "uMaskSize" ),
-                                                    Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::MASK_SIZE ] ),
-                                                    EqualToConstraintVector2 ) );
+  Constraint maskSizeConstraint = Constraint::New<Vector2>( shader, shader.GetPropertyIndex( "uMaskSize" ), EqualToConstraint() );
+  maskSizeConstraint.AddSource( Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::MASK_SIZE ] ) );
+  maskSizeConstraint.Apply();
+
   shader.SetUniform( "uMaskOffset", mTargetSize );
-  shader.ApplyConstraint( Constraint::New<Vector2>( shader.GetPropertyIndex( "uMaskOffset" ),
-                                                    Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::MASK_OFFSET ] ),
-                                                    EqualToConstraintVector2 ) );
+  Constraint maskOffsetConstraint = Constraint::New<Vector2>( shader, shader.GetPropertyIndex( "uMaskOffset" ), EqualToConstraint() );
+  maskOffsetConstraint.AddSource( Source( self, mCustomProperties[ Dali::Toolkit::MaskedImageView::MASK_OFFSET ] ) );
+  maskOffsetConstraint.Apply();
 
   shader.SetEffectImage( mMaskImage );
   mSourceImageActor.SetShaderEffect( shader );
index 37e5776..fc6f71a 100644 (file)
@@ -19,7 +19,6 @@
 #include <dali-toolkit/internal/controls/magnifier/magnifier-impl.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
@@ -35,27 +34,6 @@ const char* DEFAULT_FRAME_IMAGE_PATH = DALI_IMAGE_DIR "magnifier-image-frame.png
 
 const float IMAGE_BORDER_INDENT = 14.0f;            ///< Indent of border in pixels.
 
-/**
- * ImageBorderSizeConstraint
- */
-struct ImageBorderSizeConstraint
-{
-  ImageBorderSizeConstraint()
-  : mSizeOffset(Vector3(IMAGE_BORDER_INDENT - 1, IMAGE_BORDER_INDENT - 1, 0.0f) * 2.0f)
-  {
-  }
-
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& referenceSizeProperty)
-  {
-    const Vector3& referenceSize = referenceSizeProperty.GetVector3();
-
-    return referenceSize + mSizeOffset;
-  }
-
-  Vector3 mSizeOffset;                        ///< The amount to offset the size from referenceSize
-};
-
 struct CameraActorPositionConstraint
 {
   CameraActorPositionConstraint(const Vector2& stageSize, float defaultCameraDistance = 0.0f)
@@ -64,14 +42,13 @@ struct CameraActorPositionConstraint
   {
   }
 
-  Vector3 operator()(const Vector3& current,
-                     const PropertyInput& sourcePositionProperty)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& sourcePosition = sourcePositionProperty.GetVector3();
+    const Vector3& sourcePosition = inputs[0]->GetVector3();
 
-    return Vector3( sourcePosition.x + mStageSize.x * 0.5f,
-                    sourcePosition.y + mStageSize.y * 0.5f,
-                    sourcePosition.z + mDefaultCameraDistance);
+    current.x = sourcePosition.x + mStageSize.x * 0.5f;
+    current.y = sourcePosition.y + mStageSize.y * 0.5f;
+    current.z = sourcePosition.z + mDefaultCameraDistance;
   }
 
   Vector2 mStageSize;
@@ -86,25 +63,18 @@ struct RenderTaskViewportPositionConstraint
   {
   }
 
-  Vector2 operator()(const Vector2& current,
-                     const PropertyInput& positionProperty,
-                     const PropertyInput& magnifierSizeProperty,
-                     const PropertyInput& magnifierScaleProperty)
+  void operator()( Vector2& current, const PropertyInputContainer& inputs )
   {
-    Vector2 position(positionProperty.GetVector3()); // World position?
-
-    //position -= mStageSize * 0.5f;
+    current = inputs[0]->GetVector3(); // World position?
 
     // should be updated when:
     // Magnifier's world position/size/scale/parentorigin/anchorpoint changes.
     // or Magnifier camera's world position changes.
-    Vector3 size = magnifierSizeProperty.GetVector3() * magnifierScaleProperty.GetVector3();
+    Vector3 size = inputs[1]->GetVector3() * inputs[2]->GetVector3(); /* magnifier-size * magnifier-scale */
 
     // Reposition, and resize viewport to reflect the world bounds of this Magnifier actor.
-    position.x += (mStageSize.width - size.width) * 0.5f;
-    position.y += (mStageSize.height - size.height) * 0.5f;
-
-    return position;
+    current.x += ( mStageSize.width - size.width ) * 0.5f;
+    current.y += ( mStageSize.height - size.height ) * 0.5f;
   }
 
   Vector2 mStageSize;
@@ -116,11 +86,9 @@ struct RenderTaskViewportSizeConstraint
   {
   }
 
-  Vector2 operator()(const Vector2& current,
-                     const PropertyInput& magnifierSizeProperty,
-                     const PropertyInput& magnifierScaleProperty)
+  void operator()( Vector2& current, const PropertyInputContainer& inputs )
   {
-    return Vector2(magnifierSizeProperty.GetVector3() * magnifierScaleProperty.GetVector3());
+    current = inputs[0]->GetVector3() * inputs[1]->GetVector3(); /* magnifier-size * magnifier-scale */
   }
 };
 
@@ -192,10 +160,9 @@ void Magnifier::Initialize()
   mSourceActor = Actor::New();
   Stage().GetCurrent().Add(mSourceActor);
   mSourceActor.SetParentOrigin(ParentOrigin::CENTER);
-  Constraint constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                                    Source( self, mPropertySourcePosition ),
-                                                    EqualToConstraint() );
-  mSourceActor.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( mSourceActor, Actor::Property::POSITION, EqualToConstraint() );
+  constraint.AddSource( Source( self, mPropertySourcePosition ) );
+  constraint.Apply();
 
   // create the render task this will render content on top of everything
   // based on camera source position.
@@ -224,25 +191,22 @@ void Magnifier::Initialize()
   // at the end of the update cycle i.e. after constraints have been applied.)
   //Property::Index propertySourcePositionDelayed = mCameraActor.RegisterProperty("delayed-source-position", Vector3::ZERO);
 
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         Source( mSourceActor, Actor::Property::WORLD_POSITION ),
-                                         CameraActorPositionConstraint(stageSize, mDefaultCameraDistance) );
-  mCameraActor.ApplyConstraint(constraint);
+  constraint = Constraint::New<Vector3>( mCameraActor, Actor::Property::POSITION, CameraActorPositionConstraint(stageSize, mDefaultCameraDistance) );
+  constraint.AddSource( Source( mSourceActor, Actor::Property::WORLD_POSITION ) );
+  constraint.Apply();
 
   // Apply constraint to render-task viewport position
-  constraint = Constraint::New<Vector2>( RenderTask::Property::VIEWPORT_POSITION,
-                                         Source( self, Actor::Property::WORLD_POSITION ),//mPropertySourcePosition ),
-                                         Source( self, Actor::Property::SIZE ),
-                                         Source( self, Actor::Property::WORLD_SCALE ),
-                                         RenderTaskViewportPositionConstraint(stageSize) );
-  mTask.ApplyConstraint(constraint);
+  constraint = Constraint::New<Vector2>( mTask, RenderTask::Property::VIEWPORT_POSITION, RenderTaskViewportPositionConstraint(stageSize) );
+  constraint.AddSource( Source( self, Actor::Property::WORLD_POSITION ) );
+  constraint.AddSource( Source( self, Actor::Property::SIZE ) );
+  constraint.AddSource( Source( self, Actor::Property::WORLD_SCALE ) );
+  constraint.Apply();
 
   // Apply constraint to render-task viewport position
-  constraint = Constraint::New<Vector2>( RenderTask::Property::VIEWPORT_SIZE,
-                                         Source( self, Actor::Property::SIZE ),
-                                         Source( self, Actor::Property::WORLD_SCALE ),
-                                         RenderTaskViewportSizeConstraint() );
-  mTask.ApplyConstraint(constraint);
+  constraint = Constraint::New<Vector2>( mTask, RenderTask::Property::VIEWPORT_SIZE, RenderTaskViewportSizeConstraint() );
+  constraint.AddSource( Source( self, Actor::Property::SIZE ) );
+  constraint.AddSource( Source( self, Actor::Property::WORLD_SCALE ) );
+  constraint.Apply();
 }
 
 Magnifier::~Magnifier()
@@ -289,10 +253,9 @@ void Magnifier::SetFrameVisibility(bool visible)
     mFrame.SetPositionInheritanceMode(DONT_INHERIT_POSITION);
     mFrame.SetInheritScale(true);
 
-    Constraint constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                                      ParentSource( Actor::Property::WORLD_POSITION ),
-                                                      EqualToConstraint() );
-    mFrame.ApplyConstraint( constraint );
+    Constraint constraint = Constraint::New<Vector3>( mFrame, Actor::Property::POSITION, EqualToConstraint() );
+    constraint.AddSource( ParentSource( Actor::Property::WORLD_POSITION ) );
+    constraint.Apply();
 
     mFrame.SetNinePatchBorder( Vector4::ONE * IMAGE_BORDER_INDENT );
     self.Add(mFrame);
index 2f4ba6c..39f8be3 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/animation/animation.h>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/events/hit-test-algorithm.h>
 #include <dali/public-api/object/type-registry.h>
@@ -80,17 +79,17 @@ struct OriginalCenterConstraint
     mDirection = offset  / mDistance;
   }
 
-  Vector2 operator()(const Vector2& current, const PropertyInput& panDisplacement)
+  void operator()( Vector2& current, const PropertyInputContainer& inputs )
   {
-    float displacement = panDisplacement.GetFloat();
+    float displacement = inputs[0]->GetFloat();
 
     if( displacement < mDistance )
     {
-      return mOldCenter + mDirection * displacement;
+      current = mOldCenter + mDirection * displacement;
     }
     else
     {
-      return mNewCenter + Vector2(0.25f*(displacement-mDistance), 0.f);
+      current = mNewCenter + Vector2(0.25f*(displacement-mDistance), 0.f);
     }
   }
 
@@ -117,19 +116,18 @@ struct RotationConstraint
     mRotation = isTurnBack ? Quaternion( -Math::PI, Vector3::YAXIS ) : Quaternion( 0.f, Vector3::YAXIS );
   }
 
-  Quaternion operator()( const Quaternion& current, const PropertyInput& panDisplacement )
+  void operator()( Quaternion& current, const PropertyInputContainer& inputs )
   {
-    float displacement = panDisplacement.GetFloat();
-    float angle;
+    float displacement = inputs[0]->GetFloat();
     if( displacement < mDistance)
     {
-      return mRotation;
+      current = mRotation;
     }
     else
     {
       float coef = std::max(-1.0f, mStep*(mDistance-displacement));
-      angle = Math::PI*( mConst + mSign*coef );
-      return Quaternion( angle, Vector3::YAXIS );
+      float angle = Math::PI * ( mConst + mSign * coef );
+      current = Quaternion( angle, Vector3::YAXIS );
     }
   }
 
@@ -148,22 +146,23 @@ struct RotationConstraint
  */
 struct CurrentCenterConstraint
 {
-  CurrentCenterConstraint( float pageWidth)
+  CurrentCenterConstraint( float pageWidth )
   : mPageWidth( pageWidth )
   {
     mThres = pageWidth * PAGE_TURN_OVER_THRESHOLD_RATIO * 0.5f;
   }
 
-  Vector2 operator()( const Vector2& current, const PropertyInput& center, const PropertyInput& originalCenter )
+  void operator()( Vector2& current, const PropertyInputContainer& inputs )
   {
-    Vector2 centerPosition = center.GetVector2();
+    const Vector2& centerPosition = inputs[0]->GetVector2();
     if( centerPosition.x > 0.f )
     {
-      return Vector2( mThres+centerPosition.x*0.5f , centerPosition.y);
+      current.x = mThres+centerPosition.x * 0.5f;
+      current.y = centerPosition.y;
     }
     else
     {
-      Vector2 centerOrigin = originalCenter.GetVector2();
+      const Vector2& centerOrigin = inputs[1]->GetVector2();
       Vector2 direction = centerOrigin - Vector2(mThres, centerPosition.y);
       float coef = 1.f+(centerPosition.x*2.f / mPageWidth);
       // Todo: when coef <= 0, the page is flat, slow down the last moment of the page stretch by 10 times to avoid a small bounce
@@ -171,7 +170,7 @@ struct CurrentCenterConstraint
       {
         coef = (coef+0.225f)/10.0f;
       }
-      return centerOrigin - direction * coef;
+      current = centerOrigin - direction * coef;
     }
   }
 
@@ -185,14 +184,13 @@ struct ShadowBlurStrengthConstraint
   : mThres( thres )
   {}
 
-  float operator()( const float current,  const PropertyInput& currentCenter, const PropertyInput& originalCenter, const PropertyInput& panDisplacement)
+  void operator()( float& blurStrength,  const PropertyInputContainer& inputs )
   {
-    float displacement = panDisplacement.GetFloat();
-    float blurStrength;
+    float displacement = inputs[2]->GetFloat();
     if( EqualsZero(displacement))
     {
-      Vector2 cur = currentCenter.GetVector2();
-      Vector2 ori = originalCenter.GetVector2();
+      const Vector2& cur = inputs[0]->GetVector2();
+      const Vector2& ori = inputs[1]->GetVector2();
       blurStrength =  5.f*(ori-cur).Length() / mThres;
     }
     else
@@ -201,7 +199,6 @@ struct ShadowBlurStrengthConstraint
     }
 
     blurStrength = blurStrength > 1.f ? 1.f : ( blurStrength < 0.f ? 0.f : blurStrength );
-    return blurStrength;
   }
 
   float mThres;
@@ -807,12 +804,12 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition )
       mShadowView.RemoveConstraints();
       Actor self = Self();
       self.SetProperty( mPropertyPanDisplacement[mIndex], 0.f );
-      Constraint shadowBlurStrengthConstraint = Constraint::New<float>( mShadowView.GetBlurStrengthPropertyIndex(),
-                                                                        Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName())),
-                                                                        Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetOriginalCenterPropertyName())),
-                                                                        Source( self, mPropertyPanDisplacement[mIndex] ),
-                                                                        ShadowBlurStrengthConstraint( mPageSize.width*PAGE_TURN_OVER_THRESHOLD_RATIO ) );
-      mShadowView.ApplyConstraint( shadowBlurStrengthConstraint  );
+
+      Constraint shadowBlurStrengthConstraint = Constraint::New<float>( mShadowView, mShadowView.GetBlurStrengthPropertyIndex(), ShadowBlurStrengthConstraint( mPageSize.width*PAGE_TURN_OVER_THRESHOLD_RATIO ) );
+      shadowBlurStrengthConstraint.AddSource( Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName())) );
+      shadowBlurStrengthConstraint.AddSource( Source(mTurnEffect[mIndex],  mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetOriginalCenterPropertyName())) );
+      shadowBlurStrengthConstraint.AddSource( Source( self, mPropertyPanDisplacement[mIndex] ) );
+      shadowBlurStrengthConstraint.Apply();
     }
   }
   else
@@ -874,28 +871,24 @@ void PageTurnView::PanContinuing( const Vector2& gesturePosition )
                    /( offset.x*offset.x + offset.y*offset.y );
         offset *= k;
         Actor self = Self();
-        Source source(self, mPropertyPanDisplacement[mIndex]);
 
         Property::Index shaderOriginalCenterPropertyIndex = mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetOriginalCenterPropertyName());
-        Constraint originalCenterConstraint = Constraint::New<Vector2>( shaderOriginalCenterPropertyIndex ,
-                                                                        source,
-                                                                        OriginalCenterConstraint( mOriginalCenter, offset ));
-        mTurnEffect[mIndex].ApplyConstraint( originalCenterConstraint );
+        Constraint originalCenterConstraint = Constraint::New<Vector2>( mTurnEffect[mIndex], shaderOriginalCenterPropertyIndex, OriginalCenterConstraint( mOriginalCenter, offset ));
+        originalCenterConstraint.AddSource( Source( self, mPropertyPanDisplacement[mIndex] ) );
+        originalCenterConstraint.Apply();
 
         Property::Index shaderCurrentCenterPropertyIndex = mTurnEffect[mIndex].GetPropertyIndex(mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName());
-        Constraint currentCenterConstraint = Constraint::New<Vector2>( shaderCurrentCenterPropertyIndex,
-                                                                       Source(self, mPropertyCurrentCenter[mIndex]),
-                                                                       Source(mTurnEffect[mIndex], shaderOriginalCenterPropertyIndex),
-                                                                       CurrentCenterConstraint(mPageSize.width));
-        mTurnEffect[mIndex].ApplyConstraint( currentCenterConstraint );
+        Constraint currentCenterConstraint = Constraint::New<Vector2>( mTurnEffect[mIndex], shaderCurrentCenterPropertyIndex, CurrentCenterConstraint(mPageSize.width));
+        currentCenterConstraint.AddSource( Source(self, mPropertyCurrentCenter[mIndex]) );
+        currentCenterConstraint.AddSource( Source(mTurnEffect[mIndex], shaderOriginalCenterPropertyIndex) );
+        currentCenterConstraint.Apply();
 
         GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint();
 
         float distance = offset.Length();
-        Constraint rotationConstraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                                                     Source( self, mPropertyPanDisplacement[mIndex] ),
-                                                                     RotationConstraint(distance, mPageSize.width, mIsTurnBack[mPanActor]));
-        mPanActor.ApplyConstraint( rotationConstraint );
+        Constraint rotationConstraint = Constraint::New<Quaternion>( mPanActor, Actor::Property::ORIENTATION, RotationConstraint(distance, mPageSize.width, mIsTurnBack[mPanActor]));
+        rotationConstraint.AddSource( Source( self, mPropertyPanDisplacement[mIndex] ) );
+        rotationConstraint.Apply();
 
         mConstraints = false;
       }
index cd3a764..d57f2a4 100755 (executable)
@@ -71,24 +71,21 @@ struct IndicatorPositionConstraint
 
   /**
    * Constraint operator
-   * @param[in] current The current indicator position
-   * @param[in] indicatorSizeProperty The size of indicator.
-   * @param[in] parentSizeProperty The parent size of indicator.
-   * @param[in] scrollPositionProperty The scroll position of the scrollable container // (from 0.0 -> 1.0 in each axis)
+   * @param[in,out] current The current indicator position
+   * @param[in] inputs Contains the size of indicator, the size of indicator's parent, and the scroll position of the scrollable container (from 0.0 -> 1.0 in each axis)
    * @return The new indicator position is returned.
    */
-  Vector3 operator()(const Vector3& current,
-                     const PropertyInput& indicatorSizeProperty,
-                     const PropertyInput& parentSizeProperty,
-                     const PropertyInput& scrollPositionProperty)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    Vector3 indicatorSize = indicatorSizeProperty.GetVector3();
-    Vector3 parentSize = parentSizeProperty.GetVector3();
-    float scrollPosition = scrollPositionProperty.GetFloat();
+    const Vector3& indicatorSize = inputs[0]->GetVector3();
+    const Vector3& parentSize = inputs[1]->GetVector3();
+    float scrollPosition = inputs[2]->GetFloat();
 
     const float domainSize = fabs(mMaxPosition - mMinPosition);
     float relativePosition = (mMaxPosition - scrollPosition) / domainSize;
-    return Vector3(current.x, relativePosition * (parentSize.height - indicatorSize.height), DEFAULT_SLIDER_DEPTH);
+
+    current.y = relativePosition * ( parentSize.height - indicatorSize.height );
+    current.z = DEFAULT_SLIDER_DEPTH;
   }
 
   float mMinPosition;  ///< The minimum scroll position
@@ -198,13 +195,6 @@ void ScrollBar::ApplyConstraints()
 {
   if( mScrollConnector )
   {
-    Constraint constraint;
-
-    if(mIndicatorSizeConstraint)
-    {
-      mIndicator.RemoveConstraint(mIndicatorSizeConstraint);
-    }
-
     // Set indicator height according to the indicator's height policy
     if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed)
     {
@@ -217,15 +207,14 @@ void ScrollBar::ApplyConstraints()
 
     if(mIndicatorPositionConstraint)
     {
-      mIndicator.RemoveConstraint(mIndicatorPositionConstraint);
+      mIndicatorPositionConstraint.Remove();
     }
 
-    constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                           LocalSource( Actor::Property::SIZE ),
-                                           ParentSource( Actor::Property::SIZE ),
-                                           Source( mScrollPositionObject, Toolkit::ScrollConnector::SCROLL_POSITION ),
-                                           IndicatorPositionConstraint( mScrollConnector.GetMinLimit(), mScrollConnector.GetMaxLimit() ) );
-    mIndicatorPositionConstraint = mIndicator.ApplyConstraint( constraint );
+    mIndicatorPositionConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::POSITION, IndicatorPositionConstraint( mScrollConnector.GetMinLimit(), mScrollConnector.GetMaxLimit() ) );
+    mIndicatorPositionConstraint.AddSource( LocalSource( Actor::Property::SIZE ) );
+    mIndicatorPositionConstraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    mIndicatorPositionConstraint.AddSource( Source( mScrollPositionObject, Toolkit::ScrollConnector::SCROLL_POSITION ) );
+    mIndicatorPositionConstraint.Apply();
   }
 }
 
index 6826c0e..f6e85dd 100755 (executable)
@@ -21,7 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/actors/image-actor.h>
-#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/object/property-notification.h>
 
@@ -258,8 +258,7 @@ private:
 
   ScrollPositionNotifiedSignalType mScrollPositionNotifiedSignal;
 
-  ActiveConstraint mIndicatorSizeConstraint;
-  ActiveConstraint mIndicatorPositionConstraint;
+  Constraint mIndicatorPositionConstraint;
 };
 
 } // namespace Internal
index b01505b..a19e988 100755 (executable)
@@ -19,7 +19,6 @@
 #include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 #include <dali/public-api/object/type-registry.h>
@@ -59,11 +58,9 @@ const int SECOND_UNIT(1000);
  * ScrollBarInternal Visibility Constraint
  * Returns whether scroll bar is visible
  */
-bool ScrollBarInternalVisibilityConstraint(const bool& current,
-    const PropertyInput& canScrollProperty)
+void ScrollBarInternalVisibilityConstraint( bool& current, const PropertyInputContainer& inputs )
 {
-  bool canScroll = canScrollProperty.GetBoolean();
-  return canScroll;
+  current = inputs[0]->GetBoolean();
 }
 
 /**
@@ -83,35 +80,26 @@ struct ScrollBarInternalSizeConstraint
 
   /**
    * Constraint operator
-   * @param[in] current The current ScrollBarInternal size
-   * @param[in] scrollMinProperty The container's minimum position.
-   * @param[in] scrollMaxProperty The container's maximum position.
-   * @param[in] scrollDirectionProperty The container's scroll direction.
-   * @param[in] scrollSizeProperty The container's size of viewport.
+   * @param[in,out] current The current ScrollBarInternal size
+   * @param[in] inputs Contains the container's minimum position, its maximum position, its scroll direction & its size of viewport.
    * @return The new ScrollBarInternal position is returned.
    */
-  Vector3 operator()(const Vector3& current,
-                     const PropertyInput& scrollMinProperty,
-                     const PropertyInput& scrollMaxProperty,
-                     const PropertyInput& scrollDirectionProperty,
-                     const PropertyInput& scrollSizeProperty)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& min = scrollMinProperty.GetVector3();
-    const Vector3& max = scrollMaxProperty.GetVector3();
-    const Vector3& scrollDirection = scrollDirectionProperty.GetVector3();
+    const Vector3& min = inputs[0]->GetVector3();
+    const Vector3& max = inputs[1]->GetVector3();
+    const Vector3& scrollDirection = inputs[2]->GetVector3();
     const Toolkit::ControlOrientation::Type& orientation = static_cast<Toolkit::ControlOrientation::Type>(scrollDirection.z);
-    const Vector3& size = scrollSizeProperty.GetVector3();
+    const Vector3& size = inputs[3]->GetVector3();
     const Vector3 domainSize = max - min;
 
     if (mVertical && Toolkit::IsVertical(orientation))
     {
-      float mod = fabsf(domainSize.height) > size.height ? size.height * ( size.height / fabsf(domainSize.height) ) : size.height * ( (size.height - fabsf(domainSize.height * 0.5f)) / size.height);
-      return Vector3( current.width, mod, current.depth );
+      current.height = fabsf(domainSize.height) > size.height ? size.height * ( size.height / fabsf(domainSize.height) ) : size.height * ( (size.height - fabsf(domainSize.height * 0.5f)) / size.height);
     }
     else
     {
-      float mod = fabsf(domainSize.height) > size.width ? size.width * ( size.width / fabsf(domainSize.height) ) : size.width * ( (size.width - fabsf(domainSize.height * 0.5f)) / size.width);
-      return Vector3( current.width, mod, current.depth );
+      current.height = fabsf(domainSize.height) > size.width ? size.width * ( size.width / fabsf(domainSize.height) ) : size.width * ( (size.width - fabsf(domainSize.height * 0.5f)) / size.width);
     }
   }
 
@@ -135,23 +123,22 @@ struct ScrollBarInternalRotationConstraint
 
   /**
    * Constraint operator
-   * @param[in] current The current ScrollBarInternal rotation
+   * @param[in,out] current The current ScrollBarInternal rotation
    * @param[in] scrollDirectionProperty The container's scroll direction.
    * @return The new ScrollBarInternal rotation is returned.
    */
-  Quaternion operator()(const Quaternion& current,
-                        const PropertyInput& scrollDirectionProperty)
+  void operator()( Quaternion& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& scrollDirection = scrollDirectionProperty.GetVector3();
+    const Vector3& scrollDirection = inputs[0]->GetVector3();
     const Toolkit::ControlOrientation::Type& orientation = static_cast<Toolkit::ControlOrientation::Type>(scrollDirection.z);
 
     if( (mVertical && Toolkit::IsVertical(orientation)) || (!mVertical && Toolkit::IsHorizontal(orientation)) )
     {
-      return Quaternion(0.0f, Vector3::ZAXIS);
+      current = Quaternion(0.0f, Vector3::ZAXIS);
     }
     else
     {
-      return Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
+      current = Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
     }
   }
 
@@ -178,29 +165,24 @@ struct ScrollBarInternalPositionConstraint
 
   /**
    * Constraint operator
-   * @param[in] current The current ScrollBarInternal position
-   * @param[in] scrollBarSizeProperty ScrollBarInternal size
-   * @param[in] scrollRelativePositionProperty The container's relative position (from 0.0 -> 1.0 in each axis)
-   * @param[in] scrollMinProperty The container's minimum position.
-   * @param[in] scrollMaxProperty The container's maximum position.
-   * @param[in] scrollDirectionProperty The container's scroll direction.
-   * @param[in] scrollSizeProperty The container's size of viewport.
+   * @param[in] finalPosition The current ScrollBarInternal position
+   * @param[in] inputs Contains:
+   *                    The ScrollBarInternal size,
+   *                    The container's relative position (from 0.0 -> 1.0 in each axis),
+   *                    The container's minimum position,
+   *                    The container's maximum position,
+   *                    The container's scroll direction,
+   *                    The container's size of viewport.
    * @return The new ScrollBarInternal position is returned.
    */
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& scrollBarSizeProperty,
-                     const PropertyInput& scrollRelativePositionProperty,
-                     const PropertyInput& scrollMinProperty,
-                     const PropertyInput& scrollMaxProperty,
-                     const PropertyInput& scrollDirectionProperty,
-                     const PropertyInput& scrollSizeProperty)
+  void operator()( Vector3& finalPosition, const PropertyInputContainer& inputs )
   {
-    Vector3 barSize = scrollBarSizeProperty.GetVector3();
-    Vector3 relativePosition = scrollRelativePositionProperty.GetVector3();
-    Vector3 size = scrollSizeProperty.GetVector3();
-    const Vector3& min = scrollMinProperty.GetVector3();
-    const Vector3& max = scrollMaxProperty.GetVector3();
-    const Vector3& scrollDirection = scrollDirectionProperty.GetVector3();
+    const Vector3& barSize = inputs[0]->GetVector3();
+    const Vector3& relativePosition = inputs[1]->GetVector3();
+    const Vector3& min = inputs[2]->GetVector3();
+    const Vector3& max = inputs[3]->GetVector3();
+    const Vector3& scrollDirection = inputs[4]->GetVector3();
+    const Vector3& size = inputs[5]->GetVector3();
     const Toolkit::ControlOrientation::Type& orientation = static_cast<Toolkit::ControlOrientation::Type>(scrollDirection.z);
 
     Vector3 domainSize = max - min;
@@ -256,7 +238,7 @@ struct ScrollBarInternalPositionConstraint
     Vector3 maskedRelativePosition = Toolkit::IsVertical(orientation) ? Vector3(relativePosition.x * (size.x-barSize.y), relativePosition.y * (size.y-barSize.y), 0.0f) * mask
                                    : Vector3(relativePosition.y * (size.x-barSize.y), relativePosition.x * (size.y-barSize.y), 0.0f) * mask;
 
-    Vector3 finalPosition = relativeOffset * size + absoluteOffset + maskedRelativePosition;
+    finalPosition = relativeOffset * size + absoluteOffset + maskedRelativePosition;
 
     // If Wrapped Slider, then position 1 domain either before or after current slider.
     if(mWrap)
@@ -279,8 +261,6 @@ struct ScrollBarInternalPositionConstraint
         finalPosition.y -= size.y;
       }
     }
-
-    return finalPosition;
   }
 
   bool mVertical;           ///< Whether vertical or horizontal.
@@ -308,17 +288,14 @@ struct ScrollBarInternalHitSizeConstraint
   /**
    * Constraint operator
    * @param[in] current The current HitSize
-   * @param[in] scrollDirectionProperty The container's scroll direction.
-   * @param[in] scrollSizeProperty The container's size of viewport.
+   * @param[in] inputs Contains the container's scroll direction and size of its viewport.
    * @return The new ScrollBarInternal Hit Area size is returned.
    */
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& scrollDirectionProperty,
-                     const PropertyInput& scrollSizeProperty)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& scrollDirection = scrollDirectionProperty.GetVector3();
+    const Vector3& scrollDirection = inputs[0]->GetVector3();
     const Toolkit::ControlOrientation::Type& orientation = static_cast<Toolkit::ControlOrientation::Type>(scrollDirection.z);
-    Vector3 size = scrollSizeProperty.GetVector3();
+    const Vector3& size = inputs[1]->GetVector3();
 
     Vector3 mask;            // Mask size aspect of hit area.
     Vector3 offset;          // Add Offset size.
@@ -334,7 +311,7 @@ struct ScrollBarInternalHitSizeConstraint
       offset = Vector3::YAXIS * mThickness;
     }
 
-    return size * mask + offset;
+    current = size * mask + offset;
   }
 
   bool mVertical;           ///< Whether vertical or horizontal.
@@ -392,47 +369,47 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic
 
   // target the container to observe for scrolling
   Actor target = mContainer.Self();
-  Constraint constraint = Constraint::New<bool>( Actor::Property::VISIBLE,
-                                      Source( target, vertical ? Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL : Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL),
-                                      ScrollBarInternalVisibilityConstraint );
-  mSlider.ApplyConstraint( constraint );
-  mSliderWrap.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::SIZE,
-                                                   Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                                   Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                                   Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                                   Source( target, Actor::Property::SIZE ),
-                                                   ScrollBarInternalSizeConstraint( vertical ) );
-  mSlider.ApplyConstraint( constraint );
-  mSliderWrap.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                            Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                            ScrollBarInternalRotationConstraint( vertical ) );
-  mSlider.ApplyConstraint( constraint );
-  mSliderWrap.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         Source( mSlider, Actor::Property::SIZE),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                         Source( target, Actor::Property::SIZE ),
-                                         ScrollBarInternalPositionConstraint(vertical) );
-
-  mSlider.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         Source( mSlider, Actor::Property::SIZE),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                         Source( target, Actor::Property::SIZE ),
-                                         ScrollBarInternalPositionConstraint(vertical, true) );
-  mSliderWrap.ApplyConstraint( constraint );
+  Constraint constraint = Constraint::New<bool>( mSlider, Actor::Property::VISIBLE, ScrollBarInternalVisibilityConstraint );
+  constraint.AddSource( Source( target, vertical ? Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL : Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL ) );
+  constraint.Apply();
+
+  constraint = constraint.Clone( mSliderWrap );
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( mSlider, Actor::Property::SIZE, ScrollBarInternalSizeConstraint( vertical ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+  constraint.AddSource( Source( target, Actor::Property::SIZE ) );
+  constraint.Apply();
+
+  constraint = constraint.Clone( mSliderWrap );
+  constraint.Apply();
+
+  constraint = Constraint::New<Quaternion>( mSlider, Actor::Property::ORIENTATION, ScrollBarInternalRotationConstraint( vertical ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+  constraint.Apply();
+
+  constraint = constraint.Clone( mSliderWrap );
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( mSlider, Actor::Property::POSITION, ScrollBarInternalPositionConstraint(vertical) );
+  constraint.AddSource( Source( mSlider, Actor::Property::SIZE) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+  constraint.AddSource( Source( target, Actor::Property::SIZE ) );
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( mSliderWrap, Actor::Property::POSITION, ScrollBarInternalPositionConstraint(vertical, true) );
+  constraint.AddSource( Source( mSlider, Actor::Property::SIZE) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+  constraint.AddSource( Source( target, Actor::Property::SIZE ) );
+  constraint.Apply();
 
   // Add Sliders to internal Actor, to avoid mixing up with regular
   // Actors added by user.
@@ -446,11 +423,10 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic
   mHitArea.SetPosition(0.0f, 0.0f, 0.2f);
 
   mContainer.AddOverlay( mHitArea );
-  constraint = Constraint::New<Vector3>( Actor::Property::SIZE,
-                                         Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                         Source( target, Actor::Property::SIZE ),
-                                         ScrollBarInternalHitSizeConstraint(vertical, BAR_TAB_SIZE.width) );
-  mHitArea.ApplyConstraint( constraint );
+  constraint = Constraint::New<Vector3>( mHitArea, Actor::Property::SIZE, ScrollBarInternalHitSizeConstraint(vertical, BAR_TAB_SIZE.width) );
+  constraint.AddSource( Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+  constraint.AddSource( Source( target, Actor::Property::SIZE ) );
+  constraint.Apply();
 
   if(vertical)
   {
index 86ade19..5ea5753 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <math.h>
 #include <dali/public-api/actors/mesh-actor.h>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/geometry/animatable-mesh.h>
 #include <dali/public-api/shader-effects/shader-effect.h>
@@ -58,10 +57,9 @@ struct VertexPositionConstraint
   {
   }
 
-  Vector3 operator()( const Vector3& current, const PropertyInput& bounceCoef )
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    float positionY = mInitialY + mRange * fabsf(bounceCoef.GetFloat());
-    return Vector3( current.x, positionY, current.z );
+    current.y = mInitialY + mRange * fabsf( inputs[0]->GetFloat() );
   }
 
   float mInitialY;
@@ -107,12 +105,13 @@ Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
   for( size_t i=0;i<NUM_LAYERS;i++ )
   {
     size_t j=i*4;
-    mesh.ApplyConstraint( Constraint::New<Vector3>( mesh.GetPropertyIndex(j+2, AnimatableVertex::Property::POSITION ),
-                                                    Source(meshActor, bouncePropertyIndex),
-                                                    VertexPositionConstraint(-0.5f, LAYER_HEIGHTS[i]) ) );
-    mesh.ApplyConstraint( Constraint::New<Vector3>( mesh.GetPropertyIndex(j+3,  AnimatableVertex::Property::POSITION),
-                                                    Source(meshActor, bouncePropertyIndex),
-                                                    VertexPositionConstraint(-0.5f, LAYER_HEIGHTS[i]) ) );
+    Constraint constraint = Constraint::New<Vector3>( mesh, mesh.GetPropertyIndex(j+2, AnimatableVertex::Property::POSITION ), VertexPositionConstraint(-0.5f, LAYER_HEIGHTS[i]) );
+    constraint.AddSource( Source(meshActor, bouncePropertyIndex) );
+    constraint.Apply();
+
+    constraint = Constraint::New<Vector3>( mesh, mesh.GetPropertyIndex(j+3,  AnimatableVertex::Property::POSITION), VertexPositionConstraint(-0.5f, LAYER_HEIGHTS[i]) );
+    constraint.AddSource( Source(meshActor, bouncePropertyIndex) );
+    constraint.Apply();
   }
 
   return meshActor;
index 43f134d..9ad835f 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <algorithm>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/set-wrapper.h>
@@ -87,202 +86,165 @@ float CalculateScrollDistance(Vector2 panDistance, Toolkit::ItemLayout& layout)
 }
 
 // Overshoot overlay constraints
-
-struct OvershootOverlaySizeConstraint
+void OvershootOverlaySizeConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  Vector3 operator()(const Vector3& current,
-                     const PropertyInput& parentScrollDirectionProperty,
-                     const PropertyInput& parentOvershootProperty,
-                     const PropertyInput& parentSizeProperty)
-  {
-    const Vector3 parentScrollDirection = parentScrollDirectionProperty.GetVector3();
-    const Vector3 parentSize = parentSizeProperty.GetVector3();
-    const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
+  const Vector3& parentScrollDirection = inputs[0]->GetVector3();
+  const Vector3& parentSize = inputs[1]->GetVector3();
+  const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
 
-    float overlayWidth;
-
-    if(Toolkit::IsVertical(parentOrientation))
-    {
-      overlayWidth = fabsf(parentScrollDirection.y) > Math::MACHINE_EPSILON_1 ? parentSize.x : parentSize.y;
-    }
-    else
-    {
-      overlayWidth = fabsf(parentScrollDirection.x) > Math::MACHINE_EPSILON_1 ? parentSize.y : parentSize.x;
-    }
-
-    float overlayHeight = (overlayWidth > OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD) ? OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height : OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height*0.5f;
-
-    return Vector3( overlayWidth, overlayHeight, current.depth );
+  if(Toolkit::IsVertical(parentOrientation))
+  {
+    current.width = fabsf(parentScrollDirection.y) > Math::MACHINE_EPSILON_1 ? parentSize.x : parentSize.y;
   }
-};
+  else
+  {
+    current.width = fabsf(parentScrollDirection.x) > Math::MACHINE_EPSILON_1 ? parentSize.y : parentSize.x;
+  }
+
+  current.height = ( current.width > OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD ) ? OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height : OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height*0.5f;
+}
 
-struct OvershootOverlayRotationConstraint
+void OvershootOverlayRotationConstraint( Quaternion& current, const PropertyInputContainer& inputs )
 {
-  Quaternion operator()(const Quaternion& current,
-                        const PropertyInput& parentScrollDirectionProperty,
-                        const PropertyInput& parentOvershootProperty)
-  {
-    const Vector3 parentScrollDirection = parentScrollDirectionProperty.GetVector3();
-    const float parentOvershoot = parentOvershootProperty.GetFloat();
-    const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
+  const Vector3& parentScrollDirection = inputs[0]->GetVector3();
+  const float parentOvershoot = inputs[1]->GetFloat();
+  const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
 
-    float multiplier = 0;
-    if(Toolkit::IsVertical(parentOrientation))
+  float multiplier = 0;
+  if(Toolkit::IsVertical(parentOrientation))
+  {
+    if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
     {
-      if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
-      {
-        if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
-            || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
-        {
-          multiplier = 0.5f;
-        }
-        else
-        {
-          multiplier = 1.5f;
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
+      if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
+          || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
       {
-        multiplier = 0.0f;
+        multiplier = 0.5f;
       }
       else
       {
-        multiplier = 1.0f;
+        multiplier = 1.5f;
       }
     }
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
+    {
+      multiplier = 0.0f;
+    }
     else
     {
-      if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
-      {
-        if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot > Math::MACHINE_EPSILON_0)
-            ||(parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot < Math::MACHINE_EPSILON_0) )
-        {
-          multiplier = 1.0f;
-        }
-        else
-        {
-          multiplier = 0.0f;
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+      multiplier = 1.0f;
+    }
+  }
+  else
+  {
+    if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
+    {
+      if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot > Math::MACHINE_EPSILON_0)
+          ||(parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot < Math::MACHINE_EPSILON_0) )
       {
-        multiplier = 1.5f;
+        multiplier = 1.0f;
       }
       else
       {
-        multiplier = 0.5f;
+        multiplier = 0.0f;
       }
     }
-
-    Quaternion rotation( Radian( multiplier * Math::PI ), Vector3::ZAXIS );
-
-    return rotation;
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+    {
+      multiplier = 1.5f;
+    }
+    else
+    {
+      multiplier = 0.5f;
+    }
   }
-};
 
-struct OvershootOverlayPositionConstraint
+  current = Quaternion( Radian( multiplier * Math::PI ), Vector3::ZAXIS );
+}
+
+void OvershootOverlayPositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& parentSizeProperty,
-                     const PropertyInput& parentScrollDirectionProperty,
-                     const PropertyInput& parentOvershootProperty)
-  {
-    const Vector3 parentScrollDirection = parentScrollDirectionProperty.GetVector3();
-    const float parentOvershoot = parentOvershootProperty.GetFloat();
-    const Vector3 parentSize = parentSizeProperty.GetVector3();
-    const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
+  const Vector3& parentSize = inputs[0]->GetVector3();
+  const Vector3& parentScrollDirection = inputs[1]->GetVector3();
+  const float parentOvershoot = inputs[2]->GetFloat();
+  const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
 
-    Vector3 relativeOffset;
+  Vector3 relativeOffset;
 
-    if(Toolkit::IsVertical(parentOrientation))
+  if(Toolkit::IsVertical(parentOrientation))
+  {
+    if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
     {
-      if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
+      if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
+          || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
       {
-        if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
-            || (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
-        {
-          relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
-        }
-        else
-        {
-          relativeOffset =Vector3(0.0f, 1.0f, 0.0f);
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
-      {
-        relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
+        relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
       }
       else
       {
-        relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
+        relativeOffset =Vector3(0.0f, 1.0f, 0.0f);
       }
     }
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
+    {
+      relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
+    }
     else
     {
-      if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
-      {
-        if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot < Math::MACHINE_EPSILON_0)
-            || (parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot > Math::MACHINE_EPSILON_0) )
-        {
-          relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
-        }
-        else
-        {
-          relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
-        }
-      }
-      else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
-            || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+      relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
+    }
+  }
+  else
+  {
+    if(fabsf(parentScrollDirection.x) <= Math::MACHINE_EPSILON_1)
+    {
+      if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot < Math::MACHINE_EPSILON_0)
+          || (parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot > Math::MACHINE_EPSILON_0) )
       {
-        relativeOffset = Vector3(0.0f, 1.0f, 0.0f);
+        relativeOffset = Vector3(0.0f, 0.0f, 0.0f);
       }
       else
       {
-        relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
+        relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
       }
     }
-
-    return relativeOffset * parentSize;
-
+    else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
+          || (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
+    {
+      relativeOffset = Vector3(0.0f, 1.0f, 0.0f);
+    }
+    else
+    {
+      relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
+    }
   }
-};
 
-struct OvershootOverlayVisibilityConstraint
-{
-  bool operator()(const bool& current,
-                  const PropertyInput& parentLayoutScrollableProperty)
-  {
-    const bool parentLayoutScrollable = parentLayoutScrollableProperty.GetBoolean();
+  current = relativeOffset * parentSize;
+}
 
-    return parentLayoutScrollable;
-  }
-};
+void OvershootOverlayVisibilityConstraint( bool& current, const PropertyInputContainer& inputs )
+{
+  current = inputs[0]->GetBoolean();
+}
 
 /**
  * Relative position Constraint
  * Generates the relative position value of the item view based on the layout position,
  * and it's relation to the layout domain. This is a value from 0.0f to 1.0f in each axis.
  */
-Vector3 RelativePositionConstraint(const Vector3& current,
-                                   const PropertyInput& scrollPositionProperty,
-                                   const PropertyInput& scrollMinProperty,
-                                   const PropertyInput& scrollMaxProperty,
-                                   const PropertyInput& layoutSizeProperty)
+void RelativePositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  const Vector3& position = Vector3(0.0f, scrollPositionProperty.GetFloat(), 0.0f);
-  const Vector3& min = scrollMinProperty.GetVector3();
-  const Vector3& max = scrollMaxProperty.GetVector3();
+  const Vector3& position = Vector3(0.0f, inputs[0]->GetFloat(), 0.0f);
+  const Vector3& min = inputs[1]->GetVector3();
+  const Vector3& max = inputs[2]->GetVector3();
 
-  Vector3 relativePosition;
   Vector3 domainSize = max - min;
 
-  relativePosition.x = fabsf(domainSize.x) > Math::MACHINE_EPSILON_1 ? ((min.x - position.x) / fabsf(domainSize.x)) : 0.0f;
-  relativePosition.y = fabsf(domainSize.y) > Math::MACHINE_EPSILON_1 ? ((min.y - position.y) / fabsf(domainSize.y)) : 0.0f;
-
-  return relativePosition;
+  current.x = fabsf(domainSize.x) > Math::MACHINE_EPSILON_1 ? ((min.x - position.x) / fabsf(domainSize.x)) : 0.0f;
+  current.y = fabsf(domainSize.y) > Math::MACHINE_EPSILON_1 ? ((min.y - position.y) / fabsf(domainSize.y)) : 0.0f;
+  current.z = 0.0f;
 }
 
 } // unnamed namespace
@@ -377,13 +339,11 @@ void ItemView::OnInitialize()
 
   EnableScrollComponent(Toolkit::Scrollable::OvershootIndicator);
 
-  Constraint constraint = Constraint::New<Vector3>(Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION,
-                                                   LocalSource(mPropertyPosition),
-                                                   LocalSource(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN),
-                                                   LocalSource(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX),
-                                                   LocalSource(Actor::Property::SIZE),
-                                                   RelativePositionConstraint);
-  self.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( self, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, RelativePositionConstraint );
+  constraint.AddSource( LocalSource( mPropertyPosition ) );
+  constraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.Apply();
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mMouseWheelScrollDistanceStep = stageSize.y * DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION;
@@ -1561,36 +1521,31 @@ void ItemView::SetOvershootEnabled( bool enable )
     mOvershootOverlay.SetDrawMode(DrawMode::OVERLAY);
     self.Add(mOvershootOverlay);
 
-    Constraint constraint = Constraint::New<Vector3>( Actor::Property::SIZE,
-                                                      ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                                      Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                                      ParentSource( Actor::Property::SIZE ),
-                                                      OvershootOverlaySizeConstraint() );
-    mOvershootOverlay.ApplyConstraint(constraint);
+    Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.Apply();
+
     mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height);
 
-    constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                              ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                              Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                              OvershootOverlayRotationConstraint() );
-    mOvershootOverlay.ApplyConstraint(constraint);
-
-    constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                           ParentSource( Actor::Property::SIZE ),
-                                           ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ),
-                                           Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                           OvershootOverlayPositionConstraint() );
-    mOvershootOverlay.ApplyConstraint(constraint);
-
-    constraint = Constraint::New<bool>( Actor::Property::VISIBLE,
-                                        ParentSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ),
-                                        OvershootOverlayVisibilityConstraint() );
-    mOvershootOverlay.ApplyConstraint(constraint);
-
-    constraint = Constraint::New<float>( effectOvershootPropertyIndex,
-                                         Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
-                                         EqualToConstraint() );
-    mOvershootOverlay.ApplyConstraint(constraint);
+    constraint = Constraint::New<Quaternion>( mOvershootOverlay, Actor::Property::ORIENTATION, OvershootOverlayRotationConstraint );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+    constraint.AddSource( Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ) );
+    constraint.Apply();
+
+    constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::POSITION, OvershootOverlayPositionConstraint );
+    constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ) );
+    constraint.AddSource( Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ) );
+    constraint.Apply();
+
+    constraint = Constraint::New<bool>( mOvershootOverlay, Actor::Property::VISIBLE, OvershootOverlayVisibilityConstraint );
+    constraint.AddSource( ParentSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ) );
+    constraint.Apply();
+
+    constraint = Constraint::New<float>( mOvershootOverlay, effectOvershootPropertyIndex, EqualToConstraint() );
+    constraint.AddSource( Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ) );
+    constraint.Apply();
   }
   else
   {
index a4b955c..d4fe048 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 // TODO - Replace list with dali-vector.h
 #include <list>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 
 // INTERNAL INCLUDES
@@ -79,8 +78,9 @@ public:
      */
     void ApplyConstraint(Constraint constraint)
     {
-      ActiveConstraint activeConstraint = mActor.ApplyConstraint( constraint );
-      mConstraints.push_back( activeConstraint );
+      Constraint clone = constraint.Clone( mActor );
+      clone.Apply();
+      mConstraints.push_back( clone );
     }
 
     /**
@@ -90,17 +90,17 @@ public:
      */
     void RemoveConstraints()
     {
-      std::vector<ActiveConstraint>::iterator it = mConstraints.begin();
-      std::vector<ActiveConstraint>::iterator end = mConstraints.end();
+      std::vector<Constraint>::iterator it = mConstraints.begin();
+      std::vector<Constraint>::iterator end = mConstraints.end();
       for(;it!=end;++it)
       {
-        mActor.RemoveConstraint(*it);
+        it->Remove();
       }
       mConstraints.clear();
     }
 
     Actor mActor;                                     ///< The Actor that this ActorInfo represents.
-    std::vector<ActiveConstraint> mConstraints;       ///< A list keeping track of constraints applied to the actor via this delegate.
+    std::vector<Constraint> mConstraints;       ///< A list keeping track of constraints applied to the actor via this delegate.
   };
 
   typedef IntrusivePtr<ActorInfo> ActorInfoPtr;
index c3a900e..35a61ac 100644 (file)
@@ -18,9 +18,6 @@
 // CLASS HEADER
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.h>
 
-// EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
 #include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
index 6eb200b..4f467f2 100644 (file)
@@ -16,8 +16,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 
@@ -79,65 +77,56 @@ public:
   }
 
   /**
-   * @param[in] current The current visibility of this Actor
-   * @param[in] positionProperty The Actor's Position.
-   * @param[in] scaleProperty The Actor's Scale.
-   * @param[in] sizeProperty The Actor's Size
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE)
+   * @param[in,out] current The current visibility of this Actor
+   * @param[in] inputs Contains:
+   *                    The Actor's Position
+   *                    The Actor's Scale
+   *                    The Actor's Size
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The size of the scroll-view (scrollView SIZE)
    * @return The new visibility of this Actor.
    */
-  bool VisibilityConstraint(const bool& current,
-                                  const PropertyInput& positionProperty,
-                                  const PropertyInput& scaleProperty,
-                                  const PropertyInput& sizeProperty,
-                                  const PropertyInput& scrollPositionProperty,
-                                  const PropertyInput& scrollSizeProperty)
+  void VisibilityConstraint( bool& current, const PropertyInputContainer& inputs )
   {
     const Vector2& anchor(AnchorPoint::CENTER.GetVectorXY());
-    Vector2 position(positionProperty.GetVector3() + scrollPositionProperty.GetVector3());
-    Vector2 scaledSize(sizeProperty.GetVector3() * scaleProperty.GetVector3());
+    Vector2 position( inputs[0]->GetVector3() + inputs[3]->GetVector3());
+    Vector2 scaledSize( inputs[2]->GetVector3() * inputs[1]->GetVector3());
 
-    Vector2 domain(scrollSizeProperty.GetVector3());
+    Vector2 domain( inputs[4]->GetVector3() );
 
     position -= (anchor - mVisibilityThreshold) * scaledSize;
     domain -= (Vector2::ONE - mVisibilityThreshold * 2.0f) * scaledSize;
 
-    return ( position.x >= 0 &&
-             position.x <= domain.x &&
-             position.y >= 0 &&
-             position.y <= domain.y );
+    current = ( position.x >= 0 &&
+                position.x <= domain.x &&
+                position.y >= 0 &&
+                position.y <= domain.y );
   }
 
   /**
-   * @param[in] current The current orientation of this Actor
-   * @param[in] positionProperty The Actor's Position.
-   * @param[in] scaleProperty The Actor's Scale.
-   * @param[in] sizeProperty The Actor's Size
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE)
-   * @param[in] activateProperty Activation value (0 - normal, 1.0 - full effect)
+   * @param[in,out] current The current orientation of this Actor
+   * @param[in] inputs Contains:
+   *                    The Actor's Position.
+   *                    The Actor's Scale.
+   *                    The Actor's Size
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The size of the scroll-view (scrollView SIZE)
+   *                    Activation value (0 - normal, 1.0 - full effect)
    * @return The new orientation of this Actor.
    */
-  Quaternion RotationConstraint(const Quaternion& current,
-                                const PropertyInput& positionProperty,
-                                const PropertyInput& scaleProperty,
-                                const PropertyInput& sizeProperty,
-                                const PropertyInput& scrollPositionProperty,
-                                const PropertyInput& scrollSizeProperty,
-                                const PropertyInput& activateProperty)
+  void RotationConstraint( Quaternion& current, const PropertyInputContainer& inputs )
   {
-    const float activate(activateProperty.GetFloat());
+    const float activate(inputs[5]->GetFloat());
 
     if(activate <= Math::MACHINE_EPSILON_0)
     {
-      return current;
+      return;
     }
 
     const Vector2& anchor(AnchorPoint::CENTER.GetVectorXY());
-    Vector2 position(positionProperty.GetVector3() + scrollPositionProperty.GetVector3());
-    Vector2 scaledSize(sizeProperty.GetVector3() * scaleProperty.GetVector3());
-    Vector2 domain(scrollSizeProperty.GetVector3());
+    Vector2 position(inputs[0]->GetVector3() + inputs[3]->GetVector3());
+    Vector2 scaledSize(inputs[2]->GetVector3() * inputs[1]->GetVector3());
+    Vector2 domain(inputs[4]->GetVector3());
 
     position -= (anchor - mCanvasMargin) * scaledSize;
     domain -= (Vector2::ONE - mCanvasMargin * 2.0f) * scaledSize;
@@ -155,38 +144,35 @@ public:
 
     angle *= activate;
 
-    return Quaternion(-angle.x, Vector3::YAXIS) *
-           Quaternion(angle.y, Vector3::XAXIS) *
-           current;
+    current = Quaternion(-angle.x, Vector3::YAXIS) *
+              Quaternion(angle.y, Vector3::XAXIS) *
+              current;
   }
 
   /**
-   * @param[in] current The current position of this Actor
-   * @param[in] scaleProperty The Actor's Scale.
-   * @param[in] sizeProperty The Actor's Size
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE)
-   * @param[in] activateProperty Activation value (0 - normal, 1.0 - full effect)
+   * @param[in,out] current The current position of this Actor
+   * @param[in] inputs Contains:
+   *                    The Actor's Scale.
+   *                    The Actor's Size
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The size of the scroll-view (scrollView SIZE)
+   *                    Activation value (0 - normal, 1.0 - full effect)
    * @return The new position of this Actor.
    */
-  Vector3 PositionConstraint(const Vector3& current,
-                             const PropertyInput& scaleProperty,
-                             const PropertyInput& sizeProperty,
-                             const PropertyInput& scrollPositionProperty,
-                             const PropertyInput& scrollSizeProperty,
-                             const PropertyInput& activateProperty)
+  void PositionConstraint( Vector3& position, const PropertyInputContainer& inputs )
   {
-    const float activate(activateProperty.GetFloat());
-    Vector3 position(current + scrollPositionProperty.GetVector3());
+    const float activate(inputs[4]->GetFloat());
 
     if(activate <= Math::MACHINE_EPSILON_0)
     {
-      return position;
+      return;
     }
 
+    position += inputs[2]->GetVector3();
+
     const Vector2& anchor(AnchorPoint::CENTER.GetVectorXY());
-    Vector2 scaledSize(sizeProperty.GetVector3() * scaleProperty.GetVector3());
-    Vector2 domain(scrollSizeProperty.GetVector3());
+    Vector2 scaledSize(inputs[1]->GetVector3() * inputs[0]->GetVector3());
+    Vector2 domain(inputs[3]->GetVector3());
 
     position.GetVectorXY() -= (anchor - mCanvasMargin) * scaledSize;
     domain -= (Vector2::ONE - mCanvasMargin * 2.0f) * scaledSize;
@@ -207,8 +193,6 @@ public:
     }
 
     position.GetVectorXY() += (anchor - mCanvasMargin) * scaledSize;
-
-    return position;
   }
 
   Vector2 mAngleSwing;                                    ///< Maximum amount in X and Y axes to rotate.
@@ -230,38 +214,34 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView,
   // Apply constraints to this actor //
   Constraint constraint;
 
-  constraint = Constraint::New<bool>( Actor::Property::VISIBLE,
-                                      LocalSource( Actor::Property::POSITION ),
-                                      LocalSource( Actor::Property::SCALE ),
-                                      LocalSource( Actor::Property::SIZE ),
-                                      Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                      Source(scrollView, Actor::Property::SIZE ),
-                                      Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ),
-                                      boost::bind( &ScrollCarouselEffectInfo::VisibilityConstraint, info, _1, _2, _3, _4, _5, _6) );
+  constraint = Constraint::New<bool>( child, Actor::Property::VISIBLE, info, &ScrollCarouselEffectInfo::VisibilityConstraint );
+  constraint.AddSource( LocalSource( Actor::Property::POSITION ) );
+  constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
+  constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
+  constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  constraint.AddSource( Source( scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source( scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                            LocalSource( Actor::Property::POSITION ),
-                                            LocalSource( Actor::Property::SCALE ),
-                                            LocalSource( Actor::Property::SIZE ),
-                                            Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                            Source(scrollView, Actor::Property::SIZE ),
-                                            Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ),
-                                            boost::bind( &ScrollCarouselEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
+  constraint.Apply();
+
+  constraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, info, &ScrollCarouselEffectInfo::RotationConstraint );
+  constraint.AddSource( LocalSource( Actor::Property::POSITION ) );
+  constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
+  constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
+  constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  constraint.AddSource( Source( scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source( scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         LocalSource( Actor::Property::SCALE ),
-                                         LocalSource( Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ),
-                                         boost::bind( &ScrollCarouselEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, info, &ScrollCarouselEffectInfo::PositionConstraint );
+  constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
+  constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
+  constraint.Apply();
 }
 
 } // unnamed namespace
index dfc980d..cf28691 100644 (file)
@@ -16,8 +16,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 
@@ -62,25 +60,20 @@ public:
   }
 
   /**
-   * @param[in] current The current orientation of this Actor
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current orientation of this Actor
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new orientation of this Actor.
    */
-  Quaternion RotationConstraint(const Quaternion& current,
-                                const PropertyInput& pagePositionProperty,
-                                const PropertyInput& scrollPositionProperty,
-                                const PropertyInput& scrollPositionMin,
-                                const PropertyInput& scrollPositionMax,
-                                const PropertyInput& pageSizeProperty,
-                                const PropertyInput& scrollWrap)
+  void RotationConstraint( Quaternion& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -88,16 +81,16 @@ public:
     // short circuit: for orthognal view.
     if( (fabsf(position.x) < Math::MACHINE_EPSILON_1) && (fabsf(position.y) < Math::MACHINE_EPSILON_1) )
     {
-      return current;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
-    bool wrap = scrollWrap.GetBoolean();
+    const Vector3& pageSize = inputs[4]->GetVector3();
+    bool wrap = inputs[5]->GetBoolean();
 
     if(wrap)
     {
-      const Vector3& min = scrollPositionMin.GetVector3();
-      const Vector3& max = scrollPositionMax.GetVector3();
+      const Vector3& min = inputs[2]->GetVector3();
+      const Vector3& max = inputs[3]->GetVector3();
 
       if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
       {
@@ -115,7 +108,7 @@ public:
     // short circuit: for pages outside of view.
     if( (fabsf(position.x) >= pageSize.x) || (fabsf(position.y) >= pageSize.y) )
     {
-      return current;
+      return;
     }
 
     position.x /= pageSize.x;
@@ -124,33 +117,26 @@ public:
     Vector2 angle( Clamp(position.x, -1.0f,1.0f),
                    Clamp(position.y, -1.0f,1.0f) );
 
-    Quaternion rotation = Quaternion(angle.x * mAngleSwing.x, Vector3::YAXIS) *
+    current = Quaternion( angle.x * mAngleSwing.x, Vector3::YAXIS) *
                           Quaternion(-angle.y * mAngleSwing.y, Vector3::XAXIS) *
                           current;
-
-    return rotation;
   }
 
   /**
-   * @param[in] current The current color of this Actor
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current color of this Actor
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new color of this Actor.
    */
-  Vector4 ColorConstraint(const Vector4& current,
-                          const PropertyInput& pagePositionProperty,
-                          const PropertyInput& scrollPositionProperty,
-                          const PropertyInput& scrollPositionMin,
-                          const PropertyInput& scrollPositionMax,
-                          const PropertyInput& pageSizeProperty,
-                          const PropertyInput& scrollWrap)
+  void ColorConstraint( Vector4& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -158,16 +144,16 @@ public:
     // short circuit: for orthognal view.
     if( (fabsf(position.x) < Math::MACHINE_EPSILON_1) && (fabsf(position.y) < Math::MACHINE_EPSILON_1) )
     {
-      return current;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
-    bool wrap = scrollWrap.GetBoolean();
+    const Vector3& pageSize = inputs[4]->GetVector3();
+    bool wrap = inputs[5]->GetBoolean();
 
     if(wrap)
     {
-      const Vector3& min = scrollPositionMin.GetVector3();
-      const Vector3& max = scrollPositionMax.GetVector3();
+      const Vector3& min = inputs[2]->GetVector3();
+      const Vector3& max = inputs[3]->GetVector3();
 
       if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
       {
@@ -187,7 +173,8 @@ public:
     {
       // note preserve color channels incase there is a shader/further constraint
       // that wishes to do something with that information.
-      return Vector4(current.r, current.g, current.b, 0.0f);
+      current.a = 0.0f;
+      return;
     }
 
     position.x /= pageSize.x;
@@ -199,32 +186,24 @@ public:
     float f = (1.0f - fabsf(angle.x)) * (1.0f - fabsf(angle.y));
     f = f*f;
 
-    Vector4 color = current;
-    color.a *= f;
-
-    return color;
+    current.a *= f;
   }
 
   /**
-   * @param[in] current The current position
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current position
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new position of this Actor.
    */
-  Vector3 PositionConstraint(const Vector3& current,
-                             const PropertyInput& pagePositionProperty,
-                             const PropertyInput& scrollPositionProperty,
-                             const PropertyInput& scrollPositionMin,
-                             const PropertyInput& scrollPositionMax,
-                             const PropertyInput& pageSizeProperty,
-                             const PropertyInput& scrollWrap)
+  void PositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 relativePosition = pagePosition + scrollPosition;
@@ -232,16 +211,17 @@ public:
     // short circuit: for orthognal view.
     if( (fabsf(relativePosition.x) < Math::MACHINE_EPSILON_1) && (fabsf(relativePosition.y) < Math::MACHINE_EPSILON_1) )
     {
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
-    bool wrap = scrollWrap.GetBoolean();
+    const Vector3& pageSize = inputs[4]->GetVector3();
+    bool wrap = inputs[5]->GetBoolean();
 
     if(wrap)
     {
-      const Vector3& min = scrollPositionMin.GetVector3();
-      const Vector3& max = scrollPositionMax.GetVector3();
+      const Vector3& min = inputs[2]->GetVector3();
+      const Vector3& max = inputs[3]->GetVector3();
 
       if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
       {
@@ -261,7 +241,8 @@ public:
     {
       // position actors at: scrollposition (Property) + pagePosition (Parent) + current (this)
       // they will be invisible so doesn't have to be precise, just away from stage.
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
     relativePosition.x /= pageSize.x;
@@ -281,7 +262,7 @@ public:
     position += mAnchor;
     position += relativePosition * mPositionSwing;
 
-    return position - pagePosition;
+    current = position - pagePosition;
   }
 
   Vector3 mAnchor;                                        ///< Anchor point where Actor should rotate about.
@@ -303,41 +284,35 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView,
 {
   // Apply constraints to this actor //
   Constraint constraint;
-  constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                         Source(parentPage, Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         boost::bind( &ScrollCubeEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, info, &ScrollCubeEffectInfo::RotationConstraint );
+  constraint.AddSource( Source(parentPage, Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector4>( Actor::Property::COLOR,
-                                         Source(parentPage, Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         boost::bind( &ScrollCubeEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector4>( child, Actor::Property::COLOR, info, &ScrollCubeEffectInfo::ColorConstraint );
+  constraint.AddSource( Source(parentPage, Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         Source(parentPage, Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         boost::bind( &ScrollCubeEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, info, &ScrollCubeEffectInfo::PositionConstraint );
+  constraint.AddSource( Source(parentPage, Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
+  constraint.Apply();
 }
 
 } // unnamed namespace
index 0f21d0c..eaa99eb 100644 (file)
@@ -16,7 +16,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 
@@ -91,26 +90,21 @@ struct ScrollDepthScaleConstraint
   }
 
   /**
-   * @param[in] current The current scale
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current scale
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new scale of this Actor.
    */
-  Vector3 operator()(const Vector3& currentScale,
-                     const PropertyInput& currentPositionProperty,
-                     const PropertyInput& pagePositionProperty,
-                     const PropertyInput& scrollPositionProperty,
-                     const PropertyInput& scrollPositionMin,
-                     const PropertyInput& scrollPositionMax,
-                     const PropertyInput& pageSizeProperty)
+  void operator()( Vector3& currentScale, const PropertyInputContainer& inputs )
   {
-    const Vector3& currentPosition = currentPositionProperty.GetVector3();
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& currentPosition = inputs[0]->GetVector3();
+    const Vector3& pagePosition = inputs[1]->GetVector3();
+    const Vector3& scrollPosition = inputs[2]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -118,15 +112,15 @@ struct ScrollDepthScaleConstraint
     // short circuit: for orthognal view.
     if( (fabsf(position.x) < Math::MACHINE_EPSILON_1) && (fabsf(position.y) < Math::MACHINE_EPSILON_1) )
     {
-      return currentScale;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
+    const Vector3& pageSize = inputs[5]->GetVector3();
 
     // Don't have enough parameters, to provide Wrap mode (need a way of having 'uniforms' instead of scrollWrap.GetBoolean())
 
-    const Vector3& min = scrollPositionMin.GetVector3();
-    const Vector3& max = scrollPositionMax.GetVector3();
+    const Vector3& min = inputs[3]->GetVector3();
+    const Vector3& max = inputs[4]->GetVector3();
 
     if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
     {
@@ -143,7 +137,7 @@ struct ScrollDepthScaleConstraint
     // short circuit: for pages outside of view.
     if( (fabsf(position.x) >= pageSize.x) || (fabsf(position.y) >= pageSize.y) )
     {
-      return currentScale;
+      return;
     }
 
     // Calculate scale ////////////////////////////////////////////////////////
@@ -175,7 +169,7 @@ struct ScrollDepthScaleConstraint
 
     float f = mScaleExtent + cos(position.x * Math::PI_2) * cos(position.y * Math::PI_2) * (1.0f - mScaleExtent);
 
-    return currentScale * f;
+    currentScale *= f;
   }
 
   const Vector2 mPositionExtent;                                ///< Determines how much of the Actor's X and Y position affects exponent value.
@@ -216,25 +210,20 @@ struct ScrollDepthPositionConstraint
   }
 
   /**
-   * @param[in] current The current position
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current position
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new position of this Actor.
    */
-  Vector3 operator()(const Vector3& currentPosition,
-                     const PropertyInput& pagePositionProperty,
-                     const PropertyInput& scrollPositionProperty,
-                     const PropertyInput& scrollPositionMin,
-                     const PropertyInput& scrollPositionMax,
-                     const PropertyInput& pageSizeProperty,
-                     const PropertyInput& scrollWrap)
+  void operator()( Vector3& currentPosition, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -242,16 +231,17 @@ struct ScrollDepthPositionConstraint
     // short circuit: for orthognal view.
     if( (fabsf(position.x) < Math::MACHINE_EPSILON_1) && (fabsf(position.y) < Math::MACHINE_EPSILON_1) )
     {
-      return currentPosition + scrollPosition;
+      currentPosition += scrollPosition;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
-    bool wrap = scrollWrap.GetBoolean();
+    const Vector3& pageSize = inputs[4]->GetVector3();
+    bool wrap = inputs[5]->GetBoolean();
 
     if(wrap)
     {
-      const Vector3& min = scrollPositionMin.GetVector3();
-      const Vector3& max = scrollPositionMax.GetVector3();
+      const Vector3& min = inputs[2]->GetVector3();
+      const Vector3& max = inputs[3]->GetVector3();
 
       if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
       {
@@ -271,7 +261,8 @@ struct ScrollDepthPositionConstraint
     {
       // position actors at: scrollposition (Property) + pagePosition (Parent) + current (this)
       // they will be invisible so doesn't have to be precise, just away from stage.
-      return currentPosition + scrollPosition;
+      currentPosition += scrollPosition;
+      return;
     }
 
     // Calculate position /////////////////////////////////////////////////////
@@ -281,8 +272,6 @@ struct ScrollDepthPositionConstraint
 
     position *= mPositionScale;
 
-    Vector3 finalPosition(currentPosition - pagePosition);
-
     Vector3 relCurrentPosition = currentPosition;
     relCurrentPosition.x = relCurrentPosition.x / pageSize.x + 0.5f;
     relCurrentPosition.y = relCurrentPosition.y / pageSize.y + 0.5f;
@@ -303,9 +292,8 @@ struct ScrollDepthPositionConstraint
     position.x = RampFunction(position.x, mOffsetExtent.x + extent.x);
     position.y = RampFunction(position.y, mOffsetExtent.y + extent.y);
 
-    finalPosition += pageSize * position;
-
-    return finalPosition;
+    currentPosition -= pagePosition;
+    currentPosition += pageSize * position;
   }
 
   const Vector2 mPositionExtent;                                ///< Determines how much of the Actor's X and Y position affects exponent value.
@@ -336,29 +324,26 @@ void ApplyScrollDepthConstraints(Toolkit::ScrollView scrollView,
                                  float scaleExtent)
 {
   // Scale Constraint
-  Constraint constraint = Constraint::New<Vector3>( Actor::Property::SCALE,
-                                         LocalSource(Actor::Property::POSITION),
-                                         ParentSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         ScrollDepthScaleConstraint( positionExtent, offsetExtent, positionScale, scaleExtent ) );
+  Constraint constraint = Constraint::New<Vector3>( child, Actor::Property::SCALE, ScrollDepthScaleConstraint( positionExtent, offsetExtent, positionScale, scaleExtent ) );
+  constraint.AddSource( LocalSource( Actor::Property::POSITION ) );
+  constraint.AddSource( ParentSource( Actor::Property::POSITION ) );
+  constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source( scrollView, Actor::Property::SIZE ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
+  constraint.Apply();
 
   // Position Constraint (apply last as other constraints use Actor::POSITION as a function input)
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         ParentSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         ScrollDepthPositionConstraint( positionExtent, offsetExtent, positionScale ) );
-
+  constraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, ScrollDepthPositionConstraint( positionExtent, offsetExtent, positionScale ) );
+  constraint.AddSource( ParentSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
+  constraint.Apply();
 }
 
 } // unnamed namespace
index ee5163c..09582cf 100644 (file)
@@ -169,27 +169,21 @@ float ConstantDecelerationAlphaFunction(float progress)
  * scroll domain. This is a value from 0.0f to 1.0f in each
  * scroll position axis.
  */
-Vector3 InternalRelativePositionConstraint(const Vector3&    current,
-                                           const PropertyInput& scrollPositionProperty,
-                                           const PropertyInput& scrollMinProperty,
-                                           const PropertyInput& scrollMaxProperty,
-                                           const PropertyInput& scrollSizeProperty)
+void InternalRelativePositionConstraint( Vector3& relativePosition, const PropertyInputContainer& inputs)
 {
-  Vector3 position = -scrollPositionProperty.GetVector3();
-  const Vector3& min = scrollMinProperty.GetVector3();
-  const Vector3& max = scrollMaxProperty.GetVector3();
-  const Vector3& size = scrollSizeProperty.GetVector3();
+  Vector3 position = -inputs[0]->GetVector3();
+  const Vector3& min = inputs[1]->GetVector3();
+  const Vector3& max = inputs[2]->GetVector3();
+  const Vector3& size = inputs[3]->GetVector3();
 
   position.x = WrapInDomain(position.x, min.x, max.x);
   position.y = WrapInDomain(position.y, min.y, max.y);
 
-  Vector3 relativePosition;
   Vector3 domainSize = (max - min) - size;
 
   relativePosition.x = domainSize.x > Math::MACHINE_EPSILON_1 ? fabsf((position.x - min.x) / domainSize.x) : 0.0f;
   relativePosition.y = domainSize.y > Math::MACHINE_EPSILON_1 ? fabsf((position.y - min.y) / domainSize.y) : 0.0f;
-
-  return relativePosition;
+  relativePosition.z = 0.0f;
 }
 
 } // unnamed namespace
@@ -294,22 +288,19 @@ struct InternalPrePositionConstraint
   {
   }
 
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& gesturePositionProperty,
-                     const PropertyInput& sizeProperty)
+  void operator()( Vector3& scrollPostPosition, const PropertyInputContainer& inputs )
   {
-    Vector3 scrollPostPosition = current;
-    Vector2 panPosition = gesturePositionProperty.GetVector2();
+    const Vector2& panPosition = inputs[0]->GetVector2();
 
     if(!mWasPanning)
     {
-      mPrePosition = current;
+      mPrePosition = scrollPostPosition;
       mCurrentPanMask = mInitialPanMask;
       mWasPanning = true;
     }
 
     // Calculate Deltas...
-    Vector2 currentPosition = gesturePositionProperty.GetVector2();
+    const Vector2& currentPosition = panPosition;
     Vector2 panDelta( currentPosition - mLocalStart );
 
     // Axis Auto Lock - locks the panning to the horizontal or vertical axis if the pan
@@ -335,7 +326,7 @@ struct InternalPrePositionConstraint
     scrollPostPosition.GetVectorXY() += panDelta;
 
     // if no wrapping then clamp preposition to maximum overshoot amount
-    const Vector3& size = sizeProperty.GetVector3();
+    const Vector3& size = inputs[1]->GetVector3();
     if( mClampX )
     {
       float newXPosition = Clamp(scrollPostPosition.x, (mDomainMax.x + size.x) - mMaxOvershoot.x, mDomainMin.x + mMaxOvershoot.x );
@@ -358,8 +349,6 @@ struct InternalPrePositionConstraint
       }
       scrollPostPosition.y = newYPosition;
     }
-
-    return scrollPostPosition;
   }
 
   Vector3 mPrePosition;
@@ -397,16 +386,12 @@ struct InternalPositionConstraint
   {
   }
 
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& scrollPositionProperty,
-                     const PropertyInput& scrollMinProperty,
-                     const PropertyInput& scrollMaxProperty,
-                     const PropertyInput& scrollSizeProperty)
+  void operator()( Vector3& position, const PropertyInputContainer& inputs )
   {
-    Vector3 position = scrollPositionProperty.GetVector3();
-    const Vector2& size = scrollSizeProperty.GetVector3().GetVectorXY();
-    const Vector3& min = scrollMinProperty.GetVector3();
-    const Vector3& max = scrollMaxProperty.GetVector3();
+    position = inputs[0]->GetVector3();
+    const Vector2& size = inputs[3]->GetVector3().GetVectorXY();
+    const Vector3& min = inputs[1]->GetVector3();
+    const Vector3& max = inputs[2]->GetVector3();
 
     if( mWrap )
     {
@@ -419,8 +404,6 @@ struct InternalPositionConstraint
       position.x = mClampX ? Clamp(position.x, mDomainMax.x + size.x, mDomainMin.x ) : position.x;
       position.y = mClampY ? Clamp(position.y, mDomainMax.y + size.y, mDomainMin.y ) : position.y;
     }
-
-    return position;
   }
 
   Vector2 mDomainMin;
@@ -439,19 +422,19 @@ struct OvershootXConstraint
 {
   OvershootXConstraint(float maxOvershoot) : mMaxOvershoot(maxOvershoot) {}
 
-  float operator()(const float&    current,
-      const PropertyInput& scrollPrePositionProperty,
-      const PropertyInput& scrollPostPositionProperty,
-      const PropertyInput& canScrollProperty)
+  void operator()( float& current, const PropertyInputContainer& inputs )
   {
-    if( canScrollProperty.GetBoolean() )
+    if( inputs[2]->GetBoolean() )
     {
-      const Vector3& scrollPrePosition = scrollPrePositionProperty.GetVector3();
-      const Vector3& scrollPostPosition = scrollPostPositionProperty.GetVector3();
+      const Vector3& scrollPrePosition = inputs[0]->GetVector3();
+      const Vector3& scrollPostPosition = inputs[1]->GetVector3();
       float newOvershoot = scrollPrePosition.x - scrollPostPosition.x;
-      return (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot;
+      current = (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot;
+    }
+    else
+    {
+      current = 0.0f;
     }
-    return 0.0f;
   }
 
   float mMaxOvershoot;
@@ -465,19 +448,19 @@ struct OvershootYConstraint
 {
   OvershootYConstraint(float maxOvershoot) : mMaxOvershoot(maxOvershoot) {}
 
-  float operator()(const float&    current,
-      const PropertyInput& scrollPrePositionProperty,
-      const PropertyInput& scrollPostPositionProperty,
-      const PropertyInput& canScrollProperty)
+  void operator()( float& current, const PropertyInputContainer& inputs )
   {
-    if( canScrollProperty.GetBoolean() )
+    if( inputs[2]->GetBoolean() )
     {
-      const Vector3& scrollPrePosition = scrollPrePositionProperty.GetVector3();
-      const Vector3& scrollPostPosition = scrollPostPositionProperty.GetVector3();
+      const Vector3& scrollPrePosition = inputs[0]->GetVector3();
+      const Vector3& scrollPostPosition = inputs[1]->GetVector3();
       float newOvershoot = scrollPrePosition.y - scrollPostPosition.y;
-      return (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot;
+      current = (newOvershoot > 0.0f ? std::min(newOvershoot, mMaxOvershoot) : std::max(newOvershoot, -mMaxOvershoot)) / mMaxOvershoot;
+    }
+    else
+    {
+      current = 0.0f;
     }
-    return 0.0f;
   }
 
   float mMaxOvershoot;
@@ -488,14 +471,12 @@ struct OvershootYConstraint
  *
  * Generates position-delta property based on scroll-position + scroll-offset properties.
  */
-Vector3 InternalPositionDeltaConstraint(const Vector3&    current,
-                                        const PropertyInput& scrollPositionProperty,
-                                        const PropertyInput& scrollOffsetProperty)
+void InternalPositionDeltaConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
-  const Vector3& scrollOffset = scrollOffsetProperty.GetVector3();
+  const Vector3& scrollPosition = inputs[0]->GetVector3();
+  const Vector3& scrollOffset = inputs[1]->GetVector3();
 
-  return scrollPosition + scrollOffset;
+  current = scrollPosition + scrollOffset;
 }
 
 /**
@@ -514,18 +495,15 @@ struct InternalFinalConstraint
   {
   }
 
-  Vector3 operator()(const Vector3&    current,
-                     const PropertyInput& scrollPositionProperty,
-                     const PropertyInput& scrollOvershootXProperty,
-                     const PropertyInput& scrollOvershootYProperty)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const float& overshootx = scrollOvershootXProperty.GetFloat();
-    const float& overshooty = scrollOvershootYProperty.GetFloat();
+    const float& overshootx = inputs[1]->GetFloat();
+    const float& overshooty = inputs[2]->GetFloat();
     Vector3 offset( mFunctionX(overshootx),
                     mFunctionY(overshooty),
                     0.0f);
 
-    return scrollPositionProperty.GetVector3() - offset;
+    current = inputs[0]->GetVector3() - offset;
   }
 
   AlphaFunction mFunctionX;
@@ -603,7 +581,9 @@ void ScrollView::OnInitialize()
   mInternalActor = Actor::New();
   mInternalActor.SetDrawMode(DrawMode::OVERLAY);
   self.Add(mInternalActor);
-  mInternalActor.ApplyConstraint( Constraint::New<Vector3>( Actor::Property::SIZE, ParentSource( Actor::Property::SIZE ), EqualToConstraint() ) );
+  Constraint constraint = Constraint::New<Vector3>( mInternalActor, Actor::Property::SIZE, EqualToConstraint() );
+  constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+  constraint.Apply();
   mInternalActor.SetParentOrigin(ParentOrigin::CENTER);
   mInternalActor.SetAnchorPoint(AnchorPoint::CENTER);
 
@@ -1151,7 +1131,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct
 
     if( mScrollMainInternalPrePositionConstraint )
     {
-      self.RemoveConstraint(mScrollMainInternalPrePositionConstraint);
+      mScrollMainInternalPrePositionConstraint.Remove();
     }
   }
 
@@ -2396,7 +2376,7 @@ void ScrollView::OnPan( const PanGesture& gesture )
 
         if( mScrollMainInternalPrePositionConstraint )
         {
-          self.RemoveConstraint(mScrollMainInternalPrePositionConstraint);
+          mScrollMainInternalPrePositionConstraint.Remove();
         }
 
         if( mOvershootIndicator )
@@ -2586,14 +2566,14 @@ void ScrollView::UpdateMainInternalConstraint()
 
   if(mScrollMainInternalPositionConstraint)
   {
-    self.RemoveConstraint(mScrollMainInternalPositionConstraint);
-    self.RemoveConstraint(mScrollMainInternalDeltaConstraint);
-    self.RemoveConstraint(mScrollMainInternalFinalConstraint);
-    self.RemoveConstraint(mScrollMainInternalRelativeConstraint);
+    mScrollMainInternalPositionConstraint.Remove();
+    mScrollMainInternalDeltaConstraint.Remove();
+    mScrollMainInternalFinalConstraint.Remove();
+    mScrollMainInternalRelativeConstraint.Remove();
   }
   if( mScrollMainInternalPrePositionConstraint )
   {
-    self.RemoveConstraint(mScrollMainInternalPrePositionConstraint);
+    mScrollMainInternalPrePositionConstraint.Remove();
   }
 
   // TODO: It's probably better to use a local displacement value as this will give a displacement when scrolling just commences
@@ -2610,48 +2590,55 @@ void ScrollView::UpdateMainInternalConstraint()
   {
     initialPanMask.x = 0.0f;
   }
-  Constraint constraint;
 
   if( mPanning )
   {
-    constraint = Constraint::New<Vector3>( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION,
-                                                      Source( detector, PanGestureDetector::Property::LOCAL_POSITION ),
-                                                      Source( self, Actor::Property::SIZE ),
-                                                      InternalPrePositionConstraint( mPanStartPosition, initialPanMask, mAxisAutoLock, mAxisAutoLockGradient, mLockAxis, mMaxOvershoot, mRulerX->GetDomain(), mRulerY->GetDomain() ) );
-    mScrollMainInternalPrePositionConstraint = self.ApplyConstraint( constraint );
+    mScrollMainInternalPrePositionConstraint = Constraint::New<Vector3>( self,
+                                                                         Toolkit::ScrollView::Property::SCROLL_PRE_POSITION,
+                                                                         InternalPrePositionConstraint( mPanStartPosition,
+                                                                                                        initialPanMask,
+                                                                                                        mAxisAutoLock,
+                                                                                                        mAxisAutoLockGradient,
+                                                                                                        mLockAxis,
+                                                                                                        mMaxOvershoot,
+                                                                                                        mRulerX->GetDomain(),
+                                                                                                        mRulerY->GetDomain() ) );
+    mScrollMainInternalPrePositionConstraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+    mScrollMainInternalPrePositionConstraint.AddSource( Source( self, Actor::Property::SIZE ) );
+    mScrollMainInternalPrePositionConstraint.Apply();
   }
 
   // 2. Second calculate the clamped position (actual position)
-  constraint = Constraint::New<Vector3>( Toolkit::ScrollView::Property::SCROLL_POSITION,
-                                         LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ),
-                                         LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source( self, Actor::Property::SIZE ),
-                                         InternalPositionConstraint( mRulerX->GetDomain(),
-                                                                     mRulerY->GetDomain(), mWrapMode ) );
-  mScrollMainInternalPositionConstraint = self.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Toolkit::ScrollView::Property::SCROLL_POSITION_DELTA,
-                                         LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                         LocalSource( Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET ),
-                                         InternalPositionDeltaConstraint );
-  mScrollMainInternalDeltaConstraint = self.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Toolkit::ScrollView::Property::SCROLL_FINAL,
-                                         LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                         LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_X ),
-                                         LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_Y ),
-                                         InternalFinalConstraint( FinalDefaultAlphaFunction,
-                                                                  FinalDefaultAlphaFunction ) );
-  mScrollMainInternalFinalConstraint = self.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION,
-                                         LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                         LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         LocalSource( Actor::Property::SIZE ),
-                                         InternalRelativePositionConstraint );
-  mScrollMainInternalRelativeConstraint = self.ApplyConstraint( constraint );
+  mScrollMainInternalPositionConstraint = Constraint::New<Vector3>( self,
+                                                                    Toolkit::ScrollView::Property::SCROLL_POSITION,
+                                                                    InternalPositionConstraint( mRulerX->GetDomain(),
+                                                                                                mRulerY->GetDomain(),
+                                                                                                mWrapMode ) );
+  mScrollMainInternalPositionConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ) );
+  mScrollMainInternalPositionConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  mScrollMainInternalPositionConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  mScrollMainInternalPositionConstraint.AddSource( Source( self, Actor::Property::SIZE ) );
+  mScrollMainInternalPositionConstraint.Apply();
+
+  mScrollMainInternalDeltaConstraint = Constraint::New<Vector3>( self, Toolkit::ScrollView::Property::SCROLL_POSITION_DELTA, InternalPositionDeltaConstraint );
+  mScrollMainInternalDeltaConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  mScrollMainInternalDeltaConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET ) );
+  mScrollMainInternalDeltaConstraint.Apply();
+
+  mScrollMainInternalFinalConstraint = Constraint::New<Vector3>( self, Toolkit::ScrollView::Property::SCROLL_FINAL,
+                                                                 InternalFinalConstraint( FinalDefaultAlphaFunction,
+                                                                                          FinalDefaultAlphaFunction ) );
+  mScrollMainInternalFinalConstraint .AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  mScrollMainInternalFinalConstraint .AddSource( LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_X ) );
+  mScrollMainInternalFinalConstraint .AddSource( LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_Y ) );
+  mScrollMainInternalFinalConstraint.Apply();
+
+  mScrollMainInternalRelativeConstraint = Constraint::New<Vector3>( self, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, InternalRelativePositionConstraint );
+  mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  mScrollMainInternalRelativeConstraint.AddSource( LocalSource( Actor::Property::SIZE ) );
+  mScrollMainInternalRelativeConstraint.Apply();
 
   // When panning we want to make sure overshoot values are affected by pre position and post position
   SetOvershootConstraintsEnabled(!mWrapMode);
@@ -2663,26 +2650,24 @@ void ScrollView::SetOvershootConstraintsEnabled(bool enabled)
   // remove and reset, it may now be in wrong order with the main internal constraints
   if( mScrollMainInternalOvershootXConstraint )
   {
-    self.RemoveConstraint(mScrollMainInternalOvershootXConstraint);
+    mScrollMainInternalOvershootXConstraint.Remove();
     mScrollMainInternalOvershootXConstraint.Reset();
-    self.RemoveConstraint(mScrollMainInternalOvershootYConstraint);
+    mScrollMainInternalOvershootYConstraint.Remove();
     mScrollMainInternalOvershootYConstraint.Reset();
   }
   if( enabled )
   {
-    Constraint constraint = Constraint::New<float>( Toolkit::ScrollView::Property::OVERSHOOT_X,
-                                           LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ),
-                                           LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                           LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL ),
-                                           OvershootXConstraint(mMaxOvershoot.x) );
-    mScrollMainInternalOvershootXConstraint = self.ApplyConstraint( constraint );
+    mScrollMainInternalOvershootXConstraint= Constraint::New<float>( self, Toolkit::ScrollView::Property::OVERSHOOT_X, OvershootXConstraint(mMaxOvershoot.x) );
+    mScrollMainInternalOvershootXConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ) );
+    mScrollMainInternalOvershootXConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+    mScrollMainInternalOvershootXConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL ) );
+    mScrollMainInternalOvershootXConstraint.Apply();
 
-    constraint = Constraint::New<float>( Toolkit::ScrollView::Property::OVERSHOOT_Y,
-                                           LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ),
-                                           LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                           LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ),
-                                           OvershootYConstraint(mMaxOvershoot.y) );
-    mScrollMainInternalOvershootYConstraint = self.ApplyConstraint( constraint );
+    mScrollMainInternalOvershootYConstraint = Constraint::New<float>( self, Toolkit::ScrollView::Property::OVERSHOOT_Y, OvershootYConstraint(mMaxOvershoot.y) );
+    mScrollMainInternalOvershootYConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ) );
+    mScrollMainInternalOvershootYConstraint.AddSource( LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+    mScrollMainInternalOvershootYConstraint.AddSource( LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ) );
+    mScrollMainInternalOvershootYConstraint.Apply();
   }
   else
   {
@@ -2705,21 +2690,19 @@ void ScrollView::SetInternalConstraints()
   Constraint constraint;
 
   // MoveActor (scrolling)
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         Source( self, Toolkit::ScrollView::Property::SCROLL_POSITION ),
-                                         MoveActorConstraint );
+  constraint = Constraint::New<Vector3>( self, Actor::Property::POSITION, MoveActorConstraint );
+  constraint.AddSource( Source( self, Toolkit::ScrollView::Property::SCROLL_POSITION ) );
   constraint.SetRemoveAction(Constraint::Discard);
   ApplyConstraintToBoundActors(constraint);
 
   // WrapActor (wrap functionality)
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                                 LocalSource( Actor::Property::SCALE ),
-                                                 LocalSource( Actor::Property::ANCHOR_POINT ),
-                                                 LocalSource( Actor::Property::SIZE ),
-                                                 Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                                 Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                                 Source( self, Toolkit::ScrollView::Property::WRAP ),
-                                                 WrapActorConstraint );
+  constraint = Constraint::New<Vector3>( self, Actor::Property::POSITION, WrapActorConstraint );
+  constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
+  constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) );
+  constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
+  constraint.AddSource( Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source( self, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction(Constraint::Discard);
   ApplyConstraintToBoundActors(constraint);
 }
index da194f9..f4d211b 100644 (file)
@@ -888,13 +888,13 @@ private:
   Vector2 mMouseWheelScrollDistanceStep;        ///< The step of scroll distance in actor coordinates in X and Y axes for each mouse wheel event received.
 
   //ScrollInternalConstraintsPtr mScrollInternalConstraints;
-  ActiveConstraint mScrollMainInternalPrePositionConstraint;
-  ActiveConstraint mScrollMainInternalPositionConstraint;
-  ActiveConstraint mScrollMainInternalOvershootXConstraint;
-  ActiveConstraint mScrollMainInternalOvershootYConstraint;
-  ActiveConstraint mScrollMainInternalDeltaConstraint;
-  ActiveConstraint mScrollMainInternalFinalConstraint;
-  ActiveConstraint mScrollMainInternalRelativeConstraint;
+  Constraint mScrollMainInternalPrePositionConstraint;
+  Constraint mScrollMainInternalPositionConstraint;
+  Constraint mScrollMainInternalOvershootXConstraint;
+  Constraint mScrollMainInternalOvershootYConstraint;
+  Constraint mScrollMainInternalDeltaConstraint;
+  Constraint mScrollMainInternalFinalConstraint;
+  Constraint mScrollMainInternalRelativeConstraint;
 
   ScrollOvershootIndicatorPtr mOvershootIndicator;
 
index 704cdaf..e44800d 100644 (file)
@@ -19,8 +19,6 @@
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.h>
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 
@@ -66,25 +64,20 @@ public:
   }
 
   /**
-   * @param[in] current The current color of this Actor
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current color of this Actor
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new color of this Actor.
    */
-  Vector4 ColorConstraint(const Vector4& current,
-                          const PropertyInput& pagePositionProperty,
-                          const PropertyInput& scrollPositionProperty,
-                          const PropertyInput& scrollPositionMin,
-                          const PropertyInput& scrollPositionMax,
-                          const PropertyInput& pageSizeProperty,
-                          const PropertyInput& scrollWrap)
+  void ColorConstraint( Vector4& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -92,14 +85,14 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
+    const Vector3& pageSize = inputs[4]->GetVector3();
 
-    if( scrollWrap.GetBoolean() )
+    if( inputs[5]->GetBoolean() )
     {
-      WrapPositionWithinDomain( position, pageSize, scrollPositionMin.GetVector3(), scrollPositionMax.GetVector3() );
+      WrapPositionWithinDomain( position, pageSize, inputs[2]->GetVector3(), inputs[3]->GetVector3() );
     }
 
     // short circuit: for pages outside of view.
@@ -107,36 +100,29 @@ public:
     {
       // note preserve color channels incase there is a shader/further constraint
       // that wishes to do something with that information.
-      return Vector4(current.r, current.g, current.b, 0.0f);
+      current.a = 0.0f;
+      return;
     }
 
-    Vector4 color( current );
     Vector2 distance( position / pageSize * PAGE_SIZE_MULTIPLIER );
-    color.a = Clamp( 1.0f - distance.Length(), 0.0f, 1.0f );
-
-    return color;
+    current.a = Clamp( 1.0f - distance.Length(), 0.0f, 1.0f );
   }
 
   /**
-   * @param[in] current The current position
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current position
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new position of this Actor.
    */
-  Vector3 PositionConstraint(const Vector3& current,
-                             const PropertyInput& pagePositionProperty,
-                             const PropertyInput& scrollPositionProperty,
-                             const PropertyInput& scrollPositionMin,
-                             const PropertyInput& scrollPositionMax,
-                             const PropertyInput& pageSizeProperty,
-                             const PropertyInput& scrollWrap)
+  void PositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -144,14 +130,15 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
+    const Vector3& pageSize = inputs[4]->GetVector3();
 
-    if( scrollWrap.GetBoolean() )
+    if( inputs[5]->GetBoolean() )
     {
-      WrapPositionWithinDomain( position, pageSize, scrollPositionMin.GetVector3(), scrollPositionMax.GetVector3() );
+      WrapPositionWithinDomain( position, pageSize, inputs[2]->GetVector3(), inputs[3]->GetVector3() );
     }
 
     // short circuit: for pages outside of view.
@@ -159,7 +146,8 @@ public:
     {
       // position actors at: scrollposition (Property) + pagePosition (Parent) + current (this)
       // they will be invisible so doesn't have to be precise, just away from stage.
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
     Vector3 angle( position / pageSize * PAGE_SIZE_MULTIPLIER );
@@ -171,7 +159,7 @@ public:
     zMovement *= mPositionToPageSizeRatio;
     position.z = - ( ( zMovement.x - ( zMovement.x * cos( angle.x ) ) ) + ( zMovement.y - ( zMovement.y * cos( angle.y ) ) ) );
 
-    return position;
+    current = position;
   }
 
   const Vector2 mPositionToPageSizeRatio; ///< The page will move its position according to this ratio.
@@ -190,29 +178,25 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView,
 {
   // Apply constraints to this actor //
   Constraint constraint;
-  constraint = Constraint::New<Vector4>( Actor::Property::COLOR,
-                                         LocalSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         boost::bind( &ScrollPageCarouselEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint = Constraint::New<Vector4>( child, Actor::Property::COLOR, info, &ScrollPageCarouselEffectInfo::ColorConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         LocalSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         boost::bind( &ScrollPageCarouselEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, info, &ScrollPageCarouselEffectInfo::PositionConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
+  constraint.Apply();
 }
 
 } // unnamed namespace
index c65d4f3..66855a6 100644 (file)
@@ -19,8 +19,6 @@
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.h>
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 
@@ -69,25 +67,20 @@ public:
   }
 
   /**
-   * @param[in] current The current orientation of this Actor
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current orientation of this Actor
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new orientation of this Actor.
    */
-  Quaternion RotationConstraint(const Quaternion& current,
-                                const PropertyInput& pagePositionProperty,
-                                const PropertyInput& scrollPositionProperty,
-                                const PropertyInput& scrollPositionMin,
-                                const PropertyInput& scrollPositionMax,
-                                const PropertyInput& pageSizeProperty,
-                                const PropertyInput& scrollWrap)
+  void RotationConstraint( Quaternion& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -95,53 +88,46 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
+    const Vector3& pageSize = inputs[4]->GetVector3();
 
-    if( scrollWrap.GetBoolean() )
+    if( inputs[5]->GetBoolean() )
     {
-      WrapPositionWithinDomain( position, pageSize, scrollPositionMin.GetVector3(), scrollPositionMax.GetVector3() );
+      WrapPositionWithinDomain( position, pageSize, inputs[2]->GetVector3(), inputs[3]->GetVector3() );
     }
 
     // short circuit: for pages outside of view.
     if( IsOutsideView( position, pageSize ) )
     {
-      return current;
+      return;
     }
 
     // Our target is a 90 degree (PI/2) rotation per page, so calculate the angle we should be rotate
     // our page by calculating the amount we've moved as a fraction of the total size of the page.
     Vector2 angle( position / pageSize * Dali::Math::PI_2 );
 
-    Quaternion rotation = Quaternion( -angle.x * mAngleSwing.x, Vector3::YAXIS ) *
-                          Quaternion(  angle.y * mAngleSwing.y, Vector3::XAXIS ) *
-                          current;
-
-    return rotation;
+    current = Quaternion( -angle.x * mAngleSwing.x, Vector3::YAXIS ) *
+              Quaternion(  angle.y * mAngleSwing.y, Vector3::XAXIS ) *
+              current;
   }
 
   /**
-   * @param[in] current The current color of this Actor
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current color of this Actor
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new color of this Actor.
    */
-  Vector4 ColorConstraint(const Vector4& current,
-                          const PropertyInput& pagePositionProperty,
-                          const PropertyInput& scrollPositionProperty,
-                          const PropertyInput& scrollPositionMin,
-                          const PropertyInput& scrollPositionMax,
-                          const PropertyInput& pageSizeProperty,
-                          const PropertyInput& scrollWrap)
+  void ColorConstraint( Vector4& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -149,14 +135,14 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
+    const Vector3& pageSize = inputs[4]->GetVector3();
 
-    if( scrollWrap.GetBoolean() )
+    if( inputs[5]->GetBoolean() )
     {
-      WrapPositionWithinDomain( position, pageSize, scrollPositionMin.GetVector3(), scrollPositionMax.GetVector3() );
+      WrapPositionWithinDomain( position, pageSize, inputs[2]->GetVector3(), inputs[3]->GetVector3() );
     }
 
     // short circuit: for pages outside of view.
@@ -164,7 +150,8 @@ public:
     {
       // note preserve color channels incase there is a shader/further constraint
       // that wishes to do something with that information.
-      return Vector4(current.r, current.g, current.b, 0.0f);
+      current.a = 0.0f;
+      return;
     }
 
     // Calculate the distance of this page from our view and ensure it falls within the appropriate
@@ -176,32 +163,25 @@ public:
 
     if ( distanceFactor > 1.0f )
     {
-      return Vector4(current.r, current.g, current.b, 0.0f);
+      current.a = 0.0f;
     }
-
-    return current;
   }
 
   /**
-   * @param[in] current The current position
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP)
+   * @param[in,out] current The current position
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    Whether scroll wrap has been enabled or not (SCROLL_WRAP)
    * @return The new position of this Actor.
    */
-  Vector3 PositionConstraint(const Vector3& current,
-                             const PropertyInput& pagePositionProperty,
-                             const PropertyInput& scrollPositionProperty,
-                             const PropertyInput& scrollPositionMin,
-                             const PropertyInput& scrollPositionMax,
-                             const PropertyInput& pageSizeProperty,
-                             const PropertyInput& scrollWrap)
+  void PositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -209,14 +189,15 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
+    const Vector3& pageSize = inputs[4]->GetVector3();
 
-    if( scrollWrap.GetBoolean() )
+    if( inputs[5]->GetBoolean() )
     {
-      WrapPositionWithinDomain( position, pageSize, scrollPositionMin.GetVector3(), scrollPositionMax.GetVector3() );
+      WrapPositionWithinDomain( position, pageSize, inputs[2]->GetVector3(), inputs[3]->GetVector3() );
     }
 
     // short circuit: for pages outside of view.
@@ -224,7 +205,8 @@ public:
     {
       // position actors at: scrollposition (Property) + pagePosition (Parent) + current (this)
       // they will be invisible so doesn't have to be precise, just away from stage.
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
     // Our target when scrolling is moving from the origin to the following points around a curve:
@@ -236,11 +218,9 @@ public:
     Vector2 angle( position / pageSize * Dali::Math::PI_2 );
     Vector2 radius( pageSize * 0.5 );
 
-    position.x = radius.x * sin( angle.x );
-    position.y = radius.y * sin( angle.y );
-    position.z = ( radius.x - ( radius.x * cos( angle.x ) ) ) + ( radius.y - ( radius.y * cos( angle.y ) ) );
-
-    return position;
+    current.x = radius.x * sin( angle.x );
+    current.y = radius.y * sin( angle.y );
+    current.z = ( radius.x - ( radius.x * cos( angle.x ) ) ) + ( radius.y - ( radius.y * cos( angle.y ) ) );
   }
 
   Vector2 mAngleSwing;                                    ///< Maximum amount in X and Y axes to rotate.
@@ -259,41 +239,35 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView,
 {
   // Apply constraints to this actor //
   Constraint constraint;
-  constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                            LocalSource(Actor::Property::POSITION),
-                                            Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                            Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                            Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                            Source(scrollView, Actor::Property::SIZE ),
-                                            Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                            boost::bind( &ScrollPageCubeEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, info, &ScrollPageCubeEffectInfo::RotationConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector4>( Actor::Property::COLOR,
-                                         LocalSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         boost::bind( &ScrollPageCubeEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector4>( child, Actor::Property::COLOR, info, &ScrollPageCubeEffectInfo::ColorConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         LocalSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::WRAP ),
-                                         boost::bind( &ScrollPageCubeEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, info, &ScrollPageCubeEffectInfo::PositionConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::WRAP ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
+  constraint.Apply();
 }
 
 } // unnamed namespace
index 27db48f..0871b57 100644 (file)
@@ -18,9 +18,6 @@
 // CLASS HEADER
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.h>
 
-// EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-helper-functions.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
@@ -80,26 +77,21 @@ public:
   }
 
   /**
-   * @param[in] current The current orientation of this Actor
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION)
+   * @param[in,out] current The current orientation of this Actor
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION)
    * @return The new orientation of this Actor.
    */
-  Quaternion RotationConstraint(const Quaternion& current,
-                                const PropertyInput& pagePositionProperty,
-                                const PropertyInput& scrollPositionProperty,
-                                const PropertyInput& scrollPositionMin,
-                                const PropertyInput& scrollPositionMax,
-                                const PropertyInput& pageSizeProperty,
-                                const PropertyInput& scrollStartPagePositionProperty)
+  void RotationConstraint( Quaternion& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
-    const Vector3& scrollStartPagePosition = scrollStartPagePositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
+    const Vector3& scrollStartPagePosition = inputs[5]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -107,12 +99,12 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
-    const Vector3& minScrollPosition( scrollPositionMin.GetVector3() );
-    const Vector3& maxScrollPosition( scrollPositionMax.GetVector3() );
+    const Vector3& pageSize = inputs[4]->GetVector3();
+    const Vector3& minScrollPosition( inputs[2]->GetVector3() );
+    const Vector3& maxScrollPosition( inputs[3]->GetVector3() );
 
     if( mScrollWrap )
     {
@@ -122,7 +114,7 @@ public:
     // short circuit: for pages outside of view.
     if( IsOutsideView( position, pageSize ) )
     {
-      return current;
+      return;
     }
 
     Vector2 angle( position / ( pageSize * PAGE_SIZE_RELATIVE_ANGLE_FACTOR ) * Vector3( mSpiralAngle ) );
@@ -153,34 +145,27 @@ public:
     }
     ClampInPlace( angle.y, -angleMaxMin.y, angleMaxMin.y );
 
-    Quaternion rotation = Quaternion( angle.x, Vector3::YAXIS ) *
-                          Quaternion( angle.y, Vector3::XAXIS ) *
-                          current;
-
-    return rotation;
+    current = Quaternion( angle.x, Vector3::YAXIS ) *
+              Quaternion( angle.y, Vector3::XAXIS ) *
+              current;
   }
 
   /**
-   * @param[in] current The current color of this Actor
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION)
+   * @param[in,out] current The current color of this Actor
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION)
    * @return The new color of this Actor.
    */
-  Vector4 ColorConstraint(const Vector4& current,
-                          const PropertyInput& pagePositionProperty,
-                          const PropertyInput& scrollPositionProperty,
-                          const PropertyInput& scrollPositionMin,
-                          const PropertyInput& scrollPositionMax,
-                          const PropertyInput& pageSizeProperty,
-                          const PropertyInput& scrollStartPagePositionProperty)
+  void ColorConstraint( Vector4& color, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
-    const Vector3& scrollStartPagePosition = scrollStartPagePositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
+    const Vector3& scrollStartPagePosition = inputs[5]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -188,12 +173,12 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
-    const Vector3& minScrollPosition( scrollPositionMin.GetVector3() );
-    const Vector3& maxScrollPosition( scrollPositionMax.GetVector3() );
+    const Vector3& pageSize = inputs[4]->GetVector3();
+    const Vector3& minScrollPosition( inputs[2]->GetVector3() );
+    const Vector3& maxScrollPosition( inputs[3]->GetVector3() );
 
     if( mScrollWrap )
     {
@@ -205,10 +190,10 @@ public:
     {
       // note preserve color channels incase there is a shader/further constraint
       // that wishes to do something with that information.
-      return Vector4(current.r, current.g, current.b, 0.0f);
+      color.a = 0.0f;
+      return;
     }
 
-    Vector4 color( current );
     Vector2 distance( position / pageSize );
     float distanceLength( distance.Length() );
     const Vector2 epsilon( pageSize * PAGE_EPSILON_FACTOR );
@@ -244,31 +229,24 @@ public:
     {
       color.a = 0.0f;
     }
-
-    return color;
   }
 
   /**
-   * @param[in] current The current position
-   * @param[in] pagePositionProperty The page's position.
-   * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION)
-   * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
-   * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX)
-   * @param[in] pageSizeProperty The size of the page. (scrollView SIZE)
-   * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION)
+   * @param[in,out] current The current position
+   * @param[in] inputs Contains:
+   *                    The page's position.
+   *                    The scroll-view's position property (SCROLL_POSITION)
+   *                    The minimum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The maximum extent of this scroll domain. (SCROLL_POSITION_MIN)
+   *                    The size of the page. (scrollView SIZE)
+   *                    The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION)
    * @return The new position of this Actor.
    */
-  Vector3 PositionConstraint(const Vector3& current,
-                             const PropertyInput& pagePositionProperty,
-                             const PropertyInput& scrollPositionProperty,
-                             const PropertyInput& scrollPositionMin,
-                             const PropertyInput& scrollPositionMax,
-                             const PropertyInput& pageSizeProperty,
-                             const PropertyInput& scrollStartPagePositionProperty)
+  void PositionConstraint( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& pagePosition = pagePositionProperty.GetVector3();
-    const Vector3& scrollPosition = scrollPositionProperty.GetVector3();
-    const Vector3& scrollStartPagePosition = scrollStartPagePositionProperty.GetVector3();
+    const Vector3& pagePosition = inputs[0]->GetVector3();
+    const Vector3& scrollPosition = inputs[1]->GetVector3();
+    const Vector3& scrollStartPagePosition = inputs[5]->GetVector3();
 
     // Get position of page.
     Vector3 position = pagePosition + scrollPosition;
@@ -276,12 +254,13 @@ public:
     // short circuit: if we're looking straight on at the page.
     if( IsStraightOnView( position ) )
     {
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
-    const Vector3& pageSize = pageSizeProperty.GetVector3();
-    const Vector3& minScrollPosition( scrollPositionMin.GetVector3() );
-    const Vector3& maxScrollPosition( scrollPositionMax.GetVector3() );
+    const Vector3& pageSize = inputs[4]->GetVector3();
+    const Vector3& minScrollPosition( inputs[2]->GetVector3() );
+    const Vector3& maxScrollPosition( inputs[3]->GetVector3() );
 
     if( mScrollWrap )
     {
@@ -293,7 +272,8 @@ public:
     {
       // position actors at: scrollposition (Property) + pagePosition (Parent) + current (this)
       // they will be invisible so doesn't have to be precise, just away from stage.
-      return current + scrollPosition;
+      current += scrollPosition;
+      return;
     }
 
     const Vector2 angle( position / pageSize * ( Dali::Math::PI_4 ) );
@@ -329,7 +309,7 @@ public:
       position.z += fabsf( position.y ) * NON_SCROLL_PAGE_Z_POSITION_FACTOR;
     }
 
-    return position;
+    current = position;
   }
 
   Vector2 mSpiralAngle; ///< The angle of the spirald page
@@ -349,41 +329,35 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView,
 {
   // Apply constraints to this actor //
   Constraint constraint;
-  constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                            LocalSource(Actor::Property::POSITION),
-                                            Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                            Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                            Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                            Source(scrollView, Actor::Property::SIZE ),
-                                            Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ),
-                                            boost::bind( &ScrollPageSpiralEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, info, &ScrollPageSpiralEffectInfo::RotationConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector4>( Actor::Property::COLOR,
-                                         LocalSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ),
-                                         boost::bind( &ScrollPageSpiralEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector4>( child, Actor::Property::COLOR, info, &ScrollPageSpiralEffectInfo::ColorConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
-
-  constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                         LocalSource(Actor::Property::POSITION),
-                                         Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ),
-                                         Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ),
-                                         Source(scrollView, Actor::Property::SIZE ),
-                                         Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ),
-                                         boost::bind( &ScrollPageSpiralEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) );
-
+  constraint.Apply();
+
+  constraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, info, &ScrollPageSpiralEffectInfo::PositionConstraint );
+  constraint.AddSource( LocalSource(Actor::Property::POSITION) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+  constraint.AddSource( Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+  constraint.AddSource( Source(scrollView, Actor::Property::SIZE ) );
+  constraint.AddSource( Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ) );
   constraint.SetRemoveAction( Constraint::Discard );
-  child.ApplyConstraint( constraint );
+  constraint.Apply();
 }
 
 } // unnamed namespace
index c8c669b..573b792 100644 (file)
@@ -89,19 +89,14 @@ struct ScrollViewWobbleEffectConstraint
   }
 
   /**
-   * @param[out] current The new wobble value
-   * @param[in] propertyTime The current time since the wobble effect started
-   * @param[in] propertyPosition The scroll-position
-   * @param[in] propertyOffset The scroll-overshoot
+   * @param[in,out] direction The new wobble value
+   * @param[in] inputs Contains:
+   *                    The current time since the wobble effect started
+   *                    The scroll-position
+   *                    The scroll-overshoot x & y
    */
-  Vector3 operator()(const Vector3& current,
-                    const PropertyInput& propertyTime,
-                    const PropertyInput& propertyPosition,
-                    const PropertyInput& propertyOffsetX,
-                    const PropertyInput& propertyOffsetY)
+  void operator()( Vector3& direction, const PropertyInputContainer& inputs )
   {
-    Vector3 dir;
-
     if(mStabilized)
     {
       // check if animation cycle id has changed (if so then this spells
@@ -114,9 +109,9 @@ struct ScrollViewWobbleEffectConstraint
     else
     {
       // not stable (i.e. wobbling)
-      Vector3 offset(propertyOffsetX.GetFloat(), propertyOffsetY.GetFloat(), 0.0f);
-      const Vector3& position = propertyPosition.GetVector3() - offset;
-      const float time = propertyTime.GetFloat();
+      Vector3 offset(inputs[2]->GetFloat(), inputs[3]->GetFloat(), 0.0f);
+      const Vector3& position = inputs[1]->GetVector3() - offset;
+      const float time = inputs[0]->GetFloat();
       const float timePassed = time - mTime;
 
       mTime = time;
@@ -159,11 +154,9 @@ struct ScrollViewWobbleEffectConstraint
         }
       }
 
-      dir.x = propertyPosition.GetVector3().x - mChase.x;
-      dir.y = propertyPosition.GetVector3().y - mChase.y;
+      direction.x = position.x - mChase.x;
+      direction.y = position.y - mChase.y;
     } // end else
-
-    return dir;
   }
 
   Vector3 mChase;                                 ///< Chaser position
@@ -240,13 +233,12 @@ void ScrollViewWobbleEffect::AttachActor(Actor actor)
 
   Actor scrollView = GetScrollView();
 
-  Constraint constraint = Constraint::New<Vector3>( propertyEffectOvershoot,
-                                                    Source(scrollView, mPropertyTime),
-                                                    Source(actor, Toolkit::ScrollView::Property::SCROLL_POSITION),
-                                                    Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_X),
-                                                    Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_Y),
-                                                    ScrollViewWobbleEffectConstraint(*this) );
-  actor.ApplyConstraint(constraint);
+  Constraint constraint = Constraint::New<Vector3>( actor, propertyEffectOvershoot, ScrollViewWobbleEffectConstraint(*this) );
+  constraint.AddSource( Source( scrollView, mPropertyTime ) );
+  constraint.AddSource( Source( actor, Toolkit::ScrollView::Property::SCROLL_POSITION ) );
+  constraint.AddSource( Source( actor, Toolkit::ScrollView::Property::OVERSHOOT_X ) );
+  constraint.AddSource( Source( actor, Toolkit::ScrollView::Property::OVERSHOOT_Y ) );
+  constraint.Apply();
 }
 
 void ScrollViewWobbleEffect::DetachActor(Actor actor)
index a1ad3b6..67b5262 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <sstream>
 #include <iomanip>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/object/type-registry.h>
@@ -106,19 +105,6 @@ const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
   "  gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
   "}\n";
 
-// TODO: Add this to dali-core constraints.h
-/**
- * EqualToConstraintMatrix
- *
- * f(current, property) = property
- */
-struct EqualToConstraintMatrix
-{
-  EqualToConstraintMatrix(){}
-
-  Dali::Matrix operator()(const Dali::Matrix& current, const PropertyInput& property) {return property.GetMatrix();}
-};
-
 } // namespace
 
 ShadowView::ShadowView( float downsampleWidthScale, float downsampleHeightScale )
@@ -318,18 +304,15 @@ void ShadowView::ConstrainCamera()
     // Constrain camera to look directly at center of shadow plane. (mPointLight position
     // is under control of application, can't use transform inheritance)
 
-    Constraint cameraOrientationConstraint =
-      Constraint::New<Quaternion> ( Actor::Property::ORIENTATION,
-                                    Source( mShadowPlane, Actor::Property::WORLD_POSITION ),
-                                    Source( mPointLight,  Actor::Property::WORLD_POSITION ),
-                                    Source( mShadowPlane, Actor::Property::WORLD_ORIENTATION ),
-                                    &LookAt );
+    Constraint cameraOrientationConstraint = Constraint::New<Quaternion> ( mCameraActor, Actor::Property::ORIENTATION, &LookAt );
+    cameraOrientationConstraint.AddSource( Source( mShadowPlane, Actor::Property::WORLD_POSITION ) );
+    cameraOrientationConstraint.AddSource( Source( mPointLight,  Actor::Property::WORLD_POSITION ) );
+    cameraOrientationConstraint.AddSource( Source( mShadowPlane, Actor::Property::WORLD_ORIENTATION ) );
+    cameraOrientationConstraint.Apply();
 
-    mCameraActor.ApplyConstraint( cameraOrientationConstraint );
-
-    Constraint pointLightPositionConstraint = Constraint::New<Vector3>( Actor::Property::POSITION, Source( mPointLight, Actor::Property::WORLD_POSITION ), EqualToConstraint() );
-
-    mCameraActor.ApplyConstraint( pointLightPositionConstraint );
+    Constraint pointLightPositionConstraint = Constraint::New<Vector3>( mCameraActor, Actor::Property::POSITION, EqualToConstraint() );
+    pointLightPositionConstraint.AddSource( Source( mPointLight, Actor::Property::WORLD_POSITION ) );
+    pointLightPositionConstraint.Apply();
   }
 }
 
@@ -375,23 +358,29 @@ void ShadowView::SetShaderConstants()
   Property::Index lightCameraProjectionMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME);
   Property::Index lightCameraViewMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME);
 
-  Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraProjectionMatrixPropertyIndex, Source( mCameraActor, CameraActor::Property::PROJECTION_MATRIX ), EqualToConstraintMatrix());
-  Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraViewMatrixPropertyIndex, Source( mCameraActor, CameraActor::Property::VIEW_MATRIX ), EqualToConstraintMatrix());
+  Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowRenderShader, lightCameraProjectionMatrixPropertyIndex, EqualToConstraint() );
+  projectionMatrixConstraint.AddSource( Source( mCameraActor, CameraActor::Property::PROJECTION_MATRIX ) );
 
-  mShadowRenderShader.ApplyConstraint(projectionMatrixConstraint);
-  mShadowRenderShader.ApplyConstraint(viewMatrixConstraint);
+  Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( mShadowRenderShader, lightCameraViewMatrixPropertyIndex, EqualToConstraint() );
+  viewMatrixConstraint.AddSource( Source( mCameraActor, CameraActor::Property::VIEW_MATRIX ) );
+
+  projectionMatrixConstraint.Apply();
+  viewMatrixConstraint.Apply();
 
   // Register a property that the user can use to control the blur in the internal object
   mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT);
-  mBlurFilter.GetHandleForAnimateBlurStrength().ApplyConstraint( Constraint::New<float>( mBlurFilter.GetBlurStrengthPropertyIndex() ,
-                                                                           Source( self, mBlurStrengthPropertyIndex),
-                                                                           EqualToConstraint()) );
+
+  Constraint blurStrengthConstraint = Constraint::New<float>( mBlurFilter.GetHandleForAnimateBlurStrength(), mBlurFilter.GetBlurStrengthPropertyIndex(), EqualToConstraint() );
+  blurStrengthConstraint.AddSource( Source( self, mBlurStrengthPropertyIndex) );
+  blurStrengthConstraint.Apply();
 
   //  Register a property that the user can use to control the color of the shadow.
   Property::Index index = mShadowRenderShader.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
   mShadowColorPropertyIndex = self.RegisterProperty(SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor);
 
-  mShadowRenderShader.ApplyConstraint(Constraint::New<Dali::Vector4>( index, Source( self, mShadowColorPropertyIndex ), EqualToConstraint()) );
+  Constraint shadowRenderShaderConstraint = Constraint::New<Dali::Vector4>( mShadowRenderShader, index, EqualToConstraint() );
+  shadowRenderShaderConstraint.AddSource( Source( self, mShadowColorPropertyIndex ) );
+  shadowRenderShaderConstraint.Apply();
 }
 
 } // namespace Internal
index 5544761..384e291 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <cmath>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/object/type-registry.h>
@@ -54,20 +53,20 @@ struct ActorOpacityConstraint
     mRange = Vector2( index*rangeLength, (index+1.f)*rangeLength );
   }
 
-  float operator()( float current, const PropertyInput& blurProperty )
+  void operator()( float& current, const PropertyInputContainer& inputs )
   {
-    float blurStrength = blurProperty.GetFloat();
+    float blurStrength = inputs[0]->GetFloat();
     if(blurStrength <= mRange.x)
     {
-      return 1.f;
+      current = 1.f;
     }
     else if(blurStrength > mRange.y)
     {
-      return 0.f;
+      current = 0.f;
     }
     else
     {
-      return (mRange.y - blurStrength)/(mRange.y-mRange.x);
+      current = ( mRange.y - blurStrength) / ( mRange.y - mRange.x );
     }
   }
 
@@ -152,7 +151,9 @@ void SuperBlurView::OnInitialize()
 
   for(unsigned int i=0; i < mBlurLevels; i++)
   {
-    mImageActors[i].ApplyConstraint( Constraint::New<float>( Actor::Property::COLOR_ALPHA, ParentSource( mBlurStrengthPropertyIndex ), ActorOpacityConstraint(mBlurLevels, i) ) );
+    Constraint constraint = Constraint::New<float>( mImageActors[i], Actor::Property::COLOR_ALPHA, ActorOpacityConstraint(mBlurLevels, i) );
+    constraint.AddSource( ParentSource( mBlurStrengthPropertyIndex ) );
+    constraint.Apply();
   }
 
   Self().SetSize(Stage::GetCurrent().GetSize());
index ead7e40..732bbf9 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL HEADERS
 #include <sstream>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/common/stage.h>
 
@@ -54,79 +53,70 @@ const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
 // when the vanishing point is very far away(pageHeight*THRESHOLD), make it infinitely, in this case, the page bent horizontally
 const float THRESHOLD(20.0);
 
-struct CommonParametersConstraint
+void CommonParametersConstraint( Matrix& current, const PropertyInputContainer& inputs )
 {
-  Matrix operator()( const Matrix& current,
-                     const PropertyInput& originalCenterProperty,
-                     const PropertyInput& currentCenterProperty,
-                     const PropertyInput& pageSizeProperty)
+  const Vector2& originalCenter = inputs[0]->GetVector2();
+  Vector2 currentCenter = inputs[1]->GetVector2();
+  const Vector2& pageSize = inputs[2]->GetVector2();
+
+  // calculate the curve direction and the vanishing point
+  // here, the vanishing point is the intersection of spine with the line passing through original center and vertical to curve direction
+  Vector2 curveDirection( currentCenter - originalCenter );
+  curveDirection.Normalize();
+  if( fabs(curveDirection.y) < 0.01f) // eliminate the possibility of division by zero in the next step
   {
-    const Vector2& originalCenter = originalCenterProperty.GetVector2();
-    Vector2 currentCenter = currentCenterProperty.GetVector2();
-    const Vector2& pageSize = pageSizeProperty.GetVector2();
-
-    // calculate the curve direction and the vanishing point
-    // here, the vanishing point is the intersection of spine with the line passing through original center and vertical to curve direction
-    Vector2 curveDirection( currentCenter - originalCenter );
-    curveDirection.Normalize();
-    if( fabs(curveDirection.y) < 0.01f) // eliminate the possibility of division by zero in the next step
-    {
-      curveDirection.y = 0.01f;
-    }
-    float vanishingPointY = originalCenter.y + curveDirection.x * originalCenter.x / curveDirection.y;
-
-    float curveEndY, cosTheta ,sinTheta ,translateX, translateY;
-    // when the vanishing point is very far away, make it infinitely, in this case, the page bent horizontally
-    if( fabs(vanishingPointY-pageSize.y*0.5f) >= pageSize.y*THRESHOLD )
-    {
-      curveDirection = Vector2(-1.f,0.f);
-      currentCenter.y = originalCenter.y;
-
-      curveEndY = originalCenter.y;
-      cosTheta = 1.f;
-      sinTheta = 0.f;
-      translateX = currentCenter.x - originalCenter.x;
-      translateY = vanishingPointY;
-    }
-    else
-    {
-      curveEndY = currentCenter.y - curveDirection.y * (currentCenter.x/curveDirection.x) ;
-      Vector2 v1( currentCenter.x, currentCenter.y - vanishingPointY );
-      v1.Normalize();
-      Vector2 v2( originalCenter.x, originalCenter.y - vanishingPointY );
-      v2.Normalize();
-      cosTheta = v1.x*v2.x + v1.y*v2.y;
-      sinTheta = ( vanishingPointY > pageSize.y*0.5f ) ? sqrt(1.0-cosTheta*cosTheta) : -sqrt(1.0-cosTheta*cosTheta);
-      translateX = currentCenter.x - cosTheta*originalCenter.x - sinTheta*( originalCenter.y-vanishingPointY );
-      translateY = currentCenter.y + sinTheta*originalCenter.x - cosTheta*( originalCenter.y-vanishingPointY );
-    }
+    curveDirection.y = 0.01f;
+  }
+  float vanishingPointY = originalCenter.y + curveDirection.x * originalCenter.x / curveDirection.y;
 
-    float originalLength = fabs(originalCenter.x/curveDirection.x);
-    float currentLength = fabs(currentCenter.x/curveDirection.x);
-    float curveHeight = 0.45f*sqrt(originalLength*originalLength - currentLength*currentLength);
-
-    Matrix commonParameters( false );
-    float* parameterArray = commonParameters.AsFloat();
-    parameterArray[0] = cosTheta;
-    parameterArray[1] = -sinTheta;
-    parameterArray[2] = originalCenter.x;
-    parameterArray[3] = originalCenter.y;
-    parameterArray[4] = sinTheta;
-    parameterArray[5] = cosTheta;
-    parameterArray[6] = currentCenter.x;
-    parameterArray[7] = currentCenter.y;
-    parameterArray[8] = translateX;
-    parameterArray[9] = translateY;
-    parameterArray[10] = vanishingPointY;
-    parameterArray[11] = curveEndY;
-    parameterArray[12] = curveDirection.x;
-    parameterArray[13] = curveDirection.y;
-    parameterArray[14] = curveHeight;
-    parameterArray[15] = currentLength;
-
-    return commonParameters;
+  float curveEndY, cosTheta ,sinTheta ,translateX, translateY;
+  // when the vanishing point is very far away, make it infinitely, in this case, the page bent horizontally
+  if( fabs(vanishingPointY-pageSize.y*0.5f) >= pageSize.y*THRESHOLD )
+  {
+    curveDirection = Vector2(-1.f,0.f);
+    currentCenter.y = originalCenter.y;
+
+    curveEndY = originalCenter.y;
+    cosTheta = 1.f;
+    sinTheta = 0.f;
+    translateX = currentCenter.x - originalCenter.x;
+    translateY = vanishingPointY;
+  }
+  else
+  {
+    curveEndY = currentCenter.y - curveDirection.y * (currentCenter.x/curveDirection.x) ;
+    Vector2 v1( currentCenter.x, currentCenter.y - vanishingPointY );
+    v1.Normalize();
+    Vector2 v2( originalCenter.x, originalCenter.y - vanishingPointY );
+    v2.Normalize();
+    cosTheta = v1.x*v2.x + v1.y*v2.y;
+    sinTheta = ( vanishingPointY > pageSize.y*0.5f ) ? sqrt(1.0-cosTheta*cosTheta) : -sqrt(1.0-cosTheta*cosTheta);
+    translateX = currentCenter.x - cosTheta*originalCenter.x - sinTheta*( originalCenter.y-vanishingPointY );
+    translateY = currentCenter.y + sinTheta*originalCenter.x - cosTheta*( originalCenter.y-vanishingPointY );
   }
-};
+
+  float originalLength = fabs(originalCenter.x/curveDirection.x);
+  float currentLength = fabs(currentCenter.x/curveDirection.x);
+  float curveHeight = 0.45f*sqrt(originalLength*originalLength - currentLength*currentLength);
+
+  float* parameterArray = current.AsFloat();
+  parameterArray[0] = cosTheta;
+  parameterArray[1] = -sinTheta;
+  parameterArray[2] = originalCenter.x;
+  parameterArray[3] = originalCenter.y;
+  parameterArray[4] = sinTheta;
+  parameterArray[5] = cosTheta;
+  parameterArray[6] = currentCenter.x;
+  parameterArray[7] = currentCenter.y;
+  parameterArray[8] = translateX;
+  parameterArray[9] = translateY;
+  parameterArray[10] = vanishingPointY;
+  parameterArray[11] = curveEndY;
+  parameterArray[12] = curveDirection.x;
+  parameterArray[13] = curveDirection.y;
+  parameterArray[14] = curveHeight;
+  parameterArray[15] = currentLength;
+}
 
 }//namespace
 
@@ -401,12 +391,8 @@ Toolkit::PageTurnEffect PageTurnEffect::CreateShaderEffect( bool enableBlending
 
   shaderImpl->mOriginalCenterPropertyIndex = handle.RegisterProperty( ORIGINAL_CENTER_PROPERTY_NAME, Vector2( defaultPageSize[0], defaultPageSize[1]*0.5f ) );
   shaderImpl->mCurrentCenterPropertyIndex = handle.RegisterProperty( CURRENT_CENTER_PROPERTY_NAME, Vector2( defaultPageSize[0], defaultPageSize[1]*0.5f ) );
-  shaderImpl->mInternalConstraint = Constraint::New<Matrix>( handle.GetPropertyIndex( "uCommonParameters" ),
-                                                        LocalSource( shaderImpl->mOriginalCenterPropertyIndex ),
-                                                        LocalSource( shaderImpl->mCurrentCenterPropertyIndex ),
-                                                        LocalSource( handle.GetPropertyIndex( PAGE_SIZE_PROPERTY_NAME ) ),
-                                                        CommonParametersConstraint() );
-  handle.ApplyConstraint( shaderImpl->mInternalConstraint );
+
+  shaderImpl->ApplyInternalConstraint();
 
   // setting isTurningBack to -1.0f here means turning page forward
   handle.SetUniform( IS_TURNING_BACK_PROPERTY_NAME, -1.0f );
@@ -447,7 +433,11 @@ void PageTurnEffect::SetSpineShadowParameter(const Vector2& spineShadowParameter
 
 void PageTurnEffect::ApplyInternalConstraint()
 {
-  mShaderEffect.ApplyConstraint( mInternalConstraint );
+  Constraint constraint = Constraint::New<Matrix>( mShaderEffect, mShaderEffect.GetPropertyIndex( "uCommonParameters" ), CommonParametersConstraint );
+  constraint.AddSource( LocalSource( mOriginalCenterPropertyIndex ) );
+  constraint.AddSource( LocalSource( mCurrentCenterPropertyIndex ) );
+  constraint.AddSource( LocalSource( mShaderEffect.GetPropertyIndex( PAGE_SIZE_PROPERTY_NAME ) ) );
+  constraint.Apply();
 }
 
 const std::string& PageTurnEffect::GetPageSizePropertyName() const
index 1e49e33..b75af2e 100644 (file)
@@ -114,7 +114,6 @@ private:
 
   Property::Index mOriginalCenterPropertyIndex;
   Property::Index mCurrentCenterPropertyIndex;
-  Constraint mInternalConstraint;
 
 private:
   //undefined copy constructor.
index 39fa68a..4cea531 100644 (file)
@@ -22,7 +22,6 @@
 #include <stack>
 #include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/actors/mesh-actor.h>
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/geometry/mesh.h>
@@ -140,10 +139,11 @@ void SetupBackgroundActor( Actor actor, Property::Index constrainingIndex, const
   actor.SetZ( BACKGROUND_ACTOR_Z_POSITION );
   actor.SetRelayoutEnabled( false );
 
-  Constraint constraint = Constraint::New<Vector3>( constrainingIndex,
-                                                    ParentSource( Actor::Property::SIZE ),
+  Constraint constraint = Constraint::New<Vector3>( actor,
+                                                    constrainingIndex,
                                                     EqualToConstraint() );
-  actor.ApplyConstraint( constraint );
+  constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+  constraint.Apply();
 }
 
 } // unnamed namespace
index 54809c3..918b9bb 100644 (file)
@@ -19,7 +19,7 @@
 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/animation.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/time-period.h>
 
 namespace
 {
 
-  // Functors which wrap constraint functions with stored item IDs
-  struct WrappedQuaternionConstraint
+// Lerps between current and target using the progress
+template< typename Type >
+void Lerp( Type& current, const Type& target, float progress )
+{
+  current += ((target - current) * progress);
+}
+
+// Functors which wrap constraint functions with stored item IDs
+struct WrappedQuaternionConstraint
+{
+  WrappedQuaternionConstraint( Dali::Toolkit::ItemLayout::QuaternionFunction wrapMe, unsigned int itemId )
+  :mWrapMe(wrapMe),
+   mItemId(itemId)
   {
-    WrappedQuaternionConstraint(Dali::Toolkit::ItemLayout::QuaternionFunction wrapMe, unsigned int itemId)
-    :mWrapMe(wrapMe),
-     mItemId(itemId)
-    {
-    }
+  }
 
-    Dali::Quaternion operator()(const Dali::Quaternion& current, const Dali::PropertyInput& layoutPosition, const Dali::PropertyInput& scrollSpeed, const Dali::PropertyInput& layoutSize)
-    {
-      float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
+  void operator()( Dali::Quaternion& current, const Dali::PropertyInputContainer& inputs )
+  {
+    float offsetLayoutPosition = inputs[0]->GetFloat() + static_cast<float>(mItemId);
+    float weight = inputs[3]->GetFloat();
 
-      return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
-    }
+    current = Dali::Quaternion::Slerp( current, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
+  }
 
-    Dali::Toolkit::ItemLayout::QuaternionFunction mWrapMe;
-    unsigned int mItemId;
-  };
+  Dali::Toolkit::ItemLayout::QuaternionFunction mWrapMe;
+  unsigned int mItemId;
+};
 
-  struct WrappedVector3Constraint
+struct WrappedVector3Constraint
+{
+  WrappedVector3Constraint( Dali::Toolkit::ItemLayout::Vector3Function wrapMe, unsigned int itemId )
+  : mWrapMe(wrapMe),
+    mItemId(itemId)
   {
-    WrappedVector3Constraint(Dali::Toolkit::ItemLayout::Vector3Function wrapMe, unsigned int itemId)
-    : mWrapMe(wrapMe),
-      mItemId(itemId)
-    {
-    }
+  }
 
-    Dali::Vector3 operator()(const Dali::Vector3& current, const Dali::PropertyInput& layoutPosition, const Dali::PropertyInput& scrollSpeed, const Dali::PropertyInput& layoutSize)
-    {
-      float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
+  void operator()( Dali::Vector3& current, const Dali::PropertyInputContainer& inputs )
+  {
+    float offsetLayoutPosition = inputs[0]->GetFloat() + static_cast<float>(mItemId);
+    float weight = inputs[3]->GetFloat();
 
-      return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
-    }
+    Lerp( current, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
+  }
 
-    Dali::Toolkit::ItemLayout::Vector3Function mWrapMe;
-    unsigned int mItemId;
-  };
+  Dali::Toolkit::ItemLayout::Vector3Function mWrapMe;
+  unsigned int mItemId;
+};
 
-  struct WrappedVector4Constraint
+struct WrappedVector4Constraint
+{
+  WrappedVector4Constraint( Dali::Toolkit::ItemLayout::Vector4Function wrapMe, unsigned int itemId )
+  : mWrapMe(wrapMe),
+    mItemId(itemId)
   {
-    WrappedVector4Constraint(Dali::Toolkit::ItemLayout::Vector4Function wrapMe, unsigned int itemId)
-    : mWrapMe(wrapMe),
-      mItemId(itemId)
-    {
-    }
+  }
 
-    Dali::Vector4 operator()(const Dali::Vector4& current, const Dali::PropertyInput& layoutPosition, const Dali::PropertyInput& scrollSpeed, const Dali::PropertyInput& layoutSize)
-    {
-      float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
+  void operator()( Dali::Vector4& current, const Dali::PropertyInputContainer& inputs )
+  {
+    float offsetLayoutPosition = inputs[0]->GetFloat() + static_cast<float>(mItemId);
+    float weight = inputs[3]->GetFloat();
 
-      return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
-    }
+    Lerp( current, mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() ), weight );
+  }
 
-    Dali::Toolkit::ItemLayout::Vector4Function mWrapMe;
-    unsigned int mItemId;
-  };
+  Dali::Toolkit::ItemLayout::Vector4Function mWrapMe;
+  unsigned int mItemId;
+};
 
-  struct WrappedBoolConstraint
+struct WrappedBoolConstraint
+{
+  WrappedBoolConstraint( Dali::Toolkit::ItemLayout::BoolFunction wrapMe, unsigned int itemId )
+  : mWrapMe(wrapMe),
+    mItemId(itemId)
   {
-    WrappedBoolConstraint(Dali::Toolkit::ItemLayout::BoolFunction wrapMe, unsigned int itemId)
-    : mWrapMe(wrapMe),
-      mItemId(itemId)
-    {
-    }
+  }
 
-    bool operator()(const bool& current, const Dali::PropertyInput& layoutPosition, const Dali::PropertyInput& scrollSpeed, const Dali::PropertyInput& layoutSize)
-    {
-      float offsetLayoutPosition = layoutPosition.GetFloat() + static_cast<float>(mItemId);
+  void operator()( bool& current, const Dali::PropertyInputContainer& inputs )
+  {
+    float weight = inputs[3]->GetFloat();
 
-      return mWrapMe(current, offsetLayoutPosition, scrollSpeed.GetFloat(), layoutSize.GetVector3());
+    if ( weight >= 1.0f )
+    {
+      float offsetLayoutPosition = inputs[0]->GetFloat() + static_cast<float>(mItemId);
+      current = mWrapMe( current, offsetLayoutPosition, inputs[1]->GetFloat(), inputs[2]->GetVector3() );
     }
+  }
 
-    Dali::Toolkit::ItemLayout::BoolFunction mWrapMe;
-    unsigned int mItemId;
-  };
+  Dali::Toolkit::ItemLayout::BoolFunction mWrapMe;
+  unsigned int mItemId;
+};
 
 }  //Unnamed namespace
 
@@ -115,8 +129,9 @@ namespace Toolkit
 {
 
 ItemLayout::ItemLayout()
-: mOrientation(ControlOrientation::Up),
-  mAlphaFunction(Dali::Constraint::DEFAULT_ALPHA_FUNCTION)
+: mOrientation( ControlOrientation::Up ),
+  mAlphaFunction( AlphaFunctions::Linear ),
+  mWeightObject()
 {
 }
 
@@ -196,18 +211,22 @@ void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float d
     Property::Index scrollSpeedProperty = itemView.GetPropertyIndex("item-view-scroll-speed");
     Property::Index scrollPositionProperty = scrollPositionObject.GetPropertyIndex("scroll-position");
 
+    // We want to animate the layout in so use a weight object to do this
+    if ( !mWeightObject )
+    {
+      mWeightObject = WeightObject::New();
+    }
+
     ItemLayout::Vector3Function positionConstraint;
     if (GetPositionConstraint(itemId, positionConstraint))
     {
       WrappedVector3Constraint wrapped(positionConstraint, itemId);
-      Constraint constraint = Constraint::New<Vector3>( Actor::Property::POSITION,
-                                                        Source( scrollPositionObject, scrollPositionProperty ),
-                                                        ParentSource( scrollSpeedProperty ),
-                                                        ParentSource( Actor::Property::SIZE ),
-                                                        wrapped );
-      constraint.SetApplyTime(durationSeconds);
-      constraint.SetAlphaFunction(mAlphaFunction);
-      actor.ApplyConstraint(constraint);
+      Constraint constraint = Constraint::New<Vector3>( actor, Actor::Property::POSITION, wrapped );
+      constraint.AddSource( Source( scrollPositionObject, scrollPositionProperty ) );
+      constraint.AddSource( ParentSource( scrollSpeedProperty ) );
+      constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+      constraint.AddSource( Source( mWeightObject, WeightObject::WEIGHT ) );
+      constraint.Apply();
     }
 
     ItemLayout::QuaternionFunction rotationConstraint;
@@ -215,15 +234,12 @@ void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float d
     {
       WrappedQuaternionConstraint wrapped(rotationConstraint, itemId);
 
-      Constraint constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
-                                                           Source( scrollPositionObject, scrollPositionProperty ),
-                                                           ParentSource( scrollSpeedProperty ),
-                                                           ParentSource( Actor::Property::SIZE ),
-                                                           wrapped );
-      constraint.SetApplyTime(durationSeconds);
-      constraint.SetAlphaFunction(mAlphaFunction);
-
-      actor.ApplyConstraint(constraint);
+      Constraint constraint = Constraint::New<Quaternion>( actor, Actor::Property::ORIENTATION, wrapped );
+      constraint.AddSource( Source( scrollPositionObject, scrollPositionProperty ) );
+      constraint.AddSource( ParentSource( scrollSpeedProperty ) );
+      constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+      constraint.AddSource( Source( mWeightObject, WeightObject::WEIGHT ) );
+      constraint.Apply();
     }
 
     ItemLayout::Vector3Function scaleConstraint;
@@ -231,15 +247,12 @@ void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float d
     {
       WrappedVector3Constraint wrapped(scaleConstraint, itemId);
 
-      Constraint constraint = Constraint::New<Vector3>( Actor::Property::SCALE,
-                                                        Source( scrollPositionObject, scrollPositionProperty ),
-                                                        ParentSource( scrollSpeedProperty ),
-                                                        ParentSource( Actor::Property::SIZE ),
-                                                        wrapped );
-      constraint.SetApplyTime(durationSeconds);
-      constraint.SetAlphaFunction(mAlphaFunction);
-
-      actor.ApplyConstraint(constraint);
+      Constraint constraint = Constraint::New<Vector3>( actor, Actor::Property::SCALE, wrapped );
+      constraint.AddSource( Source( scrollPositionObject, scrollPositionProperty ) );
+      constraint.AddSource( ParentSource( scrollSpeedProperty ) );
+      constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+      constraint.AddSource( Source( mWeightObject, WeightObject::WEIGHT ) );
+      constraint.Apply();
     }
 
     ItemLayout::Vector4Function colorConstraint;
@@ -247,17 +260,13 @@ void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float d
     {
       WrappedVector4Constraint wrapped(colorConstraint, itemId);
 
-      Constraint constraint = Constraint::New<Vector4>( Actor::Property::COLOR,
-                                                        Source( scrollPositionObject, scrollPositionProperty ),
-                                                        ParentSource( scrollSpeedProperty ),
-                                                        ParentSource( Actor::Property::SIZE ),
-                                                        wrapped );
-
-      constraint.SetApplyTime(durationSeconds);
-      constraint.SetAlphaFunction(mAlphaFunction);
+      Constraint constraint = Constraint::New<Vector4>( actor, Actor::Property::COLOR, wrapped );
+      constraint.AddSource( Source( scrollPositionObject, scrollPositionProperty ) );
+      constraint.AddSource( ParentSource( scrollSpeedProperty ) );
+      constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+      constraint.AddSource( Source( mWeightObject, WeightObject::WEIGHT ) );
       constraint.SetRemoveAction(Dali::Constraint::Discard);
-
-      actor.ApplyConstraint(constraint);
+      constraint.Apply();
     }
 
     ItemLayout::BoolFunction visibilityConstraint;
@@ -265,20 +274,25 @@ void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float d
     {
       WrappedBoolConstraint wrapped(visibilityConstraint, itemId);
 
-      Constraint constraint = Constraint::New<bool>( Actor::Property::VISIBLE,
-                                                     Source( scrollPositionObject, scrollPositionProperty ),
-                                                     ParentSource( scrollSpeedProperty ),
-                                                     ParentSource( Actor::Property::SIZE ),
-                                                     wrapped );
-
-      constraint.SetApplyTime(durationSeconds);
-      constraint.SetAlphaFunction(mAlphaFunction);
+      Constraint constraint = Constraint::New<bool>( actor, Actor::Property::VISIBLE, wrapped );
+      constraint.AddSource( Source( scrollPositionObject, scrollPositionProperty ) );
+      constraint.AddSource( ParentSource( scrollSpeedProperty ) );
+      constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
+      constraint.AddSource( Source( mWeightObject, WeightObject::WEIGHT ) );
 
       // Release visibility constraints the same time as the color constraint
       constraint.SetRemoveAction(Dali::Constraint::Discard);
 
-      actor.ApplyConstraint(constraint);
+      constraint.Apply();
     }
+
+    KeyFrames keyFrames = KeyFrames::New();
+    keyFrames.Add( 0.0f, 0.0f );
+    keyFrames.Add( 1.0f, 1.0f );
+
+    Animation applyAnimation = Dali::Animation::New( durationSeconds );
+    applyAnimation.AnimateBetween( Property( mWeightObject, WeightObject::WEIGHT ), keyFrames, mAlphaFunction, durationSeconds );
+    applyAnimation.Play();
   }
 }
 
index 92659ed..d41a704 100644 (file)
@@ -412,7 +412,8 @@ protected:
 protected:
 
   ControlOrientation::Type mOrientation;   ///< the orientation of the layout.
-  AlphaFunction            mAlphaFunction; ///<Alpha function to be applied when removing/adding constraints
+  AlphaFunction            mAlphaFunction; ///< Alpha function to be applied when removing/adding constraints
+  Handle                   mWeightObject;  ///< Weight object gets created to apply the constraints over a certain time
 };
 
 } // namespace Toolkit
index 48b21f1..995bfc2 100644 (file)
@@ -30,31 +30,23 @@ namespace Dali
 namespace Toolkit
 {
 
-Vector3 MoveActorConstraint(const Vector3&    current,
-                            const PropertyInput& scrollPositionProperty)
+void MoveActorConstraint( Vector3& current, const PropertyInputContainer& inputs )
 {
-  return current + scrollPositionProperty.GetVector3();
+  current += inputs[0]->GetVector3();
 }
 
-Vector3 WrapActorConstraint(const Vector3&    current,
-                            const PropertyInput& actorScaleProperty,
-                            const PropertyInput& actorAnchorPointProperty,
-                            const PropertyInput& actorSizeProperty,
-                            const PropertyInput& scrollPositionMin,
-                            const PropertyInput& scrollPositionMax,
-                            const PropertyInput& scrollWrap)
+void WrapActorConstraint( Vector3& position, const PropertyInputContainer& inputs )
 {
-  Vector3 position = current;
-  bool wrap = scrollWrap.GetBoolean();
+  bool wrap = inputs[5]->GetBoolean();
 
   if(wrap)
   {
-    const Vector3& min = scrollPositionMin.GetVector3();
-    const Vector3& max = scrollPositionMax.GetVector3();
+    const Vector3& min = inputs[3]->GetVector3();
+    const Vector3& max = inputs[4]->GetVector3();
 
-    const Vector3& anchor = actorAnchorPointProperty.GetVector3();
-    const Vector3 scale = actorScaleProperty.GetVector3();
-    const Vector3 size = actorSizeProperty.GetVector3();
+    const Vector3& anchor = inputs[1]->GetVector3();
+    const Vector3 scale = inputs[0]->GetVector3();
+    const Vector3 size = inputs[2]->GetVector3();
 
     if(fabsf(min.x - max.x) > Math::MACHINE_EPSILON_1)
     {
@@ -70,8 +62,6 @@ Vector3 WrapActorConstraint(const Vector3&    current,
       position.y = WrapInDomain(position.y + offsetY, min.y, max.y) - offsetY;
     }
   }
-
-  return position;
 }
 
 } // namespace Toolkit
index 9faba35..dcb8e34 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
+#include <dali/public-api/animation/constraint.h>
 
 namespace Dali
 {
@@ -44,21 +43,14 @@ namespace Toolkit
  *
  * Moves an Actor in accordance to scroll position.
  */
-DALI_IMPORT_API Vector3 MoveActorConstraint(const Vector3&    current,
-                                           const PropertyInput& scrollPositionProperty);
+DALI_IMPORT_API void MoveActorConstraint( Vector3& current, const PropertyInputContainer& inputs );
 
 /**
  * Wrap Actor constraint.
  *
  * Wraps an Actors position in accordance to min/max bounds of domain.
  */
-DALI_IMPORT_API Vector3 WrapActorConstraint(const Vector3&    current,
-                                            const PropertyInput& actorScaleProperty,
-                                            const PropertyInput& actorAnchorPointProperty,
-                                            const PropertyInput& actorSizeProperty,
-                                            const PropertyInput& scrollPositionMin,
-                                            const PropertyInput& scrollPositionMax,
-                                            const PropertyInput& scrollWrap);
+DALI_IMPORT_API void WrapActorConstraint( Vector3& position, const PropertyInputContainer& inputs );
 
 } // namespace Toolkit
 
index 5138266..99bcc31 100644 (file)
@@ -69,7 +69,6 @@ class View;
  * Layer contentLayer = Layer::New();
  * contentLayer.SetAnchorPoint( AnchorPoint::CENTER );
  * contentLayer.SetParentOrigin( ParentOrigin::CENTER );
- * contentLayer.ApplyConstraint( ParentConstraint::Size::New( ParentSize() ) );
  * view.AddContentLayer( contentLayer );
  * \endcode
  *
index de80751..9c281b4 100644 (file)
@@ -19,7 +19,6 @@
 #include <dali-toolkit/public-api/shader-effects/motion-blur-effect.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 
@@ -88,12 +87,11 @@ MotionBlurEffect MotionBlurEffect::Apply( RenderableActor renderable )
 
   Dali::Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME );
 
-  Constraint constraint = Constraint::New<Matrix>( uModelProperty,
-                                                   Source( renderable, Actor::Property::WORLD_MATRIX ),
-                                                   EqualToConstraint() );
+  Constraint constraint = Constraint::New<Matrix>( newEffect, uModelProperty, EqualToConstraint() );
+  constraint.AddSource( Source( renderable, Actor::Property::WORLD_MATRIX ) );
 
   // and set up constraint.
-  newEffect.ApplyConstraint( constraint );
+  constraint.Apply();
   return newEffect;
 }
 
index 22383f0..8817171 100644 (file)
@@ -19,7 +19,6 @@
 #include <dali-toolkit/public-api/shader-effects/motion-stretch-effect.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/animation/constraints.h>
 
@@ -102,12 +101,11 @@ MotionStretchEffect MotionStretchEffect::Apply( RenderableActor renderable )
 
   Dali::Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );
 
-  Constraint constraint = Constraint::New<Matrix>( uModelProperty,
-                                                   Source( renderable, Actor::Property::WORLD_MATRIX ),
-                                                   EqualToConstraint() );
+  Constraint constraint = Constraint::New<Matrix>( newEffect, uModelProperty, EqualToConstraint() );
+  constraint.AddSource( Source( renderable, Actor::Property::WORLD_MATRIX ) );
 
   // and set up constraint.
-  newEffect.ApplyConstraint(constraint);
+  constraint.Apply();
   return newEffect;
 }
 
index 0aef67f..d2b8967 100644 (file)
@@ -19,7 +19,6 @@
 #include <dali-toolkit/public-api/shader-effects/nine-patch-mask-effect.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 #include <dali/public-api/shader-effects/shader-effect.h>
@@ -34,14 +33,17 @@ namespace Toolkit
 namespace NinePatchMaskEffect
 {
 
-struct NinePatchMaskEffectSizeConstraint
+namespace
 {
-  Vector2 operator()( const Vector2& current, const PropertyInput& property )
-  {
-    const Vector3& actorSize = property.GetVector3();
-    return Vector2( actorSize.x, actorSize.y );
-  }
-};
+
+void NinePatchMaskEffectSizeConstraint( Vector2& current, const PropertyInputContainer& inputs )
+{
+  const Vector3& actorSize = inputs[0]->GetVector3();
+  current.x = actorSize.x;
+  current.y = actorSize.y;
+}
+
+} // unnamed namespace
 
 static void DoApply( ImageActor actor, const std::string& maskImage, const Vector2& maskSize, Vector4 maskBorder )
 {
@@ -90,9 +92,10 @@ static void DoApply( ImageActor actor, const std::string& maskImage, const Vecto
   maskEffect.SetEffectImage( ResourceImage::New( maskImage ) );
 
   maskEffect.SetUniform( "uImageSize", Vector2(0,0) /*Constrained to actor size*/ );
-  maskEffect.ApplyConstraint( Constraint::New<Vector2>( maskEffect.GetPropertyIndex("uImageSize"),
-                                                        Source(actor, Actor::Property::SIZE),
-                                                        NinePatchMaskEffectSizeConstraint() ) );
+
+  Constraint constraint = Constraint::New<Vector2>( maskEffect, maskEffect.GetPropertyIndex("uImageSize"), NinePatchMaskEffectSizeConstraint );
+  constraint.AddSource( Source(actor, Actor::Property::SIZE) );
+  constraint.Apply();
 
   maskEffect.SetUniform( "uMaskSize", maskSize );
 
index 9789576..f516973 100644 (file)
@@ -16,7 +16,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/active-constraint.h>
 #include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-input.h>
 
@@ -58,20 +57,14 @@ const float SOFT_BUTTON_RECTANGLE_SIZE_SCALE_DEFAULT = 0.5f;
 } // namespace
 
 /**
- * ReciprocalConstraint
+ * InverseConstraint
  *
  * f(current, property) = 1.0 / property
  */
-struct ReciprocalConstraint
+void InverseConstraint( float& current, const PropertyInputContainer& inputs )
 {
-  ReciprocalConstraint(){}
-
-  float operator()(const float current, const PropertyInput& property)
-  {
-    return 1.0f / property.GetFloat();
-  }
-};
-
+  current = 1.0f / inputs[0]->GetFloat();
+}
 
 ////////////////////////////////////////////////////
 //
@@ -373,8 +366,9 @@ SoftButtonEffect SoftButtonEffect::New(Type type)
     // precalc 1.0 / uInsideCircleSizeScale on CPU to save shader insns, using constraint to tie to the normal property
     Dali::Property::Index insideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME);
     Dali::Property::Index recipInsideCircleSizeScalePropertyIndex = handle.GetPropertyIndex(SOFT_BUTTON_RECIP_INSIDE_SHAPE_SIZE_SCALE_PROPERTY_NAME);
-    Constraint constraint = Constraint::New<float>( recipInsideCircleSizeScalePropertyIndex, LocalSource(insideCircleSizeScalePropertyIndex), ReciprocalConstraint());
-    handle.ApplyConstraint(constraint);
+    Constraint constraint = Constraint::New<float>( handle, recipInsideCircleSizeScalePropertyIndex, InverseConstraint );
+    constraint.AddSource( LocalSource(insideCircleSizeScalePropertyIndex) );
+    constraint.Apply();
   }
 
   return handle;