1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Add browse folder and browse file icons

This commit is contained in:
Adam Scott
2024-02-25 13:10:29 -05:00
parent 22c20cea6e
commit 44d3ce2c11
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;