diff options
author | jmb462 <jmb462@gmail.com> | 2021-10-17 23:42:04 +0200 |
---|---|---|
committer | jmb462 <jmb462@gmail.com> | 2021-10-17 23:42:04 +0200 |
commit | f2943eec72c9dbd182a17ccdab1d99809382b4e9 (patch) | |
tree | 03cd7dd932c255ff5632ffc4ff1f5ef2afc17fd7 /editor | |
parent | 468b987aa38b21b55c1cd8a8d4c03b8e1b2a1373 (diff) |
Fix plugin create dialog subfolder and script field validity checks
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugin_config_dialog.cpp | 8 | ||||
-rw-r--r-- | editor/plugin_config_dialog.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index a3ff312497..91ca1465df 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -124,6 +124,10 @@ void PluginConfigDialog::_on_cancelled() { _clear_fields(); } +void PluginConfigDialog::_on_language_changed(const int) { + _on_required_text_changed(String()); +} + void PluginConfigDialog::_on_required_text_changed(const String &) { int lang_idx = script_option_edit->get_selected(); String ext = ScriptServer::get_language(lang_idx)->get_extension(); @@ -161,6 +165,9 @@ void PluginConfigDialog::_on_required_text_changed(const String &) { is_valid = false; subfolder_validation->set_texture(invalid_icon); subfolder_validation->set_tooltip(TTR("Subfolder cannot be blank.")); + } else if (!subfolder_edit->get_text().is_valid_filename()) { + subfolder_validation->set_texture(invalid_icon); + subfolder_validation->set_tooltip(TTR("Subfolder name is not a valid folder name.")); } else { DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_RESOURCES); String path = "res://addons/" + subfolder_edit->get_text(); @@ -330,6 +337,7 @@ PluginConfigDialog::PluginConfigDialog() { } script_option_edit->select(default_lang); grid->add_child(script_option_edit); + script_option_edit->connect("item_selected", callable_mp(this, &PluginConfigDialog::_on_language_changed)); // Plugin Script Name Label *script_lb = memnew(Label); diff --git a/editor/plugin_config_dialog.h b/editor/plugin_config_dialog.h index ad5b96735f..45fcdb6b6e 100644 --- a/editor/plugin_config_dialog.h +++ b/editor/plugin_config_dialog.h @@ -59,6 +59,7 @@ class PluginConfigDialog : public ConfirmationDialog { void _clear_fields(); void _on_confirmed(); void _on_cancelled(); + void _on_language_changed(const int p_language); void _on_required_text_changed(const String &p_text); static String _to_absolute_plugin_path(const String &p_plugin_name); |