Since we allow to use MotionData feature in dali-side, let we use it.
Now we can load motion data and blendshape animation from file asyncronously.
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
+++ /dev/null
-/*
- * Copyright(c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Runtime.InteropServices;
-using System.ComponentModel;
-using Tizen.NUI;
-using Tizen.NUI.Binding;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Scene3D
-{
- public partial class Model
- {
- internal Animation InternalGenerateMotionDataAnimation(MotionData motionData, int durationMilliSeconds)
- {
- if (motionData == null || motionData.MotionValues == null)
- {
- Tizen.Log.Error("NUI", $"MotionData was null\n");
- return null;
- }
-
- Lazy<Animation> ret = new Lazy<Animation>(() => new Animation(durationMilliSeconds));
-
- foreach (var indexValuePair in motionData.MotionValues)
- {
- var motionIndex = indexValuePair.Item1;
- var motionValue = indexValuePair.Item2;
-
- if (motionIndex == null || motionValue == null || motionValue.Type == MotionValue.ValueType.Invalid)
- {
- continue;
- }
-
- // TODO : Make we use ModelNode instead of Animatable. Currently, ModelNode have some problem.
- if (motionIndex.ModelNodeId != null)
- {
- Animatable modelNode = null;
- if (motionIndex.ModelNodeId.Type == PropertyKey.KeyType.String)
- {
- modelNode = FindChildAnimatableByName(motionIndex.ModelNodeId.StringKey);
- }
- else if (motionIndex.ModelNodeId.Type == PropertyKey.KeyType.Index)
- {
- // TODO : Not implement yet.
- }
-
- if (modelNode != null)
- {
- KeyFrames keyFrames = null;
- if (motionValue.Type == MotionValue.ValueType.KeyFrames)
- {
- keyFrames = motionValue.KeyFramesValue;
- }
- else if (motionValue.Type == MotionValue.ValueType.Property)
- {
- // Generate stable keyframe animation here.
- keyFrames = new KeyFrames();
- keyFrames.Add(0.0f, motionValue.Value);
- keyFrames.Add(1.0f, motionValue.Value);
- }
-
- if (keyFrames != null)
- {
- string animatedPropertyName = motionIndex.GetPropertyName(modelNode as ModelNode);
- if (!string.IsNullOrEmpty(animatedPropertyName))
- {
- ret.Value.AnimateBetween(modelNode, animatedPropertyName, keyFrames);
- }
- }
- }
- }
- else
- {
- if (motionIndex is BlendShapeIndex)
- {
- var blendShapeIndex = motionIndex as BlendShapeIndex;
- if (blendShapeIndex.BlendShapeId?.Type == PropertyKey.KeyType.String)
- {
- // TODO : Not implement yet. (Set all blendshapes by string)
- }
- }
- }
- }
-
- return ret.IsValueCreated ? ret.Value : null;
- }
-
- internal void InternalSetMotionData(MotionData motionData)
- {
- if (motionData == null || motionData.MotionValues == null)
- {
- Tizen.Log.Error("NUI", $"MotionData was null\n");
- return;
- }
-
- foreach (var indexValuePair in motionData.MotionValues)
- {
- var motionIndex = indexValuePair.Item1;
- var motionValue = indexValuePair.Item2;
-
- if (motionIndex == null || motionValue == null || motionValue.Type == MotionValue.ValueType.Invalid)
- {
- continue;
- }
-
- if (motionIndex.ModelNodeId != null)
- {
- // TODO : Make we use ModelNode instead of Animatable. Currently, ModelNode have some problem.
- Animatable modelNode = null;
- if (motionIndex.ModelNodeId.Type == PropertyKey.KeyType.String)
- {
- modelNode = FindChildAnimatableByName(motionIndex.ModelNodeId.StringKey);
- }
- else if (motionIndex.ModelNodeId.Type == PropertyKey.KeyType.Index)
- {
- // TODO : Not implement yet.
- }
-
- if (modelNode != null)
- {
- PropertyValue value = null;
- if (motionValue.Type == MotionValue.ValueType.KeyFrames)
- {
- // TODO : Not implement yet.
- }
- else if (motionValue.Type == MotionValue.ValueType.Property)
- {
- value = motionValue.Value;
- }
-
- if (value != null)
- {
- string propertyName = motionIndex.GetPropertyName(modelNode as ModelNode);
- if (!string.IsNullOrEmpty(propertyName))
- {
- modelNode.SetProperty(propertyName, value);
- }
- }
- }
- }
- else
- {
- if (motionIndex is BlendShapeIndex)
- {
- var blendShapeIndex = motionIndex as BlendShapeIndex;
- if (blendShapeIndex.BlendShapeId?.Type == PropertyKey.KeyType.String)
- {
- // TODO : Not implement yet. (Set all blendshapes by string)
- }
- }
- }
- }
- }
- }
-}
[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_FindChildModelNodeByName")]
public static extern global::System.IntPtr FindChildModelNodeByName(global::System.Runtime.InteropServices.HandleRef model, string nodeName);
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_GenerateMotionDataAnimation")]
+ public static extern global::System.IntPtr GenerateMotionDataAnimation(global::System.Runtime.InteropServices.HandleRef model, global::System.Runtime.InteropServices.HandleRef motionData);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_SetMotionData")]
+ public static extern void SetMotionData(global::System.Runtime.InteropServices.HandleRef model, global::System.Runtime.InteropServices.HandleRef motionData);
+
[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, bool translateRootFromModelNode);
--- /dev/null
+/*
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI.Scene3D
+{
+ internal static partial class Interop
+ {
+ internal static partial class MotionData
+ {
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_New_SWIG_0")]
+ public static extern global::System.IntPtr MotionDataNew();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_New_SWIG_1")]
+ public static extern global::System.IntPtr MotionDataNew(float duration);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionData_SWIG_0")]
+ public static extern global::System.IntPtr NewMotionData();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionData_SWIG_1")]
+ public static extern global::System.IntPtr NewMotionData(global::System.Runtime.InteropServices.HandleRef motionData);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_MotionData")]
+ public static extern void DeleteMotionData(global::System.Runtime.InteropServices.HandleRef motionData);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_Assign")]
+ public static extern global::System.IntPtr MotionDataAssign(global::System.Runtime.InteropServices.HandleRef motionData, global::System.Runtime.InteropServices.HandleRef sourceMotionData);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_DownCast")]
+ public static extern global::System.IntPtr MotionDataDownCast(global::System.Runtime.InteropServices.HandleRef motionData);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_GetMotionCount")]
+ public static extern uint GetMotionCount(global::System.Runtime.InteropServices.HandleRef motionData);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_GetIndex")]
+ public static extern global::System.IntPtr GetIndex(global::System.Runtime.InteropServices.HandleRef motionData, uint index);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_GetValue")]
+ public static extern global::System.IntPtr GetValue(global::System.Runtime.InteropServices.HandleRef motionData, uint index);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_Add")]
+ public static extern void Add(global::System.Runtime.InteropServices.HandleRef motionData, global::System.Runtime.InteropServices.HandleRef motionIndex, global::System.Runtime.InteropServices.HandleRef motionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_Clear")]
+ public static extern void Clear(global::System.Runtime.InteropServices.HandleRef motionData);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_SetDuration")]
+ public static extern void SetDuration(global::System.Runtime.InteropServices.HandleRef motionData, float duration);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_GetDuration")]
+ 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);
+
+ [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);
+
+ [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);
+
+ [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);
+
+ // Signals
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_LoadCompletedSignal_Connect")]
+ public static extern void LoadCompletedConnect(global::System.Runtime.InteropServices.HandleRef motionData, global::System.Runtime.InteropServices.HandleRef handler);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_LoadCompletedSignal_Disconnect")]
+ public static extern void LoadCompletedDisconnect(global::System.Runtime.InteropServices.HandleRef motionData, global::System.Runtime.InteropServices.HandleRef handler);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI.Scene3D
+{
+ internal static partial class Interop
+ {
+ internal static partial class MotionIndex
+ {
+ #region MotionIndex
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionIndex_SWIG_0")]
+ public static extern global::System.IntPtr NewMotionIndex();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionIndex_SWIG_1")]
+ public static extern global::System.IntPtr NewMotionIndex(global::System.Runtime.InteropServices.HandleRef motionIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_MotionIndex")]
+ public static extern void DeleteMotionIndex(global::System.Runtime.InteropServices.HandleRef motionIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionIndex_Assign")]
+ public static extern global::System.IntPtr MotionIndexAssign(global::System.Runtime.InteropServices.HandleRef motionIndex, global::System.Runtime.InteropServices.HandleRef sourceMotionIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionIndex_DownCast")]
+ public static extern global::System.IntPtr MotionIndexDownCast(global::System.Runtime.InteropServices.HandleRef motionIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionIndex_SetModelNodeId")]
+ public static extern void SetModelNodeId(global::System.Runtime.InteropServices.HandleRef motionIndex, global::System.Runtime.InteropServices.HandleRef modelNodeId);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionIndex_GetModelNodeId")]
+ public static extern global::System.IntPtr GetModelNodeId(global::System.Runtime.InteropServices.HandleRef motionIndex);
+ #endregion
+
+ #region BlendShapeIndex
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_BlendShapeIndex_New_SWIG_0")]
+ public static extern global::System.IntPtr BlendShapeIndexNew();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_BlendShapeIndex_New_SWIG_1")]
+ public static extern global::System.IntPtr BlendShapeIndexNew(global::System.Runtime.InteropServices.HandleRef blendShapePropertyKey);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_BlendShapeIndex_New_SWIG_2")]
+ public static extern global::System.IntPtr BlendShapeIndexNew(global::System.Runtime.InteropServices.HandleRef modelNodePropertKey, global::System.Runtime.InteropServices.HandleRef blendShapePropertyKey);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_BlendShapeIndex_SWIG_0")]
+ public static extern global::System.IntPtr NewBlendShapeIndex();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_BlendShapeIndex_SWIG_1")]
+ public static extern global::System.IntPtr NewBlendShapeIndex(global::System.Runtime.InteropServices.HandleRef blendShapeIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_BlendShapeIndex")]
+ public static extern void DeleteBlendShapeIndex(global::System.Runtime.InteropServices.HandleRef blendShapeIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_BlendShapeIndex_Assign")]
+ public static extern global::System.IntPtr BlendShapeIndexAssign(global::System.Runtime.InteropServices.HandleRef blendShapeIndex, global::System.Runtime.InteropServices.HandleRef sourceBlendShapeIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_BlendShapeIndex_DownCast")]
+ public static extern global::System.IntPtr BlendShapeIndexDownCast(global::System.Runtime.InteropServices.HandleRef blendShapeIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_BlendShapeIndex_SetBlendShapeId")]
+ public static extern void SetBlendShapeId(global::System.Runtime.InteropServices.HandleRef blendShapeIndex, global::System.Runtime.InteropServices.HandleRef modelNodeId);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_BlendShapeIndex_GetBlendShapeId")]
+ public static extern global::System.IntPtr GetBlendShapeId(global::System.Runtime.InteropServices.HandleRef blendShapeIndex);
+ #endregion
+
+ #region MotionPropertyIndex
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionPropertyIndex_New_SWIG_0")]
+ public static extern global::System.IntPtr MotionPropertyIndexNew();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionPropertyIndex_New_SWIG_1")]
+ public static extern global::System.IntPtr MotionPropertyIndexNew(global::System.Runtime.InteropServices.HandleRef modelNodePropertKey, global::System.Runtime.InteropServices.HandleRef propertyKey);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionPropertyIndex_SWIG_0")]
+ public static extern global::System.IntPtr NewMotionPropertyIndex();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionPropertyIndex_SWIG_1")]
+ public static extern global::System.IntPtr NewMotionPropertyIndex(global::System.Runtime.InteropServices.HandleRef motionPropertyIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_MotionPropertyIndex")]
+ public static extern void DeleteMotionPropertyIndex(global::System.Runtime.InteropServices.HandleRef motionPropertyIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionPropertyIndex_Assign")]
+ public static extern global::System.IntPtr MotionPropertyIndexAssign(global::System.Runtime.InteropServices.HandleRef motionPropertyIndex, global::System.Runtime.InteropServices.HandleRef sourceMotionPropertyIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_DownCast")]
+ public static extern global::System.IntPtr MotionPropertyIndexDownCast(global::System.Runtime.InteropServices.HandleRef motionPropertyIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_SetTransformType")]
+ public static extern void SetPropertyId(global::System.Runtime.InteropServices.HandleRef motionPropertyIndex, global::System.Runtime.InteropServices.HandleRef propertyKey);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_GetTransformType")]
+ public static extern global::System.IntPtr GetPropertyId(global::System.Runtime.InteropServices.HandleRef motionPropertyIndex);
+ #endregion
+
+ #region MotionTransformIndex
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_New_SWIG_0")]
+ public static extern global::System.IntPtr MotionTransformIndexNew();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_New_SWIG_1")]
+ public static extern global::System.IntPtr MotionTransformIndexNew(global::System.Runtime.InteropServices.HandleRef modelNodePropertKey, int transformType);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionTransformIndex_SWIG_0")]
+ public static extern global::System.IntPtr NewMotionTransformIndex();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionTransformIndex_SWIG_1")]
+ public static extern global::System.IntPtr NewMotionTransformIndex(global::System.Runtime.InteropServices.HandleRef motionTransformIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_MotionTransformIndex")]
+ public static extern void DeleteMotionTransformIndex(global::System.Runtime.InteropServices.HandleRef motionTransformIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_Assign")]
+ public static extern global::System.IntPtr MotionTransformIndexAssign(global::System.Runtime.InteropServices.HandleRef motionTransformIndex, global::System.Runtime.InteropServices.HandleRef sourceMotionTransformIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_DownCast")]
+ public static extern global::System.IntPtr MotionTransformIndexDownCast(global::System.Runtime.InteropServices.HandleRef motionTransformIndex);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_SetTransformType")]
+ public static extern void SetTransformType(global::System.Runtime.InteropServices.HandleRef motionTransformIndex, int transformType);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionTransformIndex_GetTransformType")]
+ public static extern int GetTransformType(global::System.Runtime.InteropServices.HandleRef motionTransformIndex);
+ #endregion
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Tizen.NUI.Scene3D
+{
+ internal static partial class Interop
+ {
+ internal static partial class MotionValue
+ {
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_New_SWIG_0")]
+ public static extern global::System.IntPtr MotionValueNew();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_New_SWIG_1")]
+ public static extern global::System.IntPtr MotionValueNewPropertyValue(global::System.Runtime.InteropServices.HandleRef propertyValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_New_SWIG_2")]
+ public static extern global::System.IntPtr MotionValueNewKeyFrames(global::System.Runtime.InteropServices.HandleRef keyFrames);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionValue_SWIG_0")]
+ public static extern global::System.IntPtr NewMotionValue();
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_new_MotionValue_SWIG_1")]
+ public static extern global::System.IntPtr NewMotionValue(global::System.Runtime.InteropServices.HandleRef motionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_delete_MotionValue")]
+ public static extern void DeleteMotionValue(global::System.Runtime.InteropServices.HandleRef motionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_Assign")]
+ public static extern global::System.IntPtr MotionValueAssign(global::System.Runtime.InteropServices.HandleRef motionValue, global::System.Runtime.InteropServices.HandleRef sourceMotionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_DownCast")]
+ public static extern global::System.IntPtr MotionValueDownCast(global::System.Runtime.InteropServices.HandleRef motionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_GetValueType")]
+ public static extern int GetValueType(global::System.Runtime.InteropServices.HandleRef motionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_SetValue_PropertyValue")]
+ public static extern void SetValuePropertyValue(global::System.Runtime.InteropServices.HandleRef motionValue, global::System.Runtime.InteropServices.HandleRef propertyValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_SetValue_KeyFrames")]
+ public static extern void SetValueKeyFrames(global::System.Runtime.InteropServices.HandleRef motionValue, global::System.Runtime.InteropServices.HandleRef keyFrames);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_Clear")]
+ public static extern void Clear(global::System.Runtime.InteropServices.HandleRef motionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_GetPropertyValue")]
+ public static extern global::System.IntPtr GetPropertyValue(global::System.Runtime.InteropServices.HandleRef motionValue);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionValue_GetKeyFrames")]
+ public static extern global::System.IntPtr GetKeyFrames(global::System.Runtime.InteropServices.HandleRef motionValue);
+ }
+ }
+}
/// <returns>Animaion of bvh</returns>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Do not use this LoadBvhAnimation. Use MotionData.LoadMotionCaptureAnimation and GenerateMotionDataAnimation instead.")]
public Animation LoadBvhAnimation(string bvhFilename, Vector3 scale = null, bool translateRootFromModelNode = true)
{
global::System.IntPtr cPtr = Interop.Model.LoadBvhAnimation(SwigCPtr, bvhFilename, Vector3.getCPtr(scale), translateRootFromModelNode);
/// <returns>Animaion of bvh</returns>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Do not use this LoadBvhAnimationFromBuffer. Use MotionData.LoadMotionCaptureAnimationFromBuffer and GenerateMotionDataAnimation instead.")]
public Animation LoadBvhAnimationFromBuffer(string bvhBuffer, Vector3 scale = null, bool translateRootFromModelNode = true)
{
global::System.IntPtr cPtr = Interop.Model.LoadBvhAnimationFromBuffer(SwigCPtr, bvhBuffer, bvhBuffer.Length, Vector3.getCPtr(scale), translateRootFromModelNode);
/// <returns>Animaion of facial</returns>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Do not use this LoadFacialAnimation. Use LoadBlendShapeAnimation instead.")]
+ [Obsolete("Do not use this LoadFacialAnimation. Use MotionData.LoadBlendShapeAnimation and GenerateMotionDataAnimation instead.")]
public Animation LoadFacialAnimation(string facialFilename)
{
return LoadBlendShapeAnimation(facialFilename);
/// <returns>Animaion of facial</returns>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Do not use this LoadFacialAnimation. Use LoadBlendShapeAnimation instead.")]
+ [Obsolete("Do not use this LoadFacialAnimationFromBuffer. Use MotionData.LoadBlendShapeAnimationFromBuffer and GenerateMotionDataAnimation instead.")]
public Animation LoadFacialAnimationFromBuffer(string facialBuffer)
{
return LoadBlendShapeAnimationFromBuffer(facialBuffer);
/// <returns>Animaion of facial</returns>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Do not use this LoadBlendShapeAnimation. Use MotionData.LoadBlendShapeAnimation and GenerateMotionDataAnimation instead.")]
public Animation LoadBlendShapeAnimation(string jsonFilename)
{
global::System.IntPtr cPtr = Interop.Model.LoadBlendShapeAnimation(SwigCPtr, jsonFilename);
/// <returns>Animaion of facial</returns>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Do not use this LoadBlendShapeAnimationFromBuffer. Use MotionData.LoadBlendShapeAnimationFromBuffer and GenerateMotionDataAnimation instead.")]
public Animation LoadBlendShapeAnimationFromBuffer(string jsonBuffer)
{
global::System.IntPtr cPtr = Interop.Model.LoadBlendShapeAnimationFromBuffer(SwigCPtr, jsonBuffer, jsonBuffer.Length);
}
/// <summary>
- /// Prototype of animation generate by MotionData
+ /// Generate animation by MotionData.
+ /// If there is no animatable item for MotionData, return null.
/// </summary>
- /// <param name="motionData">Inputed list of pair of MotionIndex and MotionValue.</param>
- /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
- /// <returns>Generated animation by input motion data</returns>
+ /// <param name="motionData">Inputed list of pair of MotionIndex and MotionValue, and duration.</param>
+ /// <returns>Generated animation by input motion data, or null if there is no animatable item exist about inputed motionData</returns>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
- public Animation GenerateMotionDataAnimation(MotionData motionData, int durationMilliSeconds)
+ public Animation GenerateMotionDataAnimation(MotionData motionData)
{
- return InternalGenerateMotionDataAnimation(motionData, durationMilliSeconds);
+ global::System.IntPtr cPtr = Interop.Model.GenerateMotionDataAnimation(SwigCPtr, MotionData.getCPtr(motionData));
+ 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();
+
+ // It is possible if there is no animatable properties exist on inputed motionData.
+ // In this case, let we return null.
+ if (!ret.HasBody())
+ {
+ ret.Dispose();
+ ret = null;
+ }
+ return ret;
}
/// <summary>
/// Prototype of MotionData setter.
/// Note that this API didn't apply KeyFrames animation.
- /// If you want to apply the animation, please use <see cref="GenerateMotionDataAnimation(MotionData, int)"/> and play the result.
+ /// If you want to apply the animation, please use <see cref="GenerateMotionDataAnimation(MotionData)"/> and play the result.
/// </summary>
/// <param name="motionData">Inputed list of pair of MotionIndex and MotionValue.</param>
// This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetMotionData(MotionData motionData)
{
- InternalSetMotionData(motionData);
+ Interop.Model.SetMotionData(SwigCPtr, MotionData.getCPtr(motionData));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
+++ /dev/null
-using System.Numerics;
-/*
- * Copyright(c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.ComponentModel;
-using System.Collections.Generic;
-using Tizen.NUI;
-
-namespace Tizen.NUI.Scene3D
-{
- /// <summary>
- /// Index of BlendShape feature.
- /// MotionValue should be float type.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class BlendShapeIndex : MotionIndex
- {
- /// <summary>
- /// Create an initialized motion index.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public BlendShapeIndex()
- {
- }
-
- /// <summary>
- /// The key of BlendShape.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public PropertyKey BlendShapeId { get; set; } = null;
-
- /// <summary>
- /// Convert from index to DALi engine using blend shape uniform name.
- /// </summary>
- internal static string GetPropertyNameFromIndex(int index)
- {
- if (index >= 0)
- {
- return "uBlendShapeWeight[" + index.ToString() + "]";
- }
- return null;
- }
-
- /// <summary>
- /// Get uniform name of blendshape.
- /// </summary>
- internal override string GetPropertyName(ModelNode node)
- {
- if (BlendShapeId != null)
- {
- if (BlendShapeId.Type == PropertyKey.KeyType.Index)
- {
- return GetPropertyNameFromIndex(BlendShapeId.IndexKey);
- }
- if (node != null)
- {
- // TODO : Not implement yet. We should make API that get the blendshape index from node by name.
- }
- }
- return null;
- }
- }
-}
*/
using System;
+using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Collections.Generic;
namespace Tizen.NUI.Scene3D
{
/// <summary>
- /// List of each motion value.
+ /// List of model motion definitions.
+ /// Each motion has pair of <see cref="MotionIndex"/> and <see cref="MotionValue"/>.
+ /// MotionIndex is abstract class that specify the target of motion.
+ /// MotionValue is target value of motion. It can be KeyFrames.
+ ///
+ /// We can generate list of motions by MotionIndex and MotionValue classes.
+ ///
+ /// <code>
+ /// MotionData motionData = new MotionData(3.0f);
+ ///
+ /// // Make MotionIndex with MotionPropertyIndex
+ /// // Make MotionValue with PropertyValue
+ /// motionData.Add(new MotionPropertyIndex(new PropertyKey("nodeName"), new PropertyKey("color")), new MotionValue(new PropertyValue(Color.Red)));
+ ///
+ /// // Make MotionIndex with MotionTransformIndex
+ /// // Make MotionValue with Dali::KeyFrames
+ /// KeyFrames keyFrames = new KeyFrames();
+ /// keyFrames.Add(0.0f, 0.0f);
+ /// keyFrames.Add(0.0f, 1.0f);
+ /// motionData.Add(new MotionTransformIndex(new PropertyKey("nodeName"), MotionTransformIndex.TransformType.PositionX), new MotionValue(keyFrames));
+ ///
+ /// // Make MotionIndex with BlendShapeIndex
+ /// motionData.Add(new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey("blendShapeName")), motionData.GetValue(1u));
+ /// </code>
+ ///
+ /// We can request to load MotionData from file or buffer asynchronously.
+ /// If load completed, <see cref="LoadCompleted"/> event will be invoked.
+ /// If we try to load before LoadCompleted event invoked, previous load request cancel and only latest request loaded.
+ ///
+ /// <code>
+ /// MotionData motionData = new MotionData();
+ /// motionData.LoadCompleted += OnLoadCompleted;
+ /// motionData.LoadBvh("bvhFilename.bvh", Vector3.One);
+ ///
+ /// ...
+ ///
+ /// void OnLoadCompleted(object o, event e)
+ /// {
+ /// MotionData motionData = o as MotionData;
+ /// /// Do something.
+ /// }
+ /// </code>
+ ///
+ /// We can generate animation of Scene3D.Model from MotionData class.
+ /// Or, just set values.
+ ///
+ /// <code>
+ /// // Generate animation from loaded Model
+ /// Animation animation = model.GenerateMotionDataAnimation(motionData);
+ /// animation.Play();
+ ///
+ /// // Set values from loaded Model.
+ /// model2.SetMotionData(motionData);
+ /// </code>
/// </summary>
/// <remark>
+ /// We don't check duplicated MotionIndex internally.
/// We don't check MotionValue type is matched with MotionIndex.
/// </remark>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class MotionData : IDisposable
+ public class MotionData : BaseHandle
{
- private List<(MotionIndex, MotionValue)> motionValues { get; set; } = null;
+ private EventHandler loadCompletedEventHandler;
+ private LoadCompletedCallbackType loadCompletedCallback;
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate void LoadCompletedCallbackType(IntPtr motionData);
/// <summary>
- /// Owned motion value list.
+ /// Create an initialized motion data.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionData() : this(Interop.MotionData.MotionDataNew(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Create an initialized motion data with duration.
+ /// </summary>
+ /// <param name="durationMilliSeconds">Duration of this motion data when it be generated as Animation in milliseconds.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionData(int durationMilliSeconds) : this(Interop.MotionData.MotionDataNew(MilliSecondsToSeconds(durationMilliSeconds)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Copy constructor.
+ /// </summary>
+ /// <param name="motionData">Source object to copy.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionData(MotionData motionData) : this(Interop.MotionData.NewMotionData(MotionData.getCPtr(motionData)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Assignment operator.
+ /// </summary>
+ /// <param name="motionData">Source object to be assigned.</param>
+ /// <returns>Reference to this.</returns>
+ internal MotionData Assign(MotionData motionData)
+ {
+ MotionData ret = new MotionData(Interop.MotionData.MotionDataAssign(SwigCPtr, MotionData.getCPtr(motionData)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal MotionData(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ /// <summary>
+ /// Get or set the duration of this motion data in milliseconds.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("Do not use this MotionValues property directly. Use Add and GetIndex, GetValue instead.")]
- public List<(MotionIndex, MotionValue)> MotionValues
+ public int Duration
{
get
{
- return motionValues;
+ return SecondsToMilliSeconds(GetDuration());
}
set
{
- motionValues = value;
+ SetDuration(MilliSecondsToSeconds(value));
}
}
+ /// <summary>
+ /// Get the number of MotionIndex / MotionValue pair list what this hold.
+ /// </summary>
+ /// <returns>The number of motions what this hold.</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint GetMotionCount()
+ {
+ uint ret = Interop.MotionData.GetMotionCount(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
/// <summary>
/// Append pair of MotionIndex and MotionValue end of list.
/// </summary>
+ /// <param name="index">MotionIndex to be added</param>
+ /// <param name="value">MotionValue to be added</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public void Add(MotionIndex index, MotionValue value)
{
- if(motionValues == null)
- {
- motionValues = new List<(MotionIndex, MotionValue)>();
- }
- motionValues.Add((index, value));
+ Interop.MotionData.Add(SwigCPtr, MotionIndex.getCPtr(index), MotionValue.getCPtr(value));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Get MotionIndex at index'th. null if invalid index inputed
/// </summary>
+ /// <param name="index">The index of motion data list</param>
+ /// <returns>The index'th MotionIndex. Or empty handle that doesn't have body</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public MotionIndex GetIndex(uint index)
{
- if(motionValues != null && index < motionValues.Count)
+ IntPtr cPtr = Interop.MotionData.GetIndex(SwigCPtr, index);
+ MotionIndex ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as MotionIndex;
+ if (ret == null)
+ {
+ // Register new animation into Registry.
+ ret = new MotionIndex(cPtr, true);
+ }
+ else
{
- return motionValues[(int)index].Item1;
+ // We found matched NUI animation. Reduce cPtr reference count.
+ HandleRef handle = new HandleRef(this, cPtr);
+ Interop.MotionIndex.DeleteMotionIndex(handle);
+ handle = new HandleRef(null, IntPtr.Zero);
}
- return null;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
/// <summary>
/// Get MotionValue at index'th. null if invalid index inputed
/// </summary>
+ /// <param name="index">The index of motion data list</param>
+ /// <returns>The index'th MotionValue. Or empty handle that doesn't have body</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public MotionValue GetValue(uint index)
{
- if(motionValues != null && index < motionValues.Count)
+ IntPtr cPtr = Interop.MotionData.GetValue(SwigCPtr, index);
+ MotionValue ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as MotionValue;
+ if (ret == null)
{
- return motionValues[(int)index].Item2;
+ // Register new animation into Registry.
+ ret = new MotionValue(cPtr, true);
}
- return null;
+ else
+ {
+ // We found matched NUI animation. Reduce cPtr reference count.
+ HandleRef handle = new HandleRef(this, cPtr);
+ Interop.MotionValue.DeleteMotionValue(handle);
+ handle = new HandleRef(null, IntPtr.Zero);
+ }
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
/// <summary>
- /// Clear all inputed values.
+ /// Load motion capture animation.
+ /// Scale is additional scale factor of motion capture animation. It is possible that
+ /// Model's scale may not matched with motion capture animation scale.
+ /// If scale is null, default use as Vector3.ONE
+ /// We support bvh format.
+ /// After load completed, <see cref="LoadCompleted"/> event will be invoked.
/// </summary>
+ /// <param name="motionCaptureFilename">Name of motion capture format file.</param>
+ /// <param name="scale">Scale value of motion capture animation match with model.</param>
+ /// <param name="synchronousLoad">Load synchronously or not. Default is async load.</param>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
[EditorBrowsable(EditorBrowsableState.Never)]
- public void Clear()
+ public void LoadMotionCaptureAnimation(string motionCaptureFilename, Vector3 scale = null, bool synchronousLoad = false)
{
- motionValues = null;
+ Interop.MotionData.LoadMotionCaptureAnimation(SwigCPtr, motionCaptureFilename, Vector3.getCPtr(scale), synchronousLoad);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
- /// Create an initialized motion data.
+ /// Load motion capture animation.
+ /// Scale is additional scale factor of motion capture animation. It is possible that
+ /// Model's scale may not matched with motion capture animation scale.
+ /// If scale is null, default use as Vector3.ONE
+ /// We support bvh format.
+ /// After load completed, <see cref="LoadCompleted"/> event will be invoked.
+ /// </summary>
+ /// <param name="motionCaptureBuffer">Contents of motion capture format file.</param>
+ /// <param name="scale">Scale value of motion capture animation match with model.</param>
+ /// <param name="synchronousLoad">Load synchronously or not. Default is async load.</param>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LoadMotionCaptureAnimationFromBuffer(string motionCaptureBuffer, Vector3 scale = null, bool synchronousLoad = false)
+ {
+ Interop.MotionData.LoadMotionCaptureAnimationFromBuffer(SwigCPtr, motionCaptureBuffer, motionCaptureBuffer.Length, Vector3.getCPtr(scale), synchronousLoad);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Load blendshape animation from json file.
+ /// After load completed, <see cref="LoadCompleted"/> event will be invoked.
+ /// </summary>
+ /// <param name="blendShapeFilename">Name of json format file what we predefined.</param>
+ /// <param name="synchronousLoad">Load synchronously or not. Default is async load.</param>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LoadBlendShapeAnimation(string blendShapeFilename, bool synchronousLoad = false)
+ {
+ Interop.MotionData.LoadBlendShapeAnimation(SwigCPtr, blendShapeFilename, synchronousLoad);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Load morphing animation from json string.
+ /// After load completed, <see cref="LoadCompleted"/> event will be invoked.
/// </summary>
- public MotionData()
+ /// <param name="blendShapeBuffer">Contents of json format file what we predefined.</param>
+ /// <param name="synchronousLoad">Load synchronously or not. Default is async load.</param>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LoadBlendShapeAnimationFromBuffer(string blendShapeBuffer, bool synchronousLoad = false)
{
+ Interop.MotionData.LoadBlendShapeAnimationFromBuffer(SwigCPtr, blendShapeBuffer, blendShapeBuffer.Length, synchronousLoad);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
- /// IDisposable.Dipsose.
+ /// LoadCompleted event.
+ /// It will be invoked only for latest load request.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public void Dispose()
+ public event EventHandler LoadCompleted
{
- if (motionValues != null)
+ add
{
- foreach (var indexValuePair in motionValues)
+ if (loadCompletedEventHandler == null)
{
- indexValuePair.Item1?.Dispose();
- indexValuePair.Item2?.Dispose();
+ loadCompletedCallback = OnLoadCompleted;
+ Interop.MotionData.LoadCompletedConnect(SwigCPtr, loadCompletedCallback.ToHandleRef(this));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
}
- motionValues = null;
+ loadCompletedEventHandler += value;
+ }
+ remove
+ {
+ loadCompletedEventHandler -= value;
+ if (loadCompletedEventHandler == null && loadCompletedCallback != null)
+ {
+ Interop.MotionData.LoadCompletedDisconnect(SwigCPtr, loadCompletedCallback.ToHandleRef(this));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ loadCompletedCallback = null;
+ }
+ }
+ }
+
+ private void OnLoadCompleted(IntPtr motionData)
+ {
+ if (loadCompletedEventHandler != null)
+ {
+ loadCompletedEventHandler(this, null);
+ }
+ }
+
+ /// <summary>
+ /// Clear all inputed values.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Clear()
+ {
+ Interop.MotionData.Clear(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal void SetDuration(float durationSeconds)
+ {
+ Interop.MotionData.SetDuration(SwigCPtr, durationSeconds);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal float GetDuration()
+ {
+ float ret = Interop.MotionData.GetDuration(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private static float MilliSecondsToSeconds(int millisec)
+ {
+ return (float)millisec / 1000.0f;
+ }
+
+ private static int SecondsToMilliSeconds(float sec)
+ {
+ return (int)(sec * 1000);
+ }
+
+ /// <summary>
+ /// you can override it to clean-up your own resources.
+ /// </summary>
+ /// <param name="type">DisposeTypes</param>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
}
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+
+ if (loadCompletedCallback != null)
+ {
+ NUILog.Debug($"[Dispose] loadCompletedCallback");
+
+ Interop.MotionData.LoadCompletedDisconnect(SwigCPtr, loadCompletedCallback.ToHandleRef(this));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ loadCompletedCallback = null;
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Release swigCPtr.
+ /// </summary>
+ // This will be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.MotionData.DeleteMotionData(swigCPtr);
}
}
}
+++ /dev/null
-/*
- * Copyright(c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.ComponentModel;
-using System.Collections.Generic;
-using Tizen.NUI;
-
-namespace Tizen.NUI.Scene3D
-{
- /// <summary>
- /// Index of motion value. It will be used to specify the target of motion applied.
- ///
- /// There are two kinds of MotionIndex : MotionTransformIndex and BlendShapeIndex.
- /// MotionTransformIndex will be used for control the ModelNode's Position / Orientation / Scale, or each components.
- /// BlendShapeIndex will be used for control some blendshape animation.
- ///
- /// We can use this class below cases
- /// - ModelNodeId (string key) , MotionTransformIndex : Target is ModelNode's transform property
- /// - ModelNodeId (int key) , MotionTransformIndex : Target is ModelNode's transform property [not implemented yet]
- /// - ModelNodeId (string key) , BlendShapeIndex (int key) : Target is ModelNode's BlendShape
- /// - ModelNodeId (string key) , BlendShapeIndex (string key) : Target is ModelNode's BlendShape [not implemented yet]
- /// - ModelNodeId (int key) , BlendShapeIndex (int key) : Target is ModelNode's BlendShape [not implemented yet]
- /// - ModelNodeId (int key) , BlendShapeIndex (string key) : Target is ModelNode's BlendShape [not implemented yet]
- /// - ModelNodeId (null) , BlendShapeIndex (string key) : Target is all BlendShape [not implemented yet]
- /// All other cases are invalid.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public abstract class MotionIndex : IDisposable
- {
- /// <summary>
- /// The id of ModelNode. If you want to apply to all ModelNodes who has BlendShape string, let this value as null.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public PropertyKey ModelNodeId { get; set; } = null;
-
- /// <summary>
- /// Abstract API to get uniform name of index, or null if invalid. Only can be used for internal API
- /// </summary>
- abstract internal string GetPropertyName(ModelNode node);
-
- /// <summary>
- /// IDisposable.Dipsose.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void Dispose()
- {
- ModelNodeId?.Dispose();
- ModelNodeId = null;
- }
- }
-}
--- /dev/null
+/*
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Scene3D
+{
+ /// <summary>
+ /// Specialized <see cref="MotionIndex"/> to control blend shape.
+ /// We can control the blend shape by index (when we set BlendShapeId as IndexKey),
+ /// or by name (when we set BlendShapeId as StringKey).
+ ///
+ /// <see cref="MotionValue"/> should be float type.
+ ///
+ /// <code>
+ /// BlendShapeIndex blendShapeIndex0 = new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey(0u));
+ /// BlendShapeIndex blendShapeIndex1 = new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey("Target_1"));
+ ///
+ /// // We can change the property later.
+ /// BlendShapeIndex blendShapeIndex2 = new BlendShapeIndex;
+ /// blendShapeIndex2.ModelNodeId = new PropertyKey("nodeName");
+ /// blendShapeIndex2.BlendShapeId = new PropertyKey("Target_2");
+ /// </code>
+ ///
+ /// Specially, if ModelNodeId is invalid and BlendShapeId is StringKey,
+ /// It will control all ModelNode that has the inputed blend shape name.
+ ///
+ /// <code>
+ /// // If "node0" and "node1" has same BlendShape named "Smile",
+ /// // blendShapeIndexAll will control both nodes.
+ /// BlendShapeIndex blendShapeIndexAll = new BlendShapeIndex(new PropertyKey("Smile"));
+ ///
+ /// BlendShapeIndex blendShapeIndex0 = new BlendShapeIndex(new PropertyKey("node0"), new PropertyKey("Smile"));
+ /// BlendShapeIndex blendShapeIndex1 = new BlendShapeIndex(new PropertyKey("node1"), new PropertyKey("Smile"));
+ /// </code>
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class BlendShapeIndex : MotionIndex
+ {
+ /// <summary>
+ /// Create an initialized blend shape index.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BlendShapeIndex() : this(Interop.MotionIndex.BlendShapeIndexNew(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Create an initialized blend shape index with invalid node id, and input blend shape id.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BlendShapeIndex(PropertyKey blendShapeId) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(blendShapeId)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Create an initialized blend shape index with input node id, and input blend shape id.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BlendShapeIndex(PropertyKey modelNodeId, PropertyKey blendShapeId) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(modelNodeId), PropertyKey.getCPtr(blendShapeId)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Copy constructor.
+ /// </summary>
+ /// <param name="blendShapeIndex">Source object to copy.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public BlendShapeIndex(BlendShapeIndex blendShapeIndex) : this(Interop.MotionIndex.NewBlendShapeIndex(BlendShapeIndex.getCPtr(blendShapeIndex)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Assignment operator.
+ /// </summary>
+ /// <param name="blendShapeIndex">Source object to be assigned.</param>
+ /// <returns>Reference to this.</returns>
+ internal BlendShapeIndex Assign(BlendShapeIndex blendShapeIndex)
+ {
+ BlendShapeIndex ret = new BlendShapeIndex(Interop.MotionIndex.BlendShapeIndexAssign(SwigCPtr, BlendShapeIndex.getCPtr(blendShapeIndex)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal BlendShapeIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ /// <summary>
+ /// The key of blend shape.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyKey BlendShapeId
+ {
+ get
+ {
+ return GetBlendShapeId();
+ }
+ set
+ {
+ SetBlendShapeId(value);
+ }
+ }
+
+ internal void SetBlendShapeId(PropertyKey blendShapeId)
+ {
+ Interop.MotionIndex.SetBlendShapeId(SwigCPtr, Property.getCPtr(blendShapeId));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal PropertyKey GetBlendShapeId()
+ {
+ IntPtr cPtr = Interop.MotionIndex.GetBlendShapeId(SwigCPtr);
+ PropertyKey ret = new PropertyKey(cPtr, true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Release swigCPtr.
+ /// </summary>
+ // This will be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.MotionIndex.DeleteBlendShapeIndex(swigCPtr);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Scene3D
+{
+ /// <summary>
+ /// Index of motion value. It will be used to specify the target of motion applied.
+ ///
+ /// There are three kinds of MotionIndex : <see cref="MotionPropertyIndex"/>, <see cref="MotionTransformIndex"/> and <see cref="BlendShapeIndex"/>.
+ /// MotionPropertyIndex will be used for control whole kind of properties.
+ /// The <see cref="MotionData"/> loaded from files / buffer will have this kind of MotionIndex.
+ ///
+ /// MotionTransformIndex will be used for control the <see cref="ModelNode"/>'s Position / Orientation / Scale, or each components.
+ /// BlendShapeIndex will be used for control some blend shape animation.
+ ///
+ /// We can use this class below cases
+ /// - ModelNodeId (string key) , MotionTransformIndex : Target is ModelNode's transform property
+ /// - ModelNodeId (int key) , MotionTransformIndex : Target is ModelNode's transform property [not implemented yet]
+ /// - ModelNodeId (string key) , BlendShapeIndex (int key) : Target is ModelNode's BlendShape
+ /// - ModelNodeId (string key) , BlendShapeIndex (string key) : Target is ModelNode's BlendShape
+ /// - ModelNodeId (int key) , BlendShapeIndex (int key) : Target is ModelNode's BlendShape [not implemented yet]
+ /// - ModelNodeId (int key) , BlendShapeIndex (string key) : Target is ModelNode's BlendShape [not implemented yet]
+ /// - ModelNodeId (null) , BlendShapeIndex (string key) : Target is all ModelNode's BlendShape
+ /// All other cases are invalid.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class MotionIndex : BaseHandle
+ {
+ /// <summary>
+ /// Copy constructor.
+ /// </summary>
+ /// <param name="motionIndex">Source object to copy.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionIndex(MotionIndex motionIndex) : this(Interop.MotionIndex.NewMotionIndex(MotionIndex.getCPtr(motionIndex)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Assignment operator.
+ /// </summary>
+ /// <param name="motionIndex">Source object to be assigned.</param>
+ /// <returns>Reference to this.</returns>
+ internal MotionIndex Assign(MotionIndex motionIndex)
+ {
+ MotionIndex ret = new MotionIndex(Interop.MotionIndex.MotionIndexAssign(SwigCPtr, MotionIndex.getCPtr(motionIndex)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal MotionIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ /// <summary>
+ /// The id of ModelNode. If you want to apply to all ModelNodes who has BlendShape string, let this value as null.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyKey ModelNodeId
+ {
+ get
+ {
+ return GetModelNodeId();
+ }
+ set
+ {
+ SetModelNodeId(value);
+ }
+ }
+
+ internal void SetModelNodeId(PropertyKey modelNodeId)
+ {
+ Interop.MotionIndex.SetModelNodeId(SwigCPtr, Property.getCPtr(modelNodeId));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal PropertyKey GetModelNodeId()
+ {
+ IntPtr cPtr = Interop.MotionIndex.GetModelNodeId(SwigCPtr);
+ PropertyKey ret = new PropertyKey(cPtr, true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Release swigCPtr.
+ /// </summary>
+ // This will be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.MotionIndex.DeleteMotionIndex(swigCPtr);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Scene3D
+{
+ /// <summary>
+ /// Basic <see cref="MotionIndex"/> to control Dali's Property.
+ /// It can control more general case.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// MotionPropertyIndex color = new MotionPropertyIndex(new PropertyKey("nodeName"), new PropertyKey("color"));
+ ///
+ /// // We can change the property later.
+ /// MotionPropertyIndex custom = newMotionPropertyIndex();
+ /// orientation.ModelNodeId = new PropertyKey("nodeName");
+ /// orientation.PropertyId = new PropertyKey("some_custom_property");
+ ///
+ /// // Note that all cases of MotionTransformIndex can be controled by MotionPropertyIndex
+ /// // Both position0 and position1 can control the node's Position.
+ /// MotionTransformIndex position0 = new MotionTransformIndex(new PropertyKey("nodeName"), MotionTransformIndex.TransformTypes.Position);
+ /// MotionPropertyIndex position1 = new MotionPropertyIndex(new PropertyKey("nodeName"), new PropertyKey("position"));
+ ///
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class MotionPropertyIndex : MotionIndex
+ {
+ /// <summary>
+ /// Create an initialized blend shape index.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionPropertyIndex() : this(Interop.MotionIndex.MotionPropertyIndexNew(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Create an initialized blend shape index with input node id, and property id.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionPropertyIndex(PropertyKey modelNodeId, PropertyKey propertyId) : this(Interop.MotionIndex.MotionPropertyIndexNew(PropertyKey.getCPtr(modelNodeId), PropertyKey.getCPtr(propertyId)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Copy constructor.
+ /// </summary>
+ /// <param name="motionPropertyIndex">Source object to copy.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionPropertyIndex(MotionPropertyIndex motionPropertyIndex) : this(Interop.MotionIndex.NewMotionPropertyIndex(MotionPropertyIndex.getCPtr(motionPropertyIndex)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Assignment operator.
+ /// </summary>
+ /// <param name="motionPropertyIndex">Source object to be assigned.</param>
+ /// <returns>Reference to this.</returns>
+ internal MotionPropertyIndex Assign(MotionPropertyIndex motionPropertyIndex)
+ {
+ MotionPropertyIndex ret = new MotionPropertyIndex(Interop.MotionIndex.MotionPropertyIndexAssign(SwigCPtr, MotionPropertyIndex.getCPtr(motionPropertyIndex)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal MotionPropertyIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ /// <summary>
+ /// The key of property
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyKey PropertyId
+ {
+ get
+ {
+ return GetPropertyId();
+ }
+ set
+ {
+ SetPropertyId(value);
+ }
+ }
+
+ internal void SetPropertyId(PropertyKey propertyId)
+ {
+ Interop.MotionIndex.SetPropertyId(SwigCPtr, Property.getCPtr(propertyId));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal PropertyKey GetPropertyId()
+ {
+ IntPtr cPtr = Interop.MotionIndex.GetPropertyId(SwigCPtr);
+ PropertyKey ret = new PropertyKey(cPtr, true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Release swigCPtr.
+ /// </summary>
+ // This will be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.MotionIndex.DeleteMotionPropertyIndex(swigCPtr);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI;
+
+namespace Tizen.NUI.Scene3D
+{
+ /// <summary>
+ /// Specialized <see cref="MotionIndex"/> to control transform.
+ /// It will be used when app developer don't care about Property index list,
+ /// but want to change the transform properties anyway fast enough.
+ ///
+ /// Each TransformTypes has their own matched <see cref="MotionValue"/> type.
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// MotionTransformIndex position = new MotionTransformIndex(new PropertyKey("nodeName"), MotionTransformIndex.TransformTypes.Position);
+ ///
+ /// // We can change the property later.
+ /// MotionTransformIndex orientation = new MotionTransformIndex();
+ /// orientation.ModelNodeId = new PropertyKey("nodeName");
+ /// orientation.TransformType = MotionTransformIndex.TransformTypes.Orientation;
+ /// </code>
+ /// </example>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class MotionTransformIndex : MotionIndex
+ {
+ /// <summary>
+ /// The list of component types what this MotionIndex can control.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
+ public enum TransformTypes
+ {
+ /// <summary>
+ /// Invalid type.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Invalid = -1,
+
+ /// <summary>
+ /// The position of ModelNode. MotionValue should be Vector3.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Position = 0,
+
+ /// <summary>
+ /// The x position of ModelNode. MotionValue should be float.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ PositionX,
+
+ /// <summary>
+ /// The y position of ModelNode. MotionValue should be float.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ PositionY,
+
+ /// <summary>
+ /// The z position of ModelNode. MotionValue should be float.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ PositionZ,
+
+ /// <summary>
+ /// The orientation of ModelNode. MotionValue should be Rotation.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Orientation,
+
+ /// <summary>
+ /// The scale of ModelNode. MotionValue should be Vector3.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Scale,
+
+ /// <summary>
+ /// The x scale of ModelNode. MotionValue should be float.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ ScaleX,
+
+ /// <summary>
+ /// The y scale of ModelNode. MotionValue should be float.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ ScaleY,
+
+ /// <summary>
+ /// The z scale of ModelNode. MotionValue should be float.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ ScaleZ,
+ }
+
+ /// <summary>
+ /// Create an initialized blend shape index.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionTransformIndex() : this(Interop.MotionIndex.MotionTransformIndexNew(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Create an initialized blend shape index with input node id, and transform type.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionTransformIndex(PropertyKey modelNodeId, TransformTypes transformType) : this(Interop.MotionIndex.MotionTransformIndexNew(PropertyKey.getCPtr(modelNodeId), (int)transformType), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Copy constructor.
+ /// </summary>
+ /// <param name="motionTransformIndex">Source object to copy.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionTransformIndex(MotionTransformIndex motionTransformIndex) : this(Interop.MotionIndex.NewMotionTransformIndex(MotionTransformIndex.getCPtr(motionTransformIndex)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Assignment operator.
+ /// </summary>
+ /// <param name="motionTransformIndex">Source object to be assigned.</param>
+ /// <returns>Reference to this.</returns>
+ internal MotionTransformIndex Assign(MotionTransformIndex motionTransformIndex)
+ {
+ MotionTransformIndex ret = new MotionTransformIndex(Interop.MotionIndex.MotionTransformIndexAssign(SwigCPtr, MotionTransformIndex.getCPtr(motionTransformIndex)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal MotionTransformIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+ {
+ }
+
+ /// <summary>
+ /// The component type what this MotionIndex want to control.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TransformTypes TransformType
+ {
+ get
+ {
+ return GetTransformType();
+ }
+ set
+ {
+ SetTransformType(value);
+ }
+ }
+
+ internal void SetTransformType(TransformTypes transformType)
+ {
+ Interop.MotionIndex.SetTransformType(SwigCPtr, (int)transformType);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal TransformTypes GetTransformType()
+ {
+ int ret = Interop.MotionIndex.GetTransformType(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return (TransformTypes)ret;
+ }
+
+ /// <summary>
+ /// Release swigCPtr.
+ /// </summary>
+ // This will be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.MotionIndex.DeleteMotionTransformIndex(swigCPtr);
+ }
+ }
+}
+++ /dev/null
-using System.Numerics;
-/*
- * Copyright(c) 2023 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.ComponentModel;
-using System.Collections.Generic;
-using Tizen.NUI;
-
-namespace Tizen.NUI.Scene3D
-{
- /// <summary>
- /// Index of Transform feature.
- /// Each TransformTypes has their own matched MotionValue type.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class MotionTransformIndex : MotionIndex
- {
- /// <summary>
- /// The list of component types what this MotionIndex can control.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
- public enum TransformTypes
- {
- /// <summary>
- /// The position of ModelNode. MotionValue should be Vector3.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- Position,
-
- /// <summary>
- /// The x position of ModelNode. MotionValue should be float.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- PositionX,
-
- /// <summary>
- /// The y position of ModelNode. MotionValue should be float.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- PositionY,
-
- /// <summary>
- /// The z position of ModelNode. MotionValue should be float.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- PositionZ,
-
- /// <summary>
- /// The orientation of ModelNode. MotionValue should be Rotation.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- Orientation,
-
- /// <summary>
- /// The scale of ModelNode. MotionValue should be Vector3.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- Scale,
-
- /// <summary>
- /// The x scale of ModelNode. MotionValue should be float.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- ScaleX,
-
- /// <summary>
- /// The y scale of ModelNode. MotionValue should be float.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- ScaleY,
-
- /// <summary>
- /// The z scale of ModelNode. MotionValue should be float.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- ScaleZ,
- }
-
- /// <summary>
- /// Create an initialized motion index.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public MotionTransformIndex()
- {
- }
-
- /// <summary>
- /// The component type what this MotionIndex want to control.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public TransformTypes TransformType { get; set; } = TransformTypes.Position;
-
- /// <summary>
- /// Get uniform name of TransformType.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal override string GetPropertyName(ModelNode node)
- {
- switch (TransformType)
- {
- case TransformTypes.Position:
- {
- return "Position";
- }
- case TransformTypes.PositionX:
- {
- return "PositionX";
- }
- case TransformTypes.PositionY:
- {
- return "PositionY";
- }
- case TransformTypes.PositionZ:
- {
- return "PositionZ";
- }
- case TransformTypes.Orientation:
- {
- return "Orientation";
- }
- case TransformTypes.Scale:
- {
- return "Scale";
- }
- case TransformTypes.ScaleX:
- {
- return "ScaleX";
- }
- case TransformTypes.ScaleY:
- {
- return "ScaleY";
- }
- case TransformTypes.ScaleZ:
- {
- return "ScaleZ";
- }
- }
- return null;
- }
- }
-}
*/
using System;
+using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Collections.Generic;
using Tizen.NUI;
namespace Tizen.NUI.Scene3D
{
/// <summary>
- /// Target value of motion. It can be define as specific PropertyValue, or KeyFrames
+ /// This MotionValue be used for target value of each <see cref="MotionIndex"/>.
+ /// We can get and set MotionValue as 2 types : PropertyValue and KeyFrames.
+ ///
+ /// Each types will be cross-converted internally.
+ /// For example, when we set PropertyValue, we can get KeyFrames with 2 frames, and target value is set.
/// </summary>
+ /// <remarks>
+ /// The type of property should be matched with MotionIndex required.
+ /// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class MotionValue : IDisposable
+ public class MotionValue : BaseHandle
{
- private IDisposable internalValue = null;
-
/// <summary>
/// Determine whether current stored value is PropertyValue, or KeyFrames.
/// </summary>
/// Value is null, or invalid class.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- Invalid,
+ Invalid = -1,
/// <summary>
/// Value is PropertyValue.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- Property,
+ Property = 0,
/// <summary>
/// Value is KeyFrames.
/// Create an initialized motion value with invalid.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public MotionValue()
+ public MotionValue() : this(Interop.MotionValue.MotionValueNew(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Create an initialized motion value with PropertyValue.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionValue(PropertyValue propertyValue) : this(Interop.MotionValue.MotionValueNewPropertyValue(PropertyValue.getCPtr(propertyValue)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Create an initialized motion value with KeyFrames.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionValue(KeyFrames keyFrames) : this(Interop.MotionValue.MotionValueNewKeyFrames(KeyFrames.getCPtr(keyFrames)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Copy constructor.
+ /// </summary>
+ /// <param name="motionValue">Source object to copy.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public MotionValue(MotionValue motionValue) : this(Interop.MotionValue.NewMotionValue(MotionValue.getCPtr(motionValue)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Assignment operator.
+ /// </summary>
+ /// <param name="motionValue">Source object to be assigned.</param>
+ /// <returns>Reference to this.</returns>
+ internal MotionValue Assign(MotionValue motionValue)
+ {
+ MotionValue ret = new MotionValue(Interop.MotionValue.MotionValueAssign(SwigCPtr, MotionValue.getCPtr(motionValue)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal MotionValue(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
}
+
/// <summary>
/// Get or set the value as PropertyValue type.
- /// It will return null if value is not PropertyValue.
+ /// If ValueType is ValueType.KeyFrames, it will return last value of stored KeyFrames.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public PropertyValue Value
+ public PropertyValue PropertyValue
{
get
{
- return internalValue as PropertyValue;
+ return GetPropertyValue();
}
set
{
- internalValue = (Disposable)value;
+ SetPropertyValue(value);
}
}
/// <summary>
/// Get or set the value as KeyFrames type.
- /// It will return null if value is not KeyFrames.
+ /// If ValueType is ValueType.PropertyValue, it will create new KeyFrames by stored PropertyValue.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public KeyFrames KeyFramesValue
{
get
{
- return internalValue as KeyFrames;
+ return GetKeyFrames();
}
set
{
- internalValue = (BaseHandle)value;
+ SetKeyFrames(value);
}
}
/// <summary>
- /// Get the type of value what we setted.
+ /// Get the type of value what we set.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public ValueType Type
{
get
{
- if (internalValue is KeyFrames)
- {
- return ValueType.KeyFrames;
- }
- if (internalValue is PropertyValue)
- {
- return ValueType.Property;
- }
- return ValueType.Invalid;
+ return GetMotionValueType();
+ }
+ }
+
+ /// <summary>
+ /// Invalidate the value what we set.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Invalidate()
+ {
+ Interop.MotionValue.Clear(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal void SetPropertyValue(PropertyValue propertyValue)
+ {
+ Interop.MotionValue.SetValuePropertyValue(SwigCPtr, PropertyValue.getCPtr(propertyValue));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal PropertyValue GetPropertyValue()
+ {
+ IntPtr cPtr = Interop.MotionValue.GetPropertyValue(SwigCPtr);
+ PropertyValue ret = new PropertyValue(cPtr, true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+ internal void SetKeyFrames(KeyFrames keyFrames)
+ {
+ Interop.MotionValue.SetValueKeyFrames(SwigCPtr, KeyFrames.getCPtr(keyFrames));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal KeyFrames GetKeyFrames()
+ {
+ IntPtr cPtr = Interop.MotionValue.GetKeyFrames(SwigCPtr);
+ KeyFrames ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as KeyFrames;
+ if (ret == null)
+ {
+ // Register new animation into Registry.
+ ret = new KeyFrames(cPtr, true);
+ }
+ else
+ {
+ // We found matched NUI animation. Reduce cPtr reference count.
+ HandleRef handle = new HandleRef(this, cPtr);
+ Tizen.NUI.Interop.KeyFrames.DeleteKeyFrames(handle);
+ handle = new HandleRef(null, IntPtr.Zero);
}
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal ValueType GetMotionValueType()
+ {
+ int ret = Interop.MotionValue.GetValueType(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return (ValueType)ret;
}
/// <summary>
- /// IDisposable.Dipsose.
+ /// Release swigCPtr.
/// </summary>
+ // This will be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
- public void Dispose()
+ protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
{
- internalValue?.Dispose();
+ Interop.MotionValue.DeleteMotionValue(swigCPtr);
}
}
}
using System;
using System.ComponentModel;
+using System.Runtime.CompilerServices;
namespace Tizen.NUI
{
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_BaseHandle")]
public static extern void delete_BaseHandle(global::System.Runtime.InteropServices.HandleRef jarg1);
}
+
+ internal static class NDalicExtension
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal static global::System.Runtime.InteropServices.HandleRef ToHandleRef(this Delegate caller, object wrapper)
+ {
+ return new global::System.Runtime.InteropServices.HandleRef(wrapper, global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<Delegate>(caller));
+ }
+ }
}
mStaticRevertMotionData = new MotionData();
mAnimateMotionData = new MotionData();
+ mAnimateMotionData.Duration = modelMotionAnimationDurationMilliseconds;
+
mStaticMotionData.Add(
new MotionTransformIndex()
{
},
new MotionValue()
{
- Value = new PropertyValue(new Rotation(new Radian(new Degree(-45.0f)), Vector3.ZAxis)),
+ PropertyValue = new PropertyValue(new Rotation(new Radian(new Degree(-45.0f)), Vector3.ZAxis)),
}
);
mStaticRevertMotionData.Add(
},
new MotionValue()
{
- Value = new PropertyValue(new Rotation(new Radian(new Degree(0.0f)), Vector3.ZAxis)),
+ PropertyValue = new PropertyValue(new Rotation(new Radian(new Degree(0.0f)), Vector3.ZAxis)),
}
);
mStaticRevertMotionData.Add(
},
new MotionValue()
{
- Value = new PropertyValue(Vector3.One),
+ PropertyValue = new PropertyValue(Vector3.One),
}
);
},
new MotionValue()
{
- Value = new PropertyValue(new Vector3(0.5f, 1.5f, 1.0f)),
+ PropertyValue = new PropertyValue(new Vector3(0.5f, 1.5f, 1.0f)),
}
);
for (int i = 0; i < 8; ++i)
{
if (mModel != null && mModelLoadFinished)
{
- mMotionAnimation = mModel.GenerateMotionDataAnimation(mAnimateMotionData, modelMotionAnimationDurationMilliseconds);
+ mMotionAnimation = mModel.GenerateMotionDataAnimation(mAnimateMotionData);
if (mMotionAnimation != null)
{