Added a Lighting toggle in the Graphics menu - works but doesn't save properly

This commit is contained in:
unfa 2021-09-22 01:53:31 +02:00
parent 377d74286b
commit fb395c090f
4 changed files with 51 additions and 24 deletions

View file

@ -49,5 +49,13 @@ func toggle_fullscreen(is_fullscreen):
else:
get_tree().get_root().mode = Window.MODE_WINDOWED
func toggle_lighting(is_enabled):
var map = get_tree().get_root().get_node("Main").get_node("Map")
map.get_node("Lights").visible = is_enabled
map.get_node("Decals").visible = is_enabled
map.get_node("ReflectionProbes").visible = is_enabled
func set_mouse_sensitivity(sensitivity):
pass

View file

@ -4,3 +4,9 @@ func on_fullscreen_toggled(button_pressed):
if GUI:
GUI.toggle_fullscreen(button_pressed)
$Fullscreen.save_data()
func _on_Lighting_toggled(button_pressed):
if GUI:
GUI.toggle_lighting(button_pressed)
$Lighting.save_data()

View file

@ -15,9 +15,19 @@ offset_bottom = 40.0
label = "Fullscreen"
index = "Fullscreen"
[node name="Back" parent="." index="1"]
[node name="Lighting" parent="." index="1" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 44.0
offset_right = 76.0
offset_bottom = 73.0
offset_bottom = 84.0
label = "Eye Candy Lighting"
index = "Fullscreen"
[node name="Back" parent="." index="2"]
offset_top = 88.0
offset_right = 76.0
offset_bottom = 117.0
[connection signal="toggled" from="Fullscreen" to="." method="on_fullscreen_toggled"]
[connection signal="toggled" from="Lighting" to="." method="_on_Lighting_toggled"]

View file

@ -89,6 +89,7 @@ script = null
[node name="Decals" type="Node3D" parent="."]
transform = Transform3D(-0.965926, 0.258819, 4.2222e-08, 4.37114e-08, 1.43551e-22, 1, 0.258819, 0.965926, -1.13133e-08, 14.1763, 3.94448, 0.097948)
visible = false
script = null
__meta__ = {
"_edit_lock_": true
@ -139,6 +140,7 @@ albedo_mix = 0.0
script = ExtResource( "5_yr76j" )
[node name="Lights" type="Node3D" parent="."]
visible = false
script = null
__meta__ = {
"_edit_lock_": true
@ -227,30 +229,9 @@ spot_range = 9.47919
spot_angle = 65.7864
script = null
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.462097, -0.0829877, -0.882938, -0.886591, 0.0663194, 0.457775, 0.0205662, 0.994341, -0.104222, 0, 38, -1)
light_energy = 4.0
shadow_enabled = true
shadow_bias = 0.035
shadow_blur = 8.0
directional_shadow_blend_splits = true
script = null
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( "3" )
camera_effects = SubResource( "4" )
script = null
[node name="VoxelGI" type="VoxelGI" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 12, 0)
visible = false
subdiv = 0
extents = Vector3(27, 13, 22)
data = SubResource( "VoxelGIData_838pm" )
script = null
[node name="ReflectionProbes" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 12.8418, -0.943157)
visible = false
script = null
__meta__ = {
"_edit_lock_": true
@ -302,6 +283,28 @@ interior = true
enable_shadows = true
script = null
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.462097, -0.0829877, -0.882938, -0.886591, 0.0663194, 0.457775, 0.0205662, 0.994341, -0.104222, 0, 38, -1)
light_energy = 4.0
shadow_enabled = true
shadow_bias = 0.035
shadow_blur = 8.0
directional_shadow_blend_splits = true
script = null
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( "3" )
camera_effects = SubResource( "4" )
script = null
[node name="VoxelGI" type="VoxelGI" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 12, 0)
visible = false
subdiv = 0
extents = Vector3(27, 13, 22)
data = SubResource( "VoxelGIData_838pm" )
script = null
[node name="Props" type="Node3D" parent="."]
script = null
__meta__ = {