[Tizen] Change to use AnimatedProperty instead of name for getActor 42/285542/1
authorseungho baek <sbsh.baek@samsung.com>
Wed, 14 Dec 2022 09:12:23 +0000 (18:12 +0900)
committerseungho baek <sbsh.baek@samsung.com>
Wed, 14 Dec 2022 09:12:23 +0000 (18:12 +0900)
Change-Id: If7d5a3354b8f75525cde3d84fa0b5cdbabe6ea95
Signed-off-by: seungho baek <sbsh.baek@samsung.com>
examples/scene3d-model/scene3d-model-example.cpp
examples/scene3d/scene3d-example.cpp
examples/scene3d/scene3d-extension.h

index 1ae62e4..bf86b18 100644 (file)
@@ -216,6 +216,8 @@ public:
   {
     mWindow = application.GetWindow();
 
+    mWindow.GetRootLayer().SetProperty(Dali::Layer::Property::BEHAVIOR, Dali::Layer::Behavior::LAYER_3D);
+
     // Get a handle to the mWindow
     mWindow.SetBackgroundColor(Color::WHITE);
 
@@ -283,11 +285,16 @@ public:
     mModel.SetImageBasedLightSource(uri_diffuse_texture, uri_specular_texture, 0.6f);
 
     mWindow.Add(mModel);
+
+    mModel.ResourceReadySignal().Connect(this, &Scene3DModelExample::ResourceReadySignal);
+  }
+
+  void ResourceReadySignal(Control control)
+  {
     if(mModel.GetAnimationCount() > 0)
     {
-      Animation animation = (index == 0u) ? mModel.GetAnimation(0u) : mModel.GetAnimation("idleToSquatClip_0");
-      animation.Play();
-      animation.SetLoopCount(0);
+      mModel.GetAnimation(0u).Play();
+      mModel.GetAnimation(0u).SetLoopCount(0);
     }
   }
 
index 2c634c8..fa5ff00 100644 (file)
@@ -269,8 +269,8 @@ Actor LoadScene(std::string sceneName, CameraActor camera, std::vector<Animation
 \r
   if(!animations->empty())\r
   {\r
-    auto getActor = [&root](const std::string& name) {\r
-      return root.FindChildByName(name);\r
+    auto getActor = [&root](const Scene3D::Loader::AnimatedProperty& property) {\r
+      return root.FindChildByName(property.mNodeName);\r
     };\r
 \r
     animation = (*animations)[0].ReAnimate(getActor);\r
index d4cc6ca..7317d32 100644 (file)
@@ -94,8 +94,8 @@ private:
       }\r
 \r
       auto root     = mSceneLoader->mScene;\r
-      auto getActor = [&root](const std::string& name) {\r
-        return root.FindChildByName(name);\r
+      auto getActor = [&root](const Dali::Scene3D::Loader::AnimatedProperty& property) {\r
+        return root.FindChildByName(property.mNodeName);\r
       };\r
 \r
       if(mSceneLoader->mSceneAnimations.size() > animationIndex)\r