Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions UnityPy/helpers/MeshHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ def process(self):
if mesh.m_Use16BitIndices is not None:
self.m_Use16BitIndices = bool(mesh.m_Use16BitIndices)
elif (
self.version >= (2017, 4)
(self.version >= (2017, 4))
or
# version == (2017, 3, 1) & patched - px string
self.version[:2] == (2017, 3)
and mesh.m_MeshCompression == 0
(self.version[:2] == (2017, 3) and mesh.m_MeshCompression == 0)
):
self.m_Use16BitIndices = mesh.m_IndexFormat == 0
self.copy_from_mesh()
Expand Down Expand Up @@ -292,10 +291,10 @@ def get_channels(self, m_Streams: list[StreamInfo]) -> list[ChannelInfo]:
for _ in range(6)
]
for s, m_Stream in enumerate(m_Streams):
channelMask = bytearray(m_Stream.channelMask) # BitArray
channelMask = m_Stream.channelMask # uint
offset = 0
for i in range(6):
if channelMask[i]:
if channelMask & (1 << i):
m_Channel = m_Channels[i]
m_Channel.stream = s
m_Channel.offset = offset
Expand Down Expand Up @@ -326,6 +325,12 @@ def read_vertex_data(self, m_Channels: list[ChannelInfo], m_Streams: list[Stream
if m_VertexData is None:
return

# could be empty for fully compressed meshes
# in that case data will be read from CompressedMesh via decompress_compressed_mesh
# also avoids a crash in UnityPyBoost.unpack_vertexdata with empty data
if m_VertexData.m_VertexCount == 0 or not m_VertexData.m_DataSize:
return

self.m_VertexCount = m_VertexCount = m_VertexData.m_VertexCount
# m_VertexDataRaw = m_VertexData.m_DataSize

Expand Down
Loading