From e8a57e7b616dfeb8987d1b22267dcbc20916e78f Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 25 Sep 2026 12:23:14 +0200 Subject: [PATCH] Fix SPClipRatio missing FRUSTRATIO_ arg prefix on export and import --- fast64_internal/f3d/f3d_gbi.py | 4 ++++ fast64_internal/f3d/f3d_material.py | 2 +- fast64_internal/f3d/f3d_parser.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fast64_internal/f3d/f3d_gbi.py b/fast64_internal/f3d/f3d_gbi.py index 860f3a43e..7f411fa8b 100644 --- a/fast64_internal/f3d/f3d_gbi.py +++ b/fast64_internal/f3d/f3d_gbi.py @@ -3804,6 +3804,10 @@ def to_binary(self, f3d, segments): + gsMoveWd(f3d.G_MW_CLIP, f3d.G_MWO_CLIP_RPY, shortRatioPos, f3d) ) + def to_c(self, static=True): + header = "gsSPClipRatio(" if static else "gSPClipRatio(glistp++, " + return f"{header}FRUSTRATIO_{self.ratio})" + def size(self, f3d): return GFX_SIZE * 4 diff --git a/fast64_internal/f3d/f3d_material.py b/fast64_internal/f3d/f3d_material.py index bf1a739b6..de2a94fef 100644 --- a/fast64_internal/f3d/f3d_material.py +++ b/fast64_internal/f3d/f3d_material.py @@ -3656,7 +3656,7 @@ class RDPSettings(PropertyGroup): clip_ratio: bpy.props.IntProperty( default=1, min=1, - max=2**15 - 1, + max=6, update=update_node_values_with_preset, ) diff --git a/fast64_internal/f3d/f3d_parser.py b/fast64_internal/f3d/f3d_parser.py index 0d20d2221..030f4dbd7 100644 --- a/fast64_internal/f3d/f3d_parser.py +++ b/fast64_internal/f3d/f3d_parser.py @@ -1637,7 +1637,7 @@ def processCommands(self, dlData: str, dlName: str, dlCommands: "list[ParsedMacr rdp_settings: "RDPSettings" = mat.rdp_settings if command.name == "gsSPClipRatio": - rdp_settings.clip_ratio = math_eval(command.params[0], self.f3d) + rdp_settings.clip_ratio = int(command.params[0].removeprefix("FRUSTRATIO_")) elif command.name == "gsSPNumLights": self.numLights = self.getLightCount(command.params[0]) elif command.name == "gsSPLight":