Skip to content

Commit 13d9f63

Browse files
committed
black fix
1 parent e8f83f2 commit 13d9f63

20 files changed

Lines changed: 541 additions & 314 deletions

fast64_internal/f3d/f3d_gbi.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class GfxMatWriteMethod(enum.Enum):
107107
"OOT": oot_default_draw_layers,
108108
}
109109

110+
110111
def normalize_hex_pointer(name: str) -> str:
111112
stripped = name.strip()
112113
if stripped.lower().startswith("0x"):
@@ -130,6 +131,7 @@ def format_asset_path(objectPath: str | None, name: str | None) -> str:
130131
return sanitized_name
131132
return sanitized_path
132133

134+
133135
CCMUXDict = {
134136
"COMBINED": 0,
135137
"TEXEL0": 1,
@@ -2161,7 +2163,7 @@ def to_binary(self):
21612163
)
21622164

21632165
def to_soh_xml(self):
2164-
baseStr = "<Vtx X=\"{pX}\" Y=\"{pY}\" Z=\"{pZ}\" S=\"{s}\" T=\"{t}\" R=\"{r}\" G=\"{g}\" B=\"{b}\" A=\"{a}\"/>"
2166+
baseStr = '<Vtx X="{pX}" Y="{pY}" Z="{pZ}" S="{s}" T="{t}" R="{r}" G="{g}" B="{b}" A="{a}"/>'
21652167
return baseStr.format(
21662168
pX=self.position[0],
21672169
pY=self.position[1],
@@ -2262,7 +2264,7 @@ def to_binary(self):
22622264
return data
22632265

22642266
def to_soh_xml(self):
2265-
data = "<Vertex Version=\"0\">\n"
2267+
data = '<Vertex Version="0">\n'
22662268
for vert in self.vertices:
22672269
data += "\t" + vert.to_soh_xml() + "\n"
22682270
data += "</Vertex>\n"
@@ -2361,7 +2363,7 @@ def to_c(self, f3d, name_override: Optional[str] = None):
23612363
return data
23622364

23632365
def to_soh_xml(self, modelDirPath, objectPath):
2364-
data = "<DisplayList Version=\"0\">\n"
2366+
data = '<DisplayList Version="0">\n'
23652367
for command in self.commands:
23662368
if isinstance(command, (SPDisplayList, SPBranchList, SPVertex, DPSetTextureImage)):
23672369
data += "\t" + command.to_soh_xml(objectPath) + "\n"
@@ -2380,13 +2382,15 @@ def toO2R(self, folderPath: str, segments: dict | None = None):
23802382
data.extend(struct.pack("<I", 1))
23812383
data.extend(struct.pack(">IIQIQIQQQI", 0x4F444C54, 0, 0xDEADBEEFDEADBEEF, 0, 0, 0, 0, 0, 0, 0))
23822384

2383-
data.extend(struct.pack(
2384-
">bBHI",
2385-
4,
2386-
0xFF,
2387-
0xFFFF,
2388-
0xFFFFFFFF,
2389-
))
2385+
data.extend(
2386+
struct.pack(
2387+
">bBHI",
2388+
4,
2389+
0xFF,
2390+
0xFFFF,
2391+
0xFFFFFFFF,
2392+
)
2393+
)
23902394

23912395
data.extend(struct.pack(">II", 0x33 << 24, 0xBEEFBEEF))
23922396

@@ -2894,7 +2898,7 @@ def to_soh_xml(self, modelDirPath, objectPath, include_cull_vertices=True, combi
28942898

28952899
if combined_call_lines or combined_other_lines:
28962900
data += (
2897-
"<DisplayList Version=\"0\">\n"
2901+
'<DisplayList Version="0">\n'
28982902
+ "".join(combined_call_lines + combined_other_lines)
28992903
+ "</DisplayList>\n\n"
29002904
)
@@ -3440,7 +3444,7 @@ def to_soh_xml(self, modelDirPath, objectPath, include_cull_vertices=True, write
34403444
return ""
34413445

34423446
call_lines, other_lines = self.get_soh_root_draw_lines(objectPath)
3443-
drawData = "<DisplayList Version=\"0\">\n" + "".join(call_lines + other_lines) + "</DisplayList>\n\n"
3447+
drawData = '<DisplayList Version="0">\n' + "".join(call_lines + other_lines) + "</DisplayList>\n\n"
34443448
writeXMLData(drawData, os.path.join(modelDirPath, self.draw.name))
34453449
return drawData
34463450

@@ -3536,8 +3540,10 @@ def has_scroll_data(self):
35363540
True if either texture has non-zero scroll values
35373541
"""
35383542
return (
3539-
self.tile_scroll_tex0.s != 0 or self.tile_scroll_tex0.t != 0 or
3540-
self.tile_scroll_tex1.s != 0 or self.tile_scroll_tex1.t != 0
3543+
self.tile_scroll_tex0.s != 0
3544+
or self.tile_scroll_tex0.t != 0
3545+
or self.tile_scroll_tex1.s != 0
3546+
or self.tile_scroll_tex1.t != 0
35413547
)
35423548

35433549
def to_soh_xml(self):
@@ -3964,9 +3970,7 @@ def textureTypeO2R(self) -> int:
39643970
def toO2R(self, folderPath: str):
39653971
data = bytearray(0)
39663972

3967-
print(
3968-
f"FImage.toO2R {self.name} {self.fmt} {self.bitSize} {self.width}x{self.height} {len(self.data)} bytes"
3969-
)
3973+
print(f"FImage.toO2R {self.name} {self.fmt} {self.bitSize} {self.width}x{self.height} {len(self.data)} bytes")
39703974

39713975
data.extend(struct.pack("<IIIQIQIQQQI", 0, 0x4F544558, 0, 0xDEADBEEFDEADBEEF, 0, 0, 0, 0, 0, 0, 0))
39723976
data.extend(struct.pack("<IIII", self.textureTypeO2R(), self.width, self.height, len(self.data)))
@@ -4149,6 +4153,7 @@ def to_c(self, static=True):
41494153
header += "segmented_to_virtual(" + self.vertList.name + " + " + str(self.offset) + ")"
41504154
else:
41514155
header += self.vertList.name + " + " + str(self.offset)
4156+
41524157
return header + ", " + str(self.count) + ", " + str(self.index) + ")"
41534158

41544159
def toO2R(self, folderPath: str):
@@ -4171,7 +4176,7 @@ def toO2R(self, folderPath: str):
41714176
return data
41724177

41734178
def to_soh_xml(self, objectPath=""):
4174-
baseStr = "<LoadVertices Path=\"{parent}/{vertexPath}\" VertexBufferIndex=\"{bufferIndex}\" VertexOffset=\"{vertexOffset}\" Count=\"{count}\"/>"
4179+
baseStr = '<LoadVertices Path="{parent}/{vertexPath}" VertexBufferIndex="{bufferIndex}" VertexOffset="{vertexOffset}" Count="{count}"/>'
41754180
return baseStr.format(
41764181
parent=objectPath,
41774182
vertexPath=self.vertList.name,
@@ -5104,6 +5109,7 @@ def to_soh_xml(self, objectPath=""):
51045109
flags = ",".join(sorted(self.flagList))
51055110
return f'<GeometryFlags Mode="Load" Flags="{flags}"/>'
51065111

5112+
51075113
def gsSPSetOtherMode(cmd, sft, length, data, f3d):
51085114
if f3d.F3DEX_GBI_2:
51095115
words = _SHIFTL(cmd, 24, 8) | _SHIFTL(32 - (sft) - (length), 8, 8) | _SHIFTL((length) - 1, 0, 8), data
@@ -5452,11 +5458,13 @@ def toO2R(self, folderPath: str):
54525458
return data
54535459

54545460
def to_soh_xml(self, objectPath=""):
5455-
prefix = self.image.internal_path if self.image.internal_path else (objectPath if self.image.filename is not None else "")
5456-
imagePath = format_asset_path(prefix, self.image.name if self.image.name else "")
5457-
return (
5458-
f'<SetTextureImage Path="{imagePath}" Format="{self.fmt}" Size="{self.siz}" Width="{self.width}"/>'
5461+
prefix = (
5462+
self.image.internal_path
5463+
if self.image.internal_path
5464+
else (objectPath if self.image.filename is not None else "")
54595465
)
5466+
imagePath = format_asset_path(prefix, self.image.name if self.image.name else "")
5467+
return f'<SetTextureImage Path="{imagePath}" Format="{self.fmt}" Size="{self.siz}" Width="{self.width}"/>'
54605468

54615469

54625470
def gsDPSetCombine(muxs0, muxs1, f3d):
@@ -5532,7 +5540,7 @@ def _ac(name: str) -> str:
55325540
return name if name.startswith("G_ACMUX_") else f"G_ACMUX_{name}"
55335541

55345542
return (
5535-
'<SetCombineLERP '
5543+
"<SetCombineLERP "
55365544
f'A0="{_cc(self.a0)}" B0="{_cc(self.b0)}" C0="{_cc(self.c0)}" D0="{_cc(self.d0)}" '
55375545
f'Aa0="{_ac(self.Aa0)}" Ab0="{_ac(self.Ab0)}" Ac0="{_ac(self.Ac0)}" Ad0="{_ac(self.Ad0)}" '
55385546
f'A1="{_cc(self.a1)}" B1="{_cc(self.b1)}" C1="{_cc(self.c1)}" D1="{_cc(self.d1)}" '
@@ -5582,7 +5590,7 @@ def to_binary(self, f3d, segments):
55825590
def to_soh_xml(self, objectPath=""):
55835591
return (
55845592
f'<SetEnvColor R="{self.r}" G="{self.g}" B="{self.b}" A="{self.a}"'
5585-
f'{getDynamicCosmeticXmlAttrs(self.cosmeticEntry, self.cosmeticCategory)}/>'
5593+
f"{getDynamicCosmeticXmlAttrs(self.cosmeticEntry, self.cosmeticCategory)}/>"
55865594
)
55875595

55885596

@@ -5645,7 +5653,7 @@ def to_binary(self, f3d, segments):
56455653
def to_soh_xml(self, objectPath=""):
56465654
return (
56475655
f'<SetPrimColor M="{self.m}" L="{self.l}" R="{self.r}" G="{self.g}" B="{self.b}" A="{self.a}"'
5648-
f'{getDynamicCosmeticXmlAttrs(self.cosmeticEntry, self.cosmeticCategory)}/>'
5656+
f"{getDynamicCosmeticXmlAttrs(self.cosmeticEntry, self.cosmeticCategory)}/>"
56495657
)
56505658

56515659

@@ -5725,10 +5733,7 @@ def is_LOADTILE(self, f3d):
57255733
return self.tile == f3d.G_TX_LOADTILE
57265734

57275735
def to_soh_xml(self, objectPath=""):
5728-
return (
5729-
f'<SetTileSize T="{self.tile}" Uls="{self.uls}" Ult="{self.ult}" '
5730-
f'Lrs="{self.lrs}" Lrt="{self.lrt}"/>'
5731-
)
5736+
return f'<SetTileSize T="{self.tile}" Uls="{self.uls}" Ult="{self.ult}" ' f'Lrs="{self.lrs}" Lrt="{self.lrt}"/>'
57325737

57335738

57345739
@dataclass(unsafe_hash=True)
@@ -5743,10 +5748,7 @@ def to_binary(self, f3d, segments):
57435748
return gsDPLoadTileGeneric(f3d.G_LOADTILE, self.tile, self.uls, self.ult, self.lrs, self.lrt)
57445749

57455750
def to_soh_xml(self, objectPath=""):
5746-
return (
5747-
f'<LoadTile Tile="{self.tile}" Uls="{self.uls}" Ult="{self.ult}" '
5748-
f'Lrs="{self.lrs}" Lrt="{self.lrt}"/>'
5749-
)
5751+
return f'<LoadTile Tile="{self.tile}" Uls="{self.uls}" Ult="{self.ult}" ' f'Lrs="{self.lrs}" Lrt="{self.lrt}"/>'
57505752

57515753

57525754
@dataclass(unsafe_hash=True)
@@ -5816,8 +5818,7 @@ def to_binary(self, f3d, segments):
58165818

58175819
def to_soh_xml(self, objectPath=""):
58185820
return (
5819-
f'<LoadBlock Tile="{self.tile}" Uls="{self.uls}" Ult="{self.ult}" '
5820-
f'Lrs="{self.lrs}" Dxt="{self.dxt}" />'
5821+
f'<LoadBlock Tile="{self.tile}" Uls="{self.uls}" Ult="{self.ult}" ' f'Lrs="{self.lrs}" Dxt="{self.dxt}" />'
58215822
)
58225823

58235824

@@ -6522,5 +6523,4 @@ def to_soh_xml(self):
65226523
DPLoadTLUT_pal16,
65236524
DPLoadTLUT_pal256,
65246525
DPLoadTLUT,
6525-
]
6526-
6526+
]

fast64_internal/f3d/f3d_material.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,9 @@ def get_preview_light_entries(
19481948

19491949
color = [float(light.color[0]), float(light.color[1]), float(light.color[2]), 1.0]
19501950
light_objects = [
1951-
obj for obj in bpy.context.scene.objects if obj.type == "LIGHT" and obj.data == getattr(light, "original", light)
1951+
obj
1952+
for obj in bpy.context.scene.objects
1953+
if obj.type == "LIGHT" and obj.data == getattr(light, "original", light)
19521954
]
19531955
if not light_objects:
19541956
light_objects = [None]
@@ -2012,6 +2014,7 @@ def compress_preview_lights(light_entries: list[dict[str, Any]]) -> list[dict[st
20122014
)
20132015
return compressed
20142016

2017+
20152018
def update_light_colors(material, context):
20162019
f3dMat: "F3DMaterialProperty" = material.f3d_mat
20172020
nodes = material.node_tree.nodes
@@ -5635,4 +5638,3 @@ def mat_unregister():
56355638
"Vertex Colored Texture (No Vertex Alpha)",
56365639
),
56375640
]
5638-

fast64_internal/f3d/f3d_texture_writer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from ..utility import *
2222

2323

24-
2524
def UVtoSTLarge(obj, loopIndex, uv_data, texDimensions):
2625
uv = uv_data[loopIndex].uv.copy()
2726
uv[1] = 1 - uv[1]
@@ -423,9 +422,7 @@ def saveOrGetPaletteDefinition(
423422
fPalette.skip_export = texProp.is_vanilla_texture
424423
return paletteKey, fPalette
425424

426-
paletteName, filename = getTextureNamesFromBasename(
427-
palBaseName, palFmt, parent, True, skip_pal_suffix
428-
)
425+
paletteName, filename = getTextureNamesFromBasename(palBaseName, palFmt, parent, True, skip_pal_suffix)
429426
fPalette = FImage(paletteName, palFormat, "G_IM_SIZ_16b", 1, palLen, filename)
430427
if texProp:
431428
fPalette.internal_path = sanitize_internal_asset_path(texProp.texture_internal_path)

0 commit comments

Comments
 (0)