2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* animation.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2021-01-01 20:13:46 +01:00
|
|
|
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 02:10:30 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#ifndef ANIMATION_H
|
|
|
|
#define ANIMATION_H
|
|
|
|
|
2020-11-07 23:33:38 +01:00
|
|
|
#include "core/io/resource.h"
|
2019-08-10 14:28:17 +02:00
|
|
|
|
2020-12-20 11:46:44 +01:00
|
|
|
#define ANIM_MIN_LENGTH 0.001
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class Animation : public Resource {
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(Animation, Resource);
|
2017-06-16 00:44:11 +02:00
|
|
|
RES_BASE_EXTENSION("anim");
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-02-10 02:10:30 +01:00
|
|
|
enum TrackType {
|
|
|
|
TYPE_VALUE, ///< Set a value in a property, can be interpolated.
|
2021-06-04 02:34:41 +02:00
|
|
|
TYPE_TRANSFORM3D, ///< Transform a node or a bone.
|
2014-02-10 02:10:30 +01:00
|
|
|
TYPE_METHOD, ///< Call any method on a specific node.
|
2018-06-07 17:46:14 +02:00
|
|
|
TYPE_BEZIER, ///< Bezier curve
|
|
|
|
TYPE_AUDIO,
|
|
|
|
TYPE_ANIMATION,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum InterpolationType {
|
|
|
|
INTERPOLATION_NEAREST,
|
|
|
|
INTERPOLATION_LINEAR,
|
|
|
|
INTERPOLATION_CUBIC
|
|
|
|
};
|
|
|
|
|
2016-06-19 06:43:02 +02:00
|
|
|
enum UpdateMode {
|
|
|
|
UPDATE_CONTINUOUS,
|
|
|
|
UPDATE_DISCRETE,
|
|
|
|
UPDATE_TRIGGER,
|
2018-06-07 17:46:14 +02:00
|
|
|
UPDATE_CAPTURE,
|
2016-06-19 06:43:02 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
private:
|
|
|
|
struct Track {
|
2021-02-09 18:24:36 +01:00
|
|
|
TrackType type = TrackType::TYPE_ANIMATION;
|
|
|
|
InterpolationType interpolation = INTERPOLATION_LINEAR;
|
|
|
|
bool loop_wrap = true;
|
2014-02-10 02:10:30 +01:00
|
|
|
NodePath path; // path to something
|
2021-02-09 18:24:36 +01:00
|
|
|
bool imported = false;
|
2021-03-02 09:15:01 +01:00
|
|
|
bool enabled = true;
|
2021-02-09 18:24:36 +01:00
|
|
|
Track() {}
|
2014-02-10 02:10:30 +01:00
|
|
|
virtual ~Track() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Key {
|
2021-02-09 18:24:36 +01:00
|
|
|
float transition = 1.0;
|
|
|
|
float time = 0.0; // time in secs
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
// transform key holds either Vector3 or Quaternion
|
2017-03-05 16:44:50 +01:00
|
|
|
template <class T>
|
2014-02-10 02:10:30 +01:00
|
|
|
struct TKey : public Key {
|
|
|
|
T value;
|
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
struct TransformKey {
|
|
|
|
Vector3 loc;
|
2021-01-20 08:02:02 +01:00
|
|
|
Quaternion rot;
|
2014-02-10 02:10:30 +01:00
|
|
|
Vector3 scale;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* TRANSFORM TRACK */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
struct TransformTrack : public Track {
|
2020-03-17 07:33:00 +01:00
|
|
|
Vector<TKey<TransformKey>> transforms;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2021-06-04 02:34:41 +02:00
|
|
|
TransformTrack() { type = TYPE_TRANSFORM3D; }
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* PROPERTY VALUE TRACK */
|
|
|
|
|
|
|
|
struct ValueTrack : public Track {
|
2021-02-09 18:24:36 +01:00
|
|
|
UpdateMode update_mode = UPDATE_CONTINUOUS;
|
|
|
|
bool update_on_seek = false;
|
2020-03-17 07:33:00 +01:00
|
|
|
Vector<TKey<Variant>> values;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ValueTrack() {
|
|
|
|
type = TYPE_VALUE;
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* METHOD TRACK */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
struct MethodKey : public Key {
|
|
|
|
StringName method;
|
|
|
|
Vector<Variant> params;
|
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
struct MethodTrack : public Track {
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<MethodKey> methods;
|
|
|
|
MethodTrack() { type = TYPE_METHOD; }
|
2016-03-09 00:00:52 +01:00
|
|
|
};
|
|
|
|
|
2018-06-07 17:46:14 +02:00
|
|
|
/* BEZIER TRACK */
|
|
|
|
|
|
|
|
struct BezierKey {
|
|
|
|
Vector2 in_handle; //relative (x always <0)
|
|
|
|
Vector2 out_handle; //relative (x always >0)
|
2021-02-09 18:24:36 +01:00
|
|
|
float value = 0.0;
|
2018-06-07 17:46:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct BezierTrack : public Track {
|
2020-03-17 07:33:00 +01:00
|
|
|
Vector<TKey<BezierKey>> values;
|
2018-06-07 17:46:14 +02:00
|
|
|
|
|
|
|
BezierTrack() {
|
|
|
|
type = TYPE_BEZIER;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* AUDIO TRACK */
|
|
|
|
|
|
|
|
struct AudioKey {
|
|
|
|
RES stream;
|
2021-02-09 18:24:36 +01:00
|
|
|
float start_offset = 0.0; //offset from start
|
|
|
|
float end_offset = 0.0; //offset from end, if 0 then full length or infinite
|
2018-06-07 17:46:14 +02:00
|
|
|
AudioKey() {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AudioTrack : public Track {
|
2020-03-17 07:33:00 +01:00
|
|
|
Vector<TKey<AudioKey>> values;
|
2018-06-07 17:46:14 +02:00
|
|
|
|
|
|
|
AudioTrack() {
|
|
|
|
type = TYPE_AUDIO;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* AUDIO TRACK */
|
|
|
|
|
|
|
|
struct AnimationTrack : public Track {
|
2020-03-17 07:33:00 +01:00
|
|
|
Vector<TKey<StringName>> values;
|
2018-06-07 17:46:14 +02:00
|
|
|
|
|
|
|
AnimationTrack() {
|
|
|
|
type = TYPE_ANIMATION;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<Track *> tracks;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
template<class T>
|
2021-05-21 08:42:37 +02:00
|
|
|
int _insert_pos(double p_time, T& p_keys);*/
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
template <class T>
|
|
|
|
void _clear(T &p_keys);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
template <class T, class V>
|
2021-05-21 08:42:37 +02:00
|
|
|
int _insert(double p_time, T &p_keys, const V &p_value);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
template <class K>
|
2021-05-21 08:42:37 +02:00
|
|
|
inline int _find(const Vector<K> &p_keys, double p_time) const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_FORCE_INLINE_ Animation::TransformKey _interpolate(const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, float p_c) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_FORCE_INLINE_ Vector3 _interpolate(const Vector3 &p_a, const Vector3 &p_b, float p_c) const;
|
2021-01-20 08:02:02 +01:00
|
|
|
_FORCE_INLINE_ Quaternion _interpolate(const Quaternion &p_a, const Quaternion &p_b, float p_c) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
_FORCE_INLINE_ Variant _interpolate(const Variant &p_a, const Variant &p_b, float p_c) const;
|
|
|
|
_FORCE_INLINE_ float _interpolate(const float &p_a, const float &p_b, float p_c) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_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;
|
|
|
|
_FORCE_INLINE_ Vector3 _cubic_interpolate(const Vector3 &p_pre_a, const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_post_b, float p_c) const;
|
2021-01-20 08:02:02 +01:00
|
|
|
_FORCE_INLINE_ Quaternion _cubic_interpolate(const Quaternion &p_pre_a, const Quaternion &p_a, const Quaternion &p_b, const Quaternion &p_post_b, float p_c) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
_FORCE_INLINE_ Variant _cubic_interpolate(const Variant &p_pre_a, const Variant &p_a, const Variant &p_b, const Variant &p_post_b, float p_c) const;
|
|
|
|
_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;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
template <class T>
|
2021-05-21 08:42:37 +02:00
|
|
|
_FORCE_INLINE_ T _interpolate(const Vector<TKey<T>> &p_keys, double p_time, InterpolationType p_interp, bool p_loop_wrap, bool *p_ok) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2018-06-07 17:46:14 +02:00
|
|
|
template <class T>
|
2021-05-21 08:42:37 +02:00
|
|
|
_FORCE_INLINE_ void _track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices) const;
|
2018-06-07 17:46:14 +02:00
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
_FORCE_INLINE_ void _value_track_get_key_indices_in_range(const ValueTrack *vt, double from_time, double to_time, List<int> *p_indices) const;
|
|
|
|
_FORCE_INLINE_ void _method_track_get_key_indices_in_range(const MethodTrack *mt, double from_time, double to_time, List<int> *p_indices) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
double length = 1.0;
|
2021-02-09 18:24:36 +01:00
|
|
|
float step = 0.1;
|
|
|
|
bool loop = false;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
// bind helpers
|
2016-03-09 00:00:52 +01:00
|
|
|
private:
|
2021-05-21 08:42:37 +02:00
|
|
|
Array _transform_track_interpolate(int p_track, double p_time) const {
|
2014-02-10 02:10:30 +01:00
|
|
|
Vector3 loc;
|
2021-01-20 08:02:02 +01:00
|
|
|
Quaternion rot;
|
2014-02-10 02:10:30 +01:00
|
|
|
Vector3 scale;
|
2017-03-05 16:44:50 +01:00
|
|
|
transform_track_interpolate(p_track, p_time, &loc, &rot, &scale);
|
2014-02-10 02:10:30 +01:00
|
|
|
Array ret;
|
|
|
|
ret.push_back(loc);
|
|
|
|
ret.push_back(rot);
|
|
|
|
ret.push_back(scale);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
Vector<int> _value_track_get_key_indices(int p_track, double p_time, double p_delta) const {
|
2014-02-10 02:10:30 +01:00
|
|
|
List<int> idxs;
|
2017-03-05 16:44:50 +01:00
|
|
|
value_track_get_key_indices(p_track, p_time, p_delta, &idxs);
|
2020-02-17 22:06:54 +01:00
|
|
|
Vector<int> idxr;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2021-07-16 05:45:57 +02:00
|
|
|
for (int &E : idxs) {
|
|
|
|
idxr.push_back(E);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
return idxr;
|
|
|
|
}
|
2021-05-21 08:42:37 +02:00
|
|
|
Vector<int> _method_track_get_key_indices(int p_track, double p_time, double p_delta) const {
|
2014-02-10 02:10:30 +01:00
|
|
|
List<int> idxs;
|
2017-03-05 16:44:50 +01:00
|
|
|
method_track_get_key_indices(p_track, p_time, p_delta, &idxs);
|
2020-02-17 22:06:54 +01:00
|
|
|
Vector<int> idxr;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2021-07-16 05:45:57 +02:00
|
|
|
for (int &E : idxs) {
|
|
|
|
idxr.push_back(E);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
return idxr;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
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);
|
2017-08-11 21:10:05 +02:00
|
|
|
void _transform_track_optimize(int p_idx, float p_allowed_linear_err = 0.05, float p_allowed_angular_err = 0.01, float p_max_optimizable_angle = Math_PI * 0.125);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
protected:
|
2017-03-05 16:44:50 +01:00
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2021-02-11 18:18:45 +01:00
|
|
|
virtual void reset_state() override;
|
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
public:
|
2017-03-05 16:44:50 +01:00
|
|
|
int add_track(TrackType p_type, int p_at_pos = -1);
|
2014-02-10 02:10:30 +01:00
|
|
|
void remove_track(int p_track);
|
|
|
|
|
|
|
|
int get_track_count() const;
|
|
|
|
TrackType track_get_type(int p_track) const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void track_set_path(int p_track, const NodePath &p_path);
|
2014-02-10 02:10:30 +01:00
|
|
|
NodePath track_get_path(int p_track) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
int find_track(const NodePath &p_path) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
// transform
|
|
|
|
|
|
|
|
void track_move_up(int p_track);
|
|
|
|
void track_move_down(int p_track);
|
2019-05-25 18:01:44 +02:00
|
|
|
void track_move_to(int p_track, int p_to_index);
|
2018-06-07 17:46:14 +02:00
|
|
|
void track_swap(int p_track, int p_with_track);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void track_set_imported(int p_track, bool p_imported);
|
2016-06-20 05:19:04 +02:00
|
|
|
bool track_is_imported(int p_track) const;
|
|
|
|
|
2017-11-28 16:46:37 +01:00
|
|
|
void track_set_enabled(int p_track, bool p_enabled);
|
|
|
|
bool track_is_enabled(int p_track) const;
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
void track_insert_key(int p_track, double p_time, const Variant &p_key, float p_transition = 1);
|
2017-03-05 16:44:50 +01:00
|
|
|
void track_set_key_transition(int p_track, int p_key_idx, float p_transition);
|
|
|
|
void track_set_key_value(int p_track, int p_key_idx, const Variant &p_value);
|
2021-05-21 08:42:37 +02:00
|
|
|
void track_set_key_time(int p_track, int p_key_idx, double p_time);
|
|
|
|
int track_find_key(int p_track, double p_time, bool p_exact = false) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
void track_remove_key(int p_track, int p_idx);
|
2021-05-21 08:42:37 +02:00
|
|
|
void track_remove_key_at_time(int p_track, double p_time);
|
2014-02-10 02:10:30 +01:00
|
|
|
int track_get_key_count(int p_track) const;
|
|
|
|
Variant track_get_key_value(int p_track, int p_key_idx) const;
|
2021-05-21 08:42:37 +02:00
|
|
|
double track_get_key_time(int p_track, int p_key_idx) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
float track_get_key_transition(int p_track, int p_key_idx) const;
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
int transform_track_insert_key(int p_track, double p_time, const Vector3 &p_loc, const Quaternion &p_rot = Quaternion(), const Vector3 &p_scale = Vector3());
|
2021-01-20 08:02:02 +01:00
|
|
|
Error transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void track_set_interpolation_type(int p_track, InterpolationType p_interp);
|
2014-02-10 02:10:30 +01:00
|
|
|
InterpolationType track_get_interpolation_type(int p_track) const;
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
int bezier_track_insert_key(int p_track, double p_time, float p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle);
|
2018-06-07 17:46:14 +02:00
|
|
|
void bezier_track_set_key_value(int p_track, int p_index, float p_value);
|
|
|
|
void bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle);
|
|
|
|
void bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle);
|
|
|
|
float bezier_track_get_key_value(int p_track, int p_index) const;
|
|
|
|
Vector2 bezier_track_get_key_in_handle(int p_track, int p_index) const;
|
|
|
|
Vector2 bezier_track_get_key_out_handle(int p_track, int p_index) const;
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
float bezier_track_interpolate(int p_track, double p_time) const;
|
2018-06-07 17:46:14 +02:00
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
int audio_track_insert_key(int p_track, double p_time, const RES &p_stream, float p_start_offset = 0, float p_end_offset = 0);
|
2018-06-07 17:46:14 +02:00
|
|
|
void audio_track_set_key_stream(int p_track, int p_key, const RES &p_stream);
|
|
|
|
void audio_track_set_key_start_offset(int p_track, int p_key, float p_offset);
|
|
|
|
void audio_track_set_key_end_offset(int p_track, int p_key, float p_offset);
|
|
|
|
RES audio_track_get_key_stream(int p_track, int p_key) const;
|
|
|
|
float audio_track_get_key_start_offset(int p_track, int p_key) const;
|
|
|
|
float audio_track_get_key_end_offset(int p_track, int p_key) const;
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
int animation_track_insert_key(int p_track, double p_time, const StringName &p_animation);
|
2018-06-07 17:46:14 +02:00
|
|
|
void animation_track_set_key_animation(int p_track, int p_key, const StringName &p_animation);
|
|
|
|
StringName animation_track_get_key_animation(int p_track, int p_key) const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void track_set_interpolation_loop_wrap(int p_track, bool p_enable);
|
2017-01-09 04:41:16 +01:00
|
|
|
bool track_get_interpolation_loop_wrap(int p_track) const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
Error transform_track_interpolate(int p_track, double p_time, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
Variant value_track_interpolate(int p_track, double p_time) const;
|
|
|
|
void value_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices) const;
|
2016-06-19 06:43:02 +02:00
|
|
|
void value_track_set_update_mode(int p_track, UpdateMode p_mode);
|
|
|
|
UpdateMode value_track_get_update_mode(int p_track) const;
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
void method_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<Variant> method_track_get_params(int p_track, int p_key_idx) const;
|
|
|
|
StringName method_track_get_name(int p_track, int p_key_idx) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-12-07 14:18:55 +01:00
|
|
|
void copy_track(int p_track, Ref<Animation> p_to_animation);
|
|
|
|
|
2021-05-21 08:42:37 +02:00
|
|
|
void track_get_key_indices_in_range(int p_track, double p_time, double p_delta, List<int> *p_indices) const;
|
2018-06-07 17:46:14 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_length(float p_length);
|
|
|
|
float get_length() const;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_loop(bool p_enabled);
|
|
|
|
bool has_loop() const;
|
|
|
|
|
|
|
|
void set_step(float p_step);
|
|
|
|
float get_step() const;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
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);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
Animation();
|
2014-02-10 02:10:30 +01:00
|
|
|
~Animation();
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
VARIANT_ENUM_CAST(Animation::TrackType);
|
|
|
|
VARIANT_ENUM_CAST(Animation::InterpolationType);
|
|
|
|
VARIANT_ENUM_CAST(Animation::UpdateMode);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
#endif
|