Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Scene3D / src / public / ModelMotion / MotionIndex / MotionIndex.cs
1 /*
2  * Copyright(c) 2023 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20 using System.Collections.Generic;
21 using Tizen.NUI;
22
23 namespace Tizen.NUI.Scene3D
24 {
25     /// <summary>
26     /// Index of motion value. It will be used to specify the target of motion applied.
27     /// There are three kinds of MotionIndex : <see cref="MotionPropertyIndex"/>, <see cref="MotionTransformIndex"/> and <see cref="BlendShapeIndex"/>.
28     /// MotionPropertyIndex will be used for control all kind of properties.
29     /// The <see cref="MotionData"/> loaded from files / buffer will have this kind of MotionIndex.
30     /// MotionTransformIndex will be used for control the <see cref="ModelNode"/>'s Position / Orientation / Scale, or each components.
31     /// BlendShapeIndex will be used for control some blend shape animation.
32     /// </summary>
33     /// <remarks>
34     /// We can use below cases.
35     /// <table>
36     ///  <tr><td>ModelNodeId KeyType</td><td>MotionIndex class                                 </td><td>Description                             </td></tr>
37     ///  <tr><td>KeyType.String     </td><td>MotionTransformIndex                              </td><td>Target is ModelNode's transform property</td></tr>
38     ///  <tr><td>KeyType.String     </td><td>BlendShapeIndex (with BlendShapeId KeyType.Index) </td><td>Target is ModelNode's BlendShape        </td></tr>
39     ///  <tr><td>KeyType.String     </td><td>BlendShapeIndex (with BlendShapeId KeyType.String)</td><td>Target is ModelNode's BlendShape        </td></tr>
40     ///  <tr><td>(null)             </td><td>BlendShapeIndex (with BlendShapeId KeyType.String)</td><td>Target is all ModelNode's BlendShape    </td></tr>
41     /// </table>
42     /// All other cases are invalid.
43     /// </remarks>
44     /// <since_tizen> 11 </since_tizen>
45     public class MotionIndex : BaseHandle
46     {
47         /// <summary>
48         /// Copy constructor.
49         /// </summary>
50         /// <param name="motionIndex">Source object to copy.</param>
51         /// <since_tizen> 11 </since_tizen>
52         public MotionIndex(MotionIndex motionIndex) : this(Interop.MotionIndex.NewMotionIndex(MotionIndex.getCPtr(motionIndex)), true)
53         {
54             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55         }
56
57         /// <summary>
58         /// Assignment operator.
59         /// </summary>
60         /// <param name="motionIndex">Source object to be assigned.</param>
61         /// <returns>Reference to this.</returns>
62         internal MotionIndex Assign(MotionIndex motionIndex)
63         {
64             MotionIndex ret = new MotionIndex(Interop.MotionIndex.MotionIndexAssign(SwigCPtr, MotionIndex.getCPtr(motionIndex)), false);
65             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66             return ret;
67         }
68
69         internal MotionIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
70         {
71         }
72
73         /// <summary>
74         /// The ID of ModelNode. If you want to apply to all ModelNodes who has BlendShape string, assign null.
75         /// </summary>
76         /// <since_tizen> 11 </since_tizen>
77         public PropertyKey ModelNodeId
78         {
79             get
80             {
81                 return GetModelNodeId();
82             }
83             set
84             {
85                 SetModelNodeId(value);
86             }
87         }
88
89         internal void SetModelNodeId(PropertyKey modelNodeId)
90         {
91             Interop.MotionIndex.SetModelNodeId(SwigCPtr, Property.getCPtr(modelNodeId));
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93         }
94
95         internal PropertyKey GetModelNodeId()
96         {
97             IntPtr cPtr = Interop.MotionIndex.GetModelNodeId(SwigCPtr);
98             PropertyKey ret = new PropertyKey(cPtr, true);
99             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100             return ret;
101         }
102
103         /// <summary>
104         /// Release swigCPtr.
105         /// </summary>
106         // This will be public opened.
107         [EditorBrowsable(EditorBrowsableState.Never)]
108         protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
109         {
110             Interop.MotionIndex.DeleteMotionIndex(swigCPtr);
111         }
112     }
113 }