mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #111427 from Nallebeorn/animation-player-crash
Fix crash when rearranging filtered animation tracks
This commit is contained in:
commit
4e35e04bbd
1 changed files with 13 additions and 4 deletions
|
|
@ -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) {
|
void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim, bool p_read_only) {
|
||||||
if (animation != p_anim && _get_track_selected() >= 0) {
|
if (animation != p_anim) {
|
||||||
track_edits[_get_track_selected()]->release_focus();
|
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()) {
|
if (animation.is_valid()) {
|
||||||
animation->disconnect_changed(callable_mp(this, &AnimationTrackEditor::_animation_changed));
|
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) {
|
void AnimationTrackEditor::_track_grab_focus(int p_track) {
|
||||||
// Don't steal focus if not working with the track editor.
|
// Don't steal focus if not working with the track editor.
|
||||||
if (Object::cast_to<AnimationTrackEdit>(get_viewport()->gui_get_focus_owner())) {
|
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() {
|
int AnimationTrackEditor::_get_track_selected() {
|
||||||
for (int i = 0; i < track_edits.size(); i++) {
|
for (int i = 0; i < track_edits.size(); i++) {
|
||||||
if (track_edits[i]->has_focus()) {
|
if (track_edits[i]->has_focus()) {
|
||||||
return i;
|
return track_edits[i]->get_track();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue