RiveAnimationView: apply animation data correctly 43/268543/3
authorTaehyub Kim <taehyub.kim@samsung.com>
Fri, 24 Dec 2021 07:39:23 +0000 (16:39 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Mon, 14 Feb 2022 04:21:54 +0000 (13:21 +0900)
Animation data is overwrited by multiple SendAnimationData call
and RiveAnimationView removes the animation data after SetAnimationData.
so Sometiems animation data is not updated.
To prevent this behavior, append animation data when renderer is not updated.

Change-Id: I772a7053d033c2f3276bc411c10c63e960343470

dali-extension/internal/rive-animation-view/rive-animation-task.cpp
dali-extension/internal/rive-animation-view/rive-animation-task.h

index cbaf880..34838b6 100644 (file)
@@ -474,6 +474,14 @@ void RiveAnimationTask::ApplyAnimationData()
     }
   }
 
+  mAnimationData[index].animations.clear();
+  mAnimationData[index].elapsedTimes.clear();
+  mAnimationData[index].fillColors.clear();
+  mAnimationData[index].strokeColors.clear();
+  mAnimationData[index].opacities.clear();
+  mAnimationData[index].scales.clear();
+  mAnimationData[index].rotations.clear();
+  mAnimationData[index].positions.clear();
   mAnimationData[index].resendFlag = 0;
 }
 
index ac798a3..6978513 100644 (file)
@@ -89,22 +89,15 @@ public:
       width           = rhs.width;
       height          = rhs.height;
       playState       = rhs.playState;
-      animations.resize(rhs.animations.size());
-      std::copy(rhs.animations.begin(), rhs.animations.end(), animations.begin());
-      elapsedTimes.resize(rhs.elapsedTimes.size());
-      std::copy(rhs.elapsedTimes.begin(), rhs.elapsedTimes.end(), elapsedTimes.begin());
-      fillColors.resize(rhs.fillColors.size());
-      std::copy(rhs.fillColors.begin(), rhs.fillColors.end(), fillColors.begin());
-      strokeColors.resize(rhs.strokeColors.size());
-      std::copy(rhs.strokeColors.begin(), rhs.strokeColors.end(), strokeColors.begin());
-      opacities.resize(rhs.opacities.size());
-      std::copy(rhs.opacities.begin(), rhs.opacities.end(), opacities.begin());
-      scales.resize(rhs.scales.size());
-      std::copy(rhs.scales.begin(), rhs.scales.end(), scales.begin());
-      rotations.resize(rhs.rotations.size());
-      std::copy(rhs.rotations.begin(), rhs.rotations.end(), rotations.begin());
-      positions.resize(rhs.positions.size());
-      std::copy(rhs.positions.begin(), rhs.positions.end(), positions.begin());
+
+      animations.insert(animations.end(), rhs.animations.begin(), rhs.animations.end());
+      elapsedTimes.insert(elapsedTimes.end(), rhs.elapsedTimes.begin(), rhs.elapsedTimes.end());
+      fillColors.insert(fillColors.end(), rhs.fillColors.begin(), rhs.fillColors.end());
+      strokeColors.insert(strokeColors.end(), rhs.strokeColors.begin(), rhs.strokeColors.end());
+      opacities.insert(opacities.end(), rhs.opacities.begin(), rhs.opacities.end());
+      scales.insert(scales.end(), rhs.scales.begin(), rhs.scales.end());
+      rotations.insert(rotations.end(), rhs.rotations.begin(), rhs.rotations.end());
+      positions.insert(positions.end(), rhs.positions.begin(), rhs.positions.end());
 
       return *this;
     }