diff options
author | Yuri Sizov <yuris@humnom.net> | 2023-03-07 15:31:19 +0100 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-13 14:12:44 +0100 |
commit | 755a86f5025e9166e3c5b140d0bf5650166f0db1 (patch) | |
tree | af748878f739b47e4633ba51364867501de9d4cd /scene | |
parent | 2d0d07f51b5caf16d43eab7e8526250e371942d5 (diff) |
Generate empty textures for theme icons if the SVG module is disabled
(cherry picked from commit 64215ad1192878b72e784c5a62ea9b2dba0520dd)
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index cc606b5b88..2e1ba96d11 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -86,6 +86,10 @@ static Ref<ImageTexture> generate_icon(int p_index) { ImageLoaderSVG img_loader; Error err = img_loader.create_image_from_string(img, default_theme_icons_sources[p_index], scale, upsample, HashMap<Color, Color>()); ERR_FAIL_COND_V_MSG(err != OK, Ref<ImageTexture>(), "Failed generating icon, unsupported or invalid SVG data in default theme."); +#else + // If the SVG module is disabled, we can't really display the UI well, but at least we won't crash. + // 16 pixels is used as it's the most common base size for Godot icons. + img = Image::create_empty(16 * scale, 16 * scale, false, Image::FORMAT_RGBA8); #endif return ImageTexture::create_from_image(img); |