Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Mar 11, 2024
1 parent 3bbae52 commit e63e997
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _onAllCompleted(self):
QMessageBox(
QMessageBox.Critical,
errorTitle,
"\n".join(str(universal_simplify_exception(error)) for error in self.errors),
"\n".join(str(universal_simplify_exception(error)).replace(",", ":", 1) + "<br>" for error in self.errors),
).exec_()


Expand Down
5 changes: 4 additions & 1 deletion Tools/HolocronToolset/src/toolset/gui/windows/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ def _extractResource(self, resource: FileResource, filepath: os.PathLike | str,
traceback.print_exc()
msg = f"Failed to extract resource: {resource.resname()}.{resource.restype().extension}"
raise RuntimeError(msg) from e
QMessageBox(QMessageBox.Information, "Finished extracting", f"Extracted {resource.resname()} to {r_filepath}").exec_()

def _extractTxi(self, tpc: TPC, filepath: Path):
with filepath.with_suffix(".txi").open("wb") as file:
Expand All @@ -990,14 +991,16 @@ def _extractMdlTextures(self, resource: FileResource, folderpath: Path, loader:
for texture in model.list_textures(data):
try:
tpc: TPC | None = self.active.texture(texture)
if tpc is None:
raise ValueError(texture) # noqa: TRY301
if self.ui.tpcTxiCheckbox.isChecked():
self._extractTxi(tpc, folderpath.joinpath(f"{texture}.tpc"))
file_format = ResourceType.TGA if self.ui.tpcDecompileCheckbox.isChecked() else ResourceType.TPC
extension = "tga" if file_format == ResourceType.TGA else "tpc"
write_tpc(tpc, folderpath.joinpath(f"{texture}.{extension}"), file_format)
except Exception as e: # noqa: PERF203
etype, msg = universal_simplify_exception(e)
loader.errors.append(e.__class__(f"Could not find or extract tpc: '{texture}'\nReason ({etype}): {msg}"))
loader.errors.append(e.__class__(f"Could not find or extract tpc: '{texture}'"))
except Exception as e:
etype, msg = universal_simplify_exception(e)
loader.errors.append(e.__class__(f"Could not determine textures used in model: '{resource.resname()}'\nReason ({etype}): {msg}"))
Expand Down

0 comments on commit e63e997

Please sign in to comment.