1 #ifndef __DALI_MODEL_ACTOR_FACTORY_H__
2 #define __DALI_MODEL_ACTOR_FACTORY_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
26 #include <dali/public-api/animation/alpha-functions.h>
38 * @brief This factory class is used to generate actors and animations from a model resource.
40 class DALI_IMPORT_API ModelActorFactory
45 * @brief Create an initialized Actor and child actors.
47 * This tree of actors is either the entire model
48 * (use an empty name), or a specific entity within the model
49 * (specify by entity name).
51 * These child actors may be accessed by using either Actor::GetChildren()
52 * or Actor::FindChildByName()
54 * SetSize() (or an equivalent) should be called on this root actor
55 * to scale the actor and it's children to fit within the required
56 * screen volume. Note that if any of the size coordinates are zero,
57 * (including Z), then the model will not display.
59 * @pre the model has finished loading
60 * @param[in] model A loaded model object
61 * @param[in] name of the entity to create.
62 * @return A handle to a newly allocated Dali resource.
64 static Actor BuildActorTree(Model& model, const std::string& name);
67 * @brief Create an animation on the actor and child actors using the indexed animation map.
69 * If the animation map does not exist in the model, then this returns an uninitialised
70 * handle. Uses the duration from the model. Note, changing the duration of the animation
71 * will not change the duration of the animators. Instead, use the other variant of this method.
72 * @param[in] model A model resource handle
73 * @param[in] actor An actor tree (generated by BuildActorTree) to animate
74 * @param[in] index The index of the animation
75 * @return A handle to an animation, or uninitialised.
77 static Animation BuildAnimation(Model& model, Actor actor, size_t index);
80 * @brief Create an animation on the actor and child actors using the indexed animation map.
82 * If the animation map does not exist in the model, then this returns an uninitialised
84 * @param[in] model A model resource handle
85 * @param[in] actor An actor tree (generated by BuildActorTree) to animate
86 * @param[in] index The index of the animation
87 * @param[in] durationSeconds The duration in seconds to run the effect over
88 * @return A handle to an animation, or uninitialised.
90 static Animation BuildAnimation(Model& model, Actor actor, size_t index, float durationSeconds);
93 * @brief Create an animation on the actor and child actors using the indexed animation map.
95 * If the animation map does not exist in the model, then this returns an uninitialised
97 * @param[in] model A model resource handle
98 * @param[in] actor An actor tree (generated by BuildActorTree) to animate
99 * @param[in] index The index of the animation
100 * @param[in] alpha The alpha function to apply to the overall progress.
101 * @return A handle to an animation, or uninitialised.
103 static Animation BuildAnimation(Model& model, Actor actor, size_t index, AlphaFunction alpha);
106 * @brief Create an animation on the actor and child actors using the indexed animation map.
108 * If the animation map does not exist in the model, then this returns an uninitialised
110 * @param[in] model A model resource handle
111 * @param[in] actor An actor tree (generated by BuildActorTree) to animate
112 * @param[in] index The index of the animation
113 * @param[in] durationSeconds The duration in seconds to run the effect over
114 * @param[in] alpha The alpha function to apply to the overall progress.
115 * @return A handle to an animation, or uninitialised.
117 static Animation BuildAnimation(Model& model, Actor actor, size_t index, AlphaFunction alpha, float durationSeconds);
124 #endif /* __DALI_MODEL_ACTOR_FACTORY_H__ */