From: Eunki, Hong Date: Tue, 18 Apr 2023 11:01:47 +0000 (+0900) Subject: [NUI] Make bvh/facial Animation from string buffer X-Git-Tag: accepted/tizen/unified/20231205.024657~357 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a30dc8ca0e8727aca82630fcea49447929815cbb;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Make bvh/facial Animation from string buffer Let we allow to create facial animations from buffer, not from file. Signed-off-by: Eunki, Hong --- diff --git a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs index 364a9cb..184dd4b 100755 --- a/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs +++ b/src/Tizen.NUI.Scene3D/src/internal/Interop/Interop.Model.cs @@ -92,8 +92,14 @@ namespace Tizen.NUI.Scene3D [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_LoadBvhAnimation_1")] public static extern global::System.IntPtr LoadBvhAnimation(global::System.Runtime.InteropServices.HandleRef model, string bvhFilename, global::System.Runtime.InteropServices.HandleRef scale); + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_LoadBvhAnimation_2")] + public static extern global::System.IntPtr LoadBvhAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef model, string bvhBuffer, int bvhBufferLength, global::System.Runtime.InteropServices.HandleRef scale); + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_LoadFacialAnimation_1")] public static extern global::System.IntPtr LoadFacialAnimation(global::System.Runtime.InteropServices.HandleRef model, string facialFilename); + + [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_LoadFacialAnimation_2")] + public static extern global::System.IntPtr LoadFacialAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef model, string facialBuffer, int facialBufferLength); } } } diff --git a/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs b/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs index 5a83ca6..d6c36c7 100755 --- a/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs +++ b/src/Tizen.NUI.Scene3D/src/public/Controls/Model.cs @@ -380,6 +380,37 @@ namespace Tizen.NUI.Scene3D } /// + /// Load bvh animation and assign to model. + /// Scale is additional scale factor of bvh animation. It is possible that + /// Model's scale may not matched with bvh animation scale. + /// If scale is null, default use as Vector3.ONE + /// + /// Contents of bvh format file. + /// Scale value of bvh animation match with model. + /// Animaion of bvh + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public Animation LoadBvhAnimationFromBuffer(string bvhBuffer, Vector3 scale = null) + { + global::System.IntPtr cPtr = Interop.Model.LoadBvhAnimationFromBuffer(SwigCPtr, bvhBuffer, bvhBuffer.Length, Vector3.getCPtr(scale)); + Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation; + if (ret == null) + { + // Register new animation into Registry. + ret = new Animation(cPtr, true); + } + else + { + // We found matched NUI animation. Reduce cPtr reference count. + HandleRef handle = new HandleRef(this, cPtr); + Tizen.NUI.Interop.Animation.DeleteAnimation(handle); + handle = new HandleRef(null, IntPtr.Zero); + } + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// /// Load facial animation and assign to model. /// /// Name of json format file what we predefined. @@ -407,6 +438,33 @@ namespace Tizen.NUI.Scene3D } /// + /// Load facial animation and assign to model. + /// + /// Contents of json format file what we predefined. + /// Animaion of facial + // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API) + [EditorBrowsable(EditorBrowsableState.Never)] + public Animation LoadFacialAnimationFromBuffer(string facialBuffer) + { + global::System.IntPtr cPtr = Interop.Model.LoadFacialAnimationFromBuffer(SwigCPtr, facialBuffer, facialBuffer.Length); + Animation ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animation; + if (ret == null) + { + // Register new animation into Registry. + ret = new Animation(cPtr, true); + } + else + { + // We found matched NUI animation. Reduce cPtr reference count. + HandleRef handle = new HandleRef(this, cPtr); + Tizen.NUI.Interop.Animation.DeleteAnimation(handle); + handle = new HandleRef(null, IntPtr.Zero); + } + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// /// Retrieves model root Actor. /// /// Root View of the model.