Don't set metadata_label font if it doesn't exist

(cherry picked from commit 2846dbf239)
This commit is contained in:
kobewi 2021-07-23 16:29:49 +02:00 committed by Rémi Verschelde
parent 7968208b0a
commit 49f323410b
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 10 additions and 8 deletions

View file

@ -49,11 +49,13 @@ void TexturePreview::_notification(int p_what) {
break;
}
Ref<DynamicFont> metadata_label_font = get_font("expression", "EditorFonts")->duplicate();
metadata_label_font->set_size(16 * EDSCALE);
metadata_label_font->set_outline_size(2 * EDSCALE);
metadata_label_font->set_outline_color(Color::named("black"));
metadata_label->add_font_override("font", metadata_label_font);
if (metadata_label) {
Ref<DynamicFont> metadata_label_font = get_font("expression", "EditorFonts")->duplicate();
metadata_label_font->set_size(16 * EDSCALE);
metadata_label_font->set_outline_size(2 * EDSCALE);
metadata_label_font->set_outline_color(Color::named("black"));
metadata_label->add_font_override("font", metadata_label_font);
}
checkerboard->set_texture(get_icon("Checkerboard", "EditorIcons"));
} break;

View file

@ -39,10 +39,10 @@ class TexturePreview : public MarginContainer {
GDCLASS(TexturePreview, MarginContainer);
private:
TextureRect *texture_display;
TextureRect *texture_display = nullptr;
TextureRect *checkerboard;
Label *metadata_label;
TextureRect *checkerboard = nullptr;
Label *metadata_label = nullptr;
protected:
void _notification(int p_what);