2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali-scene3d/internal/model-motion/motion-index/motion-transform-index-impl.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/public-api/object/type-registry-helper.h>
24 #include <dali/public-api/object/type-registry.h>
37 * Creates control through type registry
41 return Scene3D::MotionTransformIndex::New();
44 // Setup properties, signals and actions using the type-registry.
45 DALI_TYPE_REGISTRATION_BEGIN(Scene3D::MotionTransformIndex, Dali::BaseHandle, Create);
46 DALI_TYPE_REGISTRATION_END()
49 MotionTransformIndexPtr MotionTransformIndex::New()
51 MotionTransformIndexPtr motionTransformIndex = new MotionTransformIndex();
53 motionTransformIndex->Initialize();
55 return motionTransformIndex;
58 MotionTransformIndex::MotionTransformIndex()
62 MotionTransformIndex::~MotionTransformIndex()
66 void MotionTransformIndex::Initialize()
70 void MotionTransformIndex::SetTransformType(Scene3D::MotionTransformIndex::TransformType type)
72 mTransformType = type;
75 Scene3D::MotionTransformIndex::TransformType MotionTransformIndex::GetTransformType() const
77 return mTransformType;
80 std::string MotionTransformIndex::GetPropertyName(Scene3D::ModelNode node)
82 using TransformType = Scene3D::MotionTransformIndex::TransformType;
84 switch(mTransformType)
86 case TransformType::POSITION:
90 case TransformType::POSITION_X:
94 case TransformType::POSITION_Y:
98 case TransformType::POSITION_Z:
102 case TransformType::ORIENTATION:
104 return "orientation";
106 case TransformType::SCALE:
110 case TransformType::SCALE_X:
114 case TransformType::SCALE_Y:
118 case TransformType::SCALE_Z:
124 DALI_LOG_ERROR("Invalid transform type used\n");
130 Property::Index MotionTransformIndex::GetPropertyIndex(Scene3D::ModelNode node)
132 using TransformType = Scene3D::MotionTransformIndex::TransformType;
134 switch(mTransformType)
136 case TransformType::POSITION:
138 return Dali::Actor::Property::POSITION;
140 case TransformType::POSITION_X:
142 return Dali::Actor::Property::POSITION_X;
144 case TransformType::POSITION_Y:
146 return Dali::Actor::Property::POSITION_Y;
148 case TransformType::POSITION_Z:
150 return Dali::Actor::Property::POSITION_Z;
152 case TransformType::ORIENTATION:
154 return Dali::Actor::Property::ORIENTATION;
156 case TransformType::SCALE:
158 return Dali::Actor::Property::SCALE;
160 case TransformType::SCALE_X:
162 return Dali::Actor::Property::SCALE_X;
164 case TransformType::SCALE_Y:
166 return Dali::Actor::Property::SCALE_Y;
168 case TransformType::SCALE_Z:
170 return Dali::Actor::Property::SCALE_Z;
174 DALI_LOG_ERROR("Invalid transform type used\n");
175 return Property::INVALID_INDEX;
180 } // namespace Internal
182 } // namespace Scene3D