Преглед на файлове

Merge pull request #102692 from a-johnston/avoid_preview_error_for_animation_node

Prevent off-thread errors when generating resource previews for animation nodes
Rémi Verschelde преди 8 месеца
родител
ревизия
caaa3e5f4b
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      editor/plugins/animation_tree_editor_plugin.cpp

+ 2 - 1
editor/plugins/animation_tree_editor_plugin.cpp

@@ -234,7 +234,8 @@ bool AnimationTreeEditor::can_edit(const Ref<AnimationNode> &p_node) const {
 }
 
 Vector<String> 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<String>();
 	}