Skip to content

Commit

Permalink
Check for null environment in settings label update (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mieldepoche authored Aug 23, 2023
1 parent e73e837 commit c205a17
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions addons/debug_menu/debug_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func _ready() -> void:
update_settings_label()
)


func _input(event: InputEvent) -> void:
if event.is_action_pressed("cycle_debug_menu"):
style = wrapi(style + 1, 0, Style.MAX) as Style
Expand Down Expand Up @@ -185,7 +186,6 @@ func update_settings_label() -> void:
if viewport.screen_space_aa == Viewport.SCREEN_SPACE_AA_FXAA:
antialiasing_3d_string += (" + " if not antialiasing_3d_string.is_empty() else "") + "FXAA"

var environment := viewport.get_camera_3d().get_world_3d().environment
settings.text += "3D scale (%s): %d%% = %d×%d" % [
"Bilinear" if viewport.scaling_3d_mode == Viewport.SCALING_3D_MODE_BILINEAR else "FSR 1.0",
viewport.scaling_3d_scale * 100,
Expand All @@ -195,23 +195,25 @@ func update_settings_label() -> void:

if not antialiasing_3d_string.is_empty():
settings.text += "\n3D Antialiasing: %s" % antialiasing_3d_string

var environment := viewport.get_camera_3d().get_world_3d().environment
if environment:
if environment.ssr_enabled:
settings.text += "\nSSR: %d Steps" % environment.ssr_max_steps

if environment.ssr_enabled:
settings.text += "\nSSR: %d Steps" % environment.ssr_max_steps

if environment.ssao_enabled:
settings.text += "\nSSAO: On"
if environment.ssil_enabled:
settings.text += "\nSSIL: On"
if environment.ssao_enabled:
settings.text += "\nSSAO: On"
if environment.ssil_enabled:
settings.text += "\nSSIL: On"

if environment.sdfgi_enabled:
settings.text += "\nSDFGI: %d Cascades" % environment.sdfgi_cascades
if environment.sdfgi_enabled:
settings.text += "\nSDFGI: %d Cascades" % environment.sdfgi_cascades

if environment.glow_enabled:
settings.text += "\nGlow: On"
if environment.glow_enabled:
settings.text += "\nGlow: On"

if environment.volumetric_fog_enabled:
settings.text += "\nVolumetric Fog: On"
if environment.volumetric_fog_enabled:
settings.text += "\nVolumetric Fog: On"
var antialiasing_2d_string := ""
if viewport.msaa_2d >= Viewport.MSAA_2X:
antialiasing_2d_string = "%d× MSAA" % pow(2, viewport.msaa_2d)
Expand Down

0 comments on commit c205a17

Please sign in to comment.