[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / model-motion / motion-index / blend-shape-index.h
1 #ifndef DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_H
2 #define DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_H
3
4 /*
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali-scene3d/public-api/model-motion/motion-index/motion-index.h>
25
26 namespace Dali
27 {
28 namespace Scene3D
29 {
30 //Forward declarations.
31 namespace Internal
32 {
33 class BlendShapeIndex;
34 } // namespace Internal
35
36 /**
37  * @addtogroup dali_scene3d_model_motion_blend_shape_index
38  * @{
39  */
40
41 /**
42  * @brief Specialized MotionIndex to control blend shape.
43  * We can control the blend shape by index (when we set BlendShapeId as IndexKey),
44  * or by name (when we set BlendShapeId as StringKey).
45  *
46  * MotionValue should be float type.
47  *
48  * @code
49  *
50  * BlendShapeIndex blendShapeIndex0 = BlendShapeIndex::New("nodeName", 0u);
51  * BlendShapeIndex blendShapeIndex1 = BlendShapeIndex::New("nodeName", "Target_1");
52  *
53  * // We can change the property later.
54  * BlendShapeIndex blendShapeIndex2 = BlendShapeIndex::New();
55  * blendShapeIndex2.SetModelNodeId("nodeName");
56  * blendShapeIndex2.SetBlendShapeId("Target_2");
57  *
58  * @endcode
59  *
60  * Specially, if ModelNodeId is Property::INVALID_KEY and BlendShapeId is StringKey,
61  * It will control all ModelNode that has the inputed BlendShape name.
62  *
63  * @code
64  *
65  * // If "node0" and "node1" has same BlendShape named "Smile",
66  * // blendShapeIndexAll will control both nodes.
67  * BlendShapeIndex blendShapeIndexAll = BlendShapeIndex::New("Smile");
68  *
69  * BlendShapeIndex blendShapeIndex0 = BlendShapeIndex::New("node0", "Smile");
70  * BlendShapeIndex blendShapeIndex1 = BlendShapeIndex::New("node1", "Smile");
71  *
72  * @endcode
73  *
74  * @SINCE_2_2.34
75  */
76 class DALI_SCENE3D_API BlendShapeIndex : public MotionIndex
77 {
78 public: // Creation & Destruction
79   /**
80    * @brief Create an initialized BlendShapeIndex.
81    *
82    * @SINCE_2_2.34
83    * @return A handle to a newly allocated Dali resource
84    */
85   static BlendShapeIndex New();
86
87   /**
88    * @brief Create an initialized BlendShapeIndex with values. It will hold invalid ModelNodeId.
89    *
90    * @SINCE_2_2.34
91    * @param[in] blendShapeId The id of blend shape what this motion index looks.
92    * @return A handle to a newly allocated Dali resource
93    */
94   static BlendShapeIndex New(Property::Key blendShapeId);
95
96   /**
97    * @brief Create an initialized BlendShapeIndex with values.
98    *
99    * @SINCE_2_2.34
100    * @param[in] modelNodeId The id of model node what this motion index looks.
101    * @param[in] blendShapeId The id of blend shape what this motion index looks.
102    * @return A handle to a newly allocated Dali resource
103    */
104   static BlendShapeIndex New(Property::Key modelNodeId, Property::Key blendShapeId);
105
106   /**
107    * @brief Creates an uninitialized BlendShapeIndex.
108    *
109    * Only derived versions can be instantiated. Calling member
110    * functions with an uninitialized Dali::Object is not allowed.
111    *
112    * @SINCE_2_2.34
113    */
114   BlendShapeIndex();
115
116   /**
117    * @brief Destructor.
118    *
119    * This is non-virtual since derived Handle types must not contain data or virtual methods.
120    *
121    * @SINCE_2_2.34
122    */
123   ~BlendShapeIndex();
124
125   /**
126    * @brief Copy constructor.
127    *
128    * @SINCE_2_2.34
129    * @param[in] blendShapeIndex Handle to an object
130    */
131   BlendShapeIndex(const BlendShapeIndex& blendShapeIndex);
132
133   /**
134    * @brief Move constructor
135    *
136    * @SINCE_2_2.34
137    * @param[in] rhs A reference to the moved handle
138    */
139   BlendShapeIndex(BlendShapeIndex&& rhs) noexcept;
140
141   /**
142    * @brief Assignment operator.
143    *
144    * @SINCE_2_2.34
145    * @param[in] blendShapeIndex Handle to an object
146    * @return reference to this
147    */
148   BlendShapeIndex& operator=(const BlendShapeIndex& blendShapeIndex);
149
150   /**
151    * @brief Move assignment
152    *
153    * @SINCE_2_2.34
154    * @param[in] rhs A reference to the moved handle
155    * @return A reference to this
156    */
157   BlendShapeIndex& operator=(BlendShapeIndex&& rhs) noexcept;
158
159   /**
160    * @brief Downcasts an Object handle to BlendShapeIndex.
161    *
162    * If handle points to a BlendShapeIndex, the downcast produces valid handle.
163    * If not, the returned handle is left uninitialized.
164    *
165    * @SINCE_2_2.34
166    * @param[in] handle Handle to an object
167    * @return Handle to a BlendShapeIndex or an uninitialized handle
168    */
169   static BlendShapeIndex DownCast(BaseHandle handle);
170
171 public: // Public Method
172   /**
173    * @brief Set the id of BlendShape what this motion index looks.
174    *
175    * @SINCE_2_2.34
176    * @param[in] blendShapeId The blend shape id.
177    */
178   void SetBlendShapeId(Property::Key blendShapeId);
179
180   /**
181    * @brief Get the id of BlendShape what this motion index looks.
182    *
183    * @SINCE_2_2.34
184    * @return The blend shape id.
185    */
186   Property::Key GetBlendShapeId() const;
187
188 public: // Not intended for application developers
189   /// @cond internal
190   /**
191    * @brief Creates a handle using the Scene3D::Internal implementation.
192    *
193    * @param[in] implementation The BlendShapeIndex implementation
194    */
195   DALI_INTERNAL BlendShapeIndex(Dali::Scene3D::Internal::BlendShapeIndex* implementation);
196   /// @endcond
197 };
198
199 /**
200  * @}
201  */
202
203 } // namespace Scene3D
204
205 } // namespace Dali
206
207 #endif // DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_H