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;
22 namespace Tizen.NUI.Scene3D
25 /// List of each motion value.
28 /// We don't check MotionValue type is matched with MotionIndex.
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public class MotionData : IDisposable
33 private List<(MotionIndex, MotionValue)> motionValues { get; set; } = null;
36 /// Owned motion value list.
38 [EditorBrowsable(EditorBrowsableState.Never)]
39 [Obsolete("Do not use this MotionValues property directly. Use Add and GetIndex, GetValue instead.")]
40 public List<(MotionIndex, MotionValue)> MotionValues
53 /// Append pair of MotionIndex and MotionValue end of list.
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public void Add(MotionIndex index, MotionValue value)
58 if(motionValues == null)
60 motionValues = new List<(MotionIndex, MotionValue)>();
62 motionValues.Add((index, value));
66 /// Get MotionIndex at index'th. null if invalid index inputed
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public MotionIndex GetIndex(uint index)
71 if(motionValues != null && index < motionValues.Count)
73 return motionValues[(int)index].Item1;
79 /// Get MotionValue at index'th. null if invalid index inputed
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public MotionValue GetValue(uint index)
84 if(motionValues != null && index < motionValues.Count)
86 return motionValues[(int)index].Item2;
92 /// Clear all inputed values.
94 [EditorBrowsable(EditorBrowsableState.Never)]
101 /// Create an initialized motion data.
108 /// IDisposable.Dipsose.
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public void Dispose()
113 if (motionValues != null)
115 foreach (var indexValuePair in motionValues)
117 indexValuePair.Item1?.Dispose();
118 indexValuePair.Item2?.Dispose();