Added menu settings add-on

This commit is contained in:
2026-03-07 14:16:44 +01:00
parent 8b7a8e014f
commit df8c8c6c3b
70 changed files with 4053 additions and 1 deletions

View File

@@ -0,0 +1,83 @@
[gd_scene load_steps=3 format=3 uid="uid://csg6c3uuct1ls"]
[sub_resource type="GDScript" id="GDScript_5w56l"]
resource_name = "anti_aliasing"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = [
\"Disabled\",
\"FXAA\",
\"2x MSAA\",
\"4x MSAA\",
\"8x MSAA\",
\"TAA\"
]
func _apply_settings() -> void:
# Enables the selected anti aliasing
match currentValue:
\"Disabled\":
set_anti_aliasing_mode()
\"FXAA\":
set_anti_aliasing_mode(Viewport.SCREEN_SPACE_AA_FXAA)
\"2x MSAA\":
set_anti_aliasing_mode(
Viewport.SCREEN_SPACE_AA_DISABLED,
Viewport.MSAA_2X
)
\"4x MSAA\":
set_anti_aliasing_mode(
Viewport.SCREEN_SPACE_AA_DISABLED,
Viewport.MSAA_4X
)
\"8x MSAA\":
set_anti_aliasing_mode(
Viewport.SCREEN_SPACE_AA_DISABLED,
Viewport.MSAA_8X
)
\"TAA\":
set_anti_aliasing_mode(
Viewport.SCREEN_SPACE_AA_DISABLED,
Viewport.MSAA_DISABLED, true
)
# Sets the anti aliasing mode according to the values provided
func set_anti_aliasing_mode(
fxaaMode: Viewport.ScreenSpaceAA = Viewport.SCREEN_SPACE_AA_DISABLED,
msaaMode: Viewport.MSAA = Viewport.MSAA_DISABLED,
taaMode: bool = false
) -> void:
get_viewport().set_screen_space_aa(fxaaMode)
get_viewport().set_msaa_3d(msaaMode)
get_viewport().set_use_taa(taaMode)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="AntiAliasing" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_5w56l")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "AntiAliasing"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Anti Aliasing"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,53 @@
[gd_scene load_steps=3 format=3 uid="uid://3ckate3v614f"]
[sub_resource type="GDScript" id="GDScript_mnbyt"]
resource_name = "depth_of_field"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Disabled\": null,
\"Low\": RenderingServer.DOF_BLUR_QUALITY_LOW,
\"Medium\": RenderingServer.DOF_BLUR_QUALITY_MEDIUM,
\"High\": RenderingServer.DOF_BLUR_QUALITY_HIGH
}
func _apply_settings() -> void:
if not apply_in_game_setting(currentValue):
if currentValue == \"Disabled\":
return
RenderingServer.camera_attributes_set_dof_blur_quality(
OPTION_LIST_[currentValue],
true
)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="DepthOfField" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_mnbyt")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "DepthOfField"
IS_IN_GAME_SETTING = true
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Depth of Field"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,109 @@
[gd_scene load_steps=3 format=3 uid="uid://byff0jwaicxvr"]
[sub_resource type="GDScript" id="GDScript_duwn0"]
resource_name = "display_mode"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Fullscreen\": DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN,
\"Borderless Windowed\": DisplayServer.WINDOW_MODE_WINDOWED,
\"Windowed\": DisplayServer.WINDOW_MODE_WINDOWED
}
func load_settings() -> void:
super.load_settings()
# Check if the resolution element should be disabled
call_deferred(\"check_resolution\")
func option_selected(index: int) -> void:
super.option_selected(index)
# Check if the resolution element should be disabled
check_resolution()
func _apply_settings() -> void:
DisplayServer.window_set_mode(OPTION_LIST_[currentValue])
if currentValue == \"Borderless Windowed\":
DisplayServer.window_set_flag(
DisplayServer.WINDOW_FLAG_BORDERLESS,
true
)
adjust_resolution()
else:
DisplayServer.window_set_flag(
DisplayServer.WINDOW_FLAG_BORDERLESS,
false
)
if currentValue == \"Windowed\":
# Set the resolution to 80% if the resolution setting doesnt exist
if not ParentRef.ELEMENT_REFERENCE_TABLE_.has(\"Resolution\"):
adjust_resolution(0.8)
return
# Apply the selected resolution manually if it has not been changed
if not ParentRef.changedElements_.has(\"Resolution\"):
# Resolution change has to be delayed by at least 2 frames.
# Otherwise height of the window will be off by a bit.
await get_tree().process_frame
await get_tree().process_frame
# Apply the resolution settings manually
ParentRef.ELEMENT_REFERENCE_TABLE_[\"Resolution\"]._apply_settings()
# Called to check if the resolution element should be disabled
func check_resolution() -> void:
if not ParentRef.ELEMENT_REFERENCE_TABLE_.has(\"Resolution\"):
return
var ResolutionRef: SettingsElement =\\
ParentRef.ELEMENT_REFERENCE_TABLE_[\"Resolution\"]
if currentValue != \"Windowed\":
ResolutionRef.OptionsRef.set_disabled(true)
else:
ResolutionRef.OptionsRef.set_disabled(false)
# Called to scale the resolution to the provided percentage
func adjust_resolution(sizeScale: float = 1.0) -> void:
var displaySize: Vector2i =\\
DisplayServer.screen_get_size(
DisplayServer.window_get_current_screen()
) * sizeScale
get_window().set_size(displaySize)
get_viewport().set_size(displaySize)
get_window().move_to_center()
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="DisplayMode" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_duwn0")
DEFAULT_VALUE = "Fullscreen"
OptionsRef = NodePath("Options")
IDENTIFIER = "DisplayMode"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Display Mode"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,55 @@
[gd_scene load_steps=3 format=3 uid="uid://du5urp5d2dyjb"]
[sub_resource type="GDScript" id="GDScript_7hlvr"]
resource_name = "glow_quality"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = [
\"Disabled\",
\"Low\",
\"High\"
]
func _apply_settings() -> void:
apply_in_game_setting(currentValue)
if currentValue == \"Disabled\":
return
# Toggle bicubic upscaling
match currentValue:
\"Low\":
RenderingServer.environment_glow_set_use_bicubic_upscale(false)
\"High\":
RenderingServer.environment_glow_set_use_bicubic_upscale(true)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="GlowQuality" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_7hlvr")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "GlowQuality"
IS_IN_GAME_SETTING = true
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Glow Quality"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,85 @@
[gd_scene load_steps=2 format=3 uid="uid://dghfxwcbi5ig"]
[sub_resource type="GDScript" id="GDScript_eitn6"]
resource_name = "max_fps"
script/source = "extends SliderElement
func init_element() -> void:
super.init_element()
# Increase UI max value by one for unlimited fps
SliderRef.set_max(MAX_VALUE + 1)
if ValueBoxRef is SpinBox:
ValueBoxRef.set_max(MAX_VALUE + 1)
func load_settings() -> void:
super.load_settings()
if currentValue == 0:
ValueBoxRef.set_text(\"Unlimited\")
SliderRef.set_value(MAX_VALUE + 1)
func value_changed(value: float) -> void:
if value > MAX_VALUE:
value = 0
ValueBoxRef.set_text(\"Unlimited\")
super.value_changed(value)
# Element specific script for applying its value to the game
func _apply_settings() -> void:
if (
ParentRef.ELEMENT_REFERENCE_TABLE_.has(\"VSync\")
and ParentRef.ELEMENT_REFERENCE_TABLE_[\"VSync\"].currentValue != \"Disabled\"
):
return
Engine.set_max_fps(currentValue)
"
[node name="MaxFPS" type="HBoxContainer" node_paths=PackedStringArray("SliderRef", "ValueBoxRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_eitn6")
MIN_VALUE = 30.0
MAX_VALUE = 240.0
STEP_VALUE = 1.0
DEFAULT_VALUE = 60.0
SliderRef = NodePath("SliderValue/Slider")
ValueBoxRef = NodePath("SliderValue/Value")
IDENTIFIER = "MaxFPS"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Max FPS"
vertical_alignment = 1
[node name="SliderValue" type="HBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 6
[node name="Slider" type="HSlider" parent="SliderValue"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
max_value = 0.0
step = 0.0
ticks_on_borders = true
[node name="Value" type="Label" parent="SliderValue"]
custom_minimum_size = Vector2(80, 31)
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 1
text = "240"
horizontal_alignment = 2
vertical_alignment = 1

View File

@@ -0,0 +1,64 @@
[gd_scene load_steps=2 format=3 uid="uid://cn8r63dmvd55c"]
[sub_resource type="GDScript" id="GDScript_utf5l"]
resource_name = "resolution"
script/source = "extends OptionElement
## Toggle window resizing by the user.
@export var RESIZABLE: bool = false
func _init() -> void:
OPTION_LIST_ = {
\"3840x2160\": Vector2i(3840, 2160),
\"2560x1440\": Vector2i(2560, 1440),
\"1920x1080\": Vector2i(1920, 1080),
\"1280x720\": Vector2i(1280, 720),
\"960x540\": Vector2i(960, 540)
}
func _ready() -> void:
super._ready()
# Toggle window resizing
DisplayServer.window_set_flag(
DisplayServer.WINDOW_FLAG_RESIZE_DISABLED,
!RESIZABLE
)
func _apply_settings() -> void:
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN:
return
if DisplayServer.window_get_flag(DisplayServer.WINDOW_FLAG_BORDERLESS):
return
# Change the window size to the selected resolution
get_window().set_size(OPTION_LIST_[currentValue])
get_viewport().set_size(OPTION_LIST_[currentValue])
get_window().move_to_center()
"
[node name="Resolution" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_utf5l")
DEFAULT_VALUE = "1920x1080"
OptionsRef = NodePath("Options")
IDENTIFIER = "Resolution"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Resolution"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0

View File

@@ -0,0 +1,41 @@
[gd_scene load_steps=3 format=3 uid="uid://5dydkttc2fww"]
[sub_resource type="GDScript" id="GDScript_usma2"]
resource_name = "fsr_options"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Ultra Quality\": 0.77,
\"Quality\": 0.67,
\"Balanced\": 0.59,
\"Performance\": 0.5
}
func _apply_settings() -> void:
get_viewport().set_scaling_3d_scale(OPTION_LIST_[currentValue])
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="FSRMode" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
size_flags_vertical = 3
script = SubResource("GDScript_usma2")
DEFAULT_VALUE = "Balanced"
OptionsRef = NodePath("Options")
IDENTIFIER = "FSRMode"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "FSR Mode"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,61 @@
[gd_scene load_steps=4 format=3 uid="uid://bdoaqhvw440eh"]
[sub_resource type="GDScript" id="GDScript_ng2w8"]
resource_name = "fsr_sharpness"
script/source = "extends SliderElement
# Element specific script for applying its value to the game
func _apply_settings() -> void:
get_viewport().set_fsr_sharpness((MAX_VALUE - currentValue) * 2.0)
"
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_hae3h"]
size = Vector2(0, 0)
[sub_resource type="Theme" id="Theme_0xoq4"]
SpinBox/icons/updown = SubResource("PlaceholderTexture2D_hae3h")
[node name="FSRSharpness" type="HBoxContainer" node_paths=PackedStringArray("SliderRef", "ValueBoxRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_ng2w8")
STEP_VALUE = 0.01
DEFAULT_VALUE = 0.9
DISPLAY_PERCENT_VALUE = true
VALUE_SUFFIX = "%"
SliderRef = NodePath("SliderValue/Slider")
ValueBoxRef = NodePath("SliderValue/Value")
IDENTIFIER = "FSRSharpness"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "FSR Sharpness"
vertical_alignment = 1
[node name="SliderValue" type="HBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 20
[node name="Slider" type="HSlider" parent="SliderValue"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
max_value = 0.0
step = 0.0
ticks_on_borders = true
[node name="Value" type="SpinBox" parent="SliderValue"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 4
theme = SubResource("Theme_0xoq4")
max_value = 0.0
step = 0.0
alignment = 2

View File

@@ -0,0 +1,62 @@
[gd_scene load_steps=4 format=3 uid="uid://ha87l3hl643g"]
[sub_resource type="GDScript" id="GDScript_7dhl4"]
resource_name = "resolution_scale"
script/source = "extends SliderElement
# Element specific script for applying its value to the game
func _apply_settings() -> void:
get_viewport().set_scaling_3d_scale(currentValue)
"
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_hae3h"]
size = Vector2(0, 0)
[sub_resource type="Theme" id="Theme_0xoq4"]
SpinBox/icons/updown = SubResource("PlaceholderTexture2D_hae3h")
[node name="ResolutionScale" type="HBoxContainer" node_paths=PackedStringArray("SliderRef", "ValueBoxRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_7dhl4")
MIN_VALUE = 0.5
MAX_VALUE = 2.0
STEP_VALUE = 0.01
DISPLAY_PERCENT_VALUE = true
VALUE_SUFFIX = "%"
SliderRef = NodePath("SliderValue/Slider")
ValueBoxRef = NodePath("SliderValue/Value")
IDENTIFIER = "ResolutionScale"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Resolution Scale"
vertical_alignment = 1
[node name="SliderValue" type="HBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 20
[node name="Slider" type="HSlider" parent="SliderValue"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
max_value = 0.0
step = 0.0
ticks_on_borders = true
[node name="Value" type="SpinBox" parent="SliderValue"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 4
theme = SubResource("Theme_0xoq4")
max_value = 0.0
step = 0.0
alignment = 2

View File

@@ -0,0 +1,128 @@
[gd_scene format=3 uid="uid://b3w7qpn4nhmu2"]
[ext_resource type="PackedScene" uid="uid://ha87l3hl643g" path="res://addons/modular-settings-menu/scenes/settings-elements/graphics-elements/scaler-sub-elements/resolution_scale.tscn" id="1_4irey"]
[ext_resource type="PackedScene" uid="uid://5dydkttc2fww" path="res://addons/modular-settings-menu/scenes/settings-elements/graphics-elements/scaler-sub-elements/fsr_mode.tscn" id="2_w65g1"]
[ext_resource type="PackedScene" uid="uid://bdoaqhvw440eh" path="res://addons/modular-settings-menu/scenes/settings-elements/graphics-elements/scaler-sub-elements/fsr_sharpness.tscn" id="3_v8pix"]
[sub_resource type="GDScript" id="GDScript_bn0b0"]
resource_name = "scaler"
script/source = "extends MultiElement
func _display_sub_elements() -> void:
match currentValue:
\"Disabled\":
for element in SUB_ELEMENTS_:
element.hide()
\"Bilinear\":
SUB_ELEMENTS_[0].show()
SUB_ELEMENTS_[1].hide()
SUB_ELEMENTS_[2].hide()
\"FSR 2.2\":
SUB_ELEMENTS_[0].hide()
SUB_ELEMENTS_[1].show()
SUB_ELEMENTS_[2].show()
"
[sub_resource type="GDScript" id="GDScript_mdyud"]
resource_name = "scaling_mode"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Disabled\": Viewport.SCALING_3D_MODE_BILINEAR,
\"Bilinear\": Viewport.SCALING_3D_MODE_BILINEAR,
\"FSR 2.2\": Viewport.SCALING_3D_MODE_FSR2
}
# Loads the saved/default values of the element
func load_settings() -> void:
super.load_settings()
# Check if TAA is selected
call_deferred(\"check_anti_aliasing\")
func option_selected(index: int) -> void:
super.option_selected(index)
# Check if TAA is selected
check_anti_aliasing()
# Called to apply the settings in the settings cache
func _apply_settings() -> void:
get_viewport().set_scaling_3d_mode(OPTION_LIST_[currentValue])
if currentValue == \"Disabled\":
get_viewport().set_scaling_3d_scale(1.0)
# Checks if TAA is selected while FSR 2.2 is enabled
func check_anti_aliasing() -> void:
if not ParentRef.ELEMENT_REFERENCE_TABLE_.has(\"AntiAliasing\"):
return
var AntiAliasingRef: SettingsElement =\\
ParentRef.ELEMENT_REFERENCE_TABLE_[\"AntiAliasing\"]
var taaIndex: int = AntiAliasingRef.OPTION_LIST_.find(\"TAA\")
if currentValue != \"FSR 2.2\":
AntiAliasingRef.OptionsRef.set_item_disabled(
taaIndex,
false
)
return
AntiAliasingRef.OptionsRef.set_item_disabled(
taaIndex,
true
)
if AntiAliasingRef.currentValue == \"TAA\":
var disabledIndex: int = AntiAliasingRef.OPTION_LIST_.find(\"Disabled\")
# Reselect the anti aliasing mode
AntiAliasingRef.OptionsRef.select(disabledIndex)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="Scaler" type="VBoxContainer" node_paths=PackedStringArray("MainElementRef", "SUB_ELEMENTS_")]
offset_top = 51.0
offset_right = 1152.0
offset_bottom = 51.0
script = SubResource("GDScript_bn0b0")
MainElementRef = NodePath("ScalingMode")
SUB_ELEMENTS_ = [NodePath("ResolutionScale"), NodePath("FSRMode"), NodePath("FSRSharpness")]
[node name="ScalingMode" type="HBoxContainer" parent="." node_paths=PackedStringArray("OptionsRef")]
layout_mode = 2
size_flags_horizontal = 3
script = SubResource("GDScript_mdyud")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "ScalingMode"
[node name="Label" type="Label" parent="ScalingMode"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Scaling Mode"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="ScalingMode"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")
[node name="ResolutionScale" parent="." instance=ExtResource("1_4irey")]
visible = false
layout_mode = 2
size_flags_vertical = 3
[node name="FSRMode" parent="." instance=ExtResource("2_w65g1")]
visible = false
layout_mode = 2
[node name="FSRSharpness" parent="." instance=ExtResource("3_v8pix")]
visible = false
layout_mode = 2

View File

@@ -0,0 +1,53 @@
[gd_scene load_steps=3 format=3 uid="uid://ddykljx6ndodi"]
[sub_resource type="GDScript" id="GDScript_6k8bu"]
resource_name = "sdfgi_quality"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Disabled\": null,
\"Low\": RenderingServer.ENV_SDFGI_RAY_COUNT_8,
\"Medium\": RenderingServer.ENV_SDFGI_RAY_COUNT_32,
\"High\": RenderingServer.ENV_SDFGI_RAY_COUNT_96
}
# Called to apply the settings in the settings cache
func apply_settings() -> void:
apply_in_game_setting(currentValue)
if currentValue == \"Disabled\":
return
RenderingServer.environment_set_sdfgi_ray_count(OPTION_LIST_[currentValue])
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="SDFGIQuality" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
tooltip_text = "Signed Distance Field Global Illumination"
script = SubResource("GDScript_6k8bu")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "SDFGIQuality"
IS_IN_GAME_SETTING = true
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "SDFGI Quality"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,50 @@
[gd_scene load_steps=3 format=3 uid="uid://cgqiotob5aaoq"]
[sub_resource type="GDScript" id="GDScript_v3ktk"]
resource_name = "shadow_quality"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Low\": RenderingServer.SHADOW_QUALITY_SOFT_LOW,
\"Medium\": RenderingServer.SHADOW_QUALITY_SOFT_MEDIUM,
\"High\": RenderingServer.SHADOW_QUALITY_SOFT_HIGH
}
# Called to apply the settings in the settings cache
func _apply_settings() -> void:
RenderingServer.directional_soft_shadow_filter_set_quality(
OPTION_LIST_[currentValue]
)
RenderingServer.positional_soft_shadow_filter_set_quality(
OPTION_LIST_[currentValue]
)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="ShadowQuality" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_v3ktk")
DEFAULT_VALUE = "Low"
OptionsRef = NodePath("Options")
IDENTIFIER = "ShadowQuality"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "Shadow Quality"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,78 @@
[gd_scene load_steps=3 format=3 uid="uid://bk5ky60jln7ag"]
[sub_resource type="GDScript" id="GDScript_h10e0"]
resource_name = "ssao_quality"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Disabled\": null,
\"Low\": {
\"quality\": RenderingServer.ENV_SSAO_QUALITY_LOW,
\"halfSize\": true,
\"blurPasses\": 1,
\"fadeOutFrom\": 25,
\"fadeOutTo\": 150
},
\"Medium\": {
\"quality\": RenderingServer.ENV_SSAO_QUALITY_MEDIUM,
\"halfSize\": true,
\"blurPasses\": 2,
\"fadeOutFrom\": 50,
\"fadeOutTo\": 300
},
\"High\": {
\"quality\": RenderingServer.ENV_SSAO_QUALITY_HIGH,
\"halfSize\": false,
\"blurPasses\": 4,
\"fadeOutFrom\": 100,
\"fadeOutTo\": 600
}
}
# Called to apply the settings in the settings cache
func _apply_settings() -> void:
apply_in_game_setting(currentValue)
if currentValue == \"Disabled\":
return
RenderingServer.environment_set_ssao_quality(
OPTION_LIST_[currentValue][\"quality\"],
OPTION_LIST_[currentValue][\"halfSize\"],
0.5,
OPTION_LIST_[currentValue][\"blurPasses\"],
OPTION_LIST_[currentValue][\"fadeOutFrom\"],
OPTION_LIST_[currentValue][\"fadeOutTo\"]
)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="SSAOQuality" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
tooltip_text = "Screen Space Ambient Occlusion"
script = SubResource("GDScript_h10e0")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "SSAOQuality"
IS_IN_GAME_SETTING = true
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "SSAO Quality"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,78 @@
[gd_scene load_steps=3 format=3 uid="uid://bmnvig4gfqj0c"]
[sub_resource type="GDScript" id="GDScript_fwd72"]
resource_name = "ssil_quality"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Disabled\": null,
\"Low\": {
\"quality\": RenderingServer.ENV_SSIL_QUALITY_LOW,
\"halfSize\": true,
\"blurPasses\": 2,
\"fadeOutFrom\": 25,
\"fadeOutTo\": 150
},
\"Medium\": {
\"quality\": RenderingServer.ENV_SSIL_QUALITY_MEDIUM,
\"halfSize\": true,
\"blurPasses\": 4,
\"fadeOutFrom\": 50,
\"fadeOutTo\": 300
},
\"High\": {
\"quality\": RenderingServer.ENV_SSIL_QUALITY_HIGH,
\"halfSize\": false,
\"blurPasses\": 8,
\"fadeOutFrom\": 100,
\"fadeOutTo\": 600
}
}
# Called to apply the settings in the settings cache
func _apply_settings() -> void:
apply_in_game_setting(currentValue)
if currentValue == \"Disabled\":
return
RenderingServer.environment_set_ssil_quality(
OPTION_LIST_[currentValue][\"quality\"],
OPTION_LIST_[currentValue][\"halfSize\"],
0.5,
OPTION_LIST_[currentValue][\"blurPasses\"],
OPTION_LIST_[currentValue][\"fadeOutFrom\"],
OPTION_LIST_[currentValue][\"fadeOutTo\"]
)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="SSILQuality" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
tooltip_text = "Screen Space Indirect Lighting"
script = SubResource("GDScript_fwd72")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "SSILQuality"
IS_IN_GAME_SETTING = true
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "SSIL Quality"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,70 @@
[gd_scene load_steps=3 format=3 uid="uid://cqfr01uk73ce5"]
[sub_resource type="GDScript" id="GDScript_v8qca"]
resource_name = "ssr_quality"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Disabled\": null,
\"Low\": {
\"roughnessQuality\": RenderingServer.ENV_SSR_ROUGHNESS_QUALITY_LOW,
\"maxSteps\": 32,
\"fadeIn\": 0.3,
\"fadeOut\": 1.0
},
\"Medium\": {
\"roughnessQuality\": RenderingServer.ENV_SSR_ROUGHNESS_QUALITY_MEDIUM,
\"maxSteps\": 64,
\"fadeIn\": 0.15,
\"fadeOut\": 2.0
},
\"High\": {
\"roughnessQuality\": RenderingServer.ENV_SSR_ROUGHNESS_QUALITY_HIGH,
\"maxSteps\": 128,
\"fadeIn\": 0.075,
\"fadeOut\": 4.0
}
}
# Called to apply the settings in the settings cache
func _apply_settings() -> void:
apply_in_game_setting(OPTION_LIST_[currentValue])
if currentValue == \"Disabled\":
return
RenderingServer.environment_set_ssr_roughness_quality(
OPTION_LIST_[currentValue][\"roughnessQuality\"]
)
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="SSRQuality" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
tooltip_text = "Screen Space Reflection"
script = SubResource("GDScript_v8qca")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "SSRQuality"
IS_IN_GAME_SETTING = true
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "SSR Quality"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

View File

@@ -0,0 +1,96 @@
[gd_scene load_steps=3 format=3 uid="uid://idtbqnsqlvb6"]
[sub_resource type="GDScript" id="GDScript_kwfgn"]
resource_name = "vsync"
script/source = "extends OptionElement
func _init() -> void:
OPTION_LIST_ = {
\"Disabled\": DisplayServer.VSYNC_DISABLED,
\"Enabled\": DisplayServer.VSYNC_ENABLED,
\"Adaptive\": DisplayServer.VSYNC_ADAPTIVE
}
# Loads the saved/default values of the element
func load_settings() -> void:
super.load_settings()
# Toggle the max fps element
call_deferred(\"toggle_max_fps\")
func option_selected(index: int) -> void:
super.option_selected(index)
# Toggle the max fps element
toggle_max_fps()
# Called to apply the settings in the settings cache
func _apply_settings() -> void:
# Set the vsync mode to the selected option
DisplayServer.window_set_vsync_mode(OPTION_LIST_[currentValue])
# Set the max fps to unlimited if vsync is being enabled
if currentValue != \"Disabled\":
Engine.set_max_fps(0)
# Check if the max fps element exists and if vsync is disabled
if (
ParentRef.ELEMENT_REFERENCE_TABLE_.has(\"MaxFPS\")
and currentValue == \"Disabled\"
):
# Check if max fps has been changed
if not ParentRef.changedElements_.has(\"MaxFPS\"):
# Apply the max fps settings manually
ParentRef.ELEMENT_REFERENCE_TABLE_[\"MaxFPS\"]._apply_settings()
elif currentValue == \"Disabled\":
# Set the max fps to the max fps read from the project settings
Engine.set_max_fps(ProjectSettings.get_setting(\"application/run/max_fps\"))
# Disable/Enable the max fps element according to if vsync is on or not
func toggle_max_fps() -> void:
if not ParentRef.ELEMENT_REFERENCE_TABLE_.has(\"MaxFPS\"):
return
# Reference to the slider value node of the max fps element
var MaxFpsRef: SettingsElement =\\
ParentRef.ELEMENT_REFERENCE_TABLE_[\"MaxFPS\"]
if currentValue == \"Disabled\":
# Enable the max fps element
MaxFpsRef.SliderRef.set_editable(true)
MaxFpsRef.ValueBoxRef.modulate = Color.WHITE
else:
# Disable the max fps element
MaxFpsRef.SliderRef.set_editable(false)
MaxFpsRef.ValueBoxRef.modulate = Color.GRAY
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_drjjf"]
[node name="VSync" type="HBoxContainer" node_paths=PackedStringArray("OptionsRef")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_kwfgn")
DEFAULT_VALUE = "Disabled"
OptionsRef = NodePath("Options")
IDENTIFIER = "VSync"
[node name="Label" type="Label" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
text = "V-Sync"
vertical_alignment = 1
[node name="Options" type="OptionButton" parent="."]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")