diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-05 11:38:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-05 11:38:48 +0200 |
commit | 789646e2010632908b0569c64190b1b37e033cb8 (patch) | |
tree | 04de886402f92952746a44fff126275d17f109dd /editor/plugins | |
parent | 189aa6340e7d40bb248a3f731229f930f8409b66 (diff) | |
parent | d89d00ac7ee50c911b9aa1b5cc6b04b1c54ca761 (diff) |
Merge pull request #47632 from Calinou/asset-search-autofocus
Automatically focus the Search field when displaying asset library
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 1345adc8ee..904517b119 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -557,8 +557,15 @@ void EditorAssetLibrary::_notification(int p_what) { error_label->raise(); } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible() && initial_loading) { - _repository_changed(0); // Update when shown for the first time. + if (is_visible()) { + // Focus the search box automatically when switching to the Templates tab (in the Project Manager) + // or switching to the AssetLib tab (in the editor). + // The Project Manager's project filter box is automatically focused in the project manager code. + filter->grab_focus(); + + if (initial_loading) { + _repository_changed(0); // Update when shown for the first time. + } } } break; case NOTIFICATION_PROCESS: { @@ -1332,6 +1339,11 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { library_main->add_theme_constant_override("separation", 10 * EDSCALE); filter = memnew(LineEdit); + if (templates_only) { + filter->set_placeholder(TTR("Search templates, projects, and demos")); + } else { + filter->set_placeholder(TTR("Search assets (excluding templates, projects, and demos)")); + } search_hb->add_child(filter); filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->connect("text_changed", callable_mp(this, &EditorAssetLibrary::_search_text_changed)); |