Merge pull request #88827 from adamscott/add-browse-folder-icon

Add browse folder and browse file icons
This commit is contained in:
Rémi Verschelde 2024-03-12 16:28:03 +01:00
commit 48ad83a4e7
No known key found for this signature in database
GPG key ID: C3336907360768E1
9 changed files with 39 additions and 3 deletions

View file

@ -471,6 +471,10 @@ void EditorFileSystemImportFormatSupportQueryBlend::_browse_install() {
browse_dialog->popup_centered_ratio();
}
void EditorFileSystemImportFormatSupportQueryBlend::_update_icons() {
blender_path_browse->set_icon(blender_path_browse->get_editor_theme_icon(SNAME("FolderBrowse")));
}
bool EditorFileSystemImportFormatSupportQueryBlend::query() {
if (!configure_blender_dialog) {
configure_blender_dialog = memnew(ConfirmationDialog);
@ -486,10 +490,12 @@ bool EditorFileSystemImportFormatSupportQueryBlend::query() {
blender_path = memnew(LineEdit);
blender_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hb->add_child(blender_path);
blender_path_browse = memnew(Button);
hb->add_child(blender_path_browse);
blender_path_browse->set_text(TTR("Browse"));
blender_path_browse->connect("pressed", callable_mp(this, &EditorFileSystemImportFormatSupportQueryBlend::_browse_install));
hb->add_child(blender_path_browse);
hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hb->set_custom_minimum_size(Size2(400 * EDSCALE, 0));
@ -515,6 +521,11 @@ bool EditorFileSystemImportFormatSupportQueryBlend::query() {
browse_dialog->connect("dir_selected", callable_mp(this, &EditorFileSystemImportFormatSupportQueryBlend::_select_install));
EditorNode::get_singleton()->get_gui_base()->add_child(browse_dialog);
// Update icons.
// This is a hack because we can't rely on notifications here as we don't receive them.
// Usually, we only have to wait for `NOTIFICATION_THEME_CHANGED` to update the icons.
callable_mp(this, &EditorFileSystemImportFormatSupportQueryBlend::_update_icons).call_deferred();
}
String path = EDITOR_GET("filesystem/import/blender/blender_path");

View file

@ -102,6 +102,8 @@ class EditorFileSystemImportFormatSupportQueryBlend : public EditorFileSystemImp
void _select_install(String p_path);
void _browse_install();
void _update_icons();
public:
virtual bool is_active() const override;
virtual Vector<String> get_file_extensions() const override;