Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Optimize performance when selecting and moving multiple keys

rinevarde4db57213450
diff --git a/editor/animation/animation_track_editor.cpp b/editor/animation/animation_track_editor.cpp
index db2d8f097af..8ddcbba1e39 100644
--- a/editor/animation/animation_track_editor.cpp
+++ b/editor/animation/animation_track_editor.cpp
@@ -6266,6 +6266,19 @@ void AnimationTrackEditor::_clear_selection(bool p_update) {
}
void AnimationTrackEditor::_update_key_edit() {
+ if (update_key_edit_pending) {
+ return;
+ }
+ update_key_edit_pending = true;
+ callable_mp(this, &AnimationTrackEditor::_update_key_edit_callback).call_deferred();
+}
+
+void AnimationTrackEditor::_update_key_edit_callback() {
+ if (!update_key_edit_pending) {
+ return;
+ }
+ update_key_edit_pending = false;
+
_clear_key_edit();
if (animation.is_null()) {
return;
diff --git a/editor/animation/animation_track_editor.h b/editor/animation/animation_track_editor.h
index 1d2fe00d8f8..017882ae47e 100644
--- a/editor/animation/animation_track_editor.h
+++ b/editor/animation/animation_track_editor.h
@@ -777,7 +777,9 @@ class AnimationTrackEditor : public VBoxContainer {
AnimationTrackKeyEdit *key_edit = nullptr;
AnimationMultiTrackKeyEdit *multi_key_edit = nullptr;
+ bool update_key_edit_pending = false;
void _update_key_edit();
+ void _update_key_edit_callback();
void _clear_key_edit();
Control *box_selection_container = nullptr;