Merge "Fix the SVACE error for facial animation loader" into devel/master
authorDavid Steele <david.steele@samsung.com>
Thu, 7 Jul 2022 09:19:49 +0000 (09:19 +0000)
committerGerrit Code Review <gerrit@review>
Thu, 7 Jul 2022 09:19:49 +0000 (09:19 +0000)
dali-scene-loader/public-api/facial-animation-loader.cpp

index 3209467..6c92d6a 100644 (file)
@@ -18,6 +18,9 @@
 // FILE HEADER\r
 #include <dali-scene-loader/public-api/facial-animation-loader.h>\r
 \r
+// EXTERNAL INCLUDES\r
+#include <sstream>\r
+\r
 // INTERNAL INCLUDES\r
 #include <dali-scene-loader/internal/json-reader.h>\r
 #include <dali-scene-loader/public-api/blend-shape-details.h>\r
@@ -135,9 +138,7 @@ AnimationDefinition LoadFacialAnimation(const std::string& url)
   }\r
 \r
   // Set the property names\r
-  char        weightNameBuffer[32];\r
-  char* const pWeightName = weightNameBuffer + sprintf(weightNameBuffer, "%s", BlendShapes::WEIGHTS_UNIFORM.c_str());\r
-  uint32_t    targets     = 0u;\r
+  uint32_t targets = 0u;\r
   for(const auto& blendShape : facialAnimation.mBlendShapes)\r
   {\r
     for(uint32_t morphTargetIndex = 0u; morphTargetIndex < blendShape.mNumberOfMorphTarget; ++morphTargetIndex)\r
@@ -147,8 +148,9 @@ AnimationDefinition LoadFacialAnimation(const std::string& url)
 \r
       animatedProperty.mNodeName = blendShape.mNodeName;\r
 \r
-      snprintf(pWeightName, sizeof(weightNameBuffer) - (pWeightName - weightNameBuffer), "[%d]", morphTargetIndex);\r
-      animatedProperty.mPropertyName = weightNameBuffer;\r
+      std::stringstream weightPropertyStream;\r
+      weightPropertyStream << BlendShapes::WEIGHTS_UNIFORM << "[" << morphTargetIndex << "]";\r
+      animatedProperty.mPropertyName = weightPropertyStream.str();\r
     }\r
     targets += blendShape.mNumberOfMorphTarget;\r
   }\r