diff options
-rw-r--r-- | drivers/gles3/storage/texture_storage.cpp | 15 | ||||
-rw-r--r-- | editor/editor_toaster.cpp | 49 | ||||
-rw-r--r-- | editor/editor_toaster.h | 2 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 29 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.h | 1 |
5 files changed, 77 insertions, 19 deletions
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 489c328f64..8818ab2118 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -567,23 +567,29 @@ Ref<Image> TextureStorage::_get_gl_image_and_format(const Ref<Image> &p_image, I } } break; case Image::FORMAT_ETC2_RA_AS_RG: { +#ifndef WEB_ENABLED if (config->etc2_supported) { r_gl_internal_format = _EXT_COMPRESSED_RGBA8_ETC2_EAC; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; - } else { + } else +#endif + { need_decompress = true; } decompress_ra_to_rg = true; } break; case Image::FORMAT_DXT5_RA_AS_RG: { +#ifndef WEB_ENABLED if (config->s3tc_supported) { r_gl_internal_format = _EXT_COMPRESSED_RGBA_S3TC_DXT5_EXT; r_gl_format = GL_RGBA; r_gl_type = GL_UNSIGNED_BYTE; r_compressed = true; - } else { + } else +#endif + { need_decompress = true; } decompress_ra_to_rg = true; @@ -1137,6 +1143,7 @@ void TextureStorage::texture_set_data(RID p_texture, const Ref<Image> &p_image, texture->gl_set_filter(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST); texture->gl_set_repeat(RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED); +#ifndef WEB_ENABLED switch (texture->format) { #ifdef GLES_OVER_GL case Image::FORMAT_L8: { @@ -1151,7 +1158,8 @@ void TextureStorage::texture_set_data(RID p_texture, const Ref<Image> &p_image, glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_B, GL_RED); glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_A, GL_GREEN); } break; -#endif +#endif // GLES3_OVER_GL + case Image::FORMAT_ETC2_RA_AS_RG: case Image::FORMAT_DXT5_RA_AS_RG: { glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_R, GL_RED); @@ -1172,6 +1180,7 @@ void TextureStorage::texture_set_data(RID p_texture, const Ref<Image> &p_image, glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_A, GL_ALPHA); } break; } +#endif // WEB_ENABLED int mipmaps = img->has_mipmaps() ? img->get_mipmap_count() + 1 : 1; diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp index dd5d68a08e..558423df78 100644 --- a/editor/editor_toaster.cpp +++ b/editor/editor_toaster.cpp @@ -90,11 +90,12 @@ void EditorToaster::_notification(int p_what) { } // Hide element if it is not visible anymore. - if (modulate_fade.a <= 0) { - if (element.key->is_visible()) { - element.key->hide(); - needs_update = true; - } + if (modulate_fade.a <= 0 && element.key->is_visible()) { + element.key->hide(); + needs_update = true; + } else if (modulate_fade.a >= 0 && !element.key->is_visible()) { + element.key->show(); + needs_update = true; } } @@ -419,12 +420,21 @@ void EditorToaster::_popup_str(String p_message, Severity p_severity, String p_t // Create a new message if needed. if (control == nullptr) { + HBoxContainer *hb = memnew(HBoxContainer); + hb->add_theme_constant_override("separation", 0); + Label *label = memnew(Label); + hb->add_child(label); - control = popup(label, p_severity, default_message_duration, p_tooltip); + Label *count_label = memnew(Label); + hb->add_child(count_label); + + control = popup(hb, p_severity, default_message_duration, p_tooltip); toasts[control].message = p_message; toasts[control].tooltip = p_tooltip; toasts[control].count = 1; + toasts[control].message_label = label; + toasts[control].message_count_label = count_label; } else { if (toasts[control].popped) { toasts[control].count += 1; @@ -441,14 +451,31 @@ void EditorToaster::_popup_str(String p_message, Severity p_severity, String p_t main_button->queue_redraw(); } - // Retrieve the label back then update the text. - Label *label = Object::cast_to<Label>(control->get_child(0)->get_child(0)); - ERR_FAIL_COND(!label); + // Retrieve the label back, then update the text. + Label *message_label = toasts[control].message_label; + ERR_FAIL_COND(!message_label); + message_label->set_text(p_message); + message_label->set_text_overrun_behavior(TextServer::OVERRUN_NO_TRIMMING); + message_label->set_custom_minimum_size(Size2()); + + Size2i size = message_label->get_combined_minimum_size(); + int limit_width = get_viewport_rect().size.x / 2; // Limit label size to half the viewport size. + if (size.x > limit_width) { + message_label->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); + message_label->set_custom_minimum_size(Size2(limit_width, 0)); + } + + // Retrieve the count label back, then update the text. + Label *message_count_label = toasts[control].message_count_label; if (toasts[control].count == 1) { - label->set_text(p_message); + message_count_label->hide(); } else { - label->set_text(vformat("%s (%d)", p_message, toasts[control].count)); + message_count_label->set_text(vformat("(%d)", toasts[control].count)); + message_count_label->show(); } + + vbox_container->reset_size(); + is_processing_error = false; } diff --git a/editor/editor_toaster.h b/editor/editor_toaster.h index acd2a8fbf3..6b834f8288 100644 --- a/editor/editor_toaster.h +++ b/editor/editor_toaster.h @@ -79,6 +79,8 @@ private: String message; String tooltip; int count = 0; + Label *message_label = nullptr; + Label *message_count_label = nullptr; }; HashMap<Control *, Toast> toasts; diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 9f2cfc8d9c..eab5eb0404 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -705,6 +705,12 @@ const char *EditorAssetLibrary::support_key[SUPPORT_MAX] = { "testing", }; +const char *EditorAssetLibrary::support_text[SUPPORT_MAX] = { + TTRC("Official"), + TTRC("Community"), + TTRC("Testing"), +}; + void EditorAssetLibrary::_select_author(int p_id) { // Open author window. } @@ -1242,15 +1248,28 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const library_vb->add_child(asset_bottom_page); if (result.is_empty()) { + String support_list; + for (int i = 0; i < SUPPORT_MAX; i++) { + if (support->get_popup()->is_item_checked(i)) { + if (!support_list.is_empty()) { + support_list += ", "; + } + support_list += TTRGET(support_text[i]); + } + } + if (support_list.is_empty()) { + support_list = "-"; + } + if (!filter->get_text().is_empty()) { library_info->set_text( - vformat(TTR("No results for \"%s\"."), filter->get_text())); + vformat(TTR("No results for \"%s\" for support level(s): %s."), filter->get_text(), support_list)); } else { // No results, even though the user didn't search for anything specific. // This is typically because the version number changed recently // and no assets compatible with the new version have been published yet. library_info->set_text( - vformat(TTR("No results compatible with %s %s."), String(VERSION_SHORT_NAME).capitalize(), String(VERSION_BRANCH))); + vformat(TTR("No results compatible with %s %s for support level(s): %s.\nCheck the enabled support levels using the 'Support' button in the top-right corner."), String(VERSION_SHORT_NAME).capitalize(), String(VERSION_BRANCH), support_list)); } library_info->show(); } else { @@ -1510,9 +1529,9 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { search_hb2->add_child(support); support->set_text(TTR("Support")); support->get_popup()->set_hide_on_checkable_item_selection(false); - support->get_popup()->add_check_item(TTR("Official"), SUPPORT_OFFICIAL); - support->get_popup()->add_check_item(TTR("Community"), SUPPORT_COMMUNITY); - support->get_popup()->add_check_item(TTR("Testing"), SUPPORT_TESTING); + support->get_popup()->add_check_item(TTRGET(support_text[SUPPORT_OFFICIAL]), SUPPORT_OFFICIAL); + support->get_popup()->add_check_item(TTRGET(support_text[SUPPORT_COMMUNITY]), SUPPORT_COMMUNITY); + support->get_popup()->add_check_item(TTRGET(support_text[SUPPORT_TESTING]), SUPPORT_TESTING); support->get_popup()->set_item_checked(SUPPORT_OFFICIAL, true); support->get_popup()->set_item_checked(SUPPORT_COMMUNITY, true); support->get_popup()->connect("id_pressed", callable_mp(this, &EditorAssetLibrary::_support_toggled)); diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index 0667f474da..8c74da0e2a 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -234,6 +234,7 @@ class EditorAssetLibrary : public PanelContainer { static const char *sort_key[SORT_MAX]; static const char *sort_text[SORT_MAX]; static const char *support_key[SUPPORT_MAX]; + static const char *support_text[SUPPORT_MAX]; ///MainListing |