[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / model-motion / motion-index / motion-property-index-impl.cpp
1 /*
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-scene3d/internal/model-motion/motion-index/motion-property-index-impl.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/type-registry-helper.h>
23 #include <dali/public-api/object/type-registry.h>
24
25 // INTERNAL INCLUDES
26
27 namespace Dali
28 {
29 namespace Scene3D
30 {
31 namespace Internal
32 {
33 namespace
34 {
35 /**
36  * Creates control through type registry
37  */
38 BaseHandle Create()
39 {
40   return Scene3D::MotionPropertyIndex::New();
41 }
42
43 // Setup properties, signals and actions using the type-registry.
44 DALI_TYPE_REGISTRATION_BEGIN(Scene3D::MotionPropertyIndex, Dali::BaseHandle, Create);
45 DALI_TYPE_REGISTRATION_END()
46
47 } // namespace
48
49 MotionPropertyIndexPtr MotionPropertyIndex::New()
50 {
51   MotionPropertyIndexPtr motionPropertyIndex = new MotionPropertyIndex();
52
53   motionPropertyIndex->Initialize();
54
55   return motionPropertyIndex;
56 }
57
58 MotionPropertyIndex::MotionPropertyIndex()
59 {
60 }
61
62 MotionPropertyIndex::~MotionPropertyIndex()
63 {
64 }
65
66 void MotionPropertyIndex::Initialize()
67 {
68 }
69
70 void MotionPropertyIndex::SetPropertyId(Property::Key propertyId)
71 {
72   mPropertyId = propertyId;
73 }
74
75 Property::Key MotionPropertyIndex::GetPropertyId() const
76 {
77   return mPropertyId;
78 }
79
80 std::string MotionPropertyIndex::GetPropertyName(Scene3D::ModelNode node)
81 {
82   if(mPropertyId.type == Property::Key::Type::STRING)
83   {
84     return mPropertyId.stringKey;
85   }
86   return "";
87 }
88
89 Property::Index MotionPropertyIndex::GetPropertyIndex(Scene3D::ModelNode node)
90 {
91   if(mPropertyId.type == Property::Key::Type::INDEX)
92   {
93     return mPropertyId.indexKey;
94   }
95   return Property::INVALID_INDEX;
96 }
97
98 } // namespace Internal
99
100 } // namespace Scene3D
101
102 } // namespace Dali