Merge pull request #118 from Nitwel/fixes

Fix reacitity bugs
This commit is contained in:
Nitwel 2024-03-21 13:29:37 +01:00 committed by GitHub
commit 17cb2b0db8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 405 additions and 225 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:c5fa5f006a42d87f43a8b411e4e4bf64a8b4fbbaedd0d02579134a8fa59161eb oid sha256:bef6a6cb32c912112413d2effbbea13a6d51540108785e3d0b09f449aeead88d
size 894176 size 883216

View File

@ -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

Binary file not shown.

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d789ce1d38ac6bd59774219ec30bb3b40e1fbcb46326c8c2a88a9e7c662c57cc
size 17844

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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="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="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://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://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://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"] [ext_resource type="PackedScene" uid="uid://ctltchlf2j2r4" path="res://addons/xr-simulator/XRSimulator.tscn" id="5_3qc8g"]

View File

@ -36,6 +36,8 @@ func _ready():
finish() finish()
chat_assistant.flip = true
audio_timer.timeout.connect(func(): audio_timer.timeout.connect(func():
voice_assistant.send_data(PackedByteArray()) voice_assistant.send_data(PackedByteArray())
) )

View File

@ -26,10 +26,10 @@ one_shot = true
[node name="ChatUser" parent="." instance=ExtResource("2_laew1")] [node name="ChatUser" parent="." instance=ExtResource("2_laew1")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.109997, 0.025, 0) 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")] [node name="ChatAssistant" parent="." instance=ExtResource("2_laew1")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0499932, -0.025, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0499932, -0.025, 0)
text = "Hello, World!" text = "Hello, World!"
flip = true
[node name="Loader" parent="." instance=ExtResource("3_25iy1")] [node name="Loader" parent="." instance=ExtResource("3_25iy1")]

View File

@ -5,33 +5,34 @@ const FontTools = preload ("res://lib/utils/font_tools.gd")
@onready var label: Label3D = $Label3D @onready var label: Label3D = $Label3D
@onready var chat: Skeleton3D = $chat_bubble/Armature/Skeleton3D @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!": @export var text := "Hello, World!":
set(value): set(value):
if !is_node_ready(): await ready
text = value text = value
label.text = value if !is_inside_tree(): return
update()
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: @export var flip: bool = false:
set(value): set(value):
if !is_node_ready(): await ready
flip = value 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 const base_width = 0.8 * 0.2
func update(): func _ready():
var text_width = FontTools.get_font_size(label).x Update.props(self, ["text", "flip"])
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))

View File

@ -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="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="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="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="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"] [node name="Chat" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.41237e-06, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.41237e-06, 0, 0)
script = ExtResource("1_rbrak") script = ExtResource("1_rbrak")
text = "Hello World" text = "Hello World"
flip = true
[node name="chat_bubble" parent="." instance=ExtResource("1_lsdcs")] [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) 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"] [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"] [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") material_override = ExtResource("2_ps3pl")
[node name="Label3D" type="Label3D" parent="."] [node name="Label3D" type="Label3D" parent="."]
@ -30,4 +30,16 @@ font_size = 20
outline_size = 0 outline_size = 0
horizontal_alignment = 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"]
[editable path="chat_bubble-flipped"]

View File

@ -9,14 +9,14 @@ extends Node3D
set(value): set(value):
disabled = value disabled = value
if !is_node_ready(): await ready if !is_inside_tree(): return
corner1.get_node("CollisionShape3D").disabled = value corner1.get_node("CollisionShape3D").disabled = disabled
corner2.get_node("CollisionShape3D").disabled = value corner2.get_node("CollisionShape3D").disabled = disabled
edge.get_node("CollisionShape3D").disabled = value edge.get_node("CollisionShape3D").disabled = disabled
corner1.visible = !value corner1.visible = !disabled
corner2.visible = !value corner2.visible = !disabled
edge.visible = !value edge.visible = !disabled
func _ready(): func _ready():
update_initial_positions() update_initial_positions()
@ -29,7 +29,7 @@ func _ready():
edge.align_to_corners(corner1.global_position, corner2.global_position) edge.align_to_corners(corner1.global_position, corner2.global_position)
corner2.look_at(corner1.global_position, Vector3.UP) 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): 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.global_position = Store.house.align_position2
corner2.look_at(corner1.global_position, Vector3.UP) 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) edge.align_to_corners(corner1.global_position, corner2.global_position)

