Change public member variable to private
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / facial-animation-loader.cpp
index dfd9cc2..26afb29 100644 (file)
@@ -130,8 +130,8 @@ AnimationDefinition LoadFacialAnimation(const std::string& url)
   GetFacialAnimationReader().Read(rootObj, facialAnimation);\r
 \r
   AnimationDefinition animationDefinition;\r
-  animationDefinition.mName     = std::string(facialAnimation.mName.data());\r
-  animationDefinition.mDuration = MILLISECONDS_TO_SECONDS * static_cast<float>(facialAnimation.mTime[facialAnimation.mNumberOfFrames - 1u]);\r
+  animationDefinition.SetName(facialAnimation.mName.data());\r
+  animationDefinition.SetDuration(MILLISECONDS_TO_SECONDS * static_cast<float>(facialAnimation.mTime[facialAnimation.mNumberOfFrames - 1u]));\r
 \r
   // Calculate the number of animated properties.\r
   uint32_t numberOfAnimatedProperties = 0u;\r
@@ -139,46 +139,29 @@ AnimationDefinition LoadFacialAnimation(const std::string& url)
   {\r
     numberOfAnimatedProperties += blendShape.mNumberOfMorphTarget;\r
   }\r
-  animationDefinition.mProperties.resize(numberOfAnimatedProperties);\r
+  animationDefinition.ReserveSize(numberOfAnimatedProperties);\r
 \r
-  // Create the key frame instances.\r
-  for(auto& animatedProperty : animationDefinition.mProperties)\r
-  {\r
-    animatedProperty.mKeyFrames = Dali::KeyFrames::New();\r
-  }\r
-\r
-  // Set the property names\r
   uint32_t targets = 0u;\r
   for(const auto& blendShape : facialAnimation.mBlendShapes)\r
   {\r
     for(uint32_t morphTargetIndex = 0u; morphTargetIndex < blendShape.mNumberOfMorphTarget; ++morphTargetIndex)\r
     {\r
-      AnimatedProperty& animatedProperty = animationDefinition.mProperties[targets + morphTargetIndex];\r
-      animatedProperty.mTimePeriod       = Dali::TimePeriod(animationDefinition.mDuration);\r
-\r
+      AnimatedProperty animatedProperty;\r
+      animatedProperty.mTimePeriod = Dali::TimePeriod(animationDefinition.GetDuration());\r
       animatedProperty.mNodeName = blendShape.mNodeName;\r
-\r
       std::stringstream weightPropertyStream;\r
       weightPropertyStream << BlendShapes::WEIGHTS_UNIFORM << "[" << morphTargetIndex << "]";\r
       animatedProperty.mPropertyName = weightPropertyStream.str();\r
-    }\r
-    targets += blendShape.mNumberOfMorphTarget;\r
-  }\r
 \r
-  targets = 0u;\r
-  for(const auto& blendShape : facialAnimation.mBlendShapes)\r
-  {\r
-    for(uint32_t timeIndex = 0u; timeIndex < facialAnimation.mNumberOfFrames; ++timeIndex)\r
-    {\r
-      const float progress = MILLISECONDS_TO_SECONDS * static_cast<float>(facialAnimation.mTime[timeIndex]) / animationDefinition.mDuration;\r
-\r
-      for(uint32_t morphTargetIndex = 0u; morphTargetIndex < blendShape.mNumberOfMorphTarget; ++morphTargetIndex)\r
+      animatedProperty.mKeyFrames = Dali::KeyFrames::New();\r
+      for(uint32_t timeIndex = 0u; timeIndex < facialAnimation.mNumberOfFrames; ++timeIndex)\r
       {\r
-        AnimatedProperty& animatedProperty = animationDefinition.mProperties[targets + morphTargetIndex];\r
-\r
+        const float progress = MILLISECONDS_TO_SECONDS * static_cast<float>(facialAnimation.mTime[timeIndex]) / animationDefinition.GetDuration();\r
         animatedProperty.mKeyFrames.Add(progress, blendShape.mKeys[timeIndex][morphTargetIndex]);\r
       }\r
+      animationDefinition.SetProperty(targets + morphTargetIndex, std::move(animatedProperty));\r
     }\r
+\r
     targets += blendShape.mNumberOfMorphTarget;\r
   }\r
 \r