|
| 1 | +import bpy |
1 | 2 | import re |
2 | 3 |
|
3 | 4 | from dataclasses import dataclass |
@@ -37,16 +38,24 @@ def from_data(raw_data: str, not_zapd_assets: bool): |
37 | 38 | for match in re.finditer(r"(\{([0-9\-]*,[0-9\-]*,[0-9\-]*)\})", entry, re.DOTALL): |
38 | 39 | colors_and_dirs.append([hexOrDecInt(value) for value in match.group(2).split(",")]) |
39 | 40 |
|
40 | | - blend_and_fogs = entry.split("},")[-1].split(",") |
41 | | - blend_split = blend_and_fogs[0].split("|") |
42 | | - blend_raw = blend_split[0] |
43 | | - fog_near = hexOrDecInt(blend_split[1]) |
44 | | - z_far = hexOrDecInt(blend_and_fogs[1]) |
45 | | - blend_rate = getEvalParamsInt(blend_raw) |
46 | | - assert blend_rate is not None |
47 | | - |
48 | | - if "/" in blend_raw: |
| 41 | + if "BLEND_RATE_AND_FOG_NEAR" in entry: |
| 42 | + blend_and_fogs = entry.replace(")", "").split("BLEND_RATE_AND_FOG_NEAR(")[-1].strip().split(",") |
| 43 | + fog_near = hexOrDecInt(blend_and_fogs[1]) |
| 44 | + z_far = hexOrDecInt(blend_and_fogs[2]) |
| 45 | + blend_rate = getEvalParamsInt(blend_and_fogs[0]) |
| 46 | + assert blend_rate is not None |
49 | 47 | blend_rate *= 4 |
| 48 | + else: |
| 49 | + blend_and_fogs = entry.split("},")[-1].split(",") |
| 50 | + blend_split = blend_and_fogs[0].split("|") |
| 51 | + blend_raw = blend_split[0] |
| 52 | + fog_near = hexOrDecInt(blend_split[1]) |
| 53 | + z_far = hexOrDecInt(blend_and_fogs[1]) |
| 54 | + blend_rate = getEvalParamsInt(blend_raw) |
| 55 | + assert blend_rate is not None |
| 56 | + |
| 57 | + if "/" in blend_raw: |
| 58 | + blend_rate *= 4 |
50 | 59 | else: |
51 | 60 | split = entry.split(",") |
52 | 61 |
|
@@ -84,6 +93,9 @@ def from_data(raw_data: str, not_zapd_assets: bool): |
84 | 93 | def getBlendFogNear(self): |
85 | 94 | """Returns the packed blend rate and fog near values""" |
86 | 95 |
|
| 96 | + if bpy.context.scene.fast64.oot.useDecompFeatures: |
| 97 | + return f"BLEND_RATE_AND_FOG_NEAR({self.blendRate}, {self.fogNear})" |
| 98 | + |
87 | 99 | return f"(({self.blendRate} << 10) | {self.fogNear})" |
88 | 100 |
|
89 | 101 | def getColorValues(self, vector: tuple[int, int, int]): |
|
0 commit comments