Skip to content

Commit

Permalink
Fix #274: Force light_environment to use the required SunSpreadAngle …
Browse files Browse the repository at this point in the history
…casing.
  • Loading branch information
TeamSpen210 committed Sep 2, 2024
1 parent 80a75a9 commit c03754a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Fix various incorrect usages of the FGD `frustum()` helper.
* Normals are now correctly calculated when generating propcombined models. This requires all previous models to be rebuilt, unfortunately.
* Fix overlays not functioning with `material_modify_control` parent searching.
* #274: Force `light_environment` to use the required `SunSpreadAngle` casing.


--------------------
Expand Down
3 changes: 2 additions & 1 deletion fgd/point/light/light_directional.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
_light(color255) : "Brightness" : "255 255 255 200"
_lighthdr(color255) : "BrightnessHDR" : "-1 -1 -1 1"
_lightscalehdr(float) : "BrightnessScaleHDR" : 0.7 : "Amount to scale the light by when compiling for HDR."
sunspreadangle(float) : "SpreadAngle" : 0 : "The angular extent of the light for casting soft shadows. Higher numbers are more diffuse. 5 is a good starting value."
// VRAD requires this casing for the key name.
SunSpreadAngle(float) : "SpreadAngle" : 0 : "The angular extent of the light for casting soft shadows. Higher numbers are more diffuse. 5 is a good starting value."

@resources []
]
3 changes: 2 additions & 1 deletion fgd/point/light/light_environment.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
_lightscalehdr(float) : "BrightnessScaleHDR" : 1 : "Amount to scale the light by when compiling for HDR."
_ambienthdr(color255) : "AmbientHDR" : "-1 -1 -1 1"
_ambientscalehdr(float) : "AmbientScaleHDR" : 1 : "Amount to scale the ambient light by when compiling for hdr."
sunspreadangle(float) : "SunSpreadAngle" : 5 : "The angular extent of the sun for casting soft shadows. Higher numbers are more diffuse. 5 is a good starting value."
// VRAD requires this casing for the key name.
SunSpreadAngle(float) : "SunSpreadAngle" : 5 : "The angular extent of the sun for casting soft shadows. Higher numbers are more diffuse. 5 is a good starting value."

@resources []
]
10 changes: 10 additions & 0 deletions transforms/fgd_tweaks/light_sun_spread_angle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""This keyvalue is case-sensitive, force the required casing."""
from hammeraddons.bsp_transform import Context, trans


@trans('FGD - Fix Sun Spread Angle')
def light_sun_spread_angle(ctx: Context) -> None:
"""Force case-sensitivity on this keyvalue."""
for ent in ctx.vmf.by_class['light_environment'] | ctx.vmf.by_class['light_directional']:
ent['SunSpreadAngle'] = ent.pop('sunspreadangle')
print(dict(ent.items()))

0 comments on commit c03754a

Please sign in to comment.