Reduce number of sliders for camera config

main
Ensar Sarajčić 2022-01-25 09:37:11 +01:00
parent 4a8c32b2c3
commit d6ec1c407b
4 changed files with 40 additions and 133 deletions

View File

@ -56,17 +56,11 @@ onready var gear_value_slider: HSlider = $MarginContainer/VSplitContainer/TabCon
# gdlint: ignore=max-line-length
onready var fov_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/FovSlider
# gdlint: ignore=max-line-length
onready var move_forward_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveForwardSlider
onready var move_depth_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveDepthSlider
# gdlint: ignore=max-line-length
onready var move_backward_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveBackwardSlider
onready var move_horizontal_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveHorizontalSlider
# gdlint: ignore=max-line-length
onready var move_left_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveLeftSlider
# gdlint: ignore=max-line-length
onready var move_right_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveRightSlider
# gdlint: ignore=max-line-length
onready var move_up_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveUpSlider
# gdlint: ignore=max-line-length
onready var move_down_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveDownSlider
onready var move_vertical_slider: HSlider = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveVerticalSlider
# gdlint: ignore=max-line-length
onready var vehicle_selector: OptionButton = $MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer/VehicleSelector
# gdlint: ignore=max-line-length
@ -89,12 +83,9 @@ func _ready() -> void:
throttle_sensitivity_slider.value = GlobalSettings.throttle_sensitivity
brakes_sensitivity_slider.value = GlobalSettings.brake_sensitivity
fov_slider.value = GlobalSettings.camera_fov
move_forward_slider.value = GlobalSettings.camera_move_forward
move_backward_slider.value = GlobalSettings.camera_move_backward
move_right_slider.value = GlobalSettings.camera_move_right
move_left_slider.value = GlobalSettings.camera_move_left
move_up_slider.value = GlobalSettings.camera_move_up
move_down_slider.value = GlobalSettings.camera_move_down
move_depth_slider.value = GlobalSettings.camera_move_depth
move_horizontal_slider.value = GlobalSettings.camera_move_horizontal
move_vertical_slider.value = GlobalSettings.camera_move_vertical
fullscreen_cb.pressed = false
borderless_cb.pressed = false
var controller = PLAYER_CONTROLLER.new()
@ -188,28 +179,16 @@ func _on_FovSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_fov = new_value
func _on_MoveForwardSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_forward = new_value
func _on_MoveDepthSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_depth = new_value
func _on_MoveBackwardSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_backward = new_value
func _on_MoveHorizontalSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_horizontal = new_value
func _on_MoveLeftSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_left = new_value
func _on_MoveRightSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_right = new_value
func _on_MoveUpSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_up = new_value
func _on_MoveDownSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_down = new_value
func _on_MoveVerticalSlider_value_changed(new_value: float) -> void:
GlobalSettings.camera_move_vertical = new_value
func _on_VehicleSelector_item_selected(item_index: int) -> void:

View File

