(UpdateManager) Fire animation notifications ONLY when scene is actually updated 87/24087/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 24 Jun 2014 12:53:25 +0000 (21:53 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 8 Jul 2014 13:15:36 +0000 (14:15 +0100)
[problem]     Timing problem where animation finsihed callbacks are emitted before the scene has
              been updated.
[cause]       We add messages to the event-queue before we've updated the scene. The queues can
              be swapped while we're still updating and the finished callback can be then fired.
              Any attempt to get current values in this callback will be from the previous frame.
[solution]    Delay adding animation-finished messages to the queue till just before update ends.

Change-Id: I3c610e5139e1bfe32873cf3f85474ab7d61ed343
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
dali/internal/update/manager/update-manager.cpp

index 8c2b6c8..a76536f 100644 (file)
@@ -838,12 +838,6 @@ void UpdateManager::Animate( float elapsedSeconds )
     }
   }
 
-  if ( mImpl->animationFinishedDuringUpdate )
-  {
-    // The application should be notified by NotificationManager, in another thread
-    mImpl->notificationManager.QueueMessage( AnimationFinishedMessage( mImpl->animationFinishedNotifier ) );
-  }
-
   PERF_MONITOR_END(PerformanceMonitor::ANIMATE_NODES);
 }
 
@@ -1180,6 +1174,15 @@ unsigned int UpdateManager::Update( float elapsedSeconds, unsigned int lastVSync
   keepUpdating |= KeepUpdating::MONITORING_PERFORMANCE;
 #endif
 
+  // Only queue the message at the end of the update so that animation finished notifications are
+  // not fired off before the scene has actually been updated.
+  // TODO: implement better queueing mechanism from update-to-event thread.
+  if ( mImpl->animationFinishedDuringUpdate )
+  {
+    // The application should be notified by NotificationManager, in another thread
+    mImpl->notificationManager.QueueMessage( AnimationFinishedMessage( mImpl->animationFinishedNotifier ) );
+  }
+
   // The update has finished; swap the double-buffering indices
   mSceneGraphBuffers.Swap();