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:
parent
3dda2a0d77
commit
440a3e7300
|
@ -16,9 +16,7 @@ class Reader:
|
||||||
self.size_pos = self.file.tell()
|
self.size_pos = self.file.tell()
|
||||||
self.header = self.read_bytes(4).decode("utf-8")
|
self.header = self.read_bytes(4).decode("utf-8")
|
||||||
self.size = self.read_u32()
|
self.size = self.read_u32()
|
||||||
|
self.end_pos = self.size_pos + self.size + 8
|
||||||
padding_length = 4 - (self.size % 4) if self.size % 4 > 0 else 0
|
|
||||||
self.end_pos = self.size_pos + padding_length + self.size + 8
|
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print(self.indent + "Begin " + self.header + ", Size: " + str(self.size) + ", Pos: " + str(self.size_pos))
|
print(self.indent + "Begin " + self.header + ", Size: " + str(self.size) + ", Pos: " + str(self.size_pos))
|
||||||
|
|
|
@ -83,7 +83,6 @@ def extract_refined_skeleton(scene: Scene):
|
||||||
|
|
||||||
if crc(model_weighted_to.name) not in scene.skeleton:
|
if crc(model_weighted_to.name) not in scene.skeleton:
|
||||||
scene.skeleton.append(crc(model_weighted_to.name))
|
scene.skeleton.append(crc(model_weighted_to.name))
|
||||||
print("Found additional bone: " + model_weighted_to.name)
|
|
||||||
|
|
||||||
for model in scene.models:
|
for model in scene.models:
|
||||||
if crc(model.name) in scene.skeleton:
|
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 strip in seg.triangle_strips:
|
||||||
for i in range(len(strip) - 2):
|
for i in range(len(strip) - 2):
|
||||||
face = tuple([offset + strip[j] for j in range(i,i+3)])
|
face = tuple([offset + strip[j] for j in range(i,i+3)])
|
||||||
print("strip face: " + str(face))
|
|
||||||
faces.append(face)
|
faces.append(face)
|
||||||
|
|
||||||
offset += len(seg.positions)
|
offset += len(seg.positions)
|
||||||
|
|
Loading…
Reference in New Issue