diff --git a/previewer/previewer.gd b/previewer/previewer.gd index fb1fe20..fd5d359 100644 --- a/previewer/previewer.gd +++ b/previewer/previewer.gd @@ -17,6 +17,8 @@ export(float) var camera_accel = 10.0 func _ready(): self._current_camera_speed = self.camera_speed + + $settings.show() func _process( delta ): @@ -75,4 +77,7 @@ func _input(event): if event.is_action_pressed( "move_speed" ): self._current_camera_speed = self.camera_speed + self.camera_accel elif event.is_action_released( "move_speed" ): - self._current_camera_speed = self.camera_speed \ No newline at end of file + self._current_camera_speed = self.camera_speed + + if event.is_action_pressed( "ui_settings_window" ): + $settings.visible = !$settings.visible \ No newline at end of file diff --git a/previewer/previewer.tscn b/previewer/previewer.tscn index f41d23a..01926de 100644 --- a/previewer/previewer.tscn +++ b/previewer/previewer.tscn @@ -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 diff --git a/previewer/settings.gd b/previewer/settings.gd new file mode 100644 index 0000000..e42d780 --- /dev/null +++ b/previewer/settings.gd @@ -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 diff --git a/previewer/settings.tscn b/previewer/settings.tscn new file mode 100644 index 0000000..caac8da --- /dev/null +++ b/previewer/settings.tscn @@ -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"] diff --git a/project.godot b/project.godot index 163b15d..a6f5799 100644 --- a/project.godot +++ b/project.godot @@ -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]