From: Eunki, Hong Date: Tue, 13 Dec 2022 12:32:23 +0000 (+0900) Subject: Bind bvh file loader X-Git-Tag: dali_2.2.12~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e714a125684462167790606dad9ebc859a42db2;p=platform%2Fcore%2Fuifw%2Fdali-csharp-binder.git Bind bvh file loader Change-Id: I7b1805da144ca1a26b0cbd57006386a8d523f85b Signed-off-by: Eunki, Hong --- diff --git a/dali-csharp-binder/src/model-wrap.cpp b/dali-csharp-binder/src/model-wrap.cpp index 879a413..95de67b 100644 --- a/dali-csharp-binder/src/model-wrap.cpp +++ b/dali-csharp-binder/src/model-wrap.cpp @@ -17,6 +17,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include "common.h" @@ -341,6 +342,44 @@ SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_Model_GetAnimation_2(void* csModel, cha return new Dali::Animation((const Dali::Animation&)result); } +SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_Model_LoadBvhAnimation_1(void* csModel, char* csFileName, void* csScale) +{ + Dali::Scene3D::Model* model = (Dali::Scene3D::Model*)csModel; + Dali::Animation result; + + if(!model) + { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::Model", 0); + return 0; + } + if(!csFileName) + { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string for filename", 0); + return 0; + } + + Dali::Vector3 scale = Dali::Vector3::ONE; + // csScale is option. + if(csScale != nullptr) + { + scale = Dali::Vector3(*static_cast(csScale)); + } + std::string filename(csFileName); + { + try + { + Dali::Scene3D::Loader::AnimationDefinition animationDefinition = Dali::Scene3D::Loader::LoadBvh(filename, "LoadedBvhAnimation", scale); + Dali::Scene3D::Loader::AnimatedProperty::GetActor getActor = [&model](const Dali::Scene3D::Loader::AnimatedProperty& property)->Dali::Actor{ + return model->FindChildByName(property.mNodeName); + }; + result = animationDefinition.ReAnimate(getActor); + } + CALL_CATCH_EXCEPTION(0); + } + + return new Dali::Animation((const Dali::Animation&)result); +} + #ifdef __cplusplus } #endif