mirror of
https://github.com/MapMakersAndProgrammers/io_scene_a3d.git
synced 2025-10-26 09:59:11 -07:00
Ignore invalid strings, some models use them for some reason
This commit is contained in:
@@ -36,6 +36,7 @@ class A3DMaterial:
|
|||||||
print(f"[A3DMaterial name: {self.name} color: {self.color} diffuse map: {self.diffuseMap}]")
|
print(f"[A3DMaterial name: {self.name} color: {self.color} diffuse map: {self.diffuseMap}]")
|
||||||
|
|
||||||
def read3(self, stream):
|
def read3(self, stream):
|
||||||
|
print(stream.tell())
|
||||||
self.name = readLengthPrefixedString(stream)
|
self.name = readLengthPrefixedString(stream)
|
||||||
self.color = unpackStream("<3f", stream)
|
self.color = unpackStream("<3f", stream)
|
||||||
self.diffuseMap = readLengthPrefixedString(stream)
|
self.diffuseMap = readLengthPrefixedString(stream)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ def readNullTerminatedString(stream):
|
|||||||
while char != b"\x00":
|
while char != b"\x00":
|
||||||
string += char
|
string += char
|
||||||
char = stream.read(1)
|
char = stream.read(1)
|
||||||
return string.decode("utf8")
|
return string.decode("utf8", errors="ignore")
|
||||||
|
|
||||||
def calculatePadding(length):
|
def calculatePadding(length):
|
||||||
# (it basically works with rounding)
|
# (it basically works with rounding)
|
||||||
@@ -47,4 +47,4 @@ def readLengthPrefixedString(stream):
|
|||||||
paddingSize = calculatePadding(length)
|
paddingSize = calculatePadding(length)
|
||||||
stream.read(paddingSize)
|
stream.read(paddingSize)
|
||||||
|
|
||||||
return string.decode("utf8")
|
return string.decode("utf8", errors="ignore")
|
||||||
Reference in New Issue
Block a user