Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Disable "Activate now" when creating addons #83578

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions editor/plugin_config_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ void PluginConfigDialog::_on_canceled() {

void PluginConfigDialog::_on_required_text_changed() {
int lang_idx = script_option_edit->get_selected();
String ext = ScriptServer::get_language(lang_idx)->get_extension();
ScriptLanguage *language = ScriptServer::get_language(lang_idx);
String ext = language->get_extension();

if (name_edit->get_text().is_empty()) {
validation_panel->set_message(MSG_ID_PLUGIN, TTR("Plugin name cannot be blank."), EditorValidationPanel::MSG_ERROR);
Expand All @@ -120,6 +121,15 @@ void PluginConfigDialog::_on_required_text_changed() {
} else {
validation_panel->set_message(MSG_ID_SUBFOLDER, "", EditorValidationPanel::MSG_OK);
}
if (active_edit->is_visible()) {
if (language->get_name() == "C#") {
active_edit->set_pressed(false);
active_edit->set_disabled(true);
validation_panel->set_message(MSG_ID_ACTIVE, TTR("C# doesn't support activating the plugin on creation because the project must be built first."), EditorValidationPanel::MSG_WARNING);
} else {
active_edit->set_disabled(false);
}
}
}

String PluginConfigDialog::_get_subfolder() {
Expand Down Expand Up @@ -291,7 +301,6 @@ PluginConfigDialog::PluginConfigDialog() {
grid->add_child(script_edit);

// Activate now checkbox
// TODO Make this option work better with languages like C#. Right now, it does not work because the C# project must be compiled first.
Label *active_lb = memnew(Label);
active_lb->set_text(TTR("Activate now?"));
active_lb->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
Expand All @@ -310,6 +319,7 @@ PluginConfigDialog::PluginConfigDialog() {
validation_panel->add_line(MSG_ID_PLUGIN, TTR("Plugin name is valid."));
validation_panel->add_line(MSG_ID_SCRIPT, TTR("Script extension is valid."));
validation_panel->add_line(MSG_ID_SUBFOLDER, TTR("Subfolder name is valid."));
validation_panel->add_line(MSG_ID_ACTIVE, "");
validation_panel->set_update_callback(callable_mp(this, &PluginConfigDialog::_on_required_text_changed));
validation_panel->set_accept_button(get_ok_button());

Expand Down
1 change: 1 addition & 0 deletions editor/plugin_config_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class PluginConfigDialog : public ConfirmationDialog {
MSG_ID_PLUGIN,
MSG_ID_SUBFOLDER,
MSG_ID_SCRIPT,
MSG_ID_ACTIVE,
};

LineEdit *name_edit = nullptr;
Expand Down
Loading