From 9ac57310ae05ec839982ddb026fcd8f40766be77 Mon Sep 17 00:00:00 2001 From: Sebastian Sille Date: Sun, 10 Dec 2023 11:23:18 +0100 Subject: [PATCH] Cleanup: Import_max Removed unnessecary code --- io_scene_max/import_max.py | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/io_scene_max/import_max.py b/io_scene_max/import_max.py index 3b2c82b..a30d036 100644 --- a/io_scene_max/import_max.py +++ b/io_scene_max/import_max.py @@ -556,16 +556,10 @@ class MaxChunk(): self.previous = None self.next = None self.size = size - self.unknown = True - self.format = None self.data = None def __str__(self): - if (self.unknown): - return "%s[%4x]%04X:%s" % ("" * self.level, self.number, self.types, - ":".join("%02x" % (c) for c in self.data)) - return "%s[%4x]%04X:%s=%s" % ("" * self.level, self.number, self.types, - self.format, self.data) + return "%s[%4x]%04X:%s" % ("" * self.level, self.number, self.types, self.data) class ByteArrayChunk(MaxChunk): @@ -574,11 +568,9 @@ class ByteArrayChunk(MaxChunk): def __init__(self, types, data, level, number): MaxChunk.__init__(self, types, data, level, number) - def set(self, data, name, fmt, start, end): + def set(self, data, fmt, start, end): try: self.data = struct.unpack(fmt, data[start:end]) - self.format = name - self.unknown = False except Exception as exc: self.data = data # print('StructError:', exc, name) @@ -586,8 +578,6 @@ class ByteArrayChunk(MaxChunk): def set_string(self, data): try: self.data = data.decode('UTF-16LE') - self.format = "Str16" - self.unknown = False except: self.data = data @@ -595,15 +585,14 @@ class ByteArrayChunk(MaxChunk): if (self.types in [0x0340, 0x4001, 0x0456, 0x0962]): self.set_string(data) elif (self.types in [0x2034, 0x2035]): - self.set(data, "ints", '<' + 'I' * int(len(data) / 4), 0, len(data)) + self.set(data, '<' + 'I' * int(len(data) / 4), 0, len(data)) elif (self.types in [0x2501, 0x2503, 0x2504, 0x2505, 0x2511]): - self.set(data, "floats", '<' + 'f' * int(len(data) / 4), 0, len(data)) + self.set(data, '<' + 'f' * int(len(data) / 4), 0, len(data)) elif (self.types == 0x2510): - self.set(data, "struct", '<' + 'f' * int(len(data) / 4 - 1) + 'I', 0, len(data)) + self.set(data, '<' + 'f' * int(len(data) / 4 - 1) + 'I', 0, len(data)) elif (self.types == 0x0100): - self.set(data, "float", '