[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / model-motion / motion-index / blend-shape-index-impl.h
1 #ifndef DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_IMPL_H
2 #define DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_IMPL_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 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/common/intrusive-ptr.h>
24 #include <dali/public-api/object/base-object.h>
25
26 // INTERNAL INCLUDES
27 #include <dali-scene3d/internal/model-motion/motion-index/motion-index-impl.h>
28 #include <dali-scene3d/public-api/model-motion/motion-index/blend-shape-index.h>
29
30 namespace Dali
31 {
32 namespace Scene3D
33 {
34 namespace Internal
35 {
36 using BlendShapeIndexPtr = IntrusivePtr<BlendShapeIndex>;
37
38 /**
39  * @brief Internal data for Scene3D::BlendShapeIndex.
40  */
41 class BlendShapeIndex : public MotionIndex
42 {
43 public: // Creation & Destruction
44   /**
45    * @brief Create a new BlendShapeIndex object.
46    * @return A smart-pointer to the newly allocated BlendShapeIndex.
47    */
48   static BlendShapeIndexPtr New();
49
50 protected:
51   /**
52    * @brief Construct a new BlendShapeIndex.
53    */
54   BlendShapeIndex();
55
56   /**
57    * @brief Second-phase constructor.
58    */
59   void Initialize();
60
61   /**
62    * @brief Virtual destructor.
63    */
64   virtual ~BlendShapeIndex();
65
66 public: // Public Method
67   /**
68    * @copydoc Dali::Scene3D::BlendShapeIndex::SetBlendShapeId()
69    */
70   void SetBlendShapeId(Property::Key blendShapeId);
71
72   /**
73    * @copydoc Dali::Scene3D::BlendShapeIndex::GetBlendShapeId()
74    */
75   Property::Key GetBlendShapeId() const;
76
77 public: // MotionIndex Override Method
78   /**
79    * @copydoc Dali::Scene3D::Internal::MotionIndex::GetPropertyName()
80    */
81   std::string GetPropertyName(Scene3D::ModelNode node = Scene3D::ModelNode()) override;
82
83   /**
84    * @copydoc Dali::Scene3D::Internal::MotionIndex::GetPropertyIndex()
85    */
86   Property::Index GetPropertyIndex(Scene3D::ModelNode node = Scene3D::ModelNode()) override;
87
88 protected:
89   Property::Key mBlendShapeId{Property::INVALID_KEY}; ///< The id of blend shape
90 };
91
92 } // namespace Internal
93
94 // Helpers for public-api forwarding methods
95
96 inline Internal::BlendShapeIndex& GetImplementation(Dali::Scene3D::BlendShapeIndex& blendShapeIndex)
97 {
98   DALI_ASSERT_ALWAYS(blendShapeIndex && "BlendShapeIndex handle is empty");
99
100   BaseObject& handle = blendShapeIndex.GetBaseObject();
101
102   return static_cast<Internal::BlendShapeIndex&>(handle);
103 }
104
105 inline const Internal::BlendShapeIndex& GetImplementation(const Dali::Scene3D::BlendShapeIndex& blendShapeIndex)
106 {
107   DALI_ASSERT_ALWAYS(blendShapeIndex && "BlendShapeIndex handle is empty");
108
109   const BaseObject& handle = blendShapeIndex.GetBaseObject();
110
111   return static_cast<const Internal::BlendShapeIndex&>(handle);
112 }
113
114 } // namespace Scene3D
115
116 } // namespace Dali
117
118 #endif // DALI_SCENE3D_MODEL_MOTION_BLEND_SHAPE_INDEX_IMPL_H