[dali_2.2.34] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / model-motion / motion-index / motion-transform-index.h
1 #ifndef DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H
2 #define DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_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 MotionTransformIndex;
34 } // namespace Internal
35
36 /**
37  * @addtogroup dali_scene3d_model_motion_motion_transform_index
38  * @{
39  */
40
41 /**
42  * @brief Specialized MotionIndex to control transform.
43  * It will be used when app developer don't care about Dali::Actor::Property list,
44  * but want to change the transform properties anyway fast enough.
45  *
46  * @code
47  *
48  * MotionTransformIndex position = MotionTransformIndex::New("nodeName", MotionTransformIndex::TransformType::POSITION);
49  *
50  * // We can change the property later.
51  * MotionTransformIndex orientation = MotionTransformIndex::New();
52  * orientation.SetModelNodeId("nodeName");
53  * orientation.SetTransformType(MotionTransformIndex::TransformType::ORIENTATION);
54  *
55  * @endcode
56  *
57  * @SINCE_2_2.34
58  */
59 class DALI_SCENE3D_API MotionTransformIndex : public MotionIndex
60 {
61 public:
62   /**
63    * @brief The type of Transform
64    * @SINCE_2_2.34
65    */
66   enum class TransformType
67   {
68     INVALID = -1,
69
70     POSITION = 0, ///< The position of ModelNode. MotionValue should be Vector3.
71     POSITION_X,   ///< The x position of ModelNode. MotionValue should be float.
72     POSITION_Y,   ///< The y position of ModelNode. MotionValue should be float.
73     POSITION_Z,   ///< The z position of ModelNode. MotionValue should be float.
74
75     ORIENTATION, ///< The orientation of ModelNode. MotionValue should be Quaternion.
76
77     SCALE,   ///< The scale of ModelNode. MotionValue should be Vector3.
78     SCALE_X, ///< The x scale of ModelNode. MotionValue should be float.
79     SCALE_Y, ///< The y scale of ModelNode. MotionValue should be float.
80     SCALE_Z, ///< The z scale of ModelNode. MotionValue should be float.
81   };
82
83 public: // Creation & Destruction
84   /**
85    * @brief Create an initialized MotionTransformIndex.
86    *
87    * @SINCE_2_2.34
88    * @return A handle to a newly allocated Dali resource
89    */
90   static MotionTransformIndex New();
91
92   /**
93    * @brief Create an initialized MotionTransformIndex with values.
94    *
95    * @SINCE_2_2.34
96    * @param[in] modelNodeId The id of model node what this motion index looks.
97    * @param[in] type The type of transform what this motion index looks.
98    * @return A handle to a newly allocated Dali resource
99    */
100   static MotionTransformIndex New(Property::Key modelNodeId, TransformType type);
101
102   /**
103    * @brief Creates an uninitialized MotionTransformIndex.
104    *
105    * Only derived versions can be instantiated. Calling member
106    * functions with an uninitialized Dali::Object is not allowed.
107    *
108    * @SINCE_2_2.34
109    */
110   MotionTransformIndex();
111
112   /**
113    * @brief Destructor.
114    *
115    * This is non-virtual since derived Handle types must not contain data or virtual methods.
116    *
117    * @SINCE_2_2.34
118    */
119   ~MotionTransformIndex();
120
121   /**
122    * @brief Copy constructor.
123    *
124    * @SINCE_2_2.34
125    * @param[in] motionTransformIndex Handle to an object
126    */
127   MotionTransformIndex(const MotionTransformIndex& motionTransformIndex);
128
129   /**
130    * @brief Move constructor
131    *
132    * @SINCE_2_2.34
133    * @param[in] rhs A reference to the moved handle
134    */
135   MotionTransformIndex(MotionTransformIndex&& rhs) noexcept;
136
137   /**
138    * @brief Assignment operator.
139    *
140    * @SINCE_2_2.34
141    * @param[in] motionTransformIndex Handle to an object
142    * @return reference to this
143    */
144   MotionTransformIndex& operator=(const MotionTransformIndex& motionTransformIndex);
145
146   /**
147    * @brief Move assignment
148    *
149    * @SINCE_2_2.34
150    * @param[in] rhs A reference to the moved handle
151    * @return A reference to this
152    */
153   MotionTransformIndex& operator=(MotionTransformIndex&& rhs) noexcept;
154
155   /**
156    * @brief Downcasts an Object handle to MotionTransformIndex.
157    *
158    * If handle points to a MotionTransformIndex, the downcast produces valid handle.
159    * If not, the returned handle is left uninitialized.
160    *
161    * @SINCE_2_2.34
162    * @param[in] handle Handle to an object
163    * @return Handle to a MotionTransformIndex or an uninitialized handle
164    */
165   static MotionTransformIndex DownCast(BaseHandle handle);
166
167 public: // Public Method
168   /**
169    * @brief Set the type of transform what this motion index looks.
170    *
171    * @SINCE_2_2.34
172    * @param[in] type The type of transform.
173    */
174   void SetTransformType(TransformType type);
175
176   /**
177    * @brief Get the type of transform what this motion index looks.
178    *
179    * @SINCE_2_2.34
180    * @return The type of transform.
181    */
182   TransformType GetTransformType() const;
183
184 public: // Not intended for application developers
185   /// @cond internal
186   /**
187    * @brief Creates a handle using the Scene3D::Internal implementation.
188    *
189    * @param[in] implementation The MotionTransformIndex implementation
190    */
191   DALI_INTERNAL MotionTransformIndex(Dali::Scene3D::Internal::MotionTransformIndex* implementation);
192   /// @endcond
193 };
194
195 /**
196  * @}
197  */
198
199 } // namespace Scene3D
200
201 } // namespace Dali
202
203 #endif // DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H