[NUI.Scene3D] Make API to apply ModelMotion
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Scene3D / src / public / ModelMotion / BlendShapeIndex.cs
1 using System.Numerics;
2 /*
3  * Copyright(c) 2023 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18
19 using System;
20 using System.ComponentModel;
21 using System.Collections.Generic;
22 using Tizen.NUI;
23
24 namespace Tizen.NUI.Scene3D
25 {
26     /// <summary>
27     /// Index of BlendShape feature.
28     /// MotionValue should be float type.
29     /// </summary>
30     [EditorBrowsable(EditorBrowsableState.Never)]
31     public class BlendShapeIndex : MotionIndex
32     {
33         /// <summary>
34         /// Create an initialized motion index.
35         /// </summary>
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         public BlendShapeIndex()
38         {
39         }
40
41         /// <summary>
42         /// The key of BlendShape.
43         /// </summary>
44         [EditorBrowsable(EditorBrowsableState.Never)]
45         public PropertyKey BlendShapeId { get; set; } = null;
46
47         /// <summary>
48         /// Convert from index to DALi engine using blend shape uniform name.
49         /// </summary>
50         internal static string GetPropertyNameFromIndex(int index)
51         {
52             if (index >= 0)
53             {
54                 return "uBlendShapeWeight[" + index.ToString() + "]";
55             }
56             return null;
57         }
58
59         /// <summary>
60         /// Get uniform name of blendshape.
61         /// </summary>
62         internal override string GetPropertyName(ModelNode node)
63         {
64             if (BlendShapeId != null)
65             {
66                 if (BlendShapeId.Type == PropertyKey.KeyType.Index)
67                 {
68                     return GetPropertyNameFromIndex(BlendShapeId.IndexKey);
69                 }
70                 if (node != null)
71                 {
72                     // TODO : Not implement yet. We should make API that get the blendshape index from node by name.
73                 }
74             }
75             return null;
76         }
77     }
78 }