Add toaster notifications for import warning.
This commit is contained in:
parent
654132cb9c
commit
35444b28e3
|
@ -38,6 +38,7 @@
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/editor_scale.h"
|
#include "editor/editor_scale.h"
|
||||||
#include "editor/editor_settings.h"
|
#include "editor/editor_settings.h"
|
||||||
|
#include "editor/gui/editor_toaster.h"
|
||||||
#include "editor/import/resource_importer_texture_settings.h"
|
#include "editor/import/resource_importer_texture_settings.h"
|
||||||
#include "scene/resources/compressed_texture.h"
|
#include "scene/resources/compressed_texture.h"
|
||||||
|
|
||||||
|
@ -108,13 +109,21 @@ void ResourceImporterTexture::update_imports() {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
if (E.value.flags & MAKE_NORMAL_FLAG && int(cf->get_value("params", "compress/normal_map")) == 0) {
|
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);
|
cf->set_value("params", "compress/normal_map", 1);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (E.value.flags & MAKE_ROUGHNESS_FLAG && int(cf->get_value("params", "roughness/mode")) == 0) {
|
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/mode", E.value.channel_for_roughness + 2);
|
||||||
cf->set_value("params", "roughness/src_normal", E.value.normal_path_for_roughness);
|
cf->set_value("params", "roughness/src_normal", E.value.normal_path_for_roughness);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
@ -131,7 +140,11 @@ void ResourceImporterTexture::update_imports() {
|
||||||
cf->set_value("params", "compress/mode", COMPRESS_BASIS_UNIVERSAL);
|
cf->set_value("params", "compress/mode", COMPRESS_BASIS_UNIVERSAL);
|
||||||
compress_string = "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);
|
cf->set_value("params", "mipmaps/generate", true);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue