diff --git a/assets/materials/pri-500.material b/assets/materials/pri-500.material new file mode 100644 index 0000000..d726374 --- /dev/null +++ b/assets/materials/pri-500.material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92f36b94bc49caee6ea06bae49983840ce37d27c0e38309038c20163c8b1c7b4 +size 1035 diff --git a/assets/materials/pri.material b/assets/materials/pri.material new file mode 100644 index 0000000..4311e61 --- /dev/null +++ b/assets/materials/pri.material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a64ff479a30fbf4433998ba63f47e35fc731c5fbc22ab54524fdcbee9528755 +size 1031 diff --git a/assets/materials/sec-500.material b/assets/materials/sec-500.material new file mode 100644 index 0000000..de858d5 --- /dev/null +++ b/assets/materials/sec-500.material @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f2e541d2068e21b4d90ea607a31c35e958323a6a2bf0c819bc61ac1ee730c88 +size 1035 diff --git a/assets/materials/ui_element.material b/assets/materials/ui_element.material deleted file mode 100644 index dbd3fe5..0000000 --- a/assets/materials/ui_element.material +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5e6a3196f918f129fd1510750002b50eebce47f0bec850695552864f067db06 -size 1028 diff --git a/content/entities/button/button.gd b/content/entities/button/button.gd index 179411e..693355e 100644 --- a/content/entities/button/button.gd +++ b/content/entities/button/button.gd @@ -21,7 +21,14 @@ func _ready(): func set_state(state): if state.attributes.has("friendly_name"): - button.label = state.attributes["friendly_name"] + var name = state.attributes["friendly_name"] + + if name.begins_with("icon:"): + name = name.substr(5) + button.icon = true + else: + button.icon = false + button.label = name func _save(): return { diff --git a/content/entities/camera/camera.gd b/content/entities/camera/camera.gd index 49b254d..21f9b9e 100644 --- a/content/entities/camera/camera.gd +++ b/content/entities/camera/camera.gd @@ -5,6 +5,7 @@ extends StaticBody3D @onready var view = $View @onready var http_request = $HTTPRequest +@onready var mesh = $MeshInstance3D # Called when the node enters the scene tree for the first time. @@ -20,12 +21,14 @@ func _ready(): func set_state(stateInfo): if stateInfo == null: view.texture = null + mesh.visible = true return var state = stateInfo["state"] if state == "unavailable": view.texture = null + mesh.visible = true return if stateInfo["attributes"].has("entity_picture"): @@ -53,6 +56,7 @@ func load_image(url: String): var texture = ImageTexture.create_from_image(image) view.texture = texture view.pixel_size = pixel_size + mesh.visible = false func _save(): return { diff --git a/content/entities/camera/camera.tscn b/content/entities/camera/camera.tscn index df3a325..bcfc514 100644 --- a/content/entities/camera/camera.tscn +++ b/content/entities/camera/camera.tscn @@ -1,9 +1,12 @@ -[gd_scene load_steps=5 format=3 uid="uid://b0nq4wjfckxsa"] +[gd_scene load_steps=6 format=3 uid="uid://b0nq4wjfckxsa"] [ext_resource type="Script" path="res://content/entities/camera/camera.gd" id="1_htxq3"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="2_e2u6o"] [ext_resource type="Script" path="res://content/functions/occludable.gd" id="3_jheyx"] +[sub_resource type="QuadMesh" id="QuadMesh_830bv"] +size = Vector2(0.15, 0.15) + [sub_resource type="BoxShape3D" id="BoxShape3D_te0pn"] size = Vector3(0.15, 0.15, 0.01) @@ -13,6 +16,8 @@ script = ExtResource("1_htxq3") [node name="View" type="Sprite3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.00451169) +mesh = SubResource("QuadMesh_830bv") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] shape = SubResource("BoxShape3D_te0pn") diff --git a/content/system/keyboard/keyboard.tscn b/content/system/keyboard/keyboard.tscn index 539dff2..86db653 100644 --- a/content/system/keyboard/keyboard.tscn +++ b/content/system/keyboard/keyboard.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=7 format=3 uid="uid://lrehk38exd5n"] +[gd_scene load_steps=9 format=3 uid="uid://lrehk38exd5n"] [ext_resource type="Script" path="res://content/system/keyboard/keyboard.gd" id="1_maojw"] [ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_xdpwr"] [ext_resource type="Script" path="res://content/ui/menu/grid.gd" id="3_mx544"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="4_86fct"] +[ext_resource type="Material" uid="uid://bnwimm214q67g" path="res://assets/materials/sec-500.material" id="5_8c8rc"] +[ext_resource type="Script" path="res://content/functions/occludable.gd" id="6_y4sdl"] [sub_resource type="BoxShape3D" id="BoxShape3D_k5ib7"] size = Vector3(0.79, 0.01, 0.26) @@ -52,4 +54,8 @@ shape = SubResource("BoxShape3D_k5ib7") [node name="MeshInstance3D" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.300719, -0.009645, 0.0928761) +material_override = ExtResource("5_8c8rc") mesh = SubResource("BoxMesh_7rntc") + +[node name="Occludable" type="Node" parent="."] +script = ExtResource("6_y4sdl") diff --git a/content/system/room/room.gd b/content/system/room/room.gd index d744f7a..aa1e171 100644 --- a/content/system/room/room.gd +++ b/content/system/room/room.gd @@ -11,7 +11,7 @@ const wall_edge_scene = preload("./wall_edge.tscn") @onready var ground = $Ground/Clickable var moving = null -var editable := true: +var editable := false: set(value): if value == editable: return @@ -36,6 +36,10 @@ func _start_edit_mode(): wall_corners.visible = true wall_edges.visible = true wall_mesh.visible = false + wall_mesh.mesh = null + + for old_coll in wall_collisions.get_children(): + old_coll.queue_free() func _end_edit_mode(): wall_corners.visible = false @@ -47,9 +51,6 @@ func _end_edit_mode(): var collisions = generate_collision(wall_mesh.mesh) - for old_coll in wall_collisions.get_children(): - old_coll.queue_free() - for collision in collisions: var static_body = StaticBody3D.new() static_body.set_collision_layer_value(4, true) @@ -196,6 +197,8 @@ func _save(): } func _load(data): + await ready + for corner in data["corners"]: add_corner(corner) diff --git a/content/system/room/room.tscn b/content/system/room/room.tscn index 5ac8428..6270f6a 100644 --- a/content/system/room/room.tscn +++ b/content/system/room/room.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=6 format=3 uid="uid://bswgmclohuqui"] +[gd_scene load_steps=7 format=3 uid="uid://bswgmclohuqui"] [ext_resource type="Script" path="res://content/system/room/room.gd" id="1_fccq0"] [ext_resource type="Script" path="res://content/functions/clickable.gd" id="1_ugebq"] @@ -8,6 +8,8 @@ [sub_resource type="ArrayMesh" id="ArrayMesh_7dibq"] +[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_ap613"] + [node name="Room" type="Node3D"] script = ExtResource("1_fccq0") @@ -30,3 +32,11 @@ material_override = ExtResource("3_al1ev") mesh = SubResource("ArrayMesh_7dibq") [node name="WallCollisions" type="Node3D" parent="."] + +[node name="Celing" type="StaticBody3D" parent="."] +transform = Transform3D(-1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0, 3.07, 0) +collision_layer = 0 +collision_mask = 0 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Celing"] +shape = SubResource("WorldBoundaryShape3D_ap613") diff --git a/content/system/room/walls.tres b/content/system/room/walls.tres index 6d784b1..b0ebc48 100644 --- a/content/system/room/walls.tres +++ b/content/system/room/walls.tres @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44ea33f724141838db4ace01175c71088af8994891a20c7fdc9bb3ac36dac9aa -size 160 +oid sha256:fe7c098cfc9adadb447df0230eba8a81f1825dd3c0cf4e654ebf98ca2314c8cc +size 151 diff --git a/content/ui/components/button/button.tscn b/content/ui/components/button/button.tscn index 54cde07..9f8b81d 100644 --- a/content/ui/components/button/button.tscn +++ b/content/ui/components/button/button.tscn @@ -2,10 +2,7 @@ [ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"] [ext_resource type="ArrayMesh" uid="uid://iv4lk77axlk4" path="res://assets/immersive_home/button.obj" id="2_cve3l"] - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8s8ln"] -transparency = 1 -albedo_color = Color(0, 0.501961, 0.886275, 1) +[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_wx7av"] [sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_o4j7g"] points = PackedVector3Array(-0.025, -0.01, -0.025, -0.025, 0.01, -0.025, 0.025, -0.01, -0.025, -0.025, -0.01, 0.025, -0.025, 0.01, 0.025, 0.025, 0.01, -0.025, 0.025, -0.01, 0.025, 0.025, 0.01, 0.025) @@ -82,15 +79,15 @@ collision_mask = 0 [node name="MeshInstance3D" type="MeshInstance3D" parent="Body"] transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.005, 0) +material_override = ExtResource("2_wx7av") mesh = ExtResource("2_cve3l") skeleton = NodePath("../..") -surface_material_override/0 = SubResource("StandardMaterial3D_8s8ln") [node name="CollisionShape3D" type="CollisionShape3D" parent="Body"] shape = SubResource("ConvexPolygonShape3D_o4j7g") [node name="Label" type="Label3D" parent="Body"] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.005, 0) +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.0107199, 0) pixel_size = 0.001 text = "Example Text" font_size = 10 diff --git a/content/ui/components/input/input.tscn b/content/ui/components/input/input.tscn index 0aefa4c..b838a37 100644 --- a/content/ui/components/input/input.tscn +++ b/content/ui/components/input/input.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=10 format=3 uid="uid://blrhy2uccrdn4"] -[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/ui_element.material" id="1_0kd7r"] +[ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="1_0kd7r"] [ext_resource type="Script" path="res://content/ui/components/input/input.gd" id="1_uml3t"] [ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="3_ij5fh"] diff --git a/content/ui/menu/edit/edit_menu.tscn b/content/ui/menu/edit/edit_menu.tscn index db65995..0c1c898 100644 --- a/content/ui/menu/edit/edit_menu.tscn +++ b/content/ui/menu/edit/edit_menu.tscn @@ -16,7 +16,6 @@ size = Vector3(0.24, 0.1, 0.1) [node name="PageNumberLabel" type="Label3D" parent="."] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.01, 0.27) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "0 / 0" font_size = 18 outline_size = 0 @@ -25,12 +24,10 @@ outline_size = 0 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, 0.01, 0.27) [node name="NextPageButton" parent="Buttons" instance=ExtResource("4_tvimg")] -focusable = true label = "navigate_next" icon = true [node name="PreviousPageButton" parent="Buttons" instance=ExtResource("4_tvimg")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.08, 0, 0) -focusable = true label = "navigate_before" icon = true diff --git a/content/ui/menu/menu.tscn b/content/ui/menu/menu.tscn index a91b2c6..2305381 100644 --- a/content/ui/menu/menu.tscn +++ b/content/ui/menu/menu.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=13 format=3 uid="uid://c3kdssrmv84kv"] +[gd_scene load_steps=14 format=3 uid="uid://c3kdssrmv84kv"] [ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"] +[ext_resource type="Material" uid="uid://bnwimm214q67g" path="res://assets/materials/sec-500.material" id="2_0x5at"] [ext_resource type="PackedScene" uid="uid://crrb0l3ekuotj" path="res://content/ui/menu/edit/edit_menu.tscn" id="4_r2raj"] [ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_w4i01"] [ext_resource type="ArrayMesh" uid="uid://cbqhhnknyium2" path="res://assets/immersive_home_panels/immersive_home_panels.obj" id="7_f4u4o"] @@ -160,6 +161,7 @@ script = ExtResource("1_ng4u3") [node name="Background" type="MeshInstance3D" parent="AnimationContainer"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21, 0, 0.15) +material_override = ExtResource("2_0x5at") mesh = SubResource("BoxMesh_08du6") skeleton = NodePath("../..") diff --git a/content/ui/menu/room/room_menu.gd b/content/ui/menu/room/room_menu.gd index 7a94699..147c68b 100644 --- a/content/ui/menu/room/room_menu.gd +++ b/content/ui/menu/room/room_menu.gd @@ -19,6 +19,10 @@ func _ready(): rooms.add_child(room) else: room = rooms.get_child(0) + if rooms.get_child_count() > 1: + for child in rooms.get_children(): + if child != room: + child.queue_free() ) spawn_windows.on_button_down.connect(func(): diff --git a/content/ui/menu/room/room_menu.tscn b/content/ui/menu/room/room_menu.tscn index 88da1c8..e1df0ee 100644 --- a/content/ui/menu/room/room_menu.tscn +++ b/content/ui/menu/room/room_menu.tscn @@ -29,7 +29,6 @@ script = ExtResource("2_elugy") [node name="Label3D" type="Label3D" parent="Interface"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.13, -1.86265e-09, 0.05) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "Edit Room" font_size = 18 outline_size = 0 @@ -37,7 +36,6 @@ outline_size = 0 [node name="CreateBlur" type="Label3D" parent="."] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.15, 0.01, 0.261858) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "Fake Windows" font_size = 18 outline_size = 0 diff --git a/content/ui/menu/settings/settings_menu.gd b/content/ui/menu/settings/settings_menu.gd index f454b0e..08cba1f 100644 --- a/content/ui/menu/settings/settings_menu.gd +++ b/content/ui/menu/settings/settings_menu.gd @@ -10,6 +10,8 @@ const credits_scene = preload("./credits.tscn") @onready var input_token = $Content/InputToken @onready var button_connect = $Content/Connect @onready var credits = $Content/Credits/Clickable +@onready var save = $Content/Save +@onready var clear_save = $Content/ClearSave @onready var background = $Background func _ready(): @@ -52,6 +54,14 @@ func _ready(): }) ) + save.on_button_down.connect(func(): + SaveSystem.save() + ) + + clear_save.on_button_down.connect(func(): + SaveSystem.clear() + ) + HomeApi.on_connect.connect(func(): connection_status.text = "Connected" ) diff --git a/content/ui/menu/settings/settings_menu.tscn b/content/ui/menu/settings/settings_menu.tscn index 642900f..195e69c 100644 --- a/content/ui/menu/settings/settings_menu.tscn +++ b/content/ui/menu/settings/settings_menu.tscn @@ -25,7 +25,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.007, 0) [node name="Label3D" type="Label3D" parent="Content"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.134377, 0, 0.253575) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "Spawn Ball" font_size = 18 outline_size = 0 @@ -41,7 +40,6 @@ script = ExtResource("3_qmg6q") [node name="ConnectionStatus" type="Label3D" parent="Content"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.250698, 0, 0.151303) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "Disconnected" font_size = 8 outline_size = 0 @@ -49,7 +47,6 @@ outline_size = 0 [node name="LabelURL" type="Label3D" parent="Content"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.03) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "url: " font_size = 18 @@ -63,7 +60,6 @@ text = "ws://192.168.0.1:8123" [node name="LabelToken" type="Label3D" parent="Content"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.07) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "token:" font_size = 18 outline_size = 0 @@ -76,7 +72,6 @@ text = "..." [node name="LabelConnect" type="Label3D" parent="Content"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.14, 0, 0.12) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "Connect" font_size = 18 outline_size = 0 @@ -97,7 +92,6 @@ shape = SubResource("BoxShape3D_3qdps") [node name="Label" type="Label3D" parent="Content/Credits"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.26, 0.0102286, 0.29) pixel_size = 0.001 -modulate = Color(0, 0, 0, 1) text = "credits" font_size = 12 outline_size = 0 @@ -113,3 +107,13 @@ outline_size = 0 [node name="Clickable" type="Node" parent="Content/Credits"] script = ExtResource("3_qmg6q") + +[node name="Save" parent="Content" instance=ExtResource("1_faxng")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.04, 0, 0.17) +label = "save" +icon = true + +[node name="ClearSave" parent="Content" instance=ExtResource("1_faxng")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, 0, 0.17) +label = "close" +icon = true diff --git a/lib/globals/save_system.gd b/lib/globals/save_system.gd index f9d4d0d..73db18c 100644 --- a/lib/globals/save_system.gd +++ b/lib/globals/save_system.gd @@ -2,6 +2,9 @@ extends Node const VariantSerializer = preload("res://lib/utils/variant_serializer.gd") +func clear(): + _clear_save_tree(get_tree().root.get_node("Main")) + func save(): if HomeApi.has_connected() == false: return @@ -19,6 +22,8 @@ func save(): save_file.store_line(json_text) func load(): + clear() + if HomeApi.has_connected() == false: return @@ -38,6 +43,12 @@ func load(): else: _build_save_tree(save_tree) +func _clear_save_tree(node: Node): + for child in node.get_children(): + _clear_save_tree(child) + + if node.has_method("_save"): + node.queue_free() func _generate_save_tree(node: Node): var children = [] @@ -76,10 +87,13 @@ func _generate_save_tree(node: Node): func _build_save_tree(tree: Dictionary): var new_object = load(tree["filename"]).instantiate() - get_node(tree["parent"]).add_child(new_object) - if new_object.has_method("_load"): new_object.call("_load", VariantSerializer.parse_value(tree["data"])) else: for key in tree["data"].keys(): new_object.set(key, VariantSerializer.parse_value(tree["data"][key])) + + get_node(tree["parent"]).add_child(new_object) + + for child in tree["children"]: + _build_save_tree(child)