From bb8537f657c4ef3e1b7958a82dbf768816b6ae5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Fri, 28 Nov 2025 10:48:43 +0200 Subject: [PATCH] [Editor] Disable embedded mode, if `--headless` is in the main instance argument list. --- editor/run/game_view_plugin.cpp | 12 ++++++++++++ editor/run/game_view_plugin.h | 1 + 2 files changed, 13 insertions(+) diff --git a/editor/run/game_view_plugin.cpp b/editor/run/game_view_plugin.cpp index 5361dbdd1d3..5b46a8b5547 100644 --- a/editor/run/game_view_plugin.cpp +++ b/editor/run/game_view_plugin.cpp @@ -44,6 +44,7 @@ #include "editor/gui/window_wrapper.h" #include "editor/run/editor_run_bar.h" #include "editor/run/embedded_process.h" +#include "editor/run/run_instances_dialog.h" #include "editor/settings/editor_feature_profile.h" #include "editor/settings/editor_settings.h" #include "editor/themes/editor_scale.h" @@ -672,6 +673,14 @@ GameView::EmbedAvailability GameView::_get_embed_available() { return EMBED_NOT_AVAILABLE_PROJECT_DISPLAY_DRIVER; } + if (RunInstancesDialog::get_singleton()) { + List instance_args; + RunInstancesDialog::get_singleton()->get_argument_list_for_instance(0, instance_args); + if (instance_args.find("--headless")) { + return EMBED_NOT_AVAILABLE_HEADLESS; + } + } + EditorRun::WindowPlacement placement = EditorRun::get_window_placement(); if (placement.force_fullscreen) { return EMBED_NOT_AVAILABLE_FULLSCREEN; @@ -731,6 +740,9 @@ void GameView::_update_ui() { case EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE: state_label->set_text(TTRC("Game embedding not available in single window mode.")); break; + case EMBED_NOT_AVAILABLE_HEADLESS: + state_label->set_text(TTRC("Game embedding not available when the game starts in headless mode.")); + break; } if (available == EMBED_AVAILABLE) { diff --git a/editor/run/game_view_plugin.h b/editor/run/game_view_plugin.h index 0876f809f73..cfb00f5ba21 100644 --- a/editor/run/game_view_plugin.h +++ b/editor/run/game_view_plugin.h @@ -129,6 +129,7 @@ class GameView : public VBoxContainer { EMBED_NOT_AVAILABLE_FULLSCREEN, EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE, EMBED_NOT_AVAILABLE_PROJECT_DISPLAY_DRIVER, + EMBED_NOT_AVAILABLE_HEADLESS, }; inline static GameView *singleton = nullptr;