Merge pull request #56967 from pycbouh/assetlib-ux-in-progress
Fix Asset Library UX when an asset is being downloaded
This commit is contained in:
commit
c13319db8d
3 changed files with 17 additions and 3 deletions
|
@ -275,7 +275,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
|
||||||
asset_contents->set_text(vformat(TTR("Contents of asset \"%s\" - No files conflict with your project:"), asset_name));
|
asset_contents->set_text(vformat(TTR("Contents of asset \"%s\" - No files conflict with your project:"), asset_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
popup_centered_ratio();
|
popup_centered_ratio(0.5);
|
||||||
updating = false;
|
updating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -374,7 +374,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
|
||||||
}
|
}
|
||||||
|
|
||||||
install_button->set_disabled(false);
|
install_button->set_disabled(false);
|
||||||
status->set_text(TTR("Success!"));
|
status->set_text(TTR("Ready to install!"));
|
||||||
// Make the progress bar invisible but don't reflow other Controls around it.
|
// Make the progress bar invisible but don't reflow other Controls around it.
|
||||||
progress->set_modulate(Color(0, 0, 0, 0));
|
progress->set_modulate(Color(0, 0, 0, 0));
|
||||||
|
|
||||||
|
@ -462,6 +462,10 @@ void EditorAssetLibraryItemDownload::_close() {
|
||||||
queue_delete();
|
queue_delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EditorAssetLibraryItemDownload::can_install() const {
|
||||||
|
return !install_button->is_disabled();
|
||||||
|
}
|
||||||
|
|
||||||
void EditorAssetLibraryItemDownload::install() {
|
void EditorAssetLibraryItemDownload::install() {
|
||||||
String file = download->get_download_file();
|
String file = download->get_download_file();
|
||||||
|
|
||||||
|
@ -1265,9 +1269,16 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
|
||||||
|
|
||||||
EditorAssetLibraryItemDownload *download_item = _get_asset_in_progress(description->get_asset_id());
|
EditorAssetLibraryItemDownload *download_item = _get_asset_in_progress(description->get_asset_id());
|
||||||
if (download_item) {
|
if (download_item) {
|
||||||
description->get_ok_button()->set_text(TTR("Install"));
|
if (download_item->can_install()) {
|
||||||
|
description->get_ok_button()->set_text(TTR("Install"));
|
||||||
|
description->get_ok_button()->set_disabled(false);
|
||||||
|
} else {
|
||||||
|
description->get_ok_button()->set_text(TTR("Downloading..."));
|
||||||
|
description->get_ok_button()->set_disabled(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
description->get_ok_button()->set_text(TTR("Download"));
|
description->get_ok_button()->set_text(TTR("Download"));
|
||||||
|
description->get_ok_button()->set_disabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.has("icon_url") && !r["icon_url"].operator String().is_empty()) {
|
if (r.has("icon_url") && !r["icon_url"].operator String().is_empty()) {
|
||||||
|
|
|
@ -164,7 +164,10 @@ public:
|
||||||
void set_external_install(bool p_enable) { external_install = p_enable; }
|
void set_external_install(bool p_enable) { external_install = p_enable; }
|
||||||
int get_asset_id() { return asset_id; }
|
int get_asset_id() { return asset_id; }
|
||||||
void configure(const String &p_title, int p_asset_id, const Ref<Texture2D> &p_preview, const String &p_download_url, const String &p_sha256_hash);
|
void configure(const String &p_title, int p_asset_id, const Ref<Texture2D> &p_preview, const String &p_download_url, const String &p_sha256_hash);
|
||||||
|
|
||||||
|
bool can_install() const;
|
||||||
void install();
|
void install();
|
||||||
|
|
||||||
EditorAssetLibraryItemDownload();
|
EditorAssetLibraryItemDownload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue