ajout d'une fenetre pour gérer les différente option de la scene.

This commit is contained in:
osquallo 2019-09-30 18:24:24 +02:00
parent d1206f2ff8
commit a1e12e2b5b
5 changed files with 88 additions and 2 deletions

View file

@ -18,6 +18,8 @@ export(float) var camera_accel = 10.0
func _ready():
self._current_camera_speed = self.camera_speed
$settings.show()
func _process( delta ):
if Input.is_action_pressed("move_up"):
@ -76,3 +78,6 @@ func _input(event):
self._current_camera_speed = self.camera_speed + self.camera_accel
elif event.is_action_released( "move_speed" ):
self._current_camera_speed = self.camera_speed
if event.is_action_pressed( "ui_settings_window" ):
$settings.visible = !$settings.visible

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=15 format=2]
[ext_resource path="res://previewer/previewer.gd" type="Script" id=1]
[ext_resource path="res://previewer/dummy/dummy.tscn" type="PackedScene" id=2]
@ -8,6 +8,7 @@
[ext_resource path="res://meshes/props/travel_box/container.tscn" type="PackedScene" id=6]
[ext_resource path="res://meshes/props/reference_box/reference_box.tscn" type="PackedScene" id=7]
[ext_resource path="res://meshes/props/fountain_suzanha/Fountain_suzanha.tscn" type="PackedScene" id=8]
[ext_resource path="res://previewer/settings.tscn" type="PackedScene" id=9]
[sub_resource type="ProceduralSky" id=1]
@ -96,3 +97,9 @@ shadow_enabled = true
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 21.7307, 0 )
extents = Vector3( 63.192, 25, 76.323 )
data = SubResource( 5 )
[node name="settings" parent="." instance=ExtResource( 9 )]
margin_left = -475.0
margin_top = -243.0
margin_right = -219.0
margin_bottom = 13.0

17
previewer/settings.gd Normal file
View file

@ -0,0 +1,17 @@
extends WindowDialog
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_color_picker_button_color_changed(color):
get_parent().get_node( "world_environment" ).environment.background_sky.sky_top_color = color

52
previewer/settings.tscn Normal file
View file

@ -0,0 +1,52 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://previewer/settings.gd" type="Script" id=1]
[node name="settings" type="WindowDialog"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -512.0
margin_top = -300.0
margin_right = -256.0
margin_bottom = -44.0
size_flags_horizontal = 2
size_flags_vertical = 2
popup_exclusive = true
window_title = "Settings (T)"
resizable = true
script = ExtResource( 1 )
[node name="scroll_container" type="ScrollContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 7
size_flags_vertical = 7
[node name="controls" type="VBoxContainer" parent="scroll_container"]
margin_right = 256.0
margin_bottom = 256.0
size_flags_horizontal = 7
size_flags_vertical = 3
[node name="sky_top_color" type="HBoxContainer" parent="scroll_container/controls"]
margin_right = 256.0
margin_bottom = 20.0
size_flags_horizontal = 3
[node name="label" type="Label" parent="scroll_container/controls/sky_top_color"]
margin_top = 3.0
margin_right = 126.0
margin_bottom = 17.0
size_flags_horizontal = 3
text = "Sky top color"
align = 2
[node name="color_picker_button" type="ColorPickerButton" parent="scroll_container/controls/sky_top_color"]
margin_left = 130.0
margin_right = 256.0
margin_bottom = 20.0
size_flags_horizontal = 3
color = Color( 0, 0.811765, 1, 1 )
[connection signal="color_changed" from="scroll_container/controls/sky_top_color/color_picker_button" to="." method="_on_color_picker_button_color_changed"]

View file

@ -71,6 +71,11 @@ move_speed={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
]
}
ui_settings_window={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":84,"unicode":0,"echo":false,"script":null)
]
}
[node]