Save and restore debug options
This commit is contained in:
parent
6bfaa0f12c
commit
79e8616fbb
|
@ -338,6 +338,7 @@ void EditorNode::_notification(int p_what) {
|
||||||
VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(),true);
|
VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(),true);
|
||||||
|
|
||||||
_editor_select(EDITOR_3D);
|
_editor_select(EDITOR_3D);
|
||||||
|
_update_debug_options();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (defer_optimize!="") {
|
if (defer_optimize!="") {
|
||||||
|
@ -2674,7 +2675,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),!ischecked);
|
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),!ischecked);
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked);
|
||||||
} break;
|
} break;
|
||||||
case RUN_LIVE_DEBUG: {
|
case RUN_LIVE_DEBUG: {
|
||||||
|
|
||||||
|
@ -2682,6 +2683,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
|
|
||||||
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG),!ischecked);
|
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG),!ischecked);
|
||||||
ScriptEditor::get_singleton()->get_debugger()->set_live_debugging(!ischecked);
|
ScriptEditor::get_singleton()->get_debugger()->set_live_debugging(!ischecked);
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
/*case RUN_DEPLOY_DUMB_CLIENTS: {
|
/*case RUN_DEPLOY_DUMB_CLIENTS: {
|
||||||
|
@ -2696,6 +2699,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
|
bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
|
||||||
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG),!ischecked);
|
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG),!ischecked);
|
||||||
run_native->set_deploy_debug_remote(!ischecked);
|
run_native->set_deploy_debug_remote(!ischecked);
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case RUN_DEBUG_COLLISONS: {
|
case RUN_DEBUG_COLLISONS: {
|
||||||
|
@ -2704,6 +2708,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS),!ischecked);
|
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS),!ischecked);
|
||||||
run_native->set_debug_collisions(!ischecked);
|
run_native->set_debug_collisions(!ischecked);
|
||||||
editor_run.set_debug_collisions(!ischecked);
|
editor_run.set_debug_collisions(!ischecked);
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisons", !ischecked);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case RUN_DEBUG_NAVIGATION: {
|
case RUN_DEBUG_NAVIGATION: {
|
||||||
|
|
||||||
|
@ -2711,6 +2717,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION),!ischecked);
|
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION),!ischecked);
|
||||||
run_native->set_debug_navigation(!ischecked);
|
run_native->set_debug_navigation(!ischecked);
|
||||||
editor_run.set_debug_navigation(!ischecked);
|
editor_run.set_debug_navigation(!ischecked);
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_navigation", !ischecked);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case RUN_RELOAD_SCRIPTS: {
|
case RUN_RELOAD_SCRIPTS: {
|
||||||
|
|
||||||
|
@ -2719,6 +2727,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS),!ischecked);
|
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS),!ischecked);
|
||||||
|
|
||||||
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
|
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
|
||||||
|
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case SETTINGS_UPDATE_ALWAYS: {
|
case SETTINGS_UPDATE_ALWAYS: {
|
||||||
|
|
||||||
|
@ -2864,6 +2874,23 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorNode::_update_debug_options() {
|
||||||
|
|
||||||
|
bool check_deploy_remote = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_deploy_remote_debug", false);
|
||||||
|
bool check_file_server = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_file_server", false);
|
||||||
|
bool check_debug_collisons = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisons", false);
|
||||||
|
bool check_debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
|
||||||
|
bool check_live_debug = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_live_debug", false);
|
||||||
|
bool check_reload_scripts = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_reload_scripts", false);
|
||||||
|
|
||||||
|
if (check_deploy_remote) _menu_option_confirm(RUN_DEPLOY_REMOTE_DEBUG, true);
|
||||||
|
if (check_file_server) _menu_option_confirm(RUN_FILE_SERVER, true);
|
||||||
|
if (check_debug_collisons) _menu_option_confirm(RUN_DEBUG_COLLISONS, true);
|
||||||
|
if (check_debug_navigation) _menu_option_confirm(RUN_DEBUG_NAVIGATION, true);
|
||||||
|
if (check_live_debug) _menu_option_confirm(RUN_LIVE_DEBUG, true);
|
||||||
|
if (check_reload_scripts) _menu_option_confirm(RUN_RELOAD_SCRIPTS, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Control* EditorNode::get_viewport() {
|
Control* EditorNode::get_viewport() {
|
||||||
|
|
||||||
|
|
|
@ -432,6 +432,7 @@ private:
|
||||||
void _menu_option(int p_option);
|
void _menu_option(int p_option);
|
||||||
void _menu_confirm_current();
|
void _menu_confirm_current();
|
||||||
void _menu_option_confirm(int p_option,bool p_confirmed);
|
void _menu_option_confirm(int p_option,bool p_confirmed);
|
||||||
|
void _update_debug_options();
|
||||||
|
|
||||||
void _property_editor_forward();
|
void _property_editor_forward();
|
||||||
void _property_editor_back();
|
void _property_editor_back();
|
||||||
|
|
|
@ -1029,26 +1029,22 @@ void EditorSettings::set_optimize_save(bool p_optimize) {
|
||||||
optimize_save=p_optimize;
|
optimize_save=p_optimize;
|
||||||
}
|
}
|
||||||
|
|
||||||
String EditorSettings::get_last_selected_language()
|
Variant EditorSettings::get_project_metadata(const String& p_section, const String& p_key, Variant p_default) {
|
||||||
{
|
|
||||||
Ref<ConfigFile> cf = memnew( ConfigFile );
|
Ref<ConfigFile> cf = memnew( ConfigFile );
|
||||||
String path = get_project_settings_path().plus_file("project_metadata.cfg");
|
String path = get_project_settings_path().plus_file("project_metadata.cfg");
|
||||||
Error err = cf->load(path);
|
Error err = cf->load(path);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
return "";
|
return p_default;
|
||||||
}
|
}
|
||||||
Variant last_selected_language = cf->get_value("script_setup", "last_selected_language");
|
return cf->get_value(p_section, p_key, p_default);
|
||||||
if (last_selected_language.get_type() != Variant::STRING)
|
|
||||||
return "";
|
|
||||||
return static_cast<String>(last_selected_language);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSettings::set_last_selected_language(String p_language)
|
void EditorSettings::set_project_metadata(const String& p_section, const String& p_key, Variant p_data)
|
||||||
{
|
{
|
||||||
Ref<ConfigFile> cf = memnew( ConfigFile );
|
Ref<ConfigFile> cf = memnew( ConfigFile );
|
||||||
String path = get_project_settings_path().plus_file("project_metadata.cfg");
|
String path = get_project_settings_path().plus_file("project_metadata.cfg");
|
||||||
cf->load(path);
|
cf->load(path);
|
||||||
cf->set_value("script_setup", "last_selected_language", p_language);
|
cf->set_value(p_section, p_key, p_data);
|
||||||
cf->save(path);
|
cf->save(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,8 +160,8 @@ public:
|
||||||
|
|
||||||
void set_optimize_save(bool p_optimize);
|
void set_optimize_save(bool p_optimize);
|
||||||
|
|
||||||
String get_last_selected_language();
|
Variant get_project_metadata(const String& p_section, const String& p_key, Variant p_default);
|
||||||
void set_last_selected_language(String p_language);
|
void set_project_metadata(const String& p_section, const String& p_key, Variant p_data);
|
||||||
|
|
||||||
EditorSettings();
|
EditorSettings();
|
||||||
~EditorSettings();
|
~EditorSettings();
|
||||||
|
|
|
@ -128,7 +128,7 @@ void ScriptCreateDialog::_create_new() {
|
||||||
Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text());
|
Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text());
|
||||||
|
|
||||||
String selected_language = language_menu->get_item_text(language_menu->get_selected());
|
String selected_language = language_menu->get_item_text(language_menu->get_selected());
|
||||||
editor_settings->set_last_selected_language(selected_language);
|
editor_settings->set_project_metadata("script_setup", "last_selected_language", selected_language);
|
||||||
|
|
||||||
if (cname!="")
|
if (cname!="")
|
||||||
scr->set_name(cname);
|
scr->set_name(cname);
|
||||||
|
@ -380,7 +380,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
editor_settings = EditorSettings::get_singleton();
|
editor_settings = EditorSettings::get_singleton();
|
||||||
String last_selected_language = editor_settings->get_last_selected_language();
|
String last_selected_language = editor_settings->get_project_metadata("script_setup", "last_selected_language", "");
|
||||||
if (last_selected_language != "")
|
if (last_selected_language != "")
|
||||||
for (int i = 0; i < language_menu->get_item_count(); i++)
|
for (int i = 0; i < language_menu->get_item_count(); i++)
|
||||||
if (language_menu->get_item_text(i) == last_selected_language)
|
if (language_menu->get_item_text(i) == last_selected_language)
|
||||||
|
|
Loading…
Reference in New Issue