diff --git a/app/content/entities/camera/camera.gd b/app/content/entities/camera/camera.gd index 4e04f53..6d56399 100644 --- a/app/content/entities/camera/camera.gd +++ b/app/content/entities/camera/camera.gd @@ -113,4 +113,14 @@ func load_image(url: String): var texture = ImageTexture.create_from_image(image) view.texture = texture view.pixel_size = pixel_size - mesh.visible = false \ No newline at end of file + mesh.visible = false + +func get_options(): + return { + "cam_active": cam_active.value, + "cam_fps": cam_fps.value, + } + +func set_options(options): + cam_active.value = options["cam_active"] + cam_fps.value = options["cam_fps"] \ No newline at end of file diff --git a/app/content/entities/camera/settings.tscn b/app/content/entities/camera/settings.tscn index 9ebf1ca..549fea9 100644 --- a/app/content/entities/camera/settings.tscn +++ b/app/content/entities/camera/settings.tscn @@ -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://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_opf0y"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_jtvwv"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_5ufyx"] resource_local_to_scene = true render_priority = 10 shader = ExtResource("2_wwobq") @@ -22,15 +22,15 @@ shader_parameter/corner_radius = 0.2 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 -[sub_resource type="QuadMesh" id="QuadMesh_myer6"] +[sub_resource type="QuadMesh" id="QuadMesh_4xo3t"] size = Vector2(0.3, 0.2) [node name="Settings" type="Node3D"] script = ExtResource("1_1ixy6") [node name="Panel" parent="." instance=ExtResource("1_myvk1")] -material_override = SubResource("ShaderMaterial_jtvwv") -mesh = SubResource("QuadMesh_myer6") +material_override = SubResource("ShaderMaterial_5ufyx") +mesh = SubResource("QuadMesh_4xo3t") skeleton = NodePath("../..") size = Vector2(0.3, 0.2) diff --git a/app/content/entities/line_chart/line_chart.gd b/app/content/entities/line_chart/line_chart.gd index 1fb7627..de524cf 100644 --- a/app/content/entities/line_chart/line_chart.gd +++ b/app/content/entities/line_chart/line_chart.gd @@ -5,14 +5,35 @@ const Entity = preload ("../entity.gd") @onready var line_chart = $LineChart @onready var timer = $Timer @onready var label = $Label3D +@onready var settings = $Settings + +enum Duration { + ONE_HOUR, + ONE_DAY, + ONE_WEEK, + ONE_MONTH, + ONE_YEAR +} + +var duration = R.state(Duration.ONE_DAY) func _ready(): super() icon.value = "finance" - label.text = entity_id + 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() + ) + if HomeApi.has_connected() == false: await HomeApi.on_connect @@ -22,6 +43,11 @@ func _ready(): request_history() + R.effect(func(_arg): + duration.value + request_history() + ) + timer.timeout.connect(request_history) func request_history(): @@ -29,12 +55,23 @@ func request_history(): var now = Time.get_unix_time_from_datetime_dict(Time.get_datetime_dict_from_system()) - # 2 days ago - var two_days_ago = now - 2 * 24 * 60 * 60 + var date - var start = Time.get_datetime_string_from_unix_time(two_days_ago) + ".000Z" + match duration.value: + Duration.ONE_HOUR: + date = now - 60 * 60 + Duration.ONE_DAY: + date = now - 24 * 60 * 60 + Duration.ONE_WEEK: + date = now - 7 * 24 * 60 * 60 + Duration.ONE_MONTH: + date = now - 30 * 24 * 60 * 60 + Duration.ONE_YEAR: + date = now - 365 * 24 * 60 * 60 - var result = await HomeApi.get_history(entity_id, start) + var start = Time.get_datetime_string_from_unix_time(date) + ".000Z" + + var result = await HomeApi.get_history(entity_id, start, "hour") if result == null: return @@ -49,3 +86,11 @@ func request_history(): func get_interface(): return "line_chart" + +func get_options(): + return { + "duration": duration.value + } + +func set_options(options): + duration.value = options["duration"] \ No newline at end of file diff --git a/app/content/entities/line_chart/line_chart.tscn b/app/content/entities/line_chart/line_chart.tscn index 58b0ef5..9348ea5 100644 --- a/app/content/entities/line_chart/line_chart.tscn +++ b/app/content/entities/line_chart/line_chart.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=5 format=3 uid="uid://cltcs0gokeald"] +[gd_scene load_steps=7 format=3 uid="uid://cltcs0gokeald"] [ext_resource type="Script" path="res://content/entities/line_chart/line_chart.gd" id="1_5dxim"] [ext_resource type="PackedScene" uid="uid://cwvykoymlrrel" path="res://content/ui/components/line_chart/line_chart.tscn" id="2_k4shm"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="3_lidml"] +[ext_resource type="Script" path="res://content/functions/camera_follower.gd" id="4_ovcs6"] +[ext_resource type="PackedScene" uid="uid://q5p1701gdfiq" path="res://content/entities/line_chart/settings.tscn" id="5_w7tql"] [sub_resource type="BoxShape3D" id="BoxShape3D_rmm5v"] size = Vector3(0.5, 0.3, 0.001) @@ -22,6 +24,10 @@ shape = SubResource("BoxShape3D_rmm5v") script = ExtResource("3_lidml") resizable = true +[node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")] +script = ExtResource("4_ovcs6") +focus_point = NodePath("../Settings") + [node name="Timer" type="Timer" parent="."] wait_time = 60.0 autostart = true @@ -32,3 +38,6 @@ pixel_size = 0.001 text = "sensor.tada" font_size = 18 outline_size = 4 + +[node name="Settings" parent="." instance=ExtResource("5_w7tql")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.67, 0.15, 0) diff --git a/app/content/entities/line_chart/settings.gd b/app/content/entities/line_chart/settings.gd new file mode 100644 index 0000000..56d2032 --- /dev/null +++ b/app/content/entities/line_chart/settings.gd @@ -0,0 +1,20 @@ +extends Node3D + +const LineChart = preload ("./line_chart.gd") + +@onready var close_button: Button3D = $Close +@onready var id_input: Input3D = $IDInput +@onready var duration_select: Select3D = $DurationSelect + +var line_chart: LineChart + +func _ready(): + line_chart = get_parent() + + close_button.on_button_up.connect(func(): + line_chart.show_settings.value=false + ) + + id_input.text = line_chart.entity_id + + R.bind(duration_select, "selected", line_chart.duration, duration_select.on_select) \ No newline at end of file diff --git a/app/content/entities/line_chart/settings.tscn b/app/content/entities/line_chart/settings.tscn new file mode 100644 index 0000000..3034009 --- /dev/null +++ b/app/content/entities/line_chart/settings.tscn @@ -0,0 +1,85 @@ +[gd_scene load_steps=9 format=3 uid="uid://q5p1701gdfiq"] + +[ext_resource type="Script" path="res://content/entities/line_chart/settings.gd" id="1_xxfkt"] +[ext_resource type="PackedScene" uid="uid://dnam3fe36gg62" path="res://content/ui/components/panel/panel.tscn" id="2_4g761"] +[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_vjmg5"] +[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_oroek"] +[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="5_ecnnd"] +[ext_resource type="PackedScene" uid="uid://wgnowarejk5y" path="res://content/ui/components/select/select.tscn" id="6_egqee"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_mfny2"] +resource_local_to_scene = true +render_priority = 10 +shader = ExtResource("3_vjmg5") +shader_parameter/color = Color(1, 1, 1, 0.3) +shader_parameter/border_color = Color(1, 1, 1, 1) +shader_parameter/edge_color = Color(0, 0, 0, 1) +shader_parameter/size = Vector2(7.5, 5) +shader_parameter/border_size = 0.01 +shader_parameter/border_fade_in = 0.05 +shader_parameter/border_fade_out = 0.0 +shader_parameter/corner_radius = 0.2 +shader_parameter/roughness = 0.3 +shader_parameter/grain_amount = 0.02 + +[sub_resource type="QuadMesh" id="QuadMesh_fngct"] +size = Vector2(0.3, 0.2) + +[node name="Settings" type="Node3D"] +script = ExtResource("1_xxfkt") + +[node name="Panel" parent="." instance=ExtResource("2_4g761")] +material_override = SubResource("ShaderMaterial_mfny2") +mesh = SubResource("QuadMesh_fngct") +skeleton = NodePath("../..") +size = Vector2(0.3, 0.2) + +[node name="Name" type="Label3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, 0.07, 0) +pixel_size = 0.001 +render_priority = 15 +outline_render_priority = 14 +text = "Chart Settings" +font_size = 24 +outline_size = 0 +horizontal_alignment = 0 + +[node name="Close" parent="." instance=ExtResource("4_oroek")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.12, 0.07, 0) +label = "close" +icon = true + +[node name="IDLabel" type="Label3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, 0.03, 0) +pixel_size = 0.001 +render_priority = 15 +outline_render_priority = 14 +text = "ID:" +font_size = 18 +outline_size = 0 +horizontal_alignment = 0 + +[node name="IDInput" parent="." instance=ExtResource("5_ecnnd")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0.03, 0) +disabled = true + +[node name="VideoLabel" type="Label3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.01, 0) +pixel_size = 0.001 +render_priority = 15 +outline_render_priority = 14 +text = "Duration:" +font_size = 18 +outline_size = 0 +horizontal_alignment = 0 + +[node name="DurationSelect" parent="." instance=ExtResource("6_egqee")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, -0.01, 0) +options = { +0: "Last Hour", +1: "Last Day", +2: "Last Week", +3: "Last Month", +4: "Last Year" +} +size = Vector3(0.16, 0.03, 0.01) diff --git a/app/content/ui/components/button/button.tscn b/app/content/ui/components/button/button.tscn index 8dd9d2b..bbe10c3 100644 --- a/app/content/ui/components/button/button.tscn +++ b/app/content/ui/components/button/button.tscn @@ -5,7 +5,7 @@ [ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="3_skm86"] [ext_resource type="AudioStream" uid="uid://c1yu80uj3fsn7" path="res://assets/sound/click.wav" id="4_51sb0"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_syops"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_n8raw"] resource_local_to_scene = true render_priority = 10 shader = ExtResource("2_db5by") @@ -20,7 +20,7 @@ shader_parameter/corner_radius = 0.2 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 -[sub_resource type="QuadMesh" id="QuadMesh_btecp"] +[sub_resource type="QuadMesh" id="QuadMesh_g3nfn"] size = Vector2(0.04, 0.04) [sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"] @@ -43,8 +43,8 @@ collision_mask = 0 [node name="Panel3D" type="MeshInstance3D" parent="Body"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005) -material_override = SubResource("ShaderMaterial_syops") -mesh = SubResource("QuadMesh_btecp") +material_override = SubResource("ShaderMaterial_n8raw") +mesh = SubResource("QuadMesh_g3nfn") skeleton = NodePath("../..") script = ExtResource("3_skm86") size = Vector2(0.04, 0.04) diff --git a/app/content/ui/components/select/option.gd b/app/content/ui/components/select/option.gd new file mode 100644 index 0000000..ac5f5fd --- /dev/null +++ b/app/content/ui/components/select/option.gd @@ -0,0 +1,34 @@ +@tool +extends Node3D + +const FontTools = preload ("res://lib/utils/font_tools.gd") + +@onready var label = $Body/Label3D +@onready var collision = $Body/CollisionShape3D +@onready var area_collision = $Area3D/CollisionShape3D + +var text = "test" +var value = "" +var disabled = false: + set(value): + disabled = value + + if is_node_ready() == false: return + + collision.disabled = value + area_collision.disabled = value + +func _ready(): + label.text = text + + _update() + +func get_size() -> Vector2: + return FontTools.get_font_size(label) + +func _update(): + var size = get_size() + collision.shape.size = Vector3(size.x, size.y, 0.004) + area_collision.shape.size = Vector3(size.x, size.y, 0.01) + collision.position = Vector3(size.x / 2, -size.y / 2, 0.002) + area_collision.position = Vector3(size.x / 2, -size.y / 2, 0.005) \ No newline at end of file diff --git a/app/content/ui/components/select/option.tscn b/app/content/ui/components/select/option.tscn new file mode 100644 index 0000000..7a6a3cf --- /dev/null +++ b/app/content/ui/components/select/option.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=5 format=3 uid="uid://c7yxuroa2pfyu"] + +[ext_resource type="FontFile" uid="uid://cs508knjj1lnw" path="res://assets/fonts/Raleway-Medium.ttf" id="1_2dk7o"] +[ext_resource type="Script" path="res://content/ui/components/select/option.gd" id="1_cdx1b"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_v323n"] +resource_local_to_scene = true +size = Vector3(0.032, 0.022, 0.004) + +[sub_resource type="BoxShape3D" id="BoxShape3D_6yqdi"] +resource_local_to_scene = true +size = Vector3(0.032, 0.022, 0.01) + +[node name="Option" type="Node3D"] +script = ExtResource("1_cdx1b") + +[node name="Body" type="StaticBody3D" parent="."] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.016, -0.011, 0.002) +shape = SubResource("BoxShape3D_v323n") + +[node name="Label3D" type="Label3D" parent="Body"] +pixel_size = 0.001 +render_priority = 40 +text = "test" +font = ExtResource("1_2dk7o") +font_size = 18 +outline_size = 0 +horizontal_alignment = 0 +vertical_alignment = 0 + +[node name="Area3D" type="Area3D" parent="."] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.016, -0.011, 0.005) +shape = SubResource("BoxShape3D_6yqdi") diff --git a/app/content/ui/components/select/select.gd b/app/content/ui/components/select/select.gd new file mode 100644 index 0000000..cfc4ff1 --- /dev/null +++ b/app/content/ui/components/select/select.gd @@ -0,0 +1,131 @@ +@tool +extends Container3D +class_name Select3D + +const FontTools = preload ("res://lib/utils/font_tools.gd") +const SelectFont = preload ("res://assets/fonts/Raleway-Medium.ttf") +const OptionScene = preload ("./option.tscn") +const Option = preload ("./option.gd") + +signal on_select(value: String) + +@onready var body = $Body +@onready var panel = $Body/Panel +@onready var label = $Body/Label +@onready var icon = $Body/Icon +@onready var collision = $Body/CollisionShape3D +@onready var area_collision = $Area3D/CollisionShape3D +@onready var options_body = $Options +@onready var options_panel = $Options/Panel +@onready var options_collision = $Options/CollisionShape3D + +@export var options: Dictionary = {} +@export var selected: Variant = null: + set(value): + if selected != value: + on_select.emit(value) + + selected = value + + if is_node_ready() == false: return + + _update() + +@export var mandatory: bool = true + +@export var open: bool = false: + set(value): + if open == value: return + + open = value + + if is_node_ready() == false: return + + _update_options_visible() +var _options_list = [] + +func _ready(): + _update() + _update_options() + +func _on_focus_out(_event: EventFocus): + open = false + +func _on_press_up(event: EventPointer): + if event.target == body: + open = !open + + if event.target.get_parent() is Option: + selected = event.target.get_parent().value + open = false + +func _on_touch_leave(event: EventTouch): + if event.target == body: + open = !open + + if event.target.get_parent() is Option: + selected = event.target.get_parent().value + open = false + +func _update(): + if selected == null: + label.text = "Select..." + else: + label.text = options[selected] + + label.position = Vector3( - size.x / 2 + 0.01, 0, 0.01) + icon.position = Vector3(size.x / 2, 0, 0.01) + + panel.size = Vector2(size.x, size.y) + collision.shape.size = Vector3(size.x, size.y, 0.01) + collision.position = Vector3(0, 0, 0.005) + area_collision.shape.size = Vector3(size.x, size.y, 0.01) + area_collision.position = Vector3(0, 0, 0.015) + +func _update_options_visible(): + options_body.visible = open + options_collision.disabled = !open + + icon.text = "arrow_drop_up" if open else "arrow_drop_down" + + for option in _options_list: + option.disabled = !open + +func _update_options(): + for option in _options_list: + options_body.remove_child(option) + option.queue_free() + + _options_list.clear() + + var total_size = Vector2(0, 0) + + var display_options = options + + if mandatory == false: + display_options[null] = "Deselect" + + var keys = display_options.keys() + keys.sort() + + for i in range(keys.size()): + var key = keys[i] + var option = OptionScene.instantiate() + option.value = key + option.text = display_options[key] + + options_body.add_child(option) + _options_list.append(option) + + var size = option.get_size() + size.y += 0.01 + total_size = Vector2(max(total_size.x, size.x), total_size.y + size.y) + + option.position = Vector3(0.01, -i * size.y - 0.01, 0) + + total_size += Vector2(0.02, 0.01) + options_panel.size = total_size + options_panel.position = Vector3(total_size.x / 2, -total_size.y / 2, 0) + options_body.position = Vector3( - size.x / 2, -size.y / 2, 0.02) + options_collision.shape.size = Vector3(total_size.x, total_size.y, 0.01) + options_collision.position = Vector3(total_size.x / 2, -total_size.y / 2, -0.005) diff --git a/app/content/ui/components/select/select.tscn b/app/content/ui/components/select/select.tscn new file mode 100644 index 0000000..e343b7a --- /dev/null +++ b/app/content/ui/components/select/select.tscn @@ -0,0 +1,122 @@ +[gd_scene load_steps=12 format=3 uid="uid://wgnowarejk5y"] + +[ext_resource type="Script" path="res://content/ui/components/select/select.gd" id="1_0yka7"] +[ext_resource type="PackedScene" uid="uid://dnam3fe36gg62" path="res://content/ui/components/panel/panel.tscn" id="2_5mspw"] +[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_8yxox"] +[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="4_61i7u"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_wfc33"] +resource_local_to_scene = true +render_priority = 10 +shader = ExtResource("3_8yxox") +shader_parameter/color = Color(1, 1, 1, 0.3) +shader_parameter/border_color = Color(1, 1, 1, 1) +shader_parameter/edge_color = Color(0, 0, 0, 1) +shader_parameter/size = Vector2(5, 1) +shader_parameter/border_size = 0.01 +shader_parameter/border_fade_in = 0.05 +shader_parameter/border_fade_out = 0.0 +shader_parameter/corner_radius = 0.2 +shader_parameter/roughness = 0.3 +shader_parameter/grain_amount = 0.02 + +[sub_resource type="QuadMesh" id="QuadMesh_sal60"] +resource_local_to_scene = true +size = Vector2(0.2, 0.04) + +[sub_resource type="BoxShape3D" id="BoxShape3D_uwnbp"] +resource_local_to_scene = true +size = Vector3(0.16, 0.03, 0.01) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_qowt5"] +resource_local_to_scene = true +render_priority = 10 +shader = ExtResource("3_8yxox") +shader_parameter/color = Color(1, 1, 1, 0.3) +shader_parameter/border_color = Color(1, 1, 1, 1) +shader_parameter/edge_color = Color(0, 0, 0, 1) +shader_parameter/size = Vector2(0.5, 0.25) +shader_parameter/border_size = 0.01 +shader_parameter/border_fade_in = 0.05 +shader_parameter/border_fade_out = 0.0 +shader_parameter/corner_radius = 0.2 +shader_parameter/roughness = 0.3 +shader_parameter/grain_amount = 0.02 + +[sub_resource type="QuadMesh" id="QuadMesh_3gij7"] +resource_local_to_scene = true +size = Vector2(0.02, 0.01) + +[sub_resource type="BoxShape3D" id="BoxShape3D_cv4hj"] +resource_local_to_scene = true +size = Vector3(0.114, 0.17, 0.01) + +[sub_resource type="BoxShape3D" id="BoxShape3D_n5ty8"] +resource_local_to_scene = true +size = Vector3(0.16, 0.03, 0.01) + +[node name="Select" type="Node3D" groups=["ui_focus"]] +script = ExtResource("1_0yka7") +size = Vector3(0.2, 0.04, 0.01) + +[node name="Body" type="StaticBody3D" parent="." groups=["ui_focus_skip"]] +collision_layer = 6 +collision_mask = 0 + +[node name="Panel" parent="Body" instance=ExtResource("2_5mspw")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.01) +material_override = SubResource("ShaderMaterial_wfc33") +mesh = SubResource("QuadMesh_sal60") +skeleton = NodePath("../..") +size = Vector2(0.2, 0.04) + +[node name="Label" type="Label3D" parent="Body"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.09, 0, 0.01) +pixel_size = 0.001 +double_sided = false +render_priority = 30 +text = "Select..." +font_size = 18 +outline_size = 0 +horizontal_alignment = 0 + +[node name="Icon" type="Label3D" parent="Body"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, 0, 0.01) +pixel_size = 0.001 +double_sided = false +render_priority = 30 +text = "arrow_drop_down" +font = ExtResource("4_61i7u") +font_size = 30 +outline_size = 0 +horizontal_alignment = 2 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005) +shape = SubResource("BoxShape3D_uwnbp") + +[node name="Options" type="StaticBody3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1, -0.02, 0.02) +visible = false +collision_layer = 6 +collision_mask = 0 + +[node name="Panel" parent="Options" instance=ExtResource("2_5mspw")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.005, 0) +material_override = SubResource("ShaderMaterial_qowt5") +mesh = SubResource("QuadMesh_3gij7") +skeleton = NodePath("../..") +size = Vector2(0.02, 0.01) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Options"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.005, -0.005) +shape = SubResource("BoxShape3D_cv4hj") +disabled = true + +[node name="Area3D" type="Area3D" parent="." groups=["ui_focus_skip"]] +collision_layer = 4 +collision_mask = 0 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.015) +shape = SubResource("BoxShape3D_n5ty8") diff --git a/app/lib/globals/event_system.gd b/app/lib/globals/event_system.gd index 866f7fd..798c020 100644 --- a/app/lib/globals/event_system.gd +++ b/app/lib/globals/event_system.gd @@ -106,6 +106,9 @@ func _handle_focus(target: Variant, event: EventBubble): if target.is_in_group("ui_focus_stop"): return true + if target == _active_node: + return true + if is_instance_valid(_active_node) == false: _active_node = null diff --git a/app/lib/globals/home_api.gd b/app/lib/globals/home_api.gd index 17a2271..ed2c1b2 100644 --- a/app/lib/globals/home_api.gd +++ b/app/lib/globals/home_api.gd @@ -146,7 +146,7 @@ func get_voice_assistant() -> VoiceAssistant: return api.get_voice_assistant() -func get_history(entity_id, start, end=null): +func get_history(entity_id, start, interval, end=null): assert(has_connected(), "Not connected") if api.has_method("get_history") == false: @@ -155,4 +155,4 @@ func get_history(entity_id, start, end=null): if groups.is_group(entity_id): return null - return await api.get_history(entity_id, start, end) + return await api.get_history(entity_id, start, interval, end) diff --git a/app/lib/home_apis/hass_ws/handlers/history.gd b/app/lib/home_apis/hass_ws/handlers/history.gd index 283694a..6b6e87a 100644 --- a/app/lib/home_apis/hass_ws/handlers/history.gd +++ b/app/lib/home_apis/hass_ws/handlers/history.gd @@ -6,7 +6,7 @@ var integration_exists: bool = false func _init(hass: HASS_API): self.api = hass -func get_history(entity_id: String, start: String, end=null): +func get_history(entity_id: String, start: String, interval: String="5minute", end=null): var meta_response = await api.connection.send_request_packet({ "type": "recorder/get_statistics_metadata", "statistic_ids": [ @@ -23,7 +23,7 @@ func get_history(entity_id: String, start: String, end=null): "statistic_ids": [ entity_id ], - "period": "5minute", + "period": interval, "types": [ "state", "mean" diff --git a/app/lib/home_apis/hass_ws/hass.gd b/app/lib/home_apis/hass_ws/hass.gd index 860955b..21ec00f 100644 --- a/app/lib/home_apis/hass_ws/hass.gd +++ b/app/lib/home_apis/hass_ws/hass.gd @@ -164,5 +164,5 @@ func update_room(room: String): func get_voice_assistant(): return assist_handler -func get_history(entity_id, start, end=null): - return await history_handler.get_history(entity_id, start, end) \ No newline at end of file +func get_history(entity_id, start, interval, end=null): + return await history_handler.get_history(entity_id, start, interval, end) \ No newline at end of file diff --git a/app/project.godot b/app/project.godot index f390c71..d950909 100644 --- a/app/project.godot +++ b/app/project.godot @@ -29,6 +29,10 @@ EventSystem="*res://lib/globals/event_system.gd" Request="*res://lib/globals/request.gd" TouchManager="*res://lib/utils/touch/touch.gd" +[debug_draw_3d] + +settings/3d/volumetric_defaults/thickness=0.001 + [display] window/vsync/vsync_mode=0 @@ -49,6 +53,12 @@ folder_colors={ import/fbx/enabled=false +[global_group] + +ui_focus="Makes the node foucsable" +ui_focus_skip="Skip the focus check on this node" +ui_focus_stop="Stops checking for focus entirely" + [gui] theme/custom_font="res://assets/fonts/Montserrat-Medium.ttf"