diff --git a/menus.py b/menus.py index d100c34..37d3124 100644 --- a/menus.py +++ b/menus.py @@ -1104,7 +1104,7 @@ def startDecomp(self): self.console.setOutput(consoleOutput) - def singleDec(self, mdl:str, out:str, batch:bool, mdlName:str, fallback:bool): + def singleDec(self, mdl:str, out:str, batch:bool, mdlName:str="", fallback:bool=False): mdl = mdl output = out decOut = "./MDLDEC/" @@ -1122,25 +1122,28 @@ def singleDec(self, mdl:str, out:str, batch:bool, mdlName:str, fallback:bool): tOutput = '' if sys.platform == 'linux': if gotArgs: - tOutput = subprocess.getoutput(f'./third_party/mdldec -a {cmdArgs} \"{mdl}\" \"{decOut}\"') + tOutput = subprocess.getoutput(f'./third_party/mdldec -a {cmdArgs} \"{mdl}\" \"{output}\"') else: - tOutput = subprocess.getoutput(f'./third_party/mdldec -a \"{mdl}\" \"{decOut}\"') + tOutput = subprocess.getoutput(f'./third_party/mdldec -a \"{mdl}\" \"{output}\"') elif sys.platform == 'win32': if gotArgs: - tOutput = subprocess.getoutput(f'\"{os.getcwd()}/third_party/mdldec.exe\" -a {cmdArgs} \"{mdl}\" \"{decOut}\"') + tOutput = subprocess.getoutput(f'\"{os.getcwd()}/third_party/mdldec.exe\" -a {cmdArgs} \"{mdl}\" \"{output}\"') else: - tOutput = subprocess.getoutput(f'\"{os.getcwd()}/third_party/mdldec.exe\" -a \"{mdl}\" \"{decOut}\"') + tOutput = subprocess.getoutput(f'\"{os.getcwd()}/third_party/mdldec.exe\" -a \"{mdl}\" \"{output}\"') # I don't have a Mac so I can't compile mdldec to Mac targets :( # So instead I have to use wine for Mac systems """elif sys.platform == 'darwin': tOutput = subprocess.getoutput(f'wine third_party/mdldec_win32.exe \"{mdl}\"')""" # Checking for errors (especially the 'unknown Studio MDL format') + v6MDL = False if tOutput.find("unknown Studio MDL format version 6") != -1: error = True if sys.platform == 'linux': + v6MDL = True shutil.copy(mdl, './') - tOutput = subprocess.getoutput(f'wine \"{os.getcwd()}/third_party/mdl6dec.exe\" \"{os.path.basename(mdl)}\" -p \"MDL6job\"') - os.remove(f"{os.path.basename(mdl)}") + v6MDLname = os.path.basename(mdl) + tOutput = subprocess.getoutput(f'wine \"{os.getcwd()}/third_party/mdl6dec.exe\" \"{v6MDLname}\" -p \"MDL6job\"') + os.remove(f"{v6MDLname}") # Moving the decompiler output to the output folder! if not os.path.exists(output): os.mkdir(output) @@ -1149,6 +1152,8 @@ def singleDec(self, mdl:str, out:str, batch:bool, mdlName:str, fallback:bool): shutil.copy(f"MDL6job/{f}", os.path.join(output, f)) shutil.rmtree('MDL6job') else: + v6MDL = True + v6MDLname = os.path.basename(mdl) tOutput = subprocess.getoutput(f'\"{os.getcwd()}/third_party/mdl6dec.exe\" \"{mdl}\" -p \"{output}\"') elif tOutput.find("ERROR:") != -1: error = True @@ -1162,7 +1167,7 @@ def singleDec(self, mdl:str, out:str, batch:bool, mdlName:str, fallback:bool): log.write(tOutput) log.close() # Moving files to output directory (this is a workaround to a bug with Xash3D's model decompiler, where absolute paths result in an error) - if not error: + """if not error: if batch and fallback and not os.path.exists(os.path.dirname(output)): os.mkdir(os.path.dirname(output)) if not os.path.exists(output): @@ -1188,7 +1193,7 @@ def singleDec(self, mdl:str, out:str, batch:bool, mdlName:str, fallback:bool): shutil.rmtree(anims) except: pass - shutil.rmtree(decOut) + shutil.rmtree(decOut)""" class CompMenu(): def __init__(self, template, master, batchManager:BatchManagerM, startHidden:bool=False): diff --git a/third_party/mdldec b/third_party/mdldec index 4f68ae1..9b3e3e5 100755 Binary files a/third_party/mdldec and b/third_party/mdldec differ diff --git a/third_party/mdldec.exe b/third_party/mdldec.exe index c65ae47..a213dd3 100755 Binary files a/third_party/mdldec.exe and b/third_party/mdldec.exe differ diff --git a/version.txt b/version.txt index 2cb971b..fed2bb8 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.3.0-(OS)-alpha +v0.3.1-(OS)-alpha