2 * Copyright(c) 2023 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
20 using System.Collections.Generic;
23 namespace Tizen.NUI.Scene3D
26 /// Specialized <see cref="MotionIndex"/> to control blend shape.
27 /// We can control the blend shape by index (when we set BlendShapeId as IndexKey),
28 /// or by name (when we set BlendShapeId as StringKey).
31 /// <see cref="MotionValue"/> should be float type.
35 /// BlendShapeIndex blendShapeIndex0 = new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey(0u));
36 /// BlendShapeIndex blendShapeIndex1 = new BlendShapeIndex(new PropertyKey("nodeName"), new PropertyKey("Target_1"));
38 /// // We can change the property later.
39 /// BlendShapeIndex blendShapeIndex2 = new BlendShapeIndex;
40 /// blendShapeIndex2.ModelNodeId = new PropertyKey("nodeName");
41 /// blendShapeIndex2.BlendShapeId = new PropertyKey("Target_2");
45 /// Specially, if ModelNodeId is invalid and BlendShapeId is StringKey,
46 /// It will control all ModelNode that has the inputed blend shape name.
49 /// // If "node0" and "node1" has same BlendShape named "Smile",
50 /// // blendShapeIndexAll will control both nodes.
51 /// BlendShapeIndex blendShapeIndexAll = new BlendShapeIndex(new PropertyKey("Smile"));
53 /// BlendShapeIndex blendShapeIndex0 = new BlendShapeIndex(new PropertyKey("node0"), new PropertyKey("Smile"));
54 /// BlendShapeIndex blendShapeIndex1 = new BlendShapeIndex(new PropertyKey("node1"), new PropertyKey("Smile"));
57 /// <since_tizen> 11 </since_tizen>
58 public class BlendShapeIndex : MotionIndex
61 /// Create an initialized blend shape index.
63 /// <since_tizen> 11 </since_tizen>
64 public BlendShapeIndex() : this(Interop.MotionIndex.BlendShapeIndexNew(), true)
66 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
70 /// Create an initialized blend shape index with invalid node ID, and given blend shape ID.
72 /// <param name="blendShapeId">Blend shape ID for this motion index</param>
73 /// <since_tizen> 11 </since_tizen>
74 public BlendShapeIndex(PropertyKey blendShapeId) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(blendShapeId)), true)
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80 /// Create an initialized blend shape index with given node ID and blend shape ID.
82 /// <param name="modelNodeId">Node ID for this motion index</param>
83 /// <param name="blendShapeId">Blend shape ID for this motion index</param>
84 /// <since_tizen> 11 </since_tizen>
85 public BlendShapeIndex(PropertyKey modelNodeId, PropertyKey blendShapeId) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(modelNodeId), PropertyKey.getCPtr(blendShapeId)), true)
87 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 /// Create an initialized blend shape index with invalid node ID, and given blend shape string ID.
93 /// <param name="blendShapeName">Blend shape string ID for this motion index</param>
94 /// <since_tizen> 11 </since_tizen>
95 public BlendShapeIndex(string blendShapeName) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(new PropertyKey(blendShapeName))), true)
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101 /// Create an initialized blend shape index with given node string ID and blend shape string ID.
103 /// <param name="modelNodeName">Node string ID for this motion index</param>
104 /// <param name="blendShapeName">Blend shape string ID for this motion index</param>
105 /// <since_tizen> 11 </since_tizen>
106 public BlendShapeIndex(string modelNodeName, string blendShapeName) : this(Interop.MotionIndex.BlendShapeIndexNew(PropertyKey.getCPtr(new PropertyKey(modelNodeName)), PropertyKey.getCPtr(new PropertyKey(blendShapeName))), true)
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112 /// Copy constructor.
114 /// <param name="blendShapeIndex">Source object to copy.</param>
115 /// <since_tizen> 11 </since_tizen>
116 public BlendShapeIndex(BlendShapeIndex blendShapeIndex) : this(Interop.MotionIndex.NewBlendShapeIndex(BlendShapeIndex.getCPtr(blendShapeIndex)), true)
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 /// Assignment operator.
124 /// <param name="blendShapeIndex">Source object to be assigned.</param>
125 /// <returns>Reference to this.</returns>
126 internal BlendShapeIndex Assign(BlendShapeIndex blendShapeIndex)
128 BlendShapeIndex ret = new BlendShapeIndex(Interop.MotionIndex.BlendShapeIndexAssign(SwigCPtr, BlendShapeIndex.getCPtr(blendShapeIndex)), false);
129 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
133 internal BlendShapeIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
138 /// The key of blend shape.
140 /// <since_tizen> 11 </since_tizen>
141 public PropertyKey BlendShapeId
145 return GetBlendShapeId();
149 SetBlendShapeId(value);
153 internal void SetBlendShapeId(PropertyKey blendShapeId)
155 Interop.MotionIndex.SetBlendShapeId(SwigCPtr, Property.getCPtr(blendShapeId));
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 internal PropertyKey GetBlendShapeId()
161 IntPtr cPtr = Interop.MotionIndex.GetBlendShapeId(SwigCPtr);
162 PropertyKey ret = new PropertyKey(cPtr, true);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// Release swigCPtr.
170 // This will be public opened.
171 [EditorBrowsable(EditorBrowsableState.Never)]
172 protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
174 Interop.MotionIndex.DeleteBlendShapeIndex(swigCPtr);