fix camera

This commit is contained in:
Nitwel 2024-05-29 22:48:01 +02:00
parent 4a4d359773
commit ad9245a922
2 changed files with 13 additions and 5 deletions

View File

@ -5,7 +5,7 @@ const Entity = preload ("../entity.gd")
@export var view_width = 0.15 @export var view_width = 0.15
@onready var view = $View @onready var view = $View
@onready var http_request = $HTTPRequest @onready var http_request: HTTPRequest = $HTTPRequest
@onready var mesh = $MeshInstance3D @onready var mesh = $MeshInstance3D
@onready var refresh_timer = $RefreshTimer @onready var refresh_timer = $RefreshTimer
@onready var settings = $Settings @onready var settings = $Settings
@ -33,6 +33,7 @@ func _ready():
) )
R.effect(func(_arg): R.effect(func(_arg):
print("Cam active: ", cam_active.value)
if cam_active.value: if cam_active.value:
refresh_timer.start() refresh_timer.start()
else: else:
@ -69,6 +70,10 @@ func set_state(stateInfo):
refresh_timer.timeout.connect(load_image.bind(url)) refresh_timer.timeout.connect(load_image.bind(url))
func load_image(url: String): func load_image(url: String):
if http_request.get_http_client_status() != HTTPClient.STATUS_DISCONNECTED:
print("HTTP client is busy, skipping")
return
http_request.request("http://192.168.33.33:8123" + url) http_request.request("http://192.168.33.33:8123" + url)
var result = await http_request.request_completed var result = await http_request.request_completed
@ -115,6 +120,8 @@ func load_image(url: String):
view.pixel_size = pixel_size view.pixel_size = pixel_size
mesh.visible = false mesh.visible = false
print("Loaded image: ", url)
func get_options(): func get_options():
return { return {
"cam_active": cam_active.value, "cam_active": cam_active.value,

View File

@ -7,7 +7,7 @@
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_t8xp5"] [ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_t8xp5"]
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_opf0y"] [ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_opf0y"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_smnuk"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_p3rs7"]
resource_local_to_scene = true resource_local_to_scene = true
render_priority = 10 render_priority = 10
shader = ExtResource("2_wwobq") shader = ExtResource("2_wwobq")
@ -22,7 +22,7 @@ shader_parameter/corner_radius = 0.2
shader_parameter/roughness = 0.3 shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02 shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_jill0"] [sub_resource type="QuadMesh" id="QuadMesh_nlygn"]
size = Vector2(0.3, 0.2) size = Vector2(0.3, 0.2)
[sub_resource type="BoxShape3D" id="BoxShape3D_ctomk"] [sub_resource type="BoxShape3D" id="BoxShape3D_ctomk"]
@ -34,8 +34,8 @@ collision_mask = 0
script = ExtResource("1_1ixy6") script = ExtResource("1_1ixy6")
[node name="Panel" parent="." instance=ExtResource("1_myvk1")] [node name="Panel" parent="." instance=ExtResource("1_myvk1")]
material_override = SubResource("ShaderMaterial_smnuk") material_override = SubResource("ShaderMaterial_p3rs7")
mesh = SubResource("QuadMesh_jill0") mesh = SubResource("QuadMesh_nlygn")
skeleton = NodePath("../..") skeleton = NodePath("../..")
size = Vector2(0.3, 0.2) size = Vector2(0.3, 0.2)
@ -82,6 +82,7 @@ horizontal_alignment = 0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.06, -0.01, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.06, -0.01, 0)
label = "videocam_off" label = "videocam_off"
icon = true icon = true
toggleable = true
[node name="FPSLabel" type="Label3D" parent="."] [node name="FPSLabel" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.05, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.05, 0)