Animation crash debugging
This commit is contained in:
44
src/modules/.clang-tidy
Normal file
44
src/modules/.clang-tidy
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-nullptr,readability-braces-around-statements'
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
HeaderFilterRegex: '.*'
|
||||||
|
AnalyzeTemporaryDtors: false
|
||||||
|
FormatStyle: none
|
||||||
|
CheckOptions:
|
||||||
|
CheckOptions:
|
||||||
|
- key: cert-dcl16-c.NewSuffixes
|
||||||
|
value: 'L;LL;LU;LLU'
|
||||||
|
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||||
|
value: '0'
|
||||||
|
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||||
|
value: '1'
|
||||||
|
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||||
|
value: '1'
|
||||||
|
- key: google-readability-function-size.StatementThreshold
|
||||||
|
value: '800'
|
||||||
|
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||||
|
value: '10'
|
||||||
|
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||||
|
value: '2'
|
||||||
|
- key: modernize-loop-convert.MaxCopySize
|
||||||
|
value: '16'
|
||||||
|
- key: modernize-loop-convert.MinConfidence
|
||||||
|
value: reasonable
|
||||||
|
- key: modernize-loop-convert.NamingStyle
|
||||||
|
value: CamelCase
|
||||||
|
- key: modernize-pass-by-value.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: modernize-use-bool-literals.IgnoreMacros
|
||||||
|
value: '0'
|
||||||
|
- key: modernize-use-default-member-init.IgnoreMacros
|
||||||
|
value: '0'
|
||||||
|
- key: modernize-use-default-member-init.UseAssignment
|
||||||
|
value: '1'
|
||||||
|
- key: modernize-use-nullptr.NullMacros
|
||||||
|
value: 'NULL'
|
||||||
|
- key: readability-braces-around-statements.ShortStatementLines
|
||||||
|
value: '0'
|
||||||
|
...
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -66,7 +66,9 @@ struct TrackNodeCache {
|
|||||||
owner(nullptr),
|
owner(nullptr),
|
||||||
bezier_accum(0.0),
|
bezier_accum(0.0),
|
||||||
object(nullptr),
|
object(nullptr),
|
||||||
accum_pass(0) {}
|
accum_pass(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Map<StringName, BezierAnim> bezier_anim;
|
Map<StringName, BezierAnim> bezier_anim;
|
||||||
TrackNodeCache() :
|
TrackNodeCache() :
|
||||||
@@ -86,11 +88,112 @@ struct TrackNodeCache {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
struct Track {
|
||||||
|
Animation::TrackType type;
|
||||||
|
Animation::InterpolationType interpolation;
|
||||||
|
bool loop_wrap;
|
||||||
|
NodePath path; // path to something
|
||||||
|
bool imported;
|
||||||
|
bool enabled;
|
||||||
|
Track()
|
||||||
|
{
|
||||||
|
interpolation = Animation::INTERPOLATION_LINEAR;
|
||||||
|
imported = false;
|
||||||
|
loop_wrap = true;
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
virtual ~Track() {}
|
||||||
|
};
|
||||||
|
struct Key {
|
||||||
|
float transition;
|
||||||
|
float time; // time in secs
|
||||||
|
Key() { transition = 1; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// transform key holds either Vector3 or Quaternion
|
||||||
|
template <class T> struct TKey : public Key {
|
||||||
|
T value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransformKey {
|
||||||
|
Vector3 loc;
|
||||||
|
Quat rot;
|
||||||
|
Vector3 scale;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransformTrack : public Track {
|
||||||
|
Vector<TKey<TransformKey>> transforms;
|
||||||
|
|
||||||
|
TransformTrack() { type = Animation::TYPE_TRANSFORM; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ValueTrack : public Track {
|
||||||
|
Animation::UpdateMode update_mode;
|
||||||
|
bool update_on_seek;
|
||||||
|
Vector<TKey<Variant>> values;
|
||||||
|
|
||||||
|
ValueTrack()
|
||||||
|
{
|
||||||
|
type = Animation::TYPE_VALUE;
|
||||||
|
update_mode = Animation::UPDATE_CONTINUOUS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MethodKey : public Key {
|
||||||
|
StringName method;
|
||||||
|
Vector<Variant> params;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MethodTrack : public Track {
|
||||||
|
Vector<MethodKey> methods;
|
||||||
|
MethodTrack() { type = Animation::TYPE_METHOD; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BezierKey {
|
||||||
|
Vector2 in_handle; //relative (x always <0)
|
||||||
|
Vector2 out_handle; //relative (x always >0)
|
||||||
|
float value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BezierTrack : public Track {
|
||||||
|
Vector<TKey<BezierKey>> values;
|
||||||
|
|
||||||
|
BezierTrack() { type = Animation::TYPE_BEZIER; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AudioKey {
|
||||||
|
RES stream;
|
||||||
|
float start_offset; //offset from start
|
||||||
|
float end_offset; //offset from end, if 0 then full length or infinite
|
||||||
|
AudioKey()
|
||||||
|
{
|
||||||
|
start_offset = 0;
|
||||||
|
end_offset = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AudioTrack : public Track {
|
||||||
|
Vector<TKey<AudioKey>> values;
|
||||||
|
|
||||||
|
AudioTrack() { type = Animation::TYPE_AUDIO; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BasicTrack : public Track {
|
||||||
|
uint8_t data[256];
|
||||||
|
BasicTrack() { type = Animation::TYPE_TRANSFORM; }
|
||||||
|
};
|
||||||
|
|
||||||
struct AnimationData {
|
struct AnimationData {
|
||||||
String name;
|
String name;
|
||||||
StringName next;
|
StringName next;
|
||||||
Vector<TrackNodeCache *> node_cache;
|
int node_cache_size;
|
||||||
|
struct TrackNodeCache *node_cache[128];
|
||||||
Ref<Animation> animation;
|
Ref<Animation> animation;
|
||||||
|
AnimationData(Ref<Animation> anim) :
|
||||||
|
animation(anim), node_cache_size(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
AnimationData() : animation(Ref<Animation>()), node_cache_size(0) {}
|
||||||
};
|
};
|
||||||
struct PlaybackData {
|
struct PlaybackData {
|
||||||
AnimationData *from;
|
AnimationData *from;
|
||||||
@@ -124,7 +227,11 @@ struct Playback {
|
|||||||
struct BlendKey {
|
struct BlendKey {
|
||||||
StringName from;
|
StringName from;
|
||||||
StringName to;
|
StringName to;
|
||||||
bool operator<(const BlendKey &bk) const { return from == bk.from ? String(to) < String(bk.to) : String(from) < String(bk.from); }
|
bool operator<(const BlendKey &bk) const
|
||||||
|
{
|
||||||
|
return from == bk.from ? String(to) < String(bk.to)
|
||||||
|
: String(from) < String(bk.from);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
struct TrackNodeCacheKey {
|
struct TrackNodeCacheKey {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
@@ -141,10 +248,7 @@ struct TrackNodeCacheKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
enum {
|
enum { NODE_CACHE_UPDATE_MAX = 1024, BLEND_FROM_MAX = 3 };
|
||||||
NODE_CACHE_UPDATE_MAX = 1024,
|
|
||||||
BLEND_FROM_MAX = 3
|
|
||||||
};
|
|
||||||
struct AnimationPlayerData {
|
struct AnimationPlayerData {
|
||||||
Map<TrackNodeCacheKey, TrackNodeCache> node_cache_map;
|
Map<TrackNodeCacheKey, TrackNodeCache> node_cache_map;
|
||||||
TrackNodeCache *cache_update[NODE_CACHE_UPDATE_MAX];
|
TrackNodeCache *cache_update[NODE_CACHE_UPDATE_MAX];
|
||||||
@@ -176,75 +280,72 @@ struct AnimationPlayerData {
|
|||||||
bool playing;
|
bool playing;
|
||||||
};
|
};
|
||||||
/* public functions */
|
/* public functions */
|
||||||
StringName find_animation(struct AnimationPlayerData *player,
|
StringName find_animation(
|
||||||
const Ref<Animation> &p_animation);
|
struct AnimationPlayerData *player, const Ref<Animation> &p_animation);
|
||||||
Error add_animation(struct AnimationPlayerData *player,
|
Error add_animation(struct AnimationPlayerData *player,
|
||||||
const StringName &p_name, const Ref<Animation> &p_animation);
|
const StringName &p_name, const Ref<Animation> &p_animation);
|
||||||
void remove_animation(struct AnimationPlayerData *player,
|
void remove_animation(
|
||||||
const StringName &p_name);
|
struct AnimationPlayerData *player, const StringName &p_name);
|
||||||
void rename_animation(struct AnimationPlayerData *player,
|
void rename_animation(struct AnimationPlayerData *player,
|
||||||
const StringName &p_name, const StringName &p_new_name);
|
const StringName &p_name, const StringName &p_new_name);
|
||||||
bool has_animation(struct AnimationPlayerData *player,
|
bool has_animation(
|
||||||
const StringName &p_name);
|
struct AnimationPlayerData *player, const StringName &p_name);
|
||||||
Ref<Animation> get_animation(struct AnimationPlayerData *player,
|
Ref<Animation> get_animation(
|
||||||
const StringName &p_name);
|
struct AnimationPlayerData *player, const StringName &p_name);
|
||||||
void get_animation_list(struct AnimationPlayerData *player,
|
void get_animation_list(
|
||||||
List<StringName> *p_animations);
|
struct AnimationPlayerData *player, List<StringName> *p_animations);
|
||||||
void set_blend_time(struct AnimationPlayerData *player,
|
void set_blend_time(struct AnimationPlayerData *player,
|
||||||
const StringName &p_animation1, const StringName &p_animation2, float p_time);
|
const StringName &p_animation1, const StringName &p_animation2,
|
||||||
|
float p_time);
|
||||||
float get_blend_time(struct AnimationPlayerData *player,
|
float get_blend_time(struct AnimationPlayerData *player,
|
||||||
const StringName &p_animation1, const StringName &p_animation2);
|
const StringName &p_animation1, const StringName &p_animation2);
|
||||||
void animation_set_next(struct AnimationPlayerData *player,
|
void animation_set_next(struct AnimationPlayerData *player,
|
||||||
const StringName &p_animation, const StringName &p_next);
|
const StringName &p_animation, const StringName &p_next);
|
||||||
StringName animation_get_next(struct AnimationPlayerData *player,
|
StringName animation_get_next(
|
||||||
const StringName &p_animation);
|
struct AnimationPlayerData *player, const StringName &p_animation);
|
||||||
void set_default_blend_time(struct AnimationPlayerData *player,
|
void set_default_blend_time(
|
||||||
float p_default);
|
struct AnimationPlayerData *player, float p_default);
|
||||||
float get_default_blend_time(struct AnimationPlayerData *player);
|
float get_default_blend_time(struct AnimationPlayerData *player);
|
||||||
void play(struct AnimationPlayerData *player,
|
void play(struct AnimationPlayerData *player,
|
||||||
const StringName &p_name = StringName(),
|
const StringName &p_name = StringName(), float p_custom_blend = -1,
|
||||||
float p_custom_blend = -1, float p_custom_scale = 1.0,
|
float p_custom_scale = 1.0, bool p_from_end = false);
|
||||||
bool p_from_end = false);
|
|
||||||
void play_backwards(struct AnimationPlayerData *player,
|
void play_backwards(struct AnimationPlayerData *player,
|
||||||
const StringName &p_name = StringName(), float p_custom_blend = -1);
|
const StringName &p_name = StringName(), float p_custom_blend = -1);
|
||||||
void queue(struct AnimationPlayerData *player,
|
void queue(struct AnimationPlayerData *player, const StringName &p_name);
|
||||||
const StringName &p_name);
|
|
||||||
PoolVector<String> get_queue(struct AnimationPlayerData *player);
|
PoolVector<String> get_queue(struct AnimationPlayerData *player);
|
||||||
void clear_queue(struct AnimationPlayerData *player);
|
void clear_queue(struct AnimationPlayerData *player);
|
||||||
void stop(struct AnimationPlayerData *player,
|
void stop(struct AnimationPlayerData *player, bool p_reset = true);
|
||||||
bool p_reset = true);
|
|
||||||
bool is_playing(struct AnimationPlayerData *player);
|
bool is_playing(struct AnimationPlayerData *player);
|
||||||
String get_current_animation(struct AnimationPlayerData *player);
|
String get_current_animation(struct AnimationPlayerData *player);
|
||||||
void set_current_animation(struct AnimationPlayerData *player,
|
void set_current_animation(
|
||||||
const String &p_anim);
|
struct AnimationPlayerData *player, const String &p_anim);
|
||||||
String get_assigned_animation(struct AnimationPlayerData *player);
|
String get_assigned_animation(struct AnimationPlayerData *player);
|
||||||
void set_assigned_animation(struct AnimationPlayerData *player,
|
void set_assigned_animation(
|
||||||
const String &p_anim);
|
struct AnimationPlayerData *player, const String &p_anim);
|
||||||
void set_active(struct AnimationPlayerData *player,
|
void set_active(struct AnimationPlayerData *player, bool p_active);
|
||||||
bool p_active);
|
|
||||||
bool is_active(struct AnimationPlayerData *player);
|
bool is_active(struct AnimationPlayerData *player);
|
||||||
bool is_valid(struct AnimationPlayerData *player);
|
bool is_valid(struct AnimationPlayerData *player);
|
||||||
void set_speed_scale(struct AnimationPlayerData *player,
|
void set_speed_scale(struct AnimationPlayerData *player, float p_speed);
|
||||||
float p_speed);
|
|
||||||
float get_speed_scale(struct AnimationPlayerData *player);
|
float get_speed_scale(struct AnimationPlayerData *player);
|
||||||
float get_playing_speed(struct AnimationPlayerData *player);
|
float get_playing_speed(struct AnimationPlayerData *player);
|
||||||
void set_autoplay(struct AnimationPlayerData *player,
|
void set_autoplay(struct AnimationPlayerData *player, const String &p_name);
|
||||||
const String &p_name);
|
|
||||||
String get_autoplay(struct AnimationPlayerData *player);
|
String get_autoplay(struct AnimationPlayerData *player);
|
||||||
void set_reset_on_save_enabled(struct AnimationPlayerData *player,
|
void set_reset_on_save_enabled(
|
||||||
bool p_enabled);
|
struct AnimationPlayerData *player, bool p_enabled);
|
||||||
bool is_reset_on_save_enabled(struct AnimationPlayerData *player);
|
bool is_reset_on_save_enabled(struct AnimationPlayerData *player);
|
||||||
void set_animation_process_mode(struct AnimationPlayerData *player,
|
void set_animation_process_mode(
|
||||||
AnimationProcessMode p_mode);
|
struct AnimationPlayerData *player, AnimationProcessMode p_mode);
|
||||||
AnimationProcessMode get_animation_process_mode(struct AnimationPlayerData *player);
|
AnimationProcessMode get_animation_process_mode(
|
||||||
void set_method_call_mode(struct AnimationPlayerData *player,
|
struct AnimationPlayerData *player);
|
||||||
AnimationMethodCallMode p_mode);
|
void set_method_call_mode(
|
||||||
AnimationMethodCallMode get_method_call_mode(struct AnimationPlayerData *player);
|
struct AnimationPlayerData *player, AnimationMethodCallMode p_mode);
|
||||||
|
AnimationMethodCallMode get_method_call_mode(
|
||||||
|
struct AnimationPlayerData *player);
|
||||||
|
|
||||||
void seek(struct AnimationPlayerData *player,
|
void seek(struct AnimationPlayerData *player, float p_time,
|
||||||
float p_time, bool p_update = false);
|
bool p_update = false);
|
||||||
void seek_delta(struct AnimationPlayerData *player,
|
void seek_delta(
|
||||||
float p_time, float p_delta);
|
struct AnimationPlayerData *player, float p_time, float p_delta);
|
||||||
float get_current_animation_position(struct AnimationPlayerData *player);
|
float get_current_animation_position(struct AnimationPlayerData *player);
|
||||||
float get_current_animation_length(struct AnimationPlayerData *player);
|
float get_current_animation_length(struct AnimationPlayerData *player);
|
||||||
void advance(struct AnimationPlayerData *player, float p_time);
|
void advance(struct AnimationPlayerData *player, float p_time);
|
||||||
|
|||||||
Reference in New Issue
Block a user