View File

@ -26,8 +26,14 @@ func update_house():
align_reference.update_align_reference() 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] 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) create_room(new_room.name, 0)
for entity_index in range(Store.house.entities.size()): for entity_index in range(Store.house.entities.size()):

View File

@ -13,13 +13,18 @@ extends Node3D
var editable: bool = false: var editable: bool = false:
set(value): set(value):
if !is_node_ready(): await ready editable = value
if value: if !is_inside_tree(): return
if editable:
state_machine.change_to("Edit") state_machine.change_to("Edit")
else: else:
state_machine.change_to("View") state_machine.change_to("View")
func _ready():
Update.props(self, ["editable"])
func has_point(point: Vector3) -> bool: func has_point(point: Vector3) -> bool:
return get_aabb().has_point(point) return get_aabb().has_point(point)

View File

@ -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="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"] [ext_resource type="Script" path="res://content/system/raycast/raycast.gd" id="1_gp8nv"]

View File

@ -10,6 +10,7 @@ const IconFont = preload ("res://assets/icons/icons.tres")
const ECHO_WAIT_INITIAL = 0.5 const ECHO_WAIT_INITIAL = 0.5
const ECHO_WAIT_REPEAT = 0.1 const ECHO_WAIT_REPEAT = 0.1
@onready var body: StaticBody3D = $Body
@onready var label_node: Label3D = $Body/Label @onready var label_node: Label3D = $Body/Label
@onready var finger_area: Area3D = $FingerArea @onready var finger_area: Area3D = $FingerArea
@ -24,19 +25,21 @@ const ECHO_WAIT_REPEAT = 0.1
@export var font_size: int = 10: @export var font_size: int = 10:
set(value): set(value):
font_size = value font_size = value
if !is_node_ready(): await ready if !is_inside_tree()||icon: return
label_node.font_size = value label_node.font_size = font_size
@export var label: String = "": @export var label: String = "":
set(value): set(value):
label = value label = value
if !is_node_ready(): await ready if !is_inside_tree(): return
label_node.text = value label_node.text = label
@export var icon: bool = false: @export var icon: bool = false:
set(value): set(value):
icon = value icon = value
if !is_node_ready(): await ready if !is_inside_tree(): return
if value: if icon:
label_node.font = IconFont label_node.font = IconFont
label_node.font_size = 36 label_node.font_size = 36
label_node.width = 1000 label_node.width = 1000
@ -51,37 +54,21 @@ const ECHO_WAIT_REPEAT = 0.1
@export var disabled: bool = false @export var disabled: bool = false
@export var echo: bool = false @export var echo: bool = false
@export var initial_active: 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: var active: bool = false:
get:
if external_value != null:
return external_value.value
return active
set(value): set(value):
if !is_node_ready(): await ready active = value
if !is_inside_tree(): return
update_animation(1.0 if active else 0.0)
if external_value != null:
external_value.value = value
else:
active = value
update_animation()
@onready var animation_player: AnimationPlayer = $AnimationPlayer
var echo_timer: Timer = null var echo_timer: Timer = null
func _ready(): func _ready():
if initial_active: if initial_active:
active = true active = true
Update.props(self, ["active", "external_value", "icon", "label", "font_size"])
if echo: if echo:
echo_timer = Timer.new() echo_timer = Timer.new()
echo_timer.wait_time = ECHO_WAIT_INITIAL echo_timer.wait_time = ECHO_WAIT_INITIAL
@ -96,16 +83,12 @@ func _ready():
add_child(echo_timer) add_child(echo_timer)
func update_animation(): func update_animation(value: float):
var length = animation_player.get_animation("down").length var tween = create_tween()
tween.set_parallel(true)
if animation_player.current_animation == "": tween.tween_property(body, "scale:y", lerpf(1.0, 0.5, value), 0.2)
return tween.tween_property(body, "position:y", lerpf(0.01, 0.005, value), 0.2)
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")
func _on_press_down(event): func _on_press_down(event):
if disabled: if disabled:
@ -147,9 +130,6 @@ func _on_touch_enter(event: EventTouch):
if event.target != finger_area: if event.target != finger_area:
return return
animation_player.stop()
animation_player.speed_scale = 0
animation_player.current_animation = "down"
AudioPlayer.play_effect("click") AudioPlayer.play_effect("click")
_touch_change(event) _touch_change(event)
@ -157,9 +137,6 @@ func _on_touch_move(event: EventTouch):
_touch_change(event) _touch_change(event)
func _on_touch_leave(_event: EventTouch): func _on_touch_leave(_event: EventTouch):
animation_player.stop()
animation_player.speed_scale = 1
if toggleable: if toggleable:
active = !active active = !active
if active: if active:
@ -188,7 +165,7 @@ func _touch_change(event: EventTouch):
elif active&&percent >= 1: elif active&&percent >= 1:
on_button_up.emit() on_button_up.emit()
animation_player.seek(percent * animation_player.current_animation_length, true) update_animation(percent)
if toggleable: if toggleable:
return return

