diff --git a/CHANGELOG.md b/CHANGELOG.md index cc890d1f..93f09eb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. -------------------- diff --git a/fgd/point/light/light_directional.fgd b/fgd/point/light/light_directional.fgd index 19c72344..f73a0e12 100644 --- a/fgd/point/light/light_directional.fgd +++ b/fgd/point/light/light_directional.fgd @@ -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 [] ] diff --git a/fgd/point/light/light_environment.fgd b/fgd/point/light/light_environment.fgd index 3a62654d..d3f09f7a 100644 --- a/fgd/point/light/light_environment.fgd +++ b/fgd/point/light/light_environment.fgd @@ -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 [] ] diff --git a/transforms/fgd_tweaks/light_sun_spread_angle.py b/transforms/fgd_tweaks/light_sun_spread_angle.py new file mode 100644 index 00000000..d307a092 --- /dev/null +++ b/transforms/fgd_tweaks/light_sun_spread_angle.py @@ -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()))