1 #ifndef DALI_SCENE3D_LOADER_ANIMATED_PROPERTY_H
2 #define DALI_SCENE3D_LOADER_ANIMATED_PROPERTY_H
4 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include <dali/public-api/actors/actor.h>
22 #include <dali/public-api/animation/animation.h>
23 #include <dali/public-api/object/property.h>
28 #include <dali-scene3d/public-api/api.h>
29 #include <dali-scene3d/public-api/loader/index.h>
31 namespace Dali::Scene3D::Loader
34 * @brief Intermediate representation for a property that's given to
35 * a Animation to animate. Since there is no getting an
36 * animated property back from the Animation (i.e. past AnimateBetween/By/To()),
37 * changing properties (e.g. from the SDK) requires the whole Animation
38 * object to be recreated with all of its properties (incl. modifications).
40 struct DALI_SCENE3D_API AnimatedProperty
44 * @brief Function to obtain an Actor based on its property. Its processing will
45 * ignore empty handles returned by it.
47 using GetActor = std::function<Actor(const AnimatedProperty&)>;
50 * @return The Property object (of the given @a actor) whose value is being animated.
52 Property GetProperty(Actor& actor) const
54 auto idx = actor.GetPropertyIndex(mPropertyName);
55 return Property(actor, idx);
59 * @brief The type of the Property (of the given @a actor) that is being animated.
61 Property::Type GetPropertyType(Actor& actor) const
63 auto idx = actor.GetPropertyIndex(mPropertyName);
64 return actor.GetPropertyType(idx);
68 * @brief Registers the animation of this property against the given @a anim.
69 * @a getActor will be used to obtain the Actor named by this property.
70 * Failing to find the actor purely means that this property will not be
73 void Animate(Animation& anim, GetActor getActor) const;
78 Property::Value mValue;
82 Index mNodeIndex = INVALID_INDEX;
83 std::string mNodeName;
84 std::string mPropertyName;
87 std::unique_ptr<Value> mValue;
89 AlphaFunction mAlphaFunction = AlphaFunction::DEFAULT;
90 TimePeriod mTimePeriod = TimePeriod(0.f);
93 } // namespace Dali::Scene3D::Loader
95 #endif //DALI_SCENE3D_LOADER_ANIMATED_PROPERTY_H