Skip to content

Commit 2c3ca47

Browse files
isHarryhK0lb3
authored andcommitted
chore(MeshHelper): inline deflating
1 parent 035c157 commit 2c3ca47

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

UnityPy/helpers/MeshHelper.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import math
44
import struct
5-
from typing import TYPE_CHECKING, List, Optional, Sequence, Tuple, TypeVar, Union, cast
5+
from typing import TYPE_CHECKING, List, Optional, Tuple, Union, cast
66

77
from ..classes.generated import (
88
ChannelInfo,
@@ -34,12 +34,6 @@
3434
Tuple3f = Tuple[float, float, float]
3535
Tuple4f = Tuple[float, float, float, float]
3636

37-
T = TypeVar("T")
38-
39-
40-
def flat_list_to_tuples(data: Sequence[T], item_size: int) -> List[tuple[T, ...]]:
41-
return [tuple(data[i : i + item_size]) for i in range(0, len(data), item_size)]
42-
4337

4438
def vector_list_to_tuples(
4539
data: Union[List[Vector2f], List[Vector3f], List[Vector4f]],
@@ -403,7 +397,10 @@ def read_vertex_data(self, m_Channels: list[ChannelInfo], m_Streams: list[Stream
403397

404398
count = len(componentBytes) // component_byte_size
405399
component_data = struct.unpack(f">{count}{component_dtype}", componentBytes)
406-
component_data = flat_list_to_tuples(component_data, channel_dimension)
400+
component_data = [
401+
tuple(component_data[i : i + channel_dimension])
402+
for i in range(0, len(component_data), channel_dimension)
403+
]
407404

408405
self.assign_channel_vertex_data(chn, component_data)
409406

0 commit comments

Comments
 (0)