From ff75641d9a643e055b24d7a9c5c56f3fd4caaf1c Mon Sep 17 00:00:00 2001 From: seungho baek Date: Tue, 21 Nov 2023 16:27:01 +0900 Subject: [PATCH] [NUI] Support RootTranslationOnly option for motion capture data Signed-off-by: seungho baek --- .../internal/Interop/Interop.MotionData.cs | 8 ++-- .../src/public/ModelMotion/MotionData.cs | 46 ++++++++++++++++++- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.MotionData.cs b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.MotionData.cs index 6f8845bcf..d7bdcb33d 100755 --- a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.MotionData.cs +++ b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.MotionData.cs @@ -64,16 +64,16 @@ namespace Tizen.NUI.Scene3D public static extern float GetDuration(global::System.Runtime.InteropServices.HandleRef motionData); [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_LoadBvh")] - public static extern float LoadMotionCaptureAnimation(global::System.Runtime.InteropServices.HandleRef motionData, string motionCaptureFilename, global::System.Runtime.InteropServices.HandleRef scale, bool synchronousLoad); + public static extern void LoadMotionCaptureAnimation(global::System.Runtime.InteropServices.HandleRef motionData, string motionCaptureFilename, bool useRootTranslationOnly, global::System.Runtime.InteropServices.HandleRef scale, bool synchronousLoad); [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_LoadBvhFromBuffer")] - public static extern float LoadMotionCaptureAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef motionData, string motionCaptureBuffer, int motionCaptureBufferLength, global::System.Runtime.InteropServices.HandleRef scale, bool synchronousLoad); + public static extern void LoadMotionCaptureAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef motionData, string motionCaptureBuffer, int motionCaptureBufferLength, bool useRootTranslationOnly, global::System.Runtime.InteropServices.HandleRef scale, bool synchronousLoad); [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_LoadFacialAnimation")] - public static extern float LoadBlendShapeAnimation(global::System.Runtime.InteropServices.HandleRef motionData, string blendShapeFilename, bool synchronousLoad); + public static extern void LoadBlendShapeAnimation(global::System.Runtime.InteropServices.HandleRef motionData, string blendShapeFilename, bool synchronousLoad); [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_LoadFacialAnimationFromBuffer")] - public static extern float LoadBlendShapeAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef motionData, string blendShapeBuffer, int blendShapeBufferLength, bool synchronousLoad); + public static extern void LoadBlendShapeAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef motionData, string blendShapeBuffer, int blendShapeBufferLength, bool synchronousLoad); // Signals diff --git a/src/Tizen.NUI.Scene3D/src/public/ModelMotion/MotionData.cs b/src/Tizen.NUI.Scene3D/src/public/ModelMotion/MotionData.cs index 7307ca937..19ffcab16 100644 --- a/src/Tizen.NUI.Scene3D/src/public/ModelMotion/MotionData.cs +++ b/src/Tizen.NUI.Scene3D/src/public/ModelMotion/MotionData.cs @@ -262,7 +262,28 @@ namespace Tizen.NUI.Scene3D /// 11 public void LoadMotionCaptureAnimation(string motionCaptureFilename, Vector3 scale = null, bool synchronousLoad = false) { - Interop.MotionData.LoadMotionCaptureAnimation(SwigCPtr, motionCaptureFilename, Vector3.getCPtr(scale), synchronousLoad); + Interop.MotionData.LoadMotionCaptureAnimation(SwigCPtr, motionCaptureFilename, false, Vector3.getCPtr(scale), synchronousLoad); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Load motion capture animation. + /// We support bvh format. + /// After load completes, event will be invoked. + /// + /// + /// Scale is additional scale factor of motion capture animation. It is possible that + /// Model's scale may not match with motion capture animation scale. + /// If scale is null, default value will be used: + /// + /// Name of motion capture format file. + /// True to use only root translation with rotation animation. + /// Scale value of motion capture animation match with model. + /// Load synchronously or not. Default is async load. + [EditorBrowsable(EditorBrowsableState.Never)] + public void LoadMotionCaptureAnimation(string motionCaptureFilename, bool useRootTranslationOnly, Vector3 scale = null, bool synchronousLoad = false) + { + Interop.MotionData.LoadMotionCaptureAnimation(SwigCPtr, motionCaptureFilename, useRootTranslationOnly, Vector3.getCPtr(scale), synchronousLoad); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } @@ -282,7 +303,28 @@ namespace Tizen.NUI.Scene3D /// 11 public void LoadMotionCaptureAnimationFromBuffer(string motionCaptureBuffer, Vector3 scale = null, bool synchronousLoad = false) { - Interop.MotionData.LoadMotionCaptureAnimationFromBuffer(SwigCPtr, motionCaptureBuffer, motionCaptureBuffer.Length, Vector3.getCPtr(scale), synchronousLoad); + Interop.MotionData.LoadMotionCaptureAnimationFromBuffer(SwigCPtr, motionCaptureBuffer, motionCaptureBuffer.Length, false, Vector3.getCPtr(scale), synchronousLoad); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Load motion capture animation from string. + /// We support bvh format. + /// After load completes, event will be invoked. + /// + /// + /// Scale is additional scale factor of motion capture animation. It is possible that + /// Model's scale may not match with motion capture animation scale. + /// If scale is null, default value will be used: + /// + /// Contents of motion capture format string. + /// True to use only root translation with rotation animation. + /// Scale value of motion capture animation match with model. + /// Load synchronously or not. Default is async load. + [EditorBrowsable(EditorBrowsableState.Never)] + public void LoadMotionCaptureAnimationFromBuffer(string motionCaptureBuffer, bool useRootTranslationOnly, Vector3 scale = null, bool synchronousLoad = false) + { + Interop.MotionData.LoadMotionCaptureAnimationFromBuffer(SwigCPtr, motionCaptureBuffer, motionCaptureBuffer.Length, useRootTranslationOnly, Vector3.getCPtr(scale), synchronousLoad); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } -- 2.34.1