You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-03 16:55:53 +00:00
Fix crash when rearranging filtered animation tracks
This commit is contained in:
@@ -3921,8 +3921,13 @@ void AnimationTrackEditor::remove_track_edit_plugin(const Ref<AnimationTrackEdit
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim, bool p_read_only) {
|
||||
if (animation != p_anim && _get_track_selected() >= 0) {
|
||||
track_edits[_get_track_selected()]->release_focus();
|
||||
if (animation != p_anim) {
|
||||
for (int i = 0; i < track_edits.size(); i++) {
|
||||
if (track_edits[i]->has_focus()) {
|
||||
track_edits[i]->release_focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (animation.is_valid()) {
|
||||
animation->disconnect_changed(callable_mp(this, &AnimationTrackEditor::_animation_changed));
|
||||
@@ -4191,7 +4196,11 @@ void AnimationTrackEditor::_animation_track_remove_request(int p_track, Ref<Anim
|
||||
void AnimationTrackEditor::_track_grab_focus(int p_track) {
|
||||
// Don't steal focus if not working with the track editor.
|
||||
if (Object::cast_to<AnimationTrackEdit>(get_viewport()->gui_get_focus_owner())) {
|
||||
track_edits[p_track]->grab_focus();
|
||||
for (int i = 0; i < track_edits.size(); i++) {
|
||||
if (track_edits[i]->get_track() == p_track) {
|
||||
track_edits[i]->grab_focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5704,7 +5713,7 @@ void AnimationTrackEditor::_timeline_value_changed(double) {
|
||||
int AnimationTrackEditor::_get_track_selected() {
|
||||
for (int i = 0; i < track_edits.size(); i++) {
|
||||
if (track_edits[i]->has_focus()) {
|
||||
return i;
|
||||
return track_edits[i]->get_track();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user