View File

@ -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="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="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="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"] [ext_resource type="Script" path="res://content/system/hands/touch_area.gd" id="4_b27lx"]
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_o4j7g"] [sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"]
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) size = Vector3(0.05, 0.02, 0.05)
[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_bqjii"] [sub_resource type="BoxShape3D" id="BoxShape3D_bqjii"]
size = Vector3(0.0501598, 0.0390937, 0.0501598) size = Vector3(0.0501598, 0.0390937, 0.0501598)
@ -88,7 +30,7 @@ mesh = ExtResource("2_cve3l")
skeleton = NodePath("../..") skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
shape = SubResource("ConvexPolygonShape3D_o4j7g") shape = SubResource("BoxShape3D_xwopm")
[node name="Label" type="Label3D" parent="Body"] [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) 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 autowrap_mode = 3
width = 50.0 width = 50.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_sbgno")
}
[node name="FingerArea" type="Area3D" parent="."] [node name="FingerArea" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0101447, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0101447, 0)
collision_layer = 4 collision_layer = 4

View File

@ -11,33 +11,29 @@ var text_handler = preload ("res://content/ui/components/input/text_handler.gd")
@onready var label: Label3D = $Label @onready var label: Label3D = $Label
@export_range(0.1, 2, 0.01, "suffix:m") var width: float = 0.15: @export_range(0.1, 2, 0.01, "suffix:m") var width: float = 0.15:
get:
return text_handler.width
set(value): set(value):
width = value
text_handler.width = value text_handler.width = value
if !is_inside_tree(): return
if !is_node_ready(): await ready mesh_box.mesh.size.x = width
collision.shape.size.x = width
mesh_box.mesh.size.x = value label.position.x = -width / 2 + 0.002
collision.shape.size.x = value
label.position.x = -value / 2 + 0.002
@export var text: String: @export var text: String:
get:
return text_handler.text
set(value): set(value):
text = value
if !is_inside_tree(): return
var focused = Engine.is_editor_hint() == false&&EventSystem.is_focused(self) == false var focused = Engine.is_editor_hint() == false&&EventSystem.is_focused(self) == false
text_handler.set_text(text, focused)
if !is_node_ready(): await ready
text_handler.set_text(value, focused)
label.text = text_handler.get_display_text() label.text = text_handler.get_display_text()
@export var disabled: bool = false: @export var disabled: bool = false:
set(value): set(value):
if !is_node_ready(): await ready
disabled = value disabled = value
if !is_inside_tree(): return
if disabled: if disabled:
label.modulate = Color(0.7, 0.7, 0.7) label.modulate = Color(0.7, 0.7, 0.7)
add_to_group("ui_focus_skip") add_to_group("ui_focus_skip")
@ -52,6 +48,8 @@ var keyboard_input: bool = false
var input_plane = Plane(Vector3.UP, Vector3.ZERO) var input_plane = Plane(Vector3.UP, Vector3.ZERO)
func _ready(): func _ready():
Update.props(self, ["text", "disabled", "width"])
text_handler.label = label text_handler.label = label
if Engine.is_editor_hint(): if Engine.is_editor_hint():

