diff options
Diffstat (limited to 'scene/animation/animation_player.h')
-rw-r--r-- | scene/animation/animation_player.h | 85 |
1 files changed, 27 insertions, 58 deletions
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 32bed6f4d6..1a66665803 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -85,89 +85,66 @@ private: }; struct TrackNodeCache { - NodePath path; - uint32_t id; + uint32_t id = 0; RES resource; - Node *node; - Node3D *spatial; - Node2D *node_2d; - Skeleton3D *skeleton; - int bone_idx; + Node *node = nullptr; + Node3D *spatial = nullptr; + Node2D *node_2d = nullptr; + Skeleton3D *skeleton = nullptr; + int bone_idx = -1; // accumulated transforms Vector3 loc_accum; Quat rot_accum; Vector3 scale_accum; - uint64_t accum_pass; + uint64_t accum_pass = 0; - bool audio_playing; - float audio_start; - float audio_len; + bool audio_playing = false; + float audio_start = 0.0; + float audio_len = 0.0; - bool animation_playing; + bool animation_playing = false; struct PropertyAnim { - - TrackNodeCache *owner; - SpecialProperty special; //small optimization + TrackNodeCache *owner = nullptr; + SpecialProperty special = SP_NONE; //small optimization Vector<StringName> subpath; - Object *object; + Object *object = nullptr; Variant value_accum; - uint64_t accum_pass; + uint64_t accum_pass = 0; Variant capture; - PropertyAnim() : - owner(NULL), - special(SP_NONE), - object(NULL), - accum_pass(0) {} + PropertyAnim() {} }; Map<StringName, PropertyAnim> property_anim; struct BezierAnim { - Vector<StringName> bezier_property; - TrackNodeCache *owner; - float bezier_accum; - Object *object; - uint64_t accum_pass; - - BezierAnim() : - owner(NULL), - bezier_accum(0.0), - object(NULL), - accum_pass(0) {} + TrackNodeCache *owner = nullptr; + float bezier_accum = 0.0; + Object *object = nullptr; + uint64_t accum_pass = 0; + + BezierAnim() {} }; Map<StringName, BezierAnim> bezier_anim; - TrackNodeCache() : - id(0), - node(NULL), - spatial(NULL), - node_2d(NULL), - skeleton(NULL), - bone_idx(-1), - accum_pass(0), - audio_playing(false), - audio_start(0.0), - audio_len(0.0), - animation_playing(false) {} + TrackNodeCache() {} }; struct TrackNodeCacheKey { - ObjectID id; int bone_idx; inline bool operator<(const TrackNodeCacheKey &p_right) const { - - if (id == p_right.id) + if (id == p_right.id) { return bone_idx < p_right.bone_idx; - else + } else { return id < p_right.id; + } } }; @@ -194,7 +171,6 @@ private: Map<StringName, AnimationData> animation_set; struct BlendKey { - StringName from; StringName to; bool operator<(const BlendKey &bk) const { return from == bk.from ? String(to) < String(bk.to) : String(from) < String(bk.from); } @@ -203,35 +179,30 @@ private: Map<BlendKey, float> blend_times; struct PlaybackData { - AnimationData *from; float pos; float speed_scale; PlaybackData() { - pos = 0; speed_scale = 1.0; - from = NULL; + from = nullptr; } }; struct Blend { - PlaybackData data; float blend_time; float blend_left; Blend() { - blend_left = 0; blend_time = 0; } }; struct Playback { - List<Blend> blend; PlaybackData current; StringName assigned; @@ -265,12 +236,10 @@ private: // bind helpers Vector<String> _get_animation_list() const { - List<StringName> animations; get_animation_list(&animations); Vector<String> ret; while (animations.size()) { - ret.push_back(animations.front()->get()); animations.pop_front(); } |