Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
Cleaned up errors and some logic errors.
  • Loading branch information
AsteriskAmpersand committed Feb 22, 2020
1 parent 767b2eb commit cb69a4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions compatibility/materialCompatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,19 @@ def loadAlternatives(self,alternativeList):
return

ibunkn = [12,0,0,0, 42,102,7,93, 0,0,0,0]
ibrunkn = [12,0,0,0, 80,96,-124,93, 0,0,0,0]
ibrunkn = [12,0,0,0, 80,96,132,93, 0,0,0,0]
def compatibilize(self,materialPath):
with open(materialPath,"rb") as mrl3File:
m = BaseMrl3()
m.marshall(FileLike(mrl3File.read()))
if m.Header.unknArr[0] == 12:
if m.Header.unknArr == self.ibunkn:
m.Header.unknArr = self.ibrunkn
data = mrl3File.read()
if data[4] == 12:
if all((data[i] == self.ibunkn[i-4] for i in range(0x4,0x10))):
data = bytearray(data)
data[0x4:0x10] = self.ibrunkn
with open(materialPath,"wb") as mrl3File:
mrl3File.write(m.serialize())
return
mrl3File.write(data)
return
m = BaseMrl3()
m.marshall(FileLike(data))
resources = m.Textures
self.updateHeader(m.Header)
for i in range(len(m.Materials)):
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ def openFile(self):
dlg.setFileMode(QtWidgets.QFileDialog.ExistingFile)
if dlg.exec_():
filename = dlg.selectedFiles()
self.addFiles(filename)
self.addFiles(filename)
def openFolder(self):
dlg = QtWidgets.QFileDialog()
dlg.setFileMode(QtWidgets.QFileDialog.Directory)
dlg.setOption(dlg.ShowDirsOnly,False)
if dlg.exec_():
filenames = dlg.selectedFiles()
self.addFiles(filenames)
self.addFiles(filenames)
def test(self):
def get2Options(string):
dlg = Options2(string)
Expand Down

0 comments on commit cb69a4e

Please sign in to comment.