-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dread BCTEX export to dds #240
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #240 +/- ##
==========================================
+ Coverage 78.85% 79.72% +0.87%
==========================================
Files 80 82 +2
Lines 4323 4548 +225
==========================================
+ Hits 3409 3626 +217
- Misses 914 922 +8 ☔ View full report in Codecov by Sentry. |
37c6931
to
669fc93
Compare
width_blks, height_blks, depth_blks, data, height_mip0, mip0.format.bytes_per_pixel | ||
) | ||
return res | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of situations can cause this to fail, and why not just let the exception "leak"?
If it's expected to fail sometimes, then return type must indicate it can be None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it outputs an ugly Rust exception, and after spending a day trying to get rust interop working I didn't bother figuring out the proper exception wrapper haha. If it fails, it would basically mean invalid data in the texture.
I can go back and fix it, just want to wrap up some stuff on navmesh tonight.
return Texture2D(mips) | ||
|
||
def _deswizzle(self, width: int, height: int, depth: int, mip0: Mip0Data, heightLog2: int, data: bytes) -> bytes: | ||
height_mip0 = 1 << max(min(heightLog2, 5), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
height_log2
|
||
folder.mkdir(parents=True, exist_ok=True) | ||
if not name: | ||
name = self.raw.name + ".dds" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this method?
|
||
return Texture2D(mips) | ||
|
||
def _deswizzle(self, width: int, height: int, depth: int, mip0: Mip0Data, heightLog2: int, data: bytes) -> bytes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a docstring
|
||
self.parse() | ||
|
||
def parse(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method supposed to be called multiple times? If it's just the constructor, make it private.
- added a RawTexture class that can parse all images, arrays, surfaces and mipmaps from Dread .bctex formats - added a DdsExporter class that can convert a RawTexture class into a Direct Draw Surface file (byte matching with SwitchToolbox exports) - added tests to validate the SHA256 of (one of) each used XTX format
- waiting on new release of py_tegra_swizzle to fix error handling
3191d4d
to
b4f5349
Compare
Notes: