[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / model-motion / motion-data.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/public-api/model-motion/motion-data.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-scene3d/internal/model-motion/motion-data-impl.h>
23
24 namespace Dali
25 {
26 namespace Scene3D
27 {
28 MotionData MotionData::New()
29 {
30   Internal::MotionDataPtr internal = Internal::MotionData::New();
31
32   return MotionData(internal.Get());
33 }
34
35 MotionData MotionData::New(float durationSeconds)
36 {
37   Internal::MotionDataPtr internal = Internal::MotionData::New();
38
39   internal->SetDuration(durationSeconds);
40
41   return MotionData(internal.Get());
42 }
43
44 MotionData::MotionData()
45 {
46 }
47
48 MotionData::MotionData(const MotionData& motionData) = default;
49
50 MotionData::MotionData(MotionData&& rhs) noexcept = default;
51
52 MotionData::~MotionData()
53 {
54 }
55
56 MotionData& MotionData::operator=(const MotionData& handle) = default;
57
58 MotionData& MotionData::operator=(MotionData&& rhs) noexcept = default;
59
60 MotionData MotionData::DownCast(BaseHandle handle)
61 {
62   return MotionData(dynamic_cast<Dali::Scene3D::Internal::MotionData*>(handle.GetObjectPtr()));
63 }
64
65 MotionData::MotionData(Dali::Scene3D::Internal::MotionData* internal)
66 : BaseHandle(internal)
67 {
68 }
69
70 // Public Method
71
72 uint32_t MotionData::GetMotionCount() const
73 {
74   return GetImplementation(*this).GetMotionCount();
75 }
76
77 MotionIndex MotionData::GetIndex(uint32_t index) const
78 {
79   return GetImplementation(*this).GetIndex(index);
80 }
81
82 MotionValue MotionData::GetValue(uint32_t index) const
83 {
84   return GetImplementation(*this).GetValue(index);
85 }
86
87 void MotionData::Add(MotionIndex index, MotionValue value)
88 {
89   GetImplementation(*this).Add(index, value);
90 }
91
92 void MotionData::Clear()
93 {
94   GetImplementation(*this).Clear();
95 }
96
97 void MotionData::SetDuration(float durationSeconds)
98 {
99   GetImplementation(*this).SetDuration(durationSeconds);
100 }
101
102 float MotionData::GetDuration() const
103 {
104   return GetImplementation(*this).GetDuration();
105 }
106
107 void MotionData::LoadBvh(const std::string& path, const Vector3& scale, bool synchronousLoad)
108 {
109   GetImplementation(*this).LoadBvh(path, false, scale, synchronousLoad);
110 }
111
112 void MotionData::LoadBvh(const std::string& path, bool useRootTranslationOnly, const Vector3& scale, bool synchronousLoad)
113 {
114   GetImplementation(*this).LoadBvh(path, useRootTranslationOnly, scale, synchronousLoad);
115 }
116
117 void MotionData::LoadBvhFromBuffer(const uint8_t* rawBuffer, int rawBufferLength, const Vector3& scale, bool synchronousLoad)
118 {
119   GetImplementation(*this).LoadBvhFromBuffer(rawBuffer, rawBufferLength, false, scale, synchronousLoad);
120 }
121
122 void MotionData::LoadBvhFromBuffer(const uint8_t* rawBuffer, int rawBufferLength, bool useRootTranslationOnly, const Vector3& scale, bool synchronousLoad)
123 {
124   GetImplementation(*this).LoadBvhFromBuffer(rawBuffer, rawBufferLength, useRootTranslationOnly, scale, synchronousLoad);
125 }
126
127 void MotionData::LoadFacialAnimation(const std::string& url, bool synchronousLoad)
128 {
129   GetImplementation(*this).LoadFacialAnimation(url, synchronousLoad);
130 }
131
132 void MotionData::LoadFacialAnimationFromBuffer(const uint8_t* rawBuffer, int rawBufferLength, bool synchronousLoad)
133 {
134   GetImplementation(*this).LoadFacialAnimationFromBuffer(rawBuffer, rawBufferLength, synchronousLoad);
135 }
136
137 MotionData::LoadCompletedSignalType& MotionData::LoadCompletedSignal()
138 {
139   return GetImplementation(*this).LoadCompletedSignal();
140 }
141
142 } // namespace Scene3D
143
144 } // namespace Dali