Skip to content

Commit 76205d4

Browse files
committed
Add editor setting to keep bottom panel state on play and stop game
1 parent 7abe0c6 commit 76205d4

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
@@ -912,14 +912,14 @@
912912
<member name="run/auto_save/save_before_running" type="bool" setter="" getter="">
913913
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.)
914914
</member>
915-
<member name="run/output/always_clear_output_on_play" type="bool" setter="" getter="">
916-
If [code]true[/code], the editor will clear the Output panel when running the project.
915+
<member name="run/bottom_panel/action_on_play" type="int" setter="" getter="">
916+
The action to execute on the bottom panel when running the project.
917917
</member>
918-
<member name="run/output/always_close_output_on_stop" type="bool" setter="" getter="">
919-
If [code]true[/code], the editor will collapse the Output panel when stopping the project.
918+
<member name="run/bottom_panel/action_on_stop" type="int" setter="" getter="">
919+
The action to execute on the bottom panel when stopping the project.
920920
</member>
921-
<member name="run/output/always_open_output_on_play" type="bool" setter="" getter="">
922-
If [code]true[/code], the editor will expand the Output panel when running the project.
921+
<member name="run/output/always_clear_output_on_play" type="bool" setter="" getter="">
922+
If [code]true[/code], the editor will clear the Output panel when running the project.
923923
</member>
924924
<member name="run/output/font_size" type="int" setter="" getter="">
925925
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
@@ -1008,7 +1008,6 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) {
10081008
set_process(true);
10091009
camera_override = CameraOverride::OVERRIDE_NONE;
10101010

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

editor/editor_node.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,17 +4391,19 @@ void EditorNode::_project_run_started() {
43914391
log->clear();
43924392
}
43934393

4394-
if (bool(EDITOR_GET("run/output/always_open_output_on_play"))) {
4394+
int action_on_play = EDITOR_GET("run/bottom_panel/action_on_play");
4395+
if (action_on_play == ACTION_ON_PLAY_OPEN_OUTPUT) {
43954396
bottom_panel->make_item_visible(log);
4397+
} else if (action_on_play == ACTION_ON_PLAY_OPEN_DEBUGGER) {
4398+
bottom_panel->make_item_visible(EditorDebuggerNode::get_singleton());
43964399
}
43974400
}
43984401

43994402
void EditorNode::_project_run_stopped() {
4400-
if (!bool(EDITOR_GET("run/output/always_close_output_on_stop"))) {
4401-
return;
4403+
int action_on_stop = EDITOR_GET("run/bottom_panel/action_on_stop");
4404+
if (action_on_stop == ACTION_ON_STOP_CLOSE_BUTTOM_PANEL) {
4405+
bottom_panel->hide_bottom_panel();
44024406
}
4403-
4404-
bottom_panel->make_item_visible(log, false);
44054407
}
44064408

44074409
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
@@ -815,11 +815,13 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
815815
// Auto save
816816
_initial_set("run/auto_save/save_before_running", true);
817817

818+
// Bottom panel
819+
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")
820+
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "run/bottom_panel/action_on_stop", EditorNode::ACTION_ON_STOP_DO_NOTHING, "Do Nothing,Close Bottom Panel")
821+
818822
// Output
819823
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "run/output/font_size", 13, "8,48,1")
820824
_initial_set("run/output/always_clear_output_on_play", true);
821-
_initial_set("run/output/always_open_output_on_play", true);
822-
_initial_set("run/output/always_close_output_on_stop", false);
823825

824826
// Platform
825827
_initial_set("run/platforms/linuxbsd/prefer_wayland", false);

0 commit comments

Comments
 (0)