1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Prevent generating editor 3D scene preview in headless mode.

This commit is contained in:
Mounir Tohami
2025-07-30 15:52:51 +03:00
parent 2a9ff39264
commit 706601778e
3 changed files with 6 additions and 13 deletions

View File

@@ -230,9 +230,12 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
}
void EditorInterface::make_scene_preview(const String &p_path, Node *p_scene, int p_preview_size) {
ERR_FAIL_NULL_MSG(p_scene, "The provided scene is null.");
if (!Engine::get_singleton()->is_editor_hint() || !DisplayServer::get_singleton()->window_can_draw()) {
return;
}
ERR_FAIL_COND_MSG(p_path.is_empty(), "Path is empty, cannot generate preview.");
ERR_FAIL_NULL_MSG(p_scene, "The provided scene is null, cannot generate preview.");
ERR_FAIL_COND_MSG(p_scene->is_inside_tree(), "The scene must not be inside the tree.");
ERR_FAIL_COND_MSG(!Engine::get_singleton()->is_editor_hint(), "This function can only be called from the editor.");
ERR_FAIL_NULL_MSG(EditorNode::get_singleton(), "EditorNode doesn't exist.");
SubViewport *sub_viewport_node = memnew(SubViewport);