Skip to content

Commit dbe9b2e

Browse files
committed
fix: Texture2DConverter - undue swizzle
1 parent 9defdd7 commit dbe9b2e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

UnityPy/export/Texture2DConverter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def image_to_texture2d(
222222
pil_mode = "RGB"
223223
# everything else defaulted to RGBA
224224

225-
if platform == BuildTarget.Switch and platform_blob is not None:
225+
if platform == BuildTarget.Switch and platform_blob:
226226
gobs_per_block = TextureSwizzler.get_switch_gobs_per_block(platform_blob)
227227
s_tex_format = tex_format
228228
if tex_format == TextureFormat.RGB24:
@@ -316,7 +316,7 @@ def parse_image_data(
316316

317317
original_width, original_height = width, height
318318
switch_swizzle = None
319-
if platform == BuildTarget.Switch and platform_blob is not None:
319+
if platform == BuildTarget.Switch and platform_blob:
320320
gobs_per_block = TextureSwizzler.get_switch_gobs_per_block(platform_blob)
321321
s_tex_format = texture_format
322322
pil_mode = "RGBA"
@@ -362,6 +362,7 @@ def parse_image_data(
362362
img.tobytes("raw", pil_mode), width, height, *block_size, gobs_per_block
363363
)
364364
)
365+
img.mode = pil_mode
365366
img = Image.frombytes(img.mode, (width, height), swizzle_data, "raw", pil_mode)
366367

367368
if original_width != width or original_height != height:

0 commit comments

Comments
 (0)