mirror of
https://github.com/godotengine/godot.git
synced 2025-01-06 17:37:18 +08:00
Debugger: Save options in project metadata
Fixes #19542.
(cherry picked from commit 090361f3c9
)
This commit is contained in:
parent
fcab27878c
commit
4816317bbc
@ -292,8 +292,6 @@ void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) {
|
||||
}
|
||||
|
||||
void ScriptEditor::_show_debugger(bool p_show) {
|
||||
|
||||
//debug_menu->get_popup()->set_item_checked( debug_menu->get_popup()->get_item_index(DEBUG_SHOW), p_show);
|
||||
}
|
||||
|
||||
void ScriptEditor::_script_created(Ref<Script> p_script) {
|
||||
@ -1119,26 +1117,21 @@ void ScriptEditor::_menu_option(int p_option) {
|
||||
_sort_list_on_update = true;
|
||||
_update_script_names();
|
||||
} break;
|
||||
case DEBUG_SHOW: {
|
||||
case DEBUG_KEEP_DEBUGGER_OPEN: {
|
||||
bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_KEEP_DEBUGGER_OPEN));
|
||||
if (debugger) {
|
||||
bool visible = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_SHOW));
|
||||
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_SHOW), !visible);
|
||||
if (visible)
|
||||
debugger->hide();
|
||||
else
|
||||
debugger->show();
|
||||
debugger->set_hide_on_stop(ischecked);
|
||||
}
|
||||
} break;
|
||||
case DEBUG_SHOW_KEEP_OPEN: {
|
||||
bool visible = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_SHOW_KEEP_OPEN));
|
||||
if (debugger)
|
||||
debugger->set_hide_on_stop(visible);
|
||||
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_SHOW_KEEP_OPEN), !visible);
|
||||
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_KEEP_DEBUGGER_OPEN), !ischecked);
|
||||
EditorSettings::get_singleton()->set_project_metadata("debug_options", "keep_debugger_open", !ischecked);
|
||||
} break;
|
||||
case DEBUG_WITH_EXTERNAL_EDITOR: {
|
||||
bool debug_with_external_editor = !debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR));
|
||||
debugger->set_debug_with_external_editor(debug_with_external_editor);
|
||||
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR), debug_with_external_editor);
|
||||
bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR));
|
||||
if (debugger) {
|
||||
debugger->set_debug_with_external_editor(!ischecked);
|
||||
}
|
||||
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR), !ischecked);
|
||||
EditorSettings::get_singleton()->set_project_metadata("debug_options", "debug_with_external_editor", !ischecked);
|
||||
} break;
|
||||
case TOGGLE_SCRIPTS_PANEL: {
|
||||
if (current) {
|
||||
@ -1388,6 +1381,18 @@ void ScriptEditor::_menu_option(int p_option) {
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEditor::_update_debug_options() {
|
||||
bool keep_debugger_open = EditorSettings::get_singleton()->get_project_metadata("debug_options", "keep_debugger_open", false);
|
||||
bool debug_with_external_editor = EditorSettings::get_singleton()->get_project_metadata("debug_options", "debug_with_external_editor", false);
|
||||
|
||||
if (keep_debugger_open) {
|
||||
_menu_option(DEBUG_KEEP_DEBUGGER_OPEN);
|
||||
}
|
||||
if (debug_with_external_editor) {
|
||||
_menu_option(DEBUG_WITH_EXTERNAL_EDITOR);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEditor::_theme_option(int p_option) {
|
||||
switch (p_option) {
|
||||
case THEME_IMPORT: {
|
||||
@ -1474,6 +1479,8 @@ void ScriptEditor::_notification(int p_what) {
|
||||
get_tree()->connect("tree_changed", this, "_tree_changed");
|
||||
editor->get_inspector_dock()->connect("request_help", this, "_request_help");
|
||||
editor->connect("request_help_search", this, "_help_search");
|
||||
|
||||
_update_debug_options();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
@ -3393,8 +3400,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
|
||||
debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/break", TTR("Break")), DEBUG_BREAK);
|
||||
debug_menu->get_popup()->add_shortcut(ED_SHORTCUT("debugger/continue", TTR("Continue"), KEY_F12), DEBUG_CONTINUE);
|
||||
debug_menu->get_popup()->add_separator();
|
||||
//debug_menu->get_popup()->add_check_item("Show Debugger",DEBUG_SHOW);
|
||||
debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/keep_debugger_open", TTR("Keep Debugger Open")), DEBUG_SHOW_KEEP_OPEN);
|
||||
debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/keep_debugger_open", TTR("Keep Debugger Open")), DEBUG_KEEP_DEBUGGER_OPEN);
|
||||
debug_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("debugger/debug_with_external_editor", TTR("Debug with External Editor")), DEBUG_WITH_EXTERNAL_EDITOR);
|
||||
debug_menu->get_popup()->connect("id_pressed", this, "_menu_option");
|
||||
|
||||
|
@ -160,8 +160,7 @@ class ScriptEditor : public PanelContainer {
|
||||
DEBUG_STEP,
|
||||
DEBUG_BREAK,
|
||||
DEBUG_CONTINUE,
|
||||
DEBUG_SHOW,
|
||||
DEBUG_SHOW_KEEP_OPEN,
|
||||
DEBUG_KEEP_DEBUGGER_OPEN,
|
||||
DEBUG_WITH_EXTERNAL_EDITOR,
|
||||
SEARCH_IN_FILES,
|
||||
SEARCH_HELP,
|
||||
@ -270,6 +269,7 @@ class ScriptEditor : public PanelContainer {
|
||||
|
||||
void _tab_changed(int p_which);
|
||||
void _menu_option(int p_option);
|
||||
void _update_debug_options();
|
||||
void _theme_option(int p_option);
|
||||
void _show_save_theme_as_dialog();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user