From 8fa356d5b5867e43f07006275b756294b869c7f2 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Mon, 27 May 2024 12:35:43 +0200 Subject: [PATCH] camera settings --- app/content/entities/camera/camera.gd | 12 ++++++++++++ app/content/entities/camera/camera.tscn | 3 ++- app/content/entities/light/light.tscn | 6 +----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/content/entities/camera/camera.gd b/app/content/entities/camera/camera.gd index 78411d1..4e04f53 100644 --- a/app/content/entities/camera/camera.gd +++ b/app/content/entities/camera/camera.gd @@ -8,6 +8,7 @@ const Entity = preload ("../entity.gd") @onready var http_request = $HTTPRequest @onready var mesh = $MeshInstance3D @onready var refresh_timer = $RefreshTimer +@onready var settings = $Settings var cam_active = R.state(false) var cam_fps = R.state(10) @@ -20,6 +21,17 @@ func _ready(): refresh_timer.wait_time=1.0 / cam_fps.value ) + remove_child(settings) + + R.effect(func(_arg): + if show_settings.value: + add_child(settings) + elif settings.is_inside_tree(): + remove_child(settings) + camera_follower.reset() + App.house.save_all_entities() + ) + R.effect(func(_arg): if cam_active.value: refresh_timer.start() diff --git a/app/content/entities/camera/camera.tscn b/app/content/entities/camera/camera.tscn index 6eb2056..50f4d2b 100644 --- a/app/content/entities/camera/camera.tscn +++ b/app/content/entities/camera/camera.tscn @@ -29,8 +29,9 @@ shape = SubResource("BoxShape3D_te0pn") script = ExtResource("2_e2u6o") resizable = true -[node name="CameraFollower" type="Node" parent="."] +[node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")] script = ExtResource("3_j7lrc") +focus_point = NodePath("../Settings") [node name="RefreshTimer" type="Timer" parent="."] wait_time = 0.1 diff --git a/app/content/entities/light/light.tscn b/app/content/entities/light/light.tscn index 1154856..c235b50 100644 --- a/app/content/entities/light/light.tscn +++ b/app/content/entities/light/light.tscn @@ -27,7 +27,7 @@ resizable = true [node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")] script = ExtResource("9_a7u7m") enabled = false -focus_point = NodePath("../FocusPoint") +focus_point = NodePath("../Settings") [node name="Lightbulb" type="CSGCombiner3D" parent="."] transform = Transform3D(1, 9.69949e-05, 0.000589194, -9.77749e-05, 0.999999, 0.00135802, -0.000589065, -0.00135808, 0.999999, 0, 0, 0) @@ -78,9 +78,5 @@ horizontal_alignment = 0 stream = ExtResource("8_3togy") volume_db = -20.0 -[node name="FocusPoint" type="Marker3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29, 0, 0) -gizmo_extents = 0.1 - [node name="Settings" parent="." instance=ExtResource("10_su84f")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29, 0, 0)