Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Animation::_clear() with explicit .clear() calls. #101354

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions scene/resources/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,50 +948,50 @@ void Animation::remove_track(int p_track) {
case TYPE_POSITION_3D: {
PositionTrack *tt = static_cast<PositionTrack *>(t);
ERR_FAIL_COND_MSG(tt->compressed_track >= 0, "Compressed tracks can't be manually removed. Call clear() to get rid of compression first.");
_clear(tt->positions);
tt->positions.clear();

} break;
case TYPE_ROTATION_3D: {
RotationTrack *rt = static_cast<RotationTrack *>(t);
ERR_FAIL_COND_MSG(rt->compressed_track >= 0, "Compressed tracks can't be manually removed. Call clear() to get rid of compression first.");
_clear(rt->rotations);
rt->rotations.clear();

} break;
case TYPE_SCALE_3D: {
ScaleTrack *st = static_cast<ScaleTrack *>(t);
ERR_FAIL_COND_MSG(st->compressed_track >= 0, "Compressed tracks can't be manually removed. Call clear() to get rid of compression first.");
_clear(st->scales);
st->scales.clear();

} break;
case TYPE_BLEND_SHAPE: {
BlendShapeTrack *bst = static_cast<BlendShapeTrack *>(t);
ERR_FAIL_COND_MSG(bst->compressed_track >= 0, "Compressed tracks can't be manually removed. Call clear() to get rid of compression first.");
_clear(bst->blend_shapes);
bst->blend_shapes.clear();

} break;
case TYPE_VALUE: {
ValueTrack *vt = static_cast<ValueTrack *>(t);
_clear(vt->values);
vt->values.clear();

} break;
case TYPE_METHOD: {
MethodTrack *mt = static_cast<MethodTrack *>(t);
_clear(mt->methods);
mt->methods.clear();

} break;
case TYPE_BEZIER: {
BezierTrack *bz = static_cast<BezierTrack *>(t);
_clear(bz->values);
bz->values.clear();

} break;
case TYPE_AUDIO: {
AudioTrack *ad = static_cast<AudioTrack *>(t);
_clear(ad->values);
ad->values.clear();

} break;
case TYPE_ANIMATION: {
AnimationTrack *an = static_cast<AnimationTrack *>(t);
_clear(an->values);
an->values.clear();

} break;
}
Expand Down Expand Up @@ -1137,11 +1137,6 @@ int Animation::_marker_insert(double p_time, Vector<MarkerKey> &p_keys, const Ma
return -1;
}

template <typename T>
void Animation::_clear(T &p_keys) {
p_keys.clear();
}

////

int Animation::position_track_insert_key(int p_track, double p_time, const Vector3 &p_position) {
Expand Down
3 changes: 0 additions & 3 deletions scene/resources/animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ class Animation : public Resource {

Vector<Track *> tracks;

template <typename T>
void _clear(T &p_keys);

template <typename T, typename V>
int _insert(double p_time, T &p_keys, const V &p_value);

Expand Down