View File

@ -56,7 +56,6 @@ _data = {
collision_layer = 2 collision_layer = 2
collision_mask = 0 collision_mask = 0
script = ExtResource("1_uml3t") script = ExtResource("1_uml3t")
width = 0.2
text = "Example" text = "Example"
[node name="Box" type="MeshInstance3D" parent="."] [node name="Box" type="MeshInstance3D" parent="."]

View File

@ -12,15 +12,18 @@ extends Node3D
@export var type: EventNotify.Type = EventNotify.Type.INFO: @export var type: EventNotify.Type = EventNotify.Type.INFO:
set(value): set(value):
type = value type = value
if !is_node_ready(): await ready if !is_inside_tree(): return
icon_label.text = _type_to_string(value) icon_label.text = _type_to_string(type)
@export var text: String = "": @export var text: String = "":
set(value): set(value):
text = value text = value
if !is_node_ready(): await ready if !is_inside_tree(): return
label.text = value label.text = text
func _ready(): func _ready():
Update.props(self, ["type", "text"])
button.on_button_down.connect(fade_out) button.on_button_down.connect(fade_out)
fade_in() fade_in()
@ -29,7 +32,7 @@ func _ready():
) )
func fade_in(): func fade_in():
if !is_node_ready(): await ready if !is_inside_tree(): await ready
animation_player.play("fade_in") animation_player.play("fade_in")

View File

@ -6,22 +6,26 @@ class_name Slider3D
set(new_value): set(new_value):
min = new_value min = new_value
if value < min: value = min if value < min: value = min
if !is_node_ready(): await ready if !is_inside_tree(): return
_update_slider() _update_slider()
@export var max: float = 1.0: @export var max: float = 1.0:
set(new_value): set(new_value):
max = new_value max = new_value
if value > max: value = max if value > max: value = max
if !is_node_ready(): await ready if !is_inside_tree(): return
_update_slider() _update_slider()
@export var value: float = 0.2: @export var value: float = 0.2:
set(new_value): set(new_value):
value = roundi(clamp(new_value, min, max) / step) * step 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 label.text = str(value) + " " + label_unit
on_value_changed.emit(value) if new_value != value: on_value_changed.emit(value)
_update_slider() _update_slider()
@export var step: float = 0.01 @export var step: float = 0.01
@ -29,29 +33,29 @@ class_name Slider3D
@export var show_label: bool = false: @export var show_label: bool = false:
set(value): set(value):
show_label = value show_label = value
if !is_node_ready(): await ready if !is_inside_tree(): return
label.visible = show_label label.visible = show_label
@export var label_unit: String = "": @export var label_unit: String = "":
set(new_value): set(new_value):
label_unit = new_value label_unit = new_value
if !is_node_ready(): await ready if !is_inside_tree(): return
label.text = str(value) + " " + label_unit label.text = str(value) + " " + label_unit
@export var size: Vector3 = Vector3(0.2, 0.01, 0.02): # Warning, units are in cm @export var size: Vector3 = Vector3(0.2, 0.01, 0.02): # Warning, units are in cm
set(value): set(value):
size = value size = value
if !is_node_ready(): await ready if !is_inside_tree(): return
_update_shape() _update_shape()
@export var cutout_border: float = 0.02: @export var cutout_border: float = 0.02:
set(value): set(value):
cutout_border = value cutout_border = value
if !is_node_ready(): await ready if !is_inside_tree(): return
_update_shape() _update_shape()
@export var cutout_depth: float = 0.05: @export var cutout_depth: float = 0.05:
set(value): set(value):
cutout_depth = value cutout_depth = value
if !is_node_ready(): await ready if !is_inside_tree(): return
_update_shape() _update_shape()
@onready var outside_rod: CSGBox3D = $Rod/Outside @onready var outside_rod: CSGBox3D = $Rod/Outside
@ -68,6 +72,9 @@ signal on_value_changed(value: float)
var move_plane: Plane var move_plane: Plane
func _ready(): func _ready():
Update.props(self, ["value", "show_label", "label_unit"])
_update_slider()
_update_shape() _update_shape()
move_plane = Plane(Vector3.UP, Vector3(0, size.y / 200, 0)) 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(): func _get_slider_min_max():
var cutout_radius = (size.z - cutout_border * 2) / 2 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): func _handle_press(event: EventPointer):
var ray_pos = event.ray.global_position 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) var click_percent = inverse_lerp(min_max.x, min_max.y, pos_x)
value = lerp(min, max, click_percent) value = lerp(min, max, click_percent)
_update_slider()
func _update_slider(): func _update_slider():
var min_max = _get_slider_min_max() var min_max = _get_slider_min_max()
@ -133,7 +139,7 @@ func _update_shape():
cutout_end_right.height = cutout_depth cutout_end_right.height = cutout_depth
cutout_end_left.position = Vector3( cutout_end_left.position = Vector3(
-cutout_box.size.x / 2, - cutout_box.size.x / 2,
0, 0,
0 0
) )

