rive-animation-view: fix animationApply and loading failures printing 05/280605/1
authorMichal Maciola <m.maciola@samsung.com>
Wed, 31 Aug 2022 13:19:57 +0000 (15:19 +0200)
committerMichal Maciola <m.maciola@samsung.com>
Thu, 1 Sep 2022 06:14:24 +0000 (08:14 +0200)
This patch fixes animationApply by passing valid time.
Additionally it adds printing in case of loading problems.

Change-Id: Ie0a7d12bb655c4efc4aa202d662f7eb8c9b14d0e

dali-extension/internal/rive-animation-view/animation-renderer/rive-animation-renderer.cpp

index 44910ce..5ef1f72 100644 (file)
@@ -112,8 +112,19 @@ void RiveAnimationRenderer::LoadRiveFile(const std::string& filename)
     return;
   }
 
+  if(bytes.Size() == 0)
+  {
+    DALI_LOG_ERROR("Failed to load: empty file %s", filename.c_str());
+    return;
+  }
+
   ClearRiveAnimations();
-  mRiveTizenAdapter->loadRiveResource(&bytes[0], bytes.Size());
+  if(!mRiveTizenAdapter->loadRiveResource(&bytes[0], bytes.Size()))
+  {
+    DALI_LOG_ERROR("Failed to load resource file %s", filename.c_str());
+    return;
+  }
+
   mArtboard = mRiveTizenAdapter->getArtboard();
 
   for(unsigned int i = 0; i < mArtboard->animationCount(); i++)
@@ -277,7 +288,7 @@ bool RiveAnimationRenderer::Render(double elapsed)
       }
       else if(animation.elapsed >= 0.0f)
       {
-        mRiveTizenAdapter->animationApply(animation.instance.get(), elapsed);
+        mRiveTizenAdapter->animationApply(animation.instance.get(), animation.elapsed);
       }
     }
   }