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 Dali's 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     [EditorBrowsable(EditorBrowsableState.Never)]
46     public class MotionPropertyIndex : MotionIndex
47     {
48         /// <summary>
49         /// Create an initialized blend shape index.
50         /// </summary>
51         [EditorBrowsable(EditorBrowsableState.Never)]
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 blend shape index with input node id, and property id.
59         /// </summary>
60         [EditorBrowsable(EditorBrowsableState.Never)]
61         public MotionPropertyIndex(PropertyKey modelNodeId, PropertyKey propertyId) : this(Interop.MotionIndex.MotionPropertyIndexNew(PropertyKey.getCPtr(modelNodeId), PropertyKey.getCPtr(propertyId)), true)
62         {
63             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
64         }
65
66         /// <summary>
67         /// Copy constructor.
68         /// </summary>
69         /// <param name="motionPropertyIndex">Source object to copy.</param>
70         [EditorBrowsable(EditorBrowsableState.Never)]
71         public MotionPropertyIndex(MotionPropertyIndex motionPropertyIndex) : this(Interop.MotionIndex.NewMotionPropertyIndex(MotionPropertyIndex.getCPtr(motionPropertyIndex)), true)
72         {
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74         }
75
76         /// <summary>
77         /// Assignment operator.
78         /// </summary>
79         /// <param name="motionPropertyIndex">Source object to be assigned.</param>
80         /// <returns>Reference to this.</returns>
81         internal MotionPropertyIndex Assign(MotionPropertyIndex motionPropertyIndex)
82         {
83             MotionPropertyIndex ret = new MotionPropertyIndex(Interop.MotionIndex.MotionPropertyIndexAssign(SwigCPtr, MotionPropertyIndex.getCPtr(motionPropertyIndex)), false);
84             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85             return ret;
86         }
87
88         internal MotionPropertyIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
89         {
90         }
91
92         /// <summary>
93         /// The key of property
94         /// </summary>
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public PropertyKey PropertyId
97         {
98             get
99             {
100                 return GetPropertyId();
101             }
102             set
103             {
104                 SetPropertyId(value);
105             }
106         }
107
108         internal void SetPropertyId(PropertyKey propertyId)
109         {
110             Interop.MotionIndex.SetPropertyId(SwigCPtr, Property.getCPtr(propertyId));
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112         }
113
114         internal PropertyKey GetPropertyId()
115         {
116             IntPtr cPtr = Interop.MotionIndex.GetPropertyId(SwigCPtr);
117             PropertyKey ret = new PropertyKey(cPtr, true);
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             return ret;
120         }
121
122         /// <summary>
123         /// Release swigCPtr.
124         /// </summary>
125         // This will be public opened.
126         [EditorBrowsable(EditorBrowsableState.Never)]
127         protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
128         {
129             Interop.MotionIndex.DeleteMotionPropertyIndex(swigCPtr);
130         }
131     }
132 }