@ -189,7 +189,6 @@ size_flags_horizontal = 3
size_flags_vertical = 3
[node name="System" type="VBoxContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 8.0
@ -221,6 +220,7 @@ __meta__ = {
}
[node name="Camera" type="HSplitContainer" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 8.0
@ -259,126 +259,66 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveForwardLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
[node name="MoveDepthLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 66.0
margin_right = 404.0
margin_bottom = 84.0
custom_fonts/font = SubResource( 5 )
text = "Move forward"
text = "Move forward/backward"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveForwardSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
[node name="MoveDepthSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 92.0
margin_right = 404.0
margin_bottom = 124.0
min_value = -10.0
max_value = 10.0
step = 0.01
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveBackwardLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 132.0
margin_right = 404.0
margin_bottom = 150.0
custom_fonts/font = SubResource( 5 )
text = "Move back"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveBackwardSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 158.0
margin_right = 404.0
margin_bottom = 190.0
max_value = 10.0
step = 0.01
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveLeftLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
[node name="MoveHorizontalLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 198.0
margin_right = 404.0
margin_bottom = 216.0
custom_fonts/font = SubResource( 5 )
text = "Move left"
text = "Move left/right"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveLeftSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
[node name="MoveHorizontalSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 224.0
margin_right = 404.0
margin_bottom = 256.0
min_value = -10.0
max_value = 10.0
step = 0.01
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveRightLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 264.0
margin_right = 404.0
margin_bottom = 282.0
custom_fonts/font = SubResource( 5 )
text = "Move right"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveRightSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 290.0
margin_right = 404.0
margin_bottom = 322.0
max_value = 10.0
step = 0.01
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveUpLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
[node name="MoveVerticalLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 330.0
margin_right = 404.0
margin_bottom = 348.0
custom_fonts/font = SubResource( 5 )
text = "Move up"
text = "Move down/up"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveUpSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
[node name="MoveVerticalSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 356.0
margin_right = 404.0
margin_bottom = 388.0
max_value = 10.0
step = 0.01
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveDownLabel" type="Label" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 396.0
margin_right = 404.0
margin_bottom = 414.0
custom_fonts/font = SubResource( 5 )
text = "Move down"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoveDownSlider" type="HSlider" parent="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera"]
margin_top = 422.0
margin_right = 404.0
margin_bottom = 454.0
min_value = -10.0
max_value = 10.0
step = 0.01
__meta__ = {
@ -668,12 +608,9 @@ __meta__ = {
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System/FullscreenCheckBox" to="." method="_on_fullscreen_toggled"]
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/System/BorderlessCheckBox" to="." method="_on_borderless_toggled"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/FovSlider" to="." method="_on_FovSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveForwardSlider" to="." method="_on_MoveForwardSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveBackwardSlider" to="." method="_on_MoveBackwardSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveLeftSlider" to="." method="_on_MoveLeftSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveRightSlider" to="." method="_on_MoveRightSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveUpSlider" to="." method="_on_MoveUpSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveDownSlider" to="." method="_on_MoveDownSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveDepthSlider" to="." method="_on_MoveDepthSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveHorizontalSlider" to="." method="_on_MoveHorizontalSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/Camera/MoveVerticalSlider" to="." method="_on_MoveVerticalSlider_value_changed"]
[connection signal="item_selected" from="MarginContainer/VSplitContainer/TabContainer/Video/TabContainer/Camera/VBoxContainer/VehicleSelector" to="." method="_on_VehicleSelector_item_selected"]
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/AutoClutchCheckBox" to="." method="_on_autoclutch_toggled"]
[connection signal="toggled" from="MarginContainer/VSplitContainer/TabContainer/Controls/Controls/AutomaticTransmissionCheckBox" to="." method="_on_automatictransmission_toggled"]

View File

@ -8,9 +8,9 @@ func reset() -> void:
translation = Vector3.ZERO
translate(
Vector3(
GlobalSettings.camera_move_right - GlobalSettings.camera_move_left,
GlobalSettings.camera_move_up - GlobalSettings.camera_move_down,
GlobalSettings.camera_move_backward - GlobalSettings.camera_move_forward
GlobalSettings.camera_move_horizontal,
GlobalSettings.camera_move_vertical,
GlobalSettings.camera_move_depth
)
)

View File

@ -13,12 +13,9 @@ var selected_camera: int = 0
var multiplayer_name: String = "Player"
var camera_fov = 70
var camera_move_forward = 0
var camera_move_backward = 0
var camera_move_right = 0
var camera_move_left = 0
var camera_move_up = 0
var camera_move_down = 0
var camera_move_depth = 0
var camera_move_horizontal = 0
var camera_move_vertical = 0
var _config: Dictionary
@ -45,12 +42,9 @@ func _ready() -> void:
if stored_config.has("camera"):
camera_fov = stored_config["camera"].get("fov", 70)
camera_move_forward = stored_config["camera"].get("camera_move_forward", 0)
camera_move_backward = stored_config["camera"].get("camera_move_backward", 0)
camera_move_left = stored_config["camera"].get("camera_move_left", 0)
camera_move_right = stored_config["camera"].get("camera_move_right", 0)
camera_move_up = stored_config["camera"].get("camera_move_up", 0)
camera_move_down = stored_config["camera"].get("camera_move_down", 0)
camera_move_depth = stored_config["camera"].get("camera_move_depth", 0)
camera_move_horizontal = stored_config["camera"].get("camera_move_horizontal", 0)
camera_move_vertical = stored_config["camera"].get("camera_move_vertical", 0)
func read_json_file(file_path: String) -> Dictionary:
@ -101,12 +95,9 @@ func to_dictionary() -> Dictionary:
"camera":
{
"fov": camera_fov,
"move_forward": camera_move_forward,
"move_backward": camera_move_backward,
"move_right": camera_move_right,
"move_left": camera_move_left,
"move_up": camera_move_up,
"move_down": camera_move_down
"move_depth": camera_move_depth,
"move_horizontal": camera_move_horizontal,
"move_vertical": camera_move_vertical
}
}