Share a single weight property between constraints
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / active-constraint-base.cpp
index 5aa63b4..ca99221 100644 (file)
@@ -78,10 +78,12 @@ ActiveConstraintBase::ActiveConstraintBase( EventToUpdate& eventToUpdate, Proper
   mTargetPropertyIndex( targetPropertyIndex ),
   mTargetProxy( NULL ),
   mSceneGraphConstraint( NULL ),
+  mCustomWeight( NULL ),
   mOffstageWeight( Dali::ActiveConstraint::DEFAULT_WEIGHT ),
   mRemoveTime( 0.0f ),
   mAlphaFunction( Dali::Constraint::DEFAULT_ALPHA_FUNCTION ),
   mRemoveAction( Dali::Constraint::DEFAULT_REMOVE_ACTION ),
+  mTag(0),
   mApplyAnimation(),
   mRemoveAnimation()
 {
@@ -102,7 +104,20 @@ ActiveConstraintBase::~ActiveConstraintBase()
   }
 }
 
-void ActiveConstraintBase::FirstApply( ProxyObject& parent, TimePeriod applyTime, ActiveConstraintCallbackType* callback )
+void ActiveConstraintBase::SetCustomWeightObject( ProxyObject& weightObject, Property::Index weightIndex )
+{
+  const SceneGraph::PropertyBase* base = weightObject.GetSceneObjectAnimatableProperty( weightIndex );
+  const SceneGraph::AnimatableProperty<float>* sceneProperty = dynamic_cast< const SceneGraph::AnimatableProperty<float>* >( base );
+
+  if( sceneProperty )
+  {
+    mCustomWeight = sceneProperty;
+
+    OnCustomWeightSet( weightObject );
+  }
+}
+
+void ActiveConstraintBase::FirstApply( ProxyObject& parent, TimePeriod applyTime )
 {
   // Notify derived classes
   OnFirstApply( parent );
@@ -263,6 +278,17 @@ ActiveConstraintBase::RemoveAction ActiveConstraintBase::GetRemoveAction() const
   return mRemoveAction;
 }
 
+void ActiveConstraintBase::SetTag(const unsigned int tag)
+{
+  mTag = tag;
+}
+
+unsigned int ActiveConstraintBase::GetTag() const
+{
+  return mTag;
+}
+
+
 bool ActiveConstraintBase::IsSceneObjectRemovable() const
 {
   return true; // The constraint removed when target SceneGraph::PropertyOwner is destroyed