From 7e14548fc691be4a4602857a01966913c44b7000 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 2 Dec 2021 12:01:38 +0100 Subject: [Editor] Move some animation specific keying logic out of inspector. Most of the custom logic to handle special keying cases is now inside the AnimationPlayerEditorPlugin. The EditorInspector now emits a signal when inspecting a new object. --- editor/animation_track_editor.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'editor/animation_track_editor.cpp') diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 13e9d58744..973f74d6cc 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3375,7 +3375,13 @@ Node *AnimationTrackEditor::get_root() const { } void AnimationTrackEditor::update_keying() { - bool keying_enabled = is_visible_in_tree() && animation.is_valid(); + bool keying_enabled = false; + + EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history(); + if (is_visible_in_tree() && animation.is_valid() && editor_history->get_path_size() > 0) { + Object *obj = ObjectDB::get_instance(editor_history->get_path_object(0)); + keying_enabled = Object::cast_to(obj) != nullptr; + } if (keying_enabled == keying) { return; @@ -4525,8 +4531,6 @@ void AnimationTrackEditor::_notification(int p_what) { if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { update_keying(); - EditorNode::get_singleton()->update_keying(); - emit_signal(SNAME("keying_changed")); } } -- cgit v1.2.3