Merge pull request #113269 from bruvzg/emb_headless

[Editor] Disable embedded mode, if `--headless` is in the main instance argument list.
This commit is contained in:
Rémi Verschelde 2025-12-01 11:49:41 +01:00
commit d1b9e51e12
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 13 additions and 0 deletions

View file

@ -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<String> 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) {

View file

@ -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;