Skip to content

Commit c42751c

Browse files
committed
Merge pull request #91033 from Hilderin/keep_current_bottom_panel_on_play
Add editor setting to keep bottom panel state on play and stop game
2 parents d489d4a + 76205d4 commit c42751c

File tree

6 files changed

+29
-19
lines changed

6 files changed

+29
-19
lines changed

doc/classes/EditorSettings.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -925,14 +925,14 @@
925925
<member name="run/auto_save/save_before_running" type="bool" setter="" getter="">
926926
If [code]true[/code], saves all scenes and scripts automatically before running the project. Setting this to [code]false[/code] prevents the editor from saving if there are no changes which can speed up the project startup slightly, but it makes it possible to run a project that has unsaved changes. (Unsaved changes will not be visible in the running project.)
927927
</member>
928-
<member name="run/output/always_clear_output_on_play" type="bool" setter="" getter="">
929-
If [code]true[/code], the editor will clear the Output panel when running the project.
928+
<member name="run/bottom_panel/action_on_play" type="int" setter="" getter="">
929+
The action to execute on the bottom panel when running the project.
930930
</member>
931-
<member name="run/output/always_close_output_on_stop" type="bool" setter="" getter="">
932-
If [code]true[/code], the editor will collapse the Output panel when stopping the project.
931+
<member name="run/bottom_panel/action_on_stop" type="int" setter="" getter="">
932+
The action to execute on the bottom panel when stopping the project.
933933
</member>
934-
<member name="run/output/always_open_output_on_play" type="bool" setter="" getter="">
935-
If [code]true[/code], the editor will expand the Output panel when running the project.
934+
<member name="run/output/always_clear_output_on_play" type="bool" setter="" getter="">
935+
If [code]true[/code], the editor will clear the Output panel when running the project.
936936
</member>
937937
<member name="run/output/font_size" type="int" setter="" getter="">
938938
The size of the font in the [b]Output[/b] panel at the bottom of the editor. This setting does not impact the font size of the script editor (see [member interface/editor/code_font_size]).

editor/debugger/editor_debugger_node.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,7 @@ Error EditorDebuggerNode::start(const String &p_uri) {
268268
}
269269
stop(true);
270270
current_uri = p_uri;
271-
if (EDITOR_GET("run/output/always_open_output_on_play")) {
272-
EditorNode::get_bottom_panel()->make_item_visible(EditorNode::get_log());
273-
} else {
274-
EditorNode::get_bottom_panel()->make_item_visible(this);
275-
}
271+
276272
server = Ref<EditorDebuggerServer>(EditorDebuggerServer::create(p_uri.substr(0, p_uri.find("://") + 3)));
277273
const Error err = server->start(p_uri);
278274
if (err != OK) {

editor/debugger/script_editor_debugger.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,6 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) {
10091009
set_process(true);
10101010
camera_override = CameraOverride::OVERRIDE_NONE;
10111011

1012-
tabs->set_current_tab(0);
10131012
_set_reason_text(TTR("Debug session started."), MESSAGE_SUCCESS);
10141013
_update_buttons_state();
10151014
emit_signal(SNAME("started"));

editor/editor_node.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4543,17 +4543,19 @@ void EditorNode::_project_run_started() {
45434543
log->clear();
45444544
}
45454545

4546-
if (bool(EDITOR_GET("run/output/always_open_output_on_play"))) {
4546+
int action_on_play = EDITOR_GET("run/bottom_panel/action_on_play");
4547+
if (action_on_play == ACTION_ON_PLAY_OPEN_OUTPUT) {
45474548
bottom_panel->make_item_visible(log);
4549+
} else if (action_on_play == ACTION_ON_PLAY_OPEN_DEBUGGER) {
4550+
bottom_panel->make_item_visible(EditorDebuggerNode::get_singleton());
45484551
}
45494552
}
45504553

45514554
void EditorNode::_project_run_stopped() {
4552-
if (!bool(EDITOR_GET("run/output/always_close_output_on_stop"))) {
4553-
return;
4555+
int action_on_stop = EDITOR_GET("run/bottom_panel/action_on_stop");
4556+
if (action_on_stop == ACTION_ON_STOP_CLOSE_BUTTOM_PANEL) {
4557+
bottom_panel->hide_bottom_panel();
45544558
}
4555-
4556-
bottom_panel->make_item_visible(log, false);
45574559
}
45584560

45594561
void EditorNode::notify_all_debug_sessions_exited() {

editor/editor_node.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ class EditorNode : public Node {
140140
SCENE_NAME_CASING_KEBAB_CASE,
141141
};
142142

143+
enum ActionOnPlay {
144+
ACTION_ON_PLAY_DO_NOTHING,
145+
ACTION_ON_PLAY_OPEN_OUTPUT,
146+
ACTION_ON_PLAY_OPEN_DEBUGGER,
147+
};
148+
149+
enum ActionOnStop {
150+
ACTION_ON_STOP_DO_NOTHING,
151+
ACTION_ON_STOP_CLOSE_BUTTOM_PANEL,
152+
};
153+
143154
struct ExecuteThreadArgs {
144155
String path;
145156
List<String> args;

editor/editor_settings.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,11 +818,13 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
818818
// Auto save
819819
_initial_set("run/auto_save/save_before_running", true);
820820

821+
// Bottom panel
822+
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "run/bottom_panel/action_on_play", EditorNode::ACTION_ON_PLAY_OPEN_OUTPUT, "Do Nothing,Open Output,Open Debugger")
823+
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "run/bottom_panel/action_on_stop", EditorNode::ACTION_ON_STOP_DO_NOTHING, "Do Nothing,Close Bottom Panel")
824+
821825
// Output
822826
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "run/output/font_size", 13, "8,48,1")
823827
_initial_set("run/output/always_clear_output_on_play", true);
824-
_initial_set("run/output/always_open_output_on_play", true);
825-
_initial_set("run/output/always_close_output_on_stop", false);
826828

827829
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "run/output/max_lines", 10000, "100,100000,1")
828830

0 commit comments

Comments
 (0)