From c82c5b0701a1907e179fcb9849258a5dbcd9770e Mon Sep 17 00:00:00 2001 From: Adam Johnston Date: Mon, 10 Feb 2025 23:17:01 -0800 Subject: [PATCH] Prevent off-thread errors when generating resource previews for animation nodes --- editor/plugins/animation_tree_editor_plugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 89338e3837a..bfffc90735a 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -234,7 +234,8 @@ bool AnimationTreeEditor::can_edit(const Ref &p_node) const { } Vector AnimationTreeEditor::get_animation_list() { - if (!singleton->tree || !singleton->is_visible()) { + // This can be called off the main thread due to resource preview generation. Quit early in that case. + if (!singleton->tree || !Thread::is_main_thread() || !singleton->is_visible()) { // When tree is empty, singleton not in the main thread. return Vector(); }