Add logs to check the messages processed by the update thread
[platform/core/uifw/dali-core.git] / dali / internal / update / animation / scene-graph-animation.cpp
index 22483bf..1fed088 100644 (file)
@@ -25,6 +25,8 @@
 #include <dali/internal/common/memory-pool-object-allocator.h>
 #include <dali/internal/render/common/performance-monitor.h>
 #include <dali/public-api/math/math-utils.h>
+#include <dali/integration-api/debug.h>
+
 namespace //Unnamed namespace
 {
 //Memory pool used to allocate new animations. Memory used by this pool will be released when shutting down DALi
@@ -151,9 +153,13 @@ void Animation::SetPlayRange( const Vector2& range )
 
 void Animation::Play()
 {
+  DALI_LOG_ERROR("Scene Graph Animation::Play: Before stable_sort\n");
+
   // Sort according to end time with earlier end times coming first, if the end time is the same, then the animators are not moved
   std::stable_sort( mAnimators.Begin(), mAnimators.End(), CompareAnimatorEndTimes );
 
+  DALI_LOG_ERROR("Scene Graph Animation::Play: After stable_sort\n");
+
   mState = Playing;
 
   if ( mSpeedFactor < 0.0f && mElapsedSeconds <= mPlayRange.x*mDurationSeconds )
@@ -161,8 +167,12 @@ void Animation::Play()
     mElapsedSeconds = mPlayRange.y * mDurationSeconds;
   }
 
+  DALI_LOG_ERROR("Scene Graph Animation::Play: Before SetAnimatorsActive\n");
+
   SetAnimatorsActive( true );
 
+  DALI_LOG_ERROR("Scene Graph Animation::Play: After SetAnimatorsActive\n");
+
   mCurrentLoop = 0;
 }
 
@@ -351,16 +361,7 @@ void Animation::Update(BufferIndex bufferIndex, float elapsedSeconds, bool& loop
 
   Vector2 playRangeSeconds = mPlayRange * mDurationSeconds;
 
-  if( 0 == mLoopCount )
-  {
-    // loop forever
-    WrapInPlayRange(mElapsedSeconds, playRangeSeconds);
-
-    UpdateAnimators(bufferIndex, false, false );
-
-    // don't increment mPlayedCount as event loop tracks this to indicate animation finished (end of all loops)
-  }
-  else if( mCurrentLoop < mLoopCount - 1) // '-1' here so last loop iteration uses play once below
+  if( 0 == mLoopCount || mCurrentLoop < mLoopCount - 1) // '-1' here so last loop iteration uses play once below
   {
     // looping
     looped =  (mState == Playing                                                 &&
@@ -373,7 +374,10 @@ void Animation::Update(BufferIndex bufferIndex, float elapsedSeconds, bool& loop
 
     if(looped)
     {
-      ++mCurrentLoop;
+      if( mLoopCount != 0 )
+      {
+        ++mCurrentLoop;
+      }
       mProgressReachedSignalRequired = mProgressMarker > 0.0f;
       // don't increment mPlayedCount until the finished final loop
     }