View File

@ -3,26 +3,29 @@ class_name Tabs3D
signal on_select(selected: int) 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 @export var initial_selected: Node3D
var proxy_group = ProxyGroup.new()
func _ready(): func _ready():
if initial_selected != null: if initial_selected != null:
selected = initial_selected selected = initial_selected
on_select.emit(selected.get_index())
for option in get_children(): for option in get_children():
if option is Button3D == false: if option is Button3D == false:
continue continue
var proxy = proxy_group.proxy(func(): option.on_button_down.connect(func():
return selected == option selected=option
, func(value: bool):
if value == true:
selected = option
on_select.emit(selected.get_index())
) )
option.external_value = proxy
option.toggleable = true option.toggleable = true

View File

@ -15,15 +15,16 @@ cull_mode = 2
script = ExtResource("1_ullcc") script = ExtResource("1_ullcc")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [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") shape = SubResource("BoxShape3D_6xl4b")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [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") material_override = SubResource("StandardMaterial3D_087gr")
mesh = SubResource("QuadMesh_chf50") mesh = SubResource("QuadMesh_chf50")
[node name="Label3D" type="Label3D" parent="."] [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 pixel_size = 0.001
text = "Texst text = "Texst
aaa" aaa"

View File

@ -1,6 +1,6 @@
extends Node3D 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 devices_node: GridContainer3D = $Devices
@onready var next_page_button = $Buttons/NextPageButton @onready var next_page_button = $Buttons/NextPageButton
@ -24,13 +24,10 @@ func _ready():
) )
func _enter_tree(): func _enter_tree():
if HomeApi.has_connected(): if !HomeApi.has_connected(): await HomeApi.on_connect
if is_node_ready():
load_devices() load_devices()
else:
HomeApi.on_connect.connect(func():
if is_node_ready():
load_devices()
)
func load_devices(): func load_devices():
if devices.size() == 0: if devices.size() == 0:
@ -38,7 +35,7 @@ func load_devices():
render() render()
HomeApi.on_disconnect.connect(func(): HomeApi.on_disconnect.connect(func():
devices = [] devices=[]
if is_node_ready(): if is_node_ready():
render() render()
) )

View File

