MSH reader no longer reads up to the next multiple of 4, since files exported with ZETools seem not to abide by that rule. It doesn't matter if files are exported with this behavior, since the reading code now skips bytes until a known header is found, instead of just reading the next header blindly. Teancum's highsinger and xizor now importing just fine.

This commit is contained in:
Will Snyder 2020-12-03 23:15:25 -05:00
parent 3dda2a0d77
commit 440a3e7300
2 changed files with 1 additions and 5 deletions

View File

@ -16,9 +16,7 @@ class Reader:
self.size_pos = self.file.tell()
self.header = self.read_bytes(4).decode("utf-8")
self.size = self.read_u32()
padding_length = 4 - (self.size % 4) if self.size % 4 > 0 else 0
self.end_pos = self.size_pos + padding_length + self.size + 8
self.end_pos = self.size_pos + self.size + 8
if self.debug:
print(self.indent + "Begin " + self.header + ", Size: " + str(self.size) + ", Pos: " + str(self.size_pos))

View File

@ -83,7 +83,6 @@ def extract_refined_skeleton(scene: Scene):
if crc(model_weighted_to.name) not in scene.skeleton:
scene.skeleton.append(crc(model_weighted_to.name))
print("Found additional bone: " + model_weighted_to.name)
for model in scene.models:
if crc(model.name) in scene.skeleton:
@ -170,7 +169,6 @@ def extract_models(scene: Scene, materials_map):
for strip in seg.triangle_strips:
for i in range(len(strip) - 2):
face = tuple([offset + strip[j] for j in range(i,i+3)])
print("strip face: " + str(face))
faces.append(face)
offset += len(seg.positions)