Skip to content

Commit d1b9e51

Browse files
committed
Merge pull request #113269 from bruvzg/emb_headless
[Editor] Disable embedded mode, if `--headless` is in the main instance argument list.
2 parents b275237 + bb8537f commit d1b9e51

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

editor/run/game_view_plugin.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "editor/gui/window_wrapper.h"
4545
#include "editor/run/editor_run_bar.h"
4646
#include "editor/run/embedded_process.h"
47+
#include "editor/run/run_instances_dialog.h"
4748
#include "editor/settings/editor_feature_profile.h"
4849
#include "editor/settings/editor_settings.h"
4950
#include "editor/themes/editor_scale.h"
@@ -672,6 +673,14 @@ GameView::EmbedAvailability GameView::_get_embed_available() {
672673
return EMBED_NOT_AVAILABLE_PROJECT_DISPLAY_DRIVER;
673674
}
674675

676+
if (RunInstancesDialog::get_singleton()) {
677+
List<String> instance_args;
678+
RunInstancesDialog::get_singleton()->get_argument_list_for_instance(0, instance_args);
679+
if (instance_args.find("--headless")) {
680+
return EMBED_NOT_AVAILABLE_HEADLESS;
681+
}
682+
}
683+
675684
EditorRun::WindowPlacement placement = EditorRun::get_window_placement();
676685
if (placement.force_fullscreen) {
677686
return EMBED_NOT_AVAILABLE_FULLSCREEN;
@@ -731,6 +740,9 @@ void GameView::_update_ui() {
731740
case EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE:
732741
state_label->set_text(TTRC("Game embedding not available in single window mode."));
733742
break;
743+
case EMBED_NOT_AVAILABLE_HEADLESS:
744+
state_label->set_text(TTRC("Game embedding not available when the game starts in headless mode."));
745+
break;
734746
}
735747

736748
if (available == EMBED_AVAILABLE) {

editor/run/game_view_plugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class GameView : public VBoxContainer {
129129
EMBED_NOT_AVAILABLE_FULLSCREEN,
130130
EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE,
131131
EMBED_NOT_AVAILABLE_PROJECT_DISPLAY_DRIVER,
132+
EMBED_NOT_AVAILABLE_HEADLESS,
132133
};
133134

134135
inline static GameView *singleton = nullptr;

0 commit comments

Comments
 (0)