Merge pull request #93255 from jsjtxietian/atlas-default

Prevent generating preview for zero sized texture
This commit is contained in:
Rémi Verschelde 2024-06-18 14:08:48 +02:00
commit 2a470143ef
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -97,6 +97,10 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const Ref<Resource> &p_from,
return Ref<Texture2D>(); return Ref<Texture2D>();
} }
if (!atex->get_region().has_area()) {
return Ref<Texture2D>();
}
img = atlas->get_region(atex->get_region()); img = atlas->get_region(atex->get_region());
} else { } else {
Ref<Texture2D> tex = p_from; Ref<Texture2D> tex = p_from;