Mono: Make 'Build' button generate solution if it doesn't exist

This commit is contained in:
Ignacio Etcheverry 2019-03-06 16:36:53 +01:00
parent 8d117b214f
commit c97db904a0
2 changed files with 14 additions and 1 deletions

View file

@ -185,6 +185,16 @@ void GodotSharpEditor::_toggle_about_dialog_on_start(bool p_enabled) {
}
}
void GodotSharpEditor::_build_solution_pressed() {
if (!FileAccess::exists(GodotSharpDirs::get_project_sln_path())) {
if (!_create_project_solution())
return; // Failed to create solution
}
MonoBottomPanel::get_singleton()->call("_build_project_pressed");
}
void GodotSharpEditor::_menu_option_pressed(int p_id) {
switch (p_id) {
@ -220,6 +230,7 @@ void GodotSharpEditor::_notification(int p_notification) {
void GodotSharpEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_build_solution_pressed"), &GodotSharpEditor::_build_solution_pressed);
ClassDB::bind_method(D_METHOD("_create_project_solution"), &GodotSharpEditor::_create_project_solution);
ClassDB::bind_method(D_METHOD("_make_api_solutions_if_needed"), &GodotSharpEditor::_make_api_solutions_if_needed);
ClassDB::bind_method(D_METHOD("_remove_create_sln_menu_option"), &GodotSharpEditor::_remove_create_sln_menu_option);
@ -482,7 +493,7 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
build_button->set_text("Build");
build_button->set_tooltip("Build solution");
build_button->set_focus_mode(Control::FOCUS_NONE);
build_button->connect("pressed", MonoBottomPanel::get_singleton(), "_build_project_pressed");
build_button->connect("pressed", this, "_build_solution_pressed");
editor->get_menu_hb()->add_child(build_button);
// External editor settings

View file

@ -65,6 +65,8 @@ class GodotSharpEditor : public Node {
void _menu_option_pressed(int p_id);
void _build_solution_pressed();
static GodotSharpEditor *singleton;
protected: