1 Commits

3 changed files with 5 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
bl_info = { bl_info = {
'name': 'SWBF .msh Import-Export', 'name': 'SWBF .msh Import-Export',
'author': 'Will Snyder, SleepKiller', 'author': 'Will Snyder, SleepKiller',
"version": (1, 2, 1), "version": (1, 0, 0),
'blender': (2, 80, 0), 'blender': (2, 80, 0),
'location': 'File > Import-Export', 'location': 'File > Import-Export',
'description': 'Export as SWBF .msh file', 'description': 'Export as SWBF .msh file',

View File

@@ -138,9 +138,6 @@ class Reader:
def how_much_left(self, pos): def how_much_left(self, pos):
return self.end_pos - pos return self.end_pos - pos
def bytes_remaining(self):
return self.end_pos - self.file.tell()
def skip_until(self, header): def skip_until(self, header):
while (self.could_have_child() and header not in self.peak_next_header()): while (self.could_have_child() and header not in self.peak_next_header()):
self.skip_bytes(1) self.skip_bytes(1)

View File

@@ -165,23 +165,19 @@ def _read_matd(matd: Reader) -> Material:
elif next_header == "TX0D": elif next_header == "TX0D":
with matd.read_child() as tx0d: with matd.read_child() as tx0d:
if tx0d.bytes_remaining() > 0: mat.texture0 = tx0d.read_string()
mat.texture0 = tx0d.read_string()
elif next_header == "TX1D": elif next_header == "TX1D":
with matd.read_child() as tx1d: with matd.read_child() as tx1d:
if tx1d.bytes_remaining() > 0: mat.texture1 = tx1d.read_string()
mat.texture1 = tx1d.read_string()
elif next_header == "TX2D": elif next_header == "TX2D":
with matd.read_child() as tx2d: with matd.read_child() as tx2d:
if tx2d.bytes_remaining() > 0: mat.texture2 = tx2d.read_string()
mat.texture2 = tx2d.read_string()
elif next_header == "TX3D": elif next_header == "TX3D":
with matd.read_child() as tx3d: with matd.read_child() as tx3d:
if tx3d.bytes_remaining() > 0: mat.texture3 = tx3d.read_string()
mat.texture3 = tx3d.read_string()
else: else:
matd.skip_bytes(1) matd.skip_bytes(1)