1 #ifndef DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_H
2 #define DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include <dali-scene3d/public-api/model-motion/motion-index/motion-index.h>
30 //Forward declarations.
33 class BlendShapeIndex;
34 } // namespace Internal
37 * @addtogroup dali_scene3d_model_motion_blend_shape_index
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)
48 * BlendShapeIndex blendShapeIndex0 = BlendShapeIndex::New("nodeName", 0u);
49 * BlendShapeIndex blendShapeIndex1 = BlendShapeIndex::New("nodeName", "Target_1");
51 * // We can change the property later.
52 * BlendShapeIndex blendShapeIndex2 = BlendShapeIndex::New();
53 * blendShapeIndex2.SetModelNodeId("nodeName");
54 * blendShapeIndex2.SetBlendShapeId("Target_2");
58 * Specially, if ModelNodeId is Property::INVALID_KEY and BlendShapeId is StringKey,
59 * It will control all ModelNode that has the inputed BlendShape name.
63 * // If "node0" and "node1" has same BlendShape named "Smile",
64 * // blendShapeIndexAll will control both nodes.
65 * BlendShapeIndex blendShapeIndexAll = BlendShapeIndex::New("Smile");
67 * BlendShapeIndex blendShapeIndex0 = BlendShapeIndex::New("node0", "Smile");
68 * BlendShapeIndex blendShapeIndex1 = BlendShapeIndex::New("node1", "Smile");
74 class DALI_SCENE3D_API BlendShapeIndex : public MotionIndex
76 public: // Creation & Destruction
78 * @brief Create an initialized BlendShapeIndex.
81 * @return A handle to a newly allocated Dali resource
83 static BlendShapeIndex New();
86 * @brief Create an initialized BlendShapeIndex with values. It will hold invalid ModelNodeId.
89 * @param[in] blendShapeId The id of blend shape what this motion index looks.
90 * @return A handle to a newly allocated Dali resource
92 static BlendShapeIndex New(Property::Key blendShapeId);
95 * @brief Create an initialized BlendShapeIndex with values.
98 * @param[in] modelNodeId The id of model node what this motion index looks.
99 * @param[in] blendShapeId The id of blend shape what this motion index looks.
100 * @return A handle to a newly allocated Dali resource
102 static BlendShapeIndex New(Property::Key modelNodeId, Property::Key blendShapeId);
105 * @brief Creates an uninitialized BlendShapeIndex.
107 * Only derived versions can be instantiated. Calling member
108 * functions with an uninitialized Dali::Object is not allowed.
117 * This is non-virtual since derived Handle types must not contain data or virtual methods.
124 * @brief Copy constructor.
127 * @param[in] blendShapeIndex Handle to an object
129 BlendShapeIndex(const BlendShapeIndex& blendShapeIndex);
132 * @brief Move constructor
135 * @param[in] rhs A reference to the moved handle
137 BlendShapeIndex(BlendShapeIndex&& rhs) noexcept;
140 * @brief Assignment operator.
143 * @param[in] blendShapeIndex Handle to an object
144 * @return reference to this
146 BlendShapeIndex& operator=(const BlendShapeIndex& blendShapeIndex);
149 * @brief Move assignment
152 * @param[in] rhs A reference to the moved handle
153 * @return A reference to this
155 BlendShapeIndex& operator=(BlendShapeIndex&& rhs) noexcept;
158 * @brief Downcasts an Object handle to BlendShapeIndex.
160 * If handle points to a BlendShapeIndex, the downcast produces valid handle.
161 * If not, the returned handle is left uninitialized.
164 * @param[in] handle Handle to an object
165 * @return Handle to a BlendShapeIndex or an uninitialized handle
167 static BlendShapeIndex DownCast(BaseHandle handle);
169 public: // Public Method
171 * @brief Set the id of BlendShape what this motion index looks.
174 * @param[in] blendShapeId The blend shape id.
176 void SetBlendShapeId(Property::Key blendShapeId);
179 * @brief Get the id of BlendShape what this motion index looks.
182 * @return The blend shape id.
184 Property::Key GetBlendShapeId() const;
186 public: // Not intended for application developers
189 * @brief Creates a handle using the Scene3D::Internal implementation.
191 * @param[in] implementation The BlendShapeIndex implementation
193 DALI_INTERNAL BlendShapeIndex(Dali::Scene3D::Internal::BlendShapeIndex* implementation);
201 } // namespace Scene3D
205 #endif // DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_H