diff --git a/app/assets/chat_bubble.blend b/app/assets/chat_bubble.blend index f944d04..1d0b9f3 100644 --- a/app/assets/chat_bubble.blend +++ b/app/assets/chat_bubble.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c5fa5f006a42d87f43a8b411e4e4bf64a8b4fbbaedd0d02579134a8fa59161eb -size 894176 +oid sha256:bef6a6cb32c912112413d2effbbea13a6d51540108785e3d0b09f449aeead88d +size 883216 diff --git a/app/assets/chat_bubble.blend.import b/app/assets/chat_bubble.blend.import new file mode 100644 index 0000000..35e7a94 --- /dev/null +++ b/app/assets/chat_bubble.blend.import @@ -0,0 +1,54 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://di82bqu33sr6k" +path="res://.godot/imported/chat_bubble.blend-de1406e8004abcd1a11c6d9c08beeab9.scn" + +[deps] + +source_file="res://assets/chat_bubble.blend" +dest_files=["res://.godot/imported/chat_bubble.blend-de1406e8004abcd1a11c6d9c08beeab9.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +import_script/path="" +_subresources={} +fbx/importer=0 +fbx/allow_geometry_helper_nodes=false +fbx/embedded_image_handling=1 +gltf/naming_version=1 +gltf/embedded_image_handling=1 +blender/nodes/visible=0 +blender/nodes/punctual_lights=true +blender/nodes/cameras=true +blender/nodes/custom_properties=true +blender/nodes/modifiers=1 +blender/meshes/colors=false +blender/meshes/uvs=true +blender/meshes/normals=true +blender/meshes/tangents=true +blender/meshes/skins=2 +blender/meshes/export_bones_deforming_mesh_only=false +blender/materials/unpack_enabled=true +blender/materials/export_materials=1 +blender/animation/limit_playback=true +blender/animation/always_sample=true +blender/animation/group_tracks=true diff --git a/app/assets/chat_bubble.blend1 b/app/assets/chat_bubble.blend1 index 6ee4542..4871ca6 100644 Binary files a/app/assets/chat_bubble.blend1 and b/app/assets/chat_bubble.blend1 differ diff --git a/app/assets/models/chat_bubble/chat_bubble-flipped.glb b/app/assets/models/chat_bubble/chat_bubble-flipped.glb new file mode 100644 index 0000000..990eb82 --- /dev/null +++ b/app/assets/models/chat_bubble/chat_bubble-flipped.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d789ce1d38ac6bd59774219ec30bb3b40e1fbcb46326c8c2a88a9e7c662c57cc +size 17844 diff --git a/app/assets/models/chat_bubble/chat_bubble-flipped.glb.import b/app/assets/models/chat_bubble/chat_bubble-flipped.glb.import new file mode 100644 index 0000000..3161c82 --- /dev/null +++ b/app/assets/models/chat_bubble/chat_bubble-flipped.glb.import @@ -0,0 +1,34 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://bbximrhpqx18o" +path="res://.godot/imported/chat_bubble-flipped.glb-789aae22dafe6fa03b0567b80233a8e3.scn" + +[deps] + +source_file="res://assets/models/chat_bubble/chat_bubble-flipped.glb" +dest_files=["res://.godot/imported/chat_bubble-flipped.glb-789aae22dafe6fa03b0567b80233a8e3.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +import_script/path="" +_subresources={} +gltf/naming_version=1 +gltf/embedded_image_handling=1 diff --git a/app/assets/ray.blend.import b/app/assets/ray.blend.import new file mode 100644 index 0000000..17bcd72 --- /dev/null +++ b/app/assets/ray.blend.import @@ -0,0 +1,54 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://po4gd6amobh2" +path="res://.godot/imported/ray.blend-eba6795b628724ab6db66b86eccc4315.scn" + +[deps] + +source_file="res://assets/ray.blend" +dest_files=["res://.godot/imported/ray.blend-eba6795b628724ab6db66b86eccc4315.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +import_script/path="" +_subresources={} +fbx/importer=0 +fbx/allow_geometry_helper_nodes=false +fbx/embedded_image_handling=1 +gltf/naming_version=1 +gltf/embedded_image_handling=1 +blender/nodes/visible=0 +blender/nodes/punctual_lights=true +blender/nodes/cameras=true +blender/nodes/custom_properties=true +blender/nodes/modifiers=1 +blender/meshes/colors=false +blender/meshes/uvs=true +blender/meshes/normals=true +blender/meshes/tangents=true +blender/meshes/skins=2 +blender/meshes/export_bones_deforming_mesh_only=false +blender/materials/unpack_enabled=true +blender/materials/export_materials=1 +blender/animation/limit_playback=true +blender/animation/always_sample=true +blender/animation/group_tracks=true diff --git a/app/assets/trash_bin.blend.import b/app/assets/trash_bin.blend.import new file mode 100644 index 0000000..91cd3d5 --- /dev/null +++ b/app/assets/trash_bin.blend.import @@ -0,0 +1,54 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://dsv5rpkom2yqk" +path="res://.godot/imported/trash_bin.blend-922964bd1a889a6b6013a91cbf134fac.scn" + +[deps] + +source_file="res://assets/trash_bin.blend" +dest_files=["res://.godot/imported/trash_bin.blend-922964bd1a889a6b6013a91cbf134fac.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +import_script/path="" +_subresources={} +fbx/importer=0 +fbx/allow_geometry_helper_nodes=false +fbx/embedded_image_handling=1 +gltf/naming_version=1 +gltf/embedded_image_handling=1 +blender/nodes/visible=0 +blender/nodes/punctual_lights=true +blender/nodes/cameras=true +blender/nodes/custom_properties=true +blender/nodes/modifiers=1 +blender/meshes/colors=false +blender/meshes/uvs=true +blender/meshes/normals=true +blender/meshes/tangents=true +blender/meshes/skins=2 +blender/meshes/export_bones_deforming_mesh_only=false +blender/materials/unpack_enabled=true +blender/materials/export_materials=1 +blender/animation/limit_playback=true +blender/animation/always_sample=true +blender/animation/group_tracks=true diff --git a/app/content/main.tscn b/app/content/main.tscn index 8ca3ce1..18fcdf6 100644 --- a/app/content/main.tscn +++ b/app/content/main.tscn @@ -3,7 +3,7 @@ [ext_resource type="PackedScene" uid="uid://clc5dre31iskm" path="res://addons/godot-xr-tools/xr/start_xr.tscn" id="1_i4c04"] [ext_resource type="Script" path="res://content/main.gd" id="1_uvrd4"] [ext_resource type="PackedScene" uid="uid://b30w6tywfj4fp" path="res://content/system/controller_left/controller_left.tscn" id="2_2lraw"] -[ext_resource type="PackedScene" uid="uid://d3f8glx1xgm5w" path="res://content/system/raycast/raycast.tscn" id="3_67lii"] +[ext_resource type="PackedScene" uid="uid://dscp8x0ari57n" path="res://content/system/raycast/raycast.tscn" id="3_67lii"] [ext_resource type="PackedScene" uid="uid://b2kjh1fpjptdr" path="res://content/system/camera/camera.tscn" id="3_rj4ac"] [ext_resource type="PackedScene" uid="uid://bsx12q23v8apy" path="res://content/system/hands/hands.tscn" id="4_v8xu6"] [ext_resource type="PackedScene" uid="uid://ctltchlf2j2r4" path="res://addons/xr-simulator/XRSimulator.tscn" id="5_3qc8g"] diff --git a/app/content/system/assist/assist.gd b/app/content/system/assist/assist.gd index f2aa43f..4188991 100644 --- a/app/content/system/assist/assist.gd +++ b/app/content/system/assist/assist.gd @@ -36,6 +36,8 @@ func _ready(): finish() + chat_assistant.flip = true + audio_timer.timeout.connect(func(): voice_assistant.send_data(PackedByteArray()) ) diff --git a/app/content/system/assist/assist.tscn b/app/content/system/assist/assist.tscn index 76c7c44..16d4087 100644 --- a/app/content/system/assist/assist.tscn +++ b/app/content/system/assist/assist.tscn @@ -26,10 +26,10 @@ one_shot = true [node name="ChatUser" parent="." instance=ExtResource("2_laew1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.109997, 0.025, 0) -flip = false [node name="ChatAssistant" parent="." instance=ExtResource("2_laew1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0499932, -0.025, 0) text = "Hello, World!" +flip = true [node name="Loader" parent="." instance=ExtResource("3_25iy1")] diff --git a/app/content/system/assist/chat.gd b/app/content/system/assist/chat.gd index 2cd61a2..be46121 100644 --- a/app/content/system/assist/chat.gd +++ b/app/content/system/assist/chat.gd @@ -5,33 +5,34 @@ const FontTools = preload ("res://lib/utils/font_tools.gd") @onready var label: Label3D = $Label3D @onready var chat: Skeleton3D = $chat_bubble/Armature/Skeleton3D -@onready var model: MeshInstance3D = $chat_bubble/Armature/Skeleton3D/Cube +@onready var chat_flipped: Skeleton3D = $"chat_bubble-flipped/Armature/Skeleton3D" +@onready var model: Node3D = $chat_bubble +@onready var model_flipped: Node3D = $"chat_bubble-flipped" @export var text := "Hello, World!": set(value): - if !is_node_ready(): await ready - text = value - label.text = value - update() + if !is_inside_tree(): return + + label.text = text + var text_width = FontTools.get_font_size(label).x + + var offset = (text_width - base_width) / 0.2 + + offset = max(0.0, offset) + + chat.set_bone_pose_position(0, Vector3(0, offset, 0)) + chat_flipped.set_bone_pose_position(1, Vector3(0, -offset, 0)) @export var flip: bool = false: set(value): - if !is_node_ready(): await ready - flip = value - model.rotation_degrees.x = -90 if value else 90 + if !is_inside_tree(): return + + model.visible = !flip + model_flipped.visible = flip const base_width = 0.8 * 0.2 -func update(): - var text_width = FontTools.get_font_size(label).x - - var offset = (text_width - base_width) / 0.2 - - offset = max(0.0, offset) - - if flip: - offset = -offset - - chat.set_bone_pose_position(1 if flip else 0, Vector3(0, offset, 0)) \ No newline at end of file +func _ready(): + Update.props(self, ["text", "flip"]) diff --git a/app/content/system/assist/chat.tscn b/app/content/system/assist/chat.tscn index 6d1136a..bec844e 100644 --- a/app/content/system/assist/chat.tscn +++ b/app/content/system/assist/chat.tscn @@ -1,24 +1,24 @@ -[gd_scene load_steps=5 format=3 uid="uid://cy6jklyde3pgo"] +[gd_scene load_steps=6 format=3 uid="uid://cy6jklyde3pgo"] [ext_resource type="PackedScene" uid="uid://b12raorbby1xd" path="res://assets/models/chat_bubble/chat_bubble.glb" id="1_lsdcs"] [ext_resource type="Script" path="res://content/system/assist/chat.gd" id="1_rbrak"] [ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_ps3pl"] [ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="4_gxfp3"] +[ext_resource type="PackedScene" uid="uid://bbximrhpqx18o" path="res://assets/models/chat_bubble/chat_bubble-flipped.glb" id="5_q44mc"] [node name="Chat" type="Node3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.41237e-06, 0, 0) script = ExtResource("1_rbrak") text = "Hello World" -flip = true [node name="chat_bubble" parent="." instance=ExtResource("1_lsdcs")] transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -0.0154175, 0, 0.0710473) [node name="Armature" parent="chat_bubble" index="0"] -transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, 0.5, 0, 0) +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.5, 0, 0) [node name="Cube" parent="chat_bubble/Armature/Skeleton3D" index="0"] -transform = Transform3D(-4.37114e-08, -1, -4.37114e-08, 0, -4.37114e-08, 1, -1, 4.37114e-08, 1.91069e-15, 0, 0.35, 0) +transform = Transform3D(-4.37114e-08, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -4.37114e-08, 1.91069e-15, 0, 0.35, 0) material_override = ExtResource("2_ps3pl") [node name="Label3D" type="Label3D" parent="."] @@ -30,4 +30,16 @@ font_size = 20 outline_size = 0 horizontal_alignment = 0 +[node name="chat_bubble-flipped" parent="." instance=ExtResource("5_q44mc")] +transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.0843144, 0, 0.000967294) +visible = false + +[node name="Armature" parent="chat_bubble-flipped" index="0"] +transform = Transform3D(-1, 0, 0, 0, 4.37114e-08, 1, 0, -1, 4.37114e-08, 0, 0, 0) + +[node name="Cube" parent="chat_bubble-flipped/Armature/Skeleton3D" index="0"] +transform = Transform3D(-4.37114e-08, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -4.37114e-08, 1.91069e-15, 0, 0, 0) +material_override = ExtResource("2_ps3pl") + [editable path="chat_bubble"] +[editable path="chat_bubble-flipped"] diff --git a/app/content/system/house/align_reference.gd b/app/content/system/house/align_reference.gd index 4773c5a..0118f58 100644 --- a/app/content/system/house/align_reference.gd +++ b/app/content/system/house/align_reference.gd @@ -9,14 +9,14 @@ extends Node3D set(value): disabled = value - if !is_node_ready(): await ready - - corner1.get_node("CollisionShape3D").disabled = value - corner2.get_node("CollisionShape3D").disabled = value - edge.get_node("CollisionShape3D").disabled = value - corner1.visible = !value - corner2.visible = !value - edge.visible = !value + if !is_inside_tree(): return + + corner1.get_node("CollisionShape3D").disabled = disabled + corner2.get_node("CollisionShape3D").disabled = disabled + edge.get_node("CollisionShape3D").disabled = disabled + corner1.visible = !disabled + corner2.visible = !disabled + edge.visible = !disabled func _ready(): update_initial_positions() @@ -29,7 +29,7 @@ func _ready(): edge.align_to_corners(corner1.global_position, corner2.global_position) corner2.look_at(corner1.global_position, Vector3.UP) - corner2.rotate(Vector3.UP, deg_to_rad(-90)) + corner2.rotate(Vector3.UP, deg_to_rad( - 90)) ) corner2.get_node("Movable").restrict_movement = func(new_position): @@ -52,7 +52,7 @@ func update_align_reference(): corner2.global_position = Store.house.align_position2 corner2.look_at(corner1.global_position, Vector3.UP) - corner2.rotate(Vector3.UP, deg_to_rad(-90)) + corner2.rotate(Vector3.UP, deg_to_rad( - 90)) edge.align_to_corners(corner1.global_position, corner2.global_position) diff --git a/app/content/system/house/house.gd b/app/content/system/house/house.gd index 2bb2016..2edfeb5 100644 --- a/app/content/system/house/house.gd +++ b/app/content/system/house/house.gd @@ -26,8 +26,14 @@ func update_house(): align_reference.update_align_reference() - for index in range(Store.house.rooms.size()): + for index in range(Store.house.rooms.size() - 1, -1, -1): var new_room = Store.house.rooms[index] + + if new_room.corners.size() == 0: + Store.house.rooms.remove_at(index) + Store.house.save_local() + continue + create_room(new_room.name, 0) for entity_index in range(Store.house.entities.size()): diff --git a/app/content/system/house/room/room.gd b/app/content/system/house/room/room.gd index 6ccc18c..7c76b8f 100644 --- a/app/content/system/house/room/room.gd +++ b/app/content/system/house/room/room.gd @@ -13,13 +13,18 @@ extends Node3D var editable: bool = false: set(value): - if !is_node_ready(): await ready - - if value: + editable = value + + if !is_inside_tree(): return + + if editable: state_machine.change_to("Edit") else: state_machine.change_to("View") +func _ready(): + Update.props(self, ["editable"]) + func has_point(point: Vector3) -> bool: return get_aabb().has_point(point) diff --git a/app/content/system/raycast/raycast.tscn b/app/content/system/raycast/raycast.tscn index 0efc290..3ac7fe6 100644 --- a/app/content/system/raycast/raycast.tscn +++ b/app/content/system/raycast/raycast.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=3 uid="uid://d3f8glx1xgm5w"] +[gd_scene load_steps=7 format=3 uid="uid://dscp8x0ari57n"] [ext_resource type="Texture2D" uid="uid://bl33klueufwja" path="res://assets/materials/pointer.png" id="1_2f2iv"] [ext_resource type="Script" path="res://content/system/raycast/raycast.gd" id="1_gp8nv"] diff --git a/app/content/ui/components/button/button.gd b/app/content/ui/components/button/button.gd index 31b9372..219af49 100644 --- a/app/content/ui/components/button/button.gd +++ b/app/content/ui/components/button/button.gd @@ -10,6 +10,7 @@ const IconFont = preload ("res://assets/icons/icons.tres") const ECHO_WAIT_INITIAL = 0.5 const ECHO_WAIT_REPEAT = 0.1 +@onready var body: StaticBody3D = $Body @onready var label_node: Label3D = $Body/Label @onready var finger_area: Area3D = $FingerArea @@ -24,19 +25,21 @@ const ECHO_WAIT_REPEAT = 0.1 @export var font_size: int = 10: set(value): font_size = value - if !is_node_ready(): await ready - label_node.font_size = value + if !is_inside_tree()||icon: return + label_node.font_size = font_size + @export var label: String = "": set(value): label = value - if !is_node_ready(): await ready - label_node.text = value + if !is_inside_tree(): return + label_node.text = label + @export var icon: bool = false: set(value): icon = value - if !is_node_ready(): await ready - - if value: + if !is_inside_tree(): return + + if icon: label_node.font = IconFont label_node.font_size = 36 label_node.width = 1000 @@ -46,42 +49,26 @@ const ECHO_WAIT_REPEAT = 0.1 label_node.font_size = font_size label_node.width = 50 label_node.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART - + @export var toggleable: bool = false @export var disabled: bool = false @export var echo: bool = false @export var initial_active: bool = false -var external_value: Proxy = null: - set(value): - if !is_node_ready(): await ready - - external_value = value - if value != null: - value.on_set.connect(func(_value): - update_animation() - ) var active: bool = false: - get: - if external_value != null: - return external_value.value - return active set(value): - if !is_node_ready(): await ready - - if external_value != null: - external_value.value = value - else: - active = value - update_animation() - -@onready var animation_player: AnimationPlayer = $AnimationPlayer + active = value + if !is_inside_tree(): return + update_animation(1.0 if active else 0.0) + var echo_timer: Timer = null func _ready(): if initial_active: active = true + Update.props(self, ["active", "external_value", "icon", "label", "font_size"]) + if echo: echo_timer = Timer.new() echo_timer.wait_time = ECHO_WAIT_INITIAL @@ -96,16 +83,12 @@ func _ready(): add_child(echo_timer) -func update_animation(): - var length = animation_player.get_animation("down").length +func update_animation(value: float): + var tween = create_tween() + tween.set_parallel(true) - if animation_player.current_animation == "": - return - - if active&&animation_player.current_animation_position != length: - animation_player.play("down") - elif !active&&animation_player.current_animation_position != 0: - animation_player.play_backwards("down") + tween.tween_property(body, "scale:y", lerpf(1.0, 0.5, value), 0.2) + tween.tween_property(body, "position:y", lerpf(0.01, 0.005, value), 0.2) func _on_press_down(event): if disabled: @@ -146,10 +129,7 @@ func _on_press_up(event): func _on_touch_enter(event: EventTouch): if event.target != finger_area: return - - animation_player.stop() - animation_player.speed_scale = 0 - animation_player.current_animation = "down" + AudioPlayer.play_effect("click") _touch_change(event) @@ -157,9 +137,6 @@ func _on_touch_move(event: EventTouch): _touch_change(event) func _on_touch_leave(_event: EventTouch): - animation_player.stop() - animation_player.speed_scale = 1 - if toggleable: active = !active if active: @@ -188,7 +165,7 @@ func _touch_change(event: EventTouch): elif active&&percent >= 1: on_button_up.emit() - animation_player.seek(percent * animation_player.current_animation_length, true) + update_animation(percent) if toggleable: return diff --git a/app/content/ui/components/button/button.tscn b/app/content/ui/components/button/button.tscn index c8565bd..d7dee7b 100644 --- a/app/content/ui/components/button/button.tscn +++ b/app/content/ui/components/button/button.tscn @@ -1,70 +1,12 @@ -[gd_scene load_steps=11 format=3 uid="uid://bsjqdvkt0u87c"] +[gd_scene load_steps=8 format=3 uid="uid://bsjqdvkt0u87c"] [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"] [ext_resource type="Material" uid="uid://bujy3egn1oqac" path="res://assets/materials/pri-500.material" id="2_wx7av"] [ext_resource type="Script" path="res://content/system/hands/touch_area.gd" id="4_b27lx"] -[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) - -[sub_resource type="Animation" id="Animation_gvfrg"] -length = 0.001 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Body:scale:y") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Body:position:y") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(0.01, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} - -[sub_resource type="Animation" id="Animation_iu2ed"] -resource_name = "down" -length = 0.2 -step = 0.01 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Body:scale:y") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.12, -0.00966179, 0.500747, -0.13, 0.00874269, 0.25, 0), -"times": PackedFloat32Array(0, 0.2) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Body:position:y") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(0.0101447, -0.25, 0, 0.12, 0.000134136, 0.0051993, -0.12, 0.000145131, 0.25, 0), -"times": PackedFloat32Array(0, 0.2) -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_sbgno"] -_data = { -"RESET": SubResource("Animation_gvfrg"), -"down": SubResource("Animation_iu2ed") -} +[sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"] +size = Vector3(0.05, 0.02, 0.05) [sub_resource type="BoxShape3D" id="BoxShape3D_bqjii"] size = Vector3(0.0501598, 0.0390937, 0.0501598) @@ -88,7 +30,7 @@ mesh = ExtResource("2_cve3l") skeleton = NodePath("../..") [node name="CollisionShape3D" type="CollisionShape3D" parent="Body"] -shape = SubResource("ConvexPolygonShape3D_o4j7g") +shape = SubResource("BoxShape3D_xwopm") [node name="Label" type="Label3D" parent="Body"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.0107199, 0) @@ -99,11 +41,6 @@ outline_size = 0 autowrap_mode = 3 width = 50.0 -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_sbgno") -} - [node name="FingerArea" type="Area3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0101447, 0) collision_layer = 4 diff --git a/app/content/ui/components/input/input.gd b/app/content/ui/components/input/input.gd index 01522c9..19c454e 100644 --- a/app/content/ui/components/input/input.gd +++ b/app/content/ui/components/input/input.gd @@ -11,33 +11,29 @@ var text_handler = preload ("res://content/ui/components/input/text_handler.gd") @onready var label: Label3D = $Label @export_range(0.1, 2, 0.01, "suffix:m") var width: float = 0.15: - get: - return text_handler.width set(value): + width = value text_handler.width = value + if !is_inside_tree(): return - if !is_node_ready(): await ready - - mesh_box.mesh.size.x = value - collision.shape.size.x = value - label.position.x = -value / 2 + 0.002 - + mesh_box.mesh.size.x = width + collision.shape.size.x = width + label.position.x = -width / 2 + 0.002 + @export var text: String: - get: - return text_handler.text set(value): - var focused = Engine.is_editor_hint() == false&&EventSystem.is_focused(self) == false - - if !is_node_ready(): await ready + text = value + if !is_inside_tree(): return - text_handler.set_text(value, focused) + var focused = Engine.is_editor_hint() == false&&EventSystem.is_focused(self) == false + text_handler.set_text(text, focused) label.text = text_handler.get_display_text() @export var disabled: bool = false: set(value): - if !is_node_ready(): await ready - disabled = value + if !is_inside_tree(): return + if disabled: label.modulate = Color(0.7, 0.7, 0.7) add_to_group("ui_focus_skip") @@ -52,6 +48,8 @@ var keyboard_input: bool = false var input_plane = Plane(Vector3.UP, Vector3.ZERO) func _ready(): + Update.props(self, ["text", "disabled", "width"]) + text_handler.label = label if Engine.is_editor_hint(): diff --git a/app/content/ui/components/input/input.tscn b/app/content/ui/components/input/input.tscn index b838a37..ef30fbf 100644 --- a/app/content/ui/components/input/input.tscn +++ b/app/content/ui/components/input/input.tscn @@ -56,7 +56,6 @@ _data = { collision_layer = 2 collision_mask = 0 script = ExtResource("1_uml3t") -width = 0.2 text = "Example" [node name="Box" type="MeshInstance3D" parent="."] diff --git a/app/content/ui/components/notification/notification.gd b/app/content/ui/components/notification/notification.gd index 38ddd61..6e1a16e 100644 --- a/app/content/ui/components/notification/notification.gd +++ b/app/content/ui/components/notification/notification.gd @@ -12,15 +12,18 @@ extends Node3D @export var type: EventNotify.Type = EventNotify.Type.INFO: set(value): type = value - if !is_node_ready(): await ready - icon_label.text = _type_to_string(value) + if !is_inside_tree(): return + icon_label.text = _type_to_string(type) + @export var text: String = "": set(value): text = value - if !is_node_ready(): await ready - label.text = value + if !is_inside_tree(): return + label.text = text func _ready(): + Update.props(self, ["type", "text"]) + button.on_button_down.connect(fade_out) fade_in() @@ -29,7 +32,7 @@ func _ready(): ) func fade_in(): - if !is_node_ready(): await ready + if !is_inside_tree(): await ready animation_player.play("fade_in") diff --git a/app/content/ui/components/slider/slider.gd b/app/content/ui/components/slider/slider.gd index 981ddb7..435d79c 100644 --- a/app/content/ui/components/slider/slider.gd +++ b/app/content/ui/components/slider/slider.gd @@ -6,22 +6,26 @@ class_name Slider3D set(new_value): min = new_value if value < min: value = min - if !is_node_ready(): await ready + if !is_inside_tree(): return + _update_slider() @export var max: float = 1.0: set(new_value): max = new_value if value > max: value = max - if !is_node_ready(): await ready + if !is_inside_tree(): return + _update_slider() + @export var value: float = 0.2: set(new_value): value = roundi(clamp(new_value, min, max) / step) * step - if !is_node_ready(): await ready + if !is_inside_tree(): return + label.text = str(value) + " " + label_unit - on_value_changed.emit(value) + if new_value != value: on_value_changed.emit(value) _update_slider() @export var step: float = 0.01 @@ -29,29 +33,29 @@ class_name Slider3D @export var show_label: bool = false: set(value): show_label = value - if !is_node_ready(): await ready + if !is_inside_tree(): return label.visible = show_label @export var label_unit: String = "": set(new_value): label_unit = new_value - if !is_node_ready(): await ready + if !is_inside_tree(): return label.text = str(value) + " " + label_unit @export var size: Vector3 = Vector3(0.2, 0.01, 0.02): # Warning, units are in cm set(value): size = value - if !is_node_ready(): await ready + if !is_inside_tree(): return _update_shape() @export var cutout_border: float = 0.02: set(value): cutout_border = value - if !is_node_ready(): await ready + if !is_inside_tree(): return _update_shape() @export var cutout_depth: float = 0.05: set(value): cutout_depth = value - if !is_node_ready(): await ready + if !is_inside_tree(): return _update_shape() @onready var outside_rod: CSGBox3D = $Rod/Outside @@ -68,6 +72,9 @@ signal on_value_changed(value: float) var move_plane: Plane func _ready(): + Update.props(self, ["value", "show_label", "label_unit"]) + + _update_slider() _update_shape() move_plane = Plane(Vector3.UP, Vector3(0, size.y / 200, 0)) @@ -80,7 +87,7 @@ func _on_press_move(event: EventPointer): func _get_slider_min_max(): var cutout_radius = (size.z - cutout_border * 2) / 2 - return Vector2(-size.x / 2 + cutout_border + cutout_radius, size.x / 2 - cutout_border - cutout_radius) / 100 + return Vector2( - size.x / 2 + cutout_border + cutout_radius, size.x / 2 - cutout_border - cutout_radius) / 100 func _handle_press(event: EventPointer): var ray_pos = event.ray.global_position @@ -101,7 +108,6 @@ func _handle_press(event: EventPointer): var click_percent = inverse_lerp(min_max.x, min_max.y, pos_x) value = lerp(min, max, click_percent) - _update_slider() func _update_slider(): var min_max = _get_slider_min_max() @@ -133,7 +139,7 @@ func _update_shape(): cutout_end_right.height = cutout_depth cutout_end_left.position = Vector3( - -cutout_box.size.x / 2, + - cutout_box.size.x / 2, 0, 0 ) diff --git a/app/content/ui/components/tabs/tabs.gd b/app/content/ui/components/tabs/tabs.gd index f8e88e6..c31150d 100644 --- a/app/content/ui/components/tabs/tabs.gd +++ b/app/content/ui/components/tabs/tabs.gd @@ -3,26 +3,29 @@ class_name Tabs3D signal on_select(selected: int) -var selected: Node3D +var selected: Node3D: + set(value): + if selected == value: + return + + if selected != null: + selected.active = false + + selected = value + selected.active = true + on_select.emit(selected.get_index()) @export var initial_selected: Node3D -var proxy_group = ProxyGroup.new() func _ready(): if initial_selected != null: selected = initial_selected - on_select.emit(selected.get_index()) for option in get_children(): if option is Button3D == false: continue - var proxy = proxy_group.proxy(func(): - return selected == option - , func(value: bool): - if value == true: - selected = option - on_select.emit(selected.get_index()) + option.on_button_down.connect(func(): + selected=option ) - - option.external_value = proxy + option.toggleable = true diff --git a/app/content/ui/console.tscn b/app/content/ui/console.tscn index 682fb56..3cbf0c6 100644 --- a/app/content/ui/console.tscn +++ b/app/content/ui/console.tscn @@ -15,15 +15,16 @@ cull_mode = 2 script = ExtResource("1_ullcc") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0) shape = SubResource("BoxShape3D_6xl4b") [node name="MeshInstance3D" type="MeshInstance3D" parent="."] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0) +transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.01, 0, 0) material_override = SubResource("StandardMaterial3D_087gr") mesh = SubResource("QuadMesh_chf50") [node name="Label3D" type="Label3D" parent="."] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.477142, 0.00806178, -0.495248) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.477979, 0.492319, 0.001) pixel_size = 0.001 text = "Texst aaa" diff --git a/app/content/ui/menu/edit/edit_menu.gd b/app/content/ui/menu/edit/edit_menu.gd index 0a08a91..9769d8c 100644 --- a/app/content/ui/menu/edit/edit_menu.gd +++ b/app/content/ui/menu/edit/edit_menu.gd @@ -1,6 +1,6 @@ extends Node3D -const ButtonScene = preload("res://content/ui/components/button/button.tscn") +const ButtonScene = preload ("res://content/ui/components/button/button.tscn") @onready var devices_node: GridContainer3D = $Devices @onready var next_page_button = $Buttons/NextPageButton @@ -24,13 +24,10 @@ func _ready(): ) func _enter_tree(): - if HomeApi.has_connected(): + if !HomeApi.has_connected(): await HomeApi.on_connect + + if is_node_ready(): load_devices() - else: - HomeApi.on_connect.connect(func(): - if is_node_ready(): - load_devices() - ) func load_devices(): if devices.size() == 0: @@ -38,7 +35,7 @@ func load_devices(): render() HomeApi.on_disconnect.connect(func(): - devices = [] + devices=[] if is_node_ready(): render() ) diff --git a/app/content/ui/menu/room/room_menu.tscn b/app/content/ui/menu/room/room_menu.tscn index 4dd5d60..81085b2 100644 --- a/app/content/ui/menu/room/room_menu.tscn +++ b/app/content/ui/menu/room/room_menu.tscn @@ -26,11 +26,11 @@ script = ExtResource("5_ddrep") initial_selected = NodePath("Overview") [node name="Overview" parent="Interface/Tabs3D" instance=ExtResource("4_cghmp")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, -0.02) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0.02) label = "Overview" [node name="Rooms" parent="Interface/Tabs3D" instance=ExtResource("4_cghmp")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.09, 0, -0.02) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.09, 0, 0.02) label = "Rooms" [node name="TabsContent3D" type="Node3D" parent="Interface" node_paths=PackedStringArray("tabs")] @@ -38,5 +38,6 @@ script = ExtResource("6_ba00g") tabs = NodePath("../Tabs3D") [node name="Overview" parent="Interface/TabsContent3D" instance=ExtResource("6_206ad")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.04) [node name="Rooms" parent="Interface/TabsContent3D" instance=ExtResource("7_2f8e0")] diff --git a/app/content/ui/menu/room/views/rooms.gd b/app/content/ui/menu/room/views/rooms.gd index 772a044..298e13c 100644 --- a/app/content/ui/menu/room/views/rooms.gd +++ b/app/content/ui/menu/room/views/rooms.gd @@ -49,12 +49,11 @@ var edit_room = false: selected_room = input.text func _ready(): - if Store.house.is_loaded(): - _generate_room_map() - else: - Store.house.on_loaded.connect(func(): - _generate_room_map() - ) + if !Store.house.is_loaded(): await Store.house.on_loaded + + _generate_room_map() + + input.text = "Room %s" % (rooms_map.get_child_count() + 1) room_button.on_button_down.connect(func(): if selected_room == null: @@ -105,7 +104,8 @@ func _on_click(event: EventPointer): func _generate_room_map(): var rooms = Store.house.rooms - var target_size = Vector2(0.3, 0.24) + var target_size = Vector2(0.2, 0.24) + var target_offset = Vector2(0, 0.05) for old_room in rooms_map.get_children(): old_room.queue_free() @@ -114,6 +114,9 @@ func _generate_room_map(): if rooms.size() == 0: return + if rooms[0].corners.size() == 0: + return + var current_min = Vector2(rooms[0].corners[0].x, rooms[0].corners[0].y) var current_max = current_min @@ -152,7 +155,7 @@ func _generate_room_map(): var target_scale = target_size / current_size var scale_value = min(target_scale.x, target_scale.y) - rooms_map.position.x = -current_min.x * scale_value - rooms_map.position.z = -current_min.y * scale_value + rooms_map.position.x = -current_min.x * scale_value + target_offset.x + rooms_map.position.z = -current_min.y * scale_value + target_offset.y rooms_map.scale = Vector3(scale_value, scale_value, scale_value) diff --git a/app/content/ui/menu/room/views/rooms.tscn b/app/content/ui/menu/room/views/rooms.tscn index 5eab1e4..c215f74 100644 --- a/app/content/ui/menu/room/views/rooms.tscn +++ b/app/content/ui/menu/room/views/rooms.tscn @@ -8,7 +8,7 @@ script = ExtResource("1_3a1oa") [node name="Rooms" type="Node3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0.01, 0.12) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0.01, 0.17) [node name="Button" parent="." instance=ExtResource("1_y3lty")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.27, 0, 0.27) diff --git a/app/lib/globals/console.gd b/app/lib/globals/console.gd new file mode 100644 index 0000000..bfc3199 --- /dev/null +++ b/app/lib/globals/console.gd @@ -0,0 +1,24 @@ +extends Node + +const console_scene = preload ("res://content/ui/console.tscn") +var _console: Node3D = null + +func _ready(): + get_node("/root/Main").tree_entered.connect(func(): + init_console() + ) + +func init_console(): + _console = console_scene.instantiate() + get_node("/root/Main").add_child(_console) + var camera = get_node("/root/Main/XROrigin3D/XRCamera3D") + + _console.global_position = camera.global_position + camera.global_transform.basis.z * - 1 + _console.global_transform.basis = Basis.looking_at(_console.global_position - camera.global_position) + +func log(message): + print(message, _console) + if _console == null: + init_console() + + _console.log(message) diff --git a/app/lib/utils/proxy_group.gd b/app/lib/utils/proxy_group.gd index d4c58c2..bf042d9 100644 --- a/app/lib/utils/proxy_group.gd +++ b/app/lib/utils/proxy_group.gd @@ -11,10 +11,9 @@ func proxy(_get: Callable, _set: Callable): for p in proxies: if p != _proxy: - p.on_set.emit(value) + p.on_set.emit(p.value) ) proxies.append(_proxy) return _proxy - \ No newline at end of file diff --git a/app/lib/utils/update_attributes.gd b/app/lib/utils/update_attributes.gd new file mode 100644 index 0000000..1d24fa0 --- /dev/null +++ b/app/lib/utils/update_attributes.gd @@ -0,0 +1,5 @@ +class_name Update + +static func props(node: Node, prop_names=[]): + for prop in prop_names: + node.set(prop, node.get(prop)) diff --git a/app/project.godot b/app/project.godot index ef8aca1..b526861 100644 --- a/app/project.godot +++ b/app/project.godot @@ -28,6 +28,7 @@ AudioPlayer="*res://lib/globals/audio_player.gd" EventSystem="*res://lib/globals/event_system.gd" Store="*res://lib/globals/main_store.gd" House="*res://lib/globals/house_body.gd" +console="*res://lib/globals/console.gd" [display] @@ -72,6 +73,7 @@ renderer/rendering_method.mobile="gl_compatibility" textures/vram_compression/import_etc2_astc=true lights_and_shadows/directional_shadow/soft_shadow_filter_quality=4 lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=4 +anti_aliasing/quality/msaa_3d=1 viewport/transparent_background=true [xr]