Skip to content

Commit eac8e9d

Browse files
committed
[SpriteFramesEditor] Decompress texture before auto slicing sprite sheet.
1 parent 7826b6b commit eac8e9d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

editor/scene/sprite_frames_editor_plugin.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,11 @@ bool SpriteFramesEditor::_matches_background_color(const Color &p_background_col
544544

545545
Size2i SpriteFramesEditor::_estimate_sprite_sheet_size(const Ref<Texture2D> p_texture) {
546546
Ref<Image> image = p_texture->get_image();
547-
Size2i size = p_texture->get_size();
547+
if (image->is_compressed()) {
548+
image = image->duplicate();
549+
ERR_FAIL_COND_V(image->decompress() != OK, p_texture->get_size());
550+
}
551+
Size2i size = image->get_size();
548552

549553
Color assumed_background_color = image->get_pixel(0, 0);
550554
Size2i sheet_size;

0 commit comments

Comments
 (0)