39 RES_BASE_EXTENSION(
"anm");
55 enum InterpolationType {
56 INTERPOLATION_NEAREST,
66 InterpolationType interpolation;
68 Track() { interpolation=INTERPOLATION_LINEAR; }
76 Key() { transition=1; }
81 struct TKey :
public Key {
97 struct TransformTrack :
public Track {
106 struct ValueTrack :
public Track {
111 ValueTrack() { type=
TYPE_VALUE; continuous=
true; }
117 struct MethodKey :
public Key {
123 struct MethodTrack :
public Track {
136 void _clear(T& p_keys);
138 template<
class T,
class V>
139 int _insert(
float p_time, T& p_keys,
const V& p_value);
142 inline int _find(
const Vector<K>& p_keys,
float p_time)
const;
144 _FORCE_INLINE_ Animation::TransformKey _interpolate(
const Animation::TransformKey& p_a,
const Animation::TransformKey& p_b,
float p_c)
const;
147 _FORCE_INLINE_
Quat _interpolate(
const Quat& p_a,
const Quat& p_b,
float p_c)
const;
149 _FORCE_INLINE_
float _interpolate(
const float& p_a,
const float& p_b,
float p_c)
const;
151 _FORCE_INLINE_ Animation::TransformKey _cubic_interpolate(
const Animation::TransformKey& p_pre_a,
const Animation::TransformKey& p_a,
const Animation::TransformKey& p_b,
const Animation::TransformKey& p_post_b,
float p_c)
const;
153 _FORCE_INLINE_
Quat _cubic_interpolate(
const Quat& p_pre_a,
const Quat& p_a,
const Quat& p_b,
const Quat& p_post_b,
float p_c)
const;
155 _FORCE_INLINE_
float _cubic_interpolate(
const float& p_pre_a,
const float& p_a,
const float& p_b,
const float& p_post_b,
float p_c)
const;
158 _FORCE_INLINE_ T _interpolate(
const Vector< TKey<T> >& p_keys,
float p_time, InterpolationType p_interp,
bool *p_ok)
const;
160 _FORCE_INLINE_
void _value_track_get_key_indices_in_range(
const ValueTrack * vt,
float from_time,
float to_time,
List<int> *p_indices)
const;
161 _FORCE_INLINE_
void _method_track_get_key_indices_in_range(
const MethodTrack * mt,
float from_time,
float to_time,
List<int> *p_indices)
const;
170 Array _transform_track_interpolate(
int p_track,
float p_time)
const {
174 transform_track_interpolate(p_track,p_time,&loc,&rot,&scale);
178 ret.push_back(scale);
182 DVector<int> _value_track_get_key_indices(
int p_track,
float p_time,
float p_delta)
const {
185 value_track_get_key_indices(p_track,p_time,p_delta,&idxs);
190 idxr.push_back(E->get());
194 DVector<int> _method_track_get_key_indices(
int p_track,
float p_time,
float p_delta)
const {
197 method_track_get_key_indices(p_track,p_time,p_delta,&idxs);
202 idxr.push_back(E->get());
207 bool _transform_track_optimize_key(
const TKey<TransformKey> &t0,
const TKey<TransformKey> &t1,
const TKey<TransformKey> &t2,
float p_alowed_linear_err,
float p_alowed_angular_err,
float p_max_optimizable_angle,
const Vector3& p_norm);
208 void _transform_track_optimize(
int p_idx,
float p_allowed_err=0.05,
float p_alowed_angular_err=0.01,
float p_max_optimizable_angle=Math_PI*0.125);
216 static void _bind_methods();
220 int add_track(
TrackType p_type,
int p_at_pos=-1);
221 void remove_track(
int p_track);
223 int get_track_count()
const;
224 TrackType track_get_type(
int p_track)
const;
226 void track_set_path(
int p_track,
const NodePath& p_path);
227 NodePath track_get_path(
int p_track)
const;
228 int find_track(
const NodePath& p_path)
const;
232 void track_move_up(
int p_track);
233 void track_move_down(
int p_track);
236 void track_insert_key(
int p_track,
float p_time,
const Variant& p_key,
float p_transition=1);
237 void track_set_key_transition(
int p_track,
int p_key_idx,
float p_transition);
238 void track_set_key_value(
int p_track,
int p_key_idx,
const Variant& p_value);
239 int track_find_key(
int p_track,
float p_time,
bool p_exact=
false)
const;
240 void track_remove_key(
int p_track,
int p_idx);
241 void track_remove_key_at_pos(
int p_track,
float p_pos);
242 int track_get_key_count(
int p_track)
const;
243 Variant track_get_key_value(
int p_track,
int p_key_idx)
const;
244 float track_get_key_time(
int p_track,
int p_key_idx)
const;
245 float track_get_key_transition(
int p_track,
int p_key_idx)
const;
247 Error transform_track_get_key(
int p_track,
int p_key,
Vector3* r_loc,
Quat* r_rot,
Vector3* r_scale)
const;
248 void track_set_interpolation_type(
int p_track,InterpolationType p_interp);
249 InterpolationType track_get_interpolation_type(
int p_track)
const;
252 Error transform_track_interpolate(
int p_track,
float p_time,
Vector3 * r_loc,
Quat *r_rot,
Vector3 *r_scale)
const;
254 Variant value_track_interpolate(
int p_track,
float p_time)
const;
255 void value_track_get_key_indices(
int p_track,
float p_time,
float p_delta,
List<int> *p_indices)
const;
256 void value_track_set_continuous(
int p_track,
bool p_continuous);
257 bool value_track_is_continuous(
int p_track)
const;
259 void method_track_get_key_indices(
int p_track,
float p_time,
float p_delta,
List<int> *p_indices)
const;
260 Vector<Variant> method_track_get_params(
int p_track,
int p_key_idx)
const;
261 StringName method_track_get_name(
int p_track,
int p_key_idx)
const;
264 void set_length(
float p_length);
265 float get_length()
const;
267 void set_loop(
bool p_enabled);
268 bool has_loop()
const;
270 void set_step(
float p_step);
271 float get_step()
const;
275 void optimize(
float p_allowed_linear_err=0.05,
float p_allowed_angular_err=0.01,
float p_max_optimizable_angle=Math_PI*0.125);
283 VARIANT_ENUM_CAST( Animation::InterpolationType );
Definition: animation.h:36
Call any method on a specific node.
Definition: animation.h:52
TrackType
Definition: animation.h:49
_FORCE_INLINE_ const Element * front() const
Definition: list.h:189
Definition: string_db.h:48
Definition: resource.h:89
Transform a node or a bone.
Definition: animation.h:51
Set a value in a property, can be interpolated.
Definition: animation.h:50