@ -26,11 +26,11 @@ script = ExtResource("5_ddrep")
initial_selected = NodePath("Overview") initial_selected = NodePath("Overview")
[node name="Overview" parent="Interface/Tabs3D" instance=ExtResource("4_cghmp")] [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" label = "Overview"
[node name="Rooms" parent="Interface/Tabs3D" instance=ExtResource("4_cghmp")] [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" label = "Rooms"
[node name="TabsContent3D" type="Node3D" parent="Interface" node_paths=PackedStringArray("tabs")] [node name="TabsContent3D" type="Node3D" parent="Interface" node_paths=PackedStringArray("tabs")]
@ -38,5 +38,6 @@ script = ExtResource("6_ba00g")
tabs = NodePath("../Tabs3D") tabs = NodePath("../Tabs3D")
[node name="Overview" parent="Interface/TabsContent3D" instance=ExtResource("6_206ad")] [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")] [node name="Rooms" parent="Interface/TabsContent3D" instance=ExtResource("7_2f8e0")]

View File

@ -49,12 +49,11 @@ var edit_room = false:
selected_room = input.text selected_room = input.text
func _ready(): func _ready():
if Store.house.is_loaded(): if !Store.house.is_loaded(): await Store.house.on_loaded
_generate_room_map()
else: _generate_room_map()
Store.house.on_loaded.connect(func():
_generate_room_map() input.text = "Room %s" % (rooms_map.get_child_count() + 1)
)
room_button.on_button_down.connect(func(): room_button.on_button_down.connect(func():
if selected_room == null: if selected_room == null:
@ -105,7 +104,8 @@ func _on_click(event: EventPointer):
func _generate_room_map(): func _generate_room_map():
var rooms = Store.house.rooms 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(): for old_room in rooms_map.get_children():
old_room.queue_free() old_room.queue_free()
@ -114,6 +114,9 @@ func _generate_room_map():
if rooms.size() == 0: if rooms.size() == 0:
return return
if rooms[0].corners.size() == 0:
return
var current_min = Vector2(rooms[0].corners[0].x, rooms[0].corners[0].y) var current_min = Vector2(rooms[0].corners[0].x, rooms[0].corners[0].y)
var current_max = current_min var current_max = current_min
@ -152,7 +155,7 @@ func _generate_room_map():
var target_scale = target_size / current_size var target_scale = target_size / current_size
var scale_value = min(target_scale.x, target_scale.y) var scale_value = min(target_scale.x, target_scale.y)
rooms_map.position.x = -current_min.x * scale_value rooms_map.position.x = -current_min.x * scale_value + target_offset.x
rooms_map.position.z = -current_min.y * scale_value rooms_map.position.z = -current_min.y * scale_value + target_offset.y
rooms_map.scale = Vector3(scale_value, scale_value, scale_value) rooms_map.scale = Vector3(scale_value, scale_value, scale_value)

View File

@ -8,7 +8,7 @@
script = ExtResource("1_3a1oa") script = ExtResource("1_3a1oa")
[node name="Rooms" type="Node3D" parent="."] [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")] [node name="Button" parent="." instance=ExtResource("1_y3lty")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.27, 0, 0.27) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.27, 0, 0.27)

View File

@ -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)

View File

@ -11,10 +11,9 @@ func proxy(_get: Callable, _set: Callable):
for p in proxies: for p in proxies:
if p != _proxy: if p != _proxy:
p.on_set.emit(value) p.on_set.emit(p.value)
) )
proxies.append(_proxy) proxies.append(_proxy)
return _proxy return _proxy

View File

@ -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))

View File

@ -28,6 +28,7 @@ AudioPlayer="*res://lib/globals/audio_player.gd"
EventSystem="*res://lib/globals/event_system.gd" EventSystem="*res://lib/globals/event_system.gd"
Store="*res://lib/globals/main_store.gd" Store="*res://lib/globals/main_store.gd"
House="*res://lib/globals/house_body.gd" House="*res://lib/globals/house_body.gd"
console="*res://lib/globals/console.gd"
[display] [display]
@ -72,6 +73,7 @@ renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true 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=4
lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=4 lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=4
anti_aliasing/quality/msaa_3d=1
viewport/transparent_background=true viewport/transparent_background=true
[xr] [xr]