diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2020-09-29 15:01:26 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-11-12 21:27:31 -0600 |
commit | ed9c7bf4509501af9a5482450359dcae69716097 (patch) | |
tree | 3352c28d9d237de289a29cb56b64091aa7c5e701 /editor/plugins | |
parent | 19571c9c4bb8c388ac5d9a0255a8c18c4680b7df (diff) |
Allow creating .gitignore and .gitattributes when creating a new project
Also allow creating these files later, and also allow disabling creating the default environment in editor settings.
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/version_control_editor_plugin.cpp | 33 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.h | 4 |
2 files changed, 37 insertions, 0 deletions
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index b97095ef39..28352d25eb 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -49,6 +49,11 @@ void VersionControlEditorPlugin::_bind_methods() { BIND_ENUM_CONSTANT(CHANGE_TYPE_TYPECHANGE); } +void VersionControlEditorPlugin::_create_vcs_metadata_files() { + String dir = "res://"; + EditorVCSInterface::create_vcs_metadata_files(EditorVCSInterface::VCSMetadata(metadata_selection->get_selected()), dir); +} + void VersionControlEditorPlugin::_selected_a_vcs(int p_id) { List<StringName> available_addons = get_available_vcs_names(); const StringName selected_vcs = set_up_choice->get_item_text(p_id); @@ -71,6 +76,10 @@ VersionControlEditorPlugin *VersionControlEditorPlugin::get_singleton() { return singleton ? singleton : memnew(VersionControlEditorPlugin); } +void VersionControlEditorPlugin::popup_vcs_metadata_dialog() { + metadata_dialog->popup_centered(); +} + void VersionControlEditorPlugin::popup_vcs_set_up_dialog(const Control *p_gui_base) { fetch_available_vcs_addon_names(); List<StringName> available_addons = get_available_vcs_names(); @@ -374,6 +383,30 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { version_control_actions = memnew(PopupMenu); + metadata_dialog = memnew(ConfirmationDialog); + metadata_dialog->set_title(TTR("Create Version Control Metadata")); + metadata_dialog->set_min_size(Size2(200, 40)); + version_control_actions->add_child(metadata_dialog); + + VBoxContainer *metadata_vb = memnew(VBoxContainer); + HBoxContainer *metadata_hb = memnew(HBoxContainer); + metadata_hb->set_custom_minimum_size(Size2(200, 20)); + Label *l = memnew(Label); + l->set_text(TTR("Create VCS metadata files for:")); + metadata_hb->add_child(l); + metadata_selection = memnew(OptionButton); + metadata_selection->set_custom_minimum_size(Size2(100, 20)); + metadata_selection->add_item("None", (int)EditorVCSInterface::VCSMetadata::NONE); + metadata_selection->add_item("Git", (int)EditorVCSInterface::VCSMetadata::GIT); + metadata_selection->select((int)EditorVCSInterface::VCSMetadata::GIT); + metadata_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_create_vcs_metadata_files)); + metadata_hb->add_child(metadata_selection); + metadata_vb->add_child(metadata_hb); + l = memnew(Label); + l->set_text(TTR("Existing VCS metadata files will be overwritten.")); + metadata_vb->add_child(l); + metadata_dialog->add_child(metadata_vb); + set_up_dialog = memnew(AcceptDialog); set_up_dialog->set_title(TTR("Set Up Version Control")); set_up_dialog->set_min_size(Size2(400, 100)); diff --git a/editor/plugins/version_control_editor_plugin.h b/editor/plugins/version_control_editor_plugin.h index d2ba63c86c..2782c1d9dc 100644 --- a/editor/plugins/version_control_editor_plugin.h +++ b/editor/plugins/version_control_editor_plugin.h @@ -57,6 +57,8 @@ private: List<StringName> available_addons; PopupMenu *version_control_actions; + ConfirmationDialog *metadata_dialog; + OptionButton *metadata_selection; AcceptDialog *set_up_dialog; VBoxContainer *set_up_vbc; HBoxContainer *set_up_hbc; @@ -98,6 +100,7 @@ private: RichTextLabel *diff; void _populate_available_vcs_names(); + void _create_vcs_metadata_files(); void _selected_a_vcs(int p_id); void _initialize_vcs(); void _send_commit_msg(); @@ -121,6 +124,7 @@ protected: public: static VersionControlEditorPlugin *get_singleton(); + void popup_vcs_metadata_dialog(); void popup_vcs_set_up_dialog(const Control *p_gui_base); void set_version_control_tool_button(Button *p_button) { version_control_dock_button = p_button; } |