Skip to content

Commit 6d2d6dd

Browse files
committed
fix: remove accidentaly added imports
1 parent 4f07bc7 commit 6d2d6dd

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

UnityPy/export/Texture2DConverter.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from io import BytesIO
55
from threading import Lock
66
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
7-
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
87

98
import astc_encoder
109
import texture2ddecoder
@@ -215,9 +214,7 @@ def image_to_texture2d(
215214
assert platform_blob is not None
216215
gobs_per_block = TextureSwizzler.get_switch_gobs_per_block(platform_blob)
217216
block_size = TextureSwizzler.TEXTURE_FORMAT_BLOCK_SIZE_MAP[s_tex_format]
218-
width, height = TextureSwizzler.get_padded_texture_size(
219-
img.width, img.height, *block_size, gobs_per_block
220-
)
217+
width, height = TextureSwizzler.get_padded_texture_size(img.width, img.height, *block_size, gobs_per_block)
221218
switch_info = (block_size, gobs_per_block)
222219

223220
if compress_func:
@@ -232,9 +229,7 @@ def image_to_texture2d(
232229

233230
if switch_info:
234231
block_size, gobs_per_block = switch_info
235-
enc_img = bytes(
236-
TextureSwizzler.swizzle(enc_img, width, height, *block_size, gobs_per_block)
237-
)
232+
enc_img = bytes(TextureSwizzler.swizzle(enc_img, width, height, *block_size, gobs_per_block))
238233

239234
return enc_img, tex_format
240235

@@ -290,12 +285,8 @@ def parse_image_data(
290285
assert platform_blob is not None
291286
gobs_per_block = TextureSwizzler.get_switch_gobs_per_block(platform_blob)
292287
block_size = TextureSwizzler.TEXTURE_FORMAT_BLOCK_SIZE_MAP[texture_format]
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-
)
288+
width, height = TextureSwizzler.get_padded_texture_size(width, height, *block_size, gobs_per_block)
289+
image_data = TextureSwizzler.deswizzle(image_data, width, height, *block_size, gobs_per_block)
299290
else:
300291
width, height = get_compressed_image_size(width, height, texture_format)
301292

UnityPy/helpers/TextureSwizzler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
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
43

54
from ..enums import BuildTarget, TextureFormat
65

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

121120

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

0 commit comments

Comments
 (0)