Skip to content

Commit b643481

Browse files
committed
chore(ruff): fix accidently dropped format related commit
1 parent bf7067c commit b643481

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

UnityPy/export/Texture2DConverter.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ def image_to_texture2d(
215215
assert platform_blob is not None
216216
gobs_per_block = TextureSwizzler.get_switch_gobs_per_block(platform_blob)
217217
block_size = TextureSwizzler.TEXTURE_FORMAT_BLOCK_SIZE_MAP[s_tex_format]
218-
width, height = TextureSwizzler.get_padded_texture_size(img.width, img.height, *block_size, gobs_per_block)
218+
width, height = TextureSwizzler.get_padded_texture_size(
219+
img.width, img.height, *block_size, gobs_per_block
220+
)
219221
switch_info = (block_size, gobs_per_block)
220222

221223
if compress_func:
@@ -230,7 +232,9 @@ def image_to_texture2d(
230232

231233
if switch_info:
232234
block_size, gobs_per_block = switch_info
233-
enc_img = bytes(TextureSwizzler.swizzle(enc_img, width, height, *block_size, gobs_per_block))
235+
enc_img = bytes(
236+
TextureSwizzler.swizzle(enc_img, width, height, *block_size, gobs_per_block)
237+
)
234238

235239
return enc_img, tex_format
236240

@@ -286,8 +290,12 @@ def parse_image_data(
286290
assert platform_blob is not None
287291
gobs_per_block = TextureSwizzler.get_switch_gobs_per_block(platform_blob)
288292
block_size = TextureSwizzler.TEXTURE_FORMAT_BLOCK_SIZE_MAP[texture_format]
289-
width, height = TextureSwizzler.get_padded_texture_size(width, height, *block_size, gobs_per_block)
290-
image_data = TextureSwizzler.deswizzle(image_data, width, height, *block_size, gobs_per_block)
293+
width, height = TextureSwizzler.get_padded_texture_size(
294+
width, height, *block_size, gobs_per_block
295+
)
296+
image_data = TextureSwizzler.deswizzle(
297+
image_data, width, height, *block_size, gobs_per_block
298+
)
291299
else:
292300
width, height = get_compressed_image_size(width, height, texture_format)
293301

UnityPy/helpers/TextureSwizzler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# based on https://github.com/nesrak1/AssetsTools.NET/blob/dev/AssetsTools.NET.Texture/Swizzle/SwitchSwizzle.cs
22
from typing import Dict, List, Optional, Tuple, Union
3+
from typing import Dict, List, Optional, Tuple, Union
34

45
from ..enums import BuildTarget, TextureFormat
56

@@ -118,7 +119,9 @@ def get_switch_gobs_per_block(platform_blob: List[int]) -> int:
118119
return 1 << int.from_bytes(platform_blob[8:12], "little")
119120

120121

121-
def is_switch_swizzled(platform: Union[BuildTarget, int], platform_blob: Optional[List[int]]) -> bool:
122+
def is_switch_swizzled(
123+
platform: Union[BuildTarget, int], platform_blob: Optional[List[int]]
124+
) -> bool:
122125
if platform != BuildTarget.Switch:
123126
return False
124127
if not platform_blob or len(platform_blob) < 12:

0 commit comments

Comments
 (0)