Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Scene3D / src / public / ModelMotion / MotionIndex / MotionPropertyIndex.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     /// Basic <see cref="MotionIndex"/> to control Property.
27     /// It can control more general case.
28     /// </summary>
29     /// <example>
30     /// <code>
31     /// MotionPropertyIndex color = new MotionPropertyIndex(new PropertyKey("nodeName"), new PropertyKey("color"));
32     ///
33     /// // We can change the property later.
34     /// MotionPropertyIndex custom = newMotionPropertyIndex();
35     /// orientation.ModelNodeId = new PropertyKey("nodeName");
36     /// orientation.PropertyId = new PropertyKey("some_custom_property");
37     ///
38     /// // Note that all cases of MotionTransformIndex can be controled by MotionPropertyIndex
39     /// // Both position0 and position1 can control the node's Position.
40     /// MotionTransformIndex position0 = new MotionTransformIndex(new PropertyKey("nodeName"), MotionTransformIndex.TransformTypes.Position);
41     /// MotionPropertyIndex  position1 = new MotionPropertyIndex(new PropertyKey("nodeName"), new PropertyKey("position"));
42     ///
43     /// </code>
44     /// </example>
45     /// <since_tizen> 11 </since_tizen>
46     public class MotionPropertyIndex : MotionIndex
47     {
48         /// <summary>
49         /// Create an initialized motion property index.
50         /// </summary>
51         /// <since_tizen> 11 </since_tizen>
52         public MotionPropertyIndex() : this(Interop.MotionIndex.MotionPropertyIndexNew(), true)
53         {
54             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55         }
56
57         /// <summary>
58         /// Create an initialized motion property index with given node ID and property ID.
59         /// </summary>
60         /// <param name="modelNodeId">Node ID for this motion index</param>
61         /// <param name="propertyId">Property ID for this motion index</param>
62         /// <since_tizen> 11 </since_tizen>
63         public MotionPropertyIndex(PropertyKey modelNodeId, PropertyKey propertyId) : this(Interop.MotionIndex.MotionPropertyIndexNew(PropertyKey.getCPtr(modelNodeId), PropertyKey.getCPtr(propertyId)), true)
64         {
65             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
66         }
67
68         /// <summary>
69         /// Create an initialized motion property index with given node string ID and property string ID.
70         /// </summary>
71         /// <param name="modelNodeName">Node string ID for this motion index</param>
72         /// <param name="propertyName">Property string ID for this motion index</param>
73         /// <since_tizen> 11 </since_tizen>
74         public MotionPropertyIndex(string modelNodeName, string propertyName) : this(Interop.MotionIndex.MotionPropertyIndexNew(PropertyKey.getCPtr(new PropertyKey(modelNodeName)), PropertyKey.getCPtr(new PropertyKey(propertyName))), true)
75         {
76             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77         }
78
79         /// <summary>
80         /// Copy constructor.
81         /// </summary>
82         /// <param name="motionPropertyIndex">Source object to copy.</param>
83         /// <since_tizen> 11 </since_tizen>
84         public MotionPropertyIndex(MotionPropertyIndex motionPropertyIndex) : this(Interop.MotionIndex.NewMotionPropertyIndex(MotionPropertyIndex.getCPtr(motionPropertyIndex)), true)
85         {
86             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87         }
88
89         /// <summary>
90         /// Assignment operator.
91         /// </summary>
92         /// <param name="motionPropertyIndex">Source object to be assigned.</param>
93         /// <returns>Reference to this.</returns>
94         internal MotionPropertyIndex Assign(MotionPropertyIndex motionPropertyIndex)
95         {
96             MotionPropertyIndex ret = new MotionPropertyIndex(Interop.MotionIndex.MotionPropertyIndexAssign(SwigCPtr, MotionPropertyIndex.getCPtr(motionPropertyIndex)), false);
97             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98             return ret;
99         }
100
101         internal MotionPropertyIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
102         {
103         }
104
105         /// <summary>
106         /// The key of property
107         /// </summary>
108         /// <since_tizen> 11 </since_tizen>
109         public PropertyKey PropertyId
110         {
111             get
112             {
113                 return GetPropertyId();
114             }
115             set
116             {
117                 SetPropertyId(value);
118             }
119         }
120
121         internal void SetPropertyId(PropertyKey propertyId)
122         {
123             Interop.MotionIndex.SetPropertyId(SwigCPtr, Property.getCPtr(propertyId));
124             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125         }
126
127         internal PropertyKey GetPropertyId()
128         {
129             IntPtr cPtr = Interop.MotionIndex.GetPropertyId(SwigCPtr);
130             PropertyKey ret = new PropertyKey(cPtr, true);
131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132             return ret;
133         }
134
135         /// <summary>
136         /// Release swigCPtr.
137         /// </summary>
138         // This will be public opened.
139         [EditorBrowsable(EditorBrowsableState.Never)]
140         protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
141         {
142             Interop.MotionIndex.DeleteMotionPropertyIndex(swigCPtr);
143         }
144     }
145 }