diff options
author | Rakka Rage <rakkarage@gmail.com> | 2023-12-05 16:25:04 -0500 |
---|---|---|
committer | Rakka Rage <rakkarage@gmail.com> | 2023-12-05 16:25:04 -0500 |
commit | 35444b28e3878d89ee9e59ea365c19dbd9afa6d3 (patch) | |
tree | 7025b14d26c4b1d087a7e8c107bd235e036932f3 /editor/import/resource_importer_texture.cpp | |
parent | 654132cb9c6ff1f27be0bf325e348e74b3e49fba (diff) | |
download | redot-engine-35444b28e3878d89ee9e59ea365c19dbd9afa6d3.tar.gz |
Add toaster notifications for import warning.
Diffstat (limited to 'editor/import/resource_importer_texture.cpp')
-rw-r--r-- | editor/import/resource_importer_texture.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index c555653732..9b98023359 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -38,6 +38,7 @@ #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" +#include "editor/gui/editor_toaster.h" #include "editor/import/resource_importer_texture_settings.h" #include "scene/resources/compressed_texture.h" @@ -108,13 +109,21 @@ void ResourceImporterTexture::update_imports() { bool changed = false; if (E.value.flags & MAKE_NORMAL_FLAG && int(cf->get_value("params", "compress/normal_map")) == 0) { - print_line(vformat(TTR("%s: Texture detected as used as a normal map in 3D. Enabling red-green texture compression to reduce memory usage (blue channel is discarded)."), String(E.key))); + String message = vformat(TTR("%s: Texture detected as used as a normal map in 3D. Enabling red-green texture compression to reduce memory usage (blue channel is discarded)."), String(E.key)); +#ifdef TOOLS_ENABLED + EditorToaster::get_singleton()->popup_str(message); +#endif + print_line(message); cf->set_value("params", "compress/normal_map", 1); changed = true; } if (E.value.flags & MAKE_ROUGHNESS_FLAG && int(cf->get_value("params", "roughness/mode")) == 0) { - print_line(vformat(TTR("%s: Texture detected as used as a roughness map in 3D. Enabling roughness limiter based on the detected associated normal map at %s."), String(E.key), E.value.normal_path_for_roughness)); + String message = vformat(TTR("%s: Texture detected as used as a roughness map in 3D. Enabling roughness limiter based on the detected associated normal map at %s."), String(E.key), E.value.normal_path_for_roughness); +#ifdef TOOLS_ENABLED + EditorToaster::get_singleton()->popup_str(message); +#endif + print_line(message); cf->set_value("params", "roughness/mode", E.value.channel_for_roughness + 2); cf->set_value("params", "roughness/src_normal", E.value.normal_path_for_roughness); changed = true; @@ -131,7 +140,11 @@ void ResourceImporterTexture::update_imports() { cf->set_value("params", "compress/mode", COMPRESS_BASIS_UNIVERSAL); compress_string = "Basis Universal"; } - print_line(vformat(TTR("%s: Texture detected as used in 3D. Enabling mipmap generation and setting the texture compression mode to %s."), String(E.key), compress_string)); + String message = vformat(TTR("%s: Texture detected as used in 3D. Enabling mipmap generation and setting the texture compression mode to %s."), String(E.key), compress_string); +#ifdef TOOLS_ENABLED + EditorToaster::get_singleton()->popup_str(message); +#endif + print_line(message); cf->set_value("params", "mipmaps/generate", true); changed = true; } |