fix rooms and input focus

This commit is contained in:
Nitwel 2024-04-25 11:45:14 +02:00
parent b2f6b707d2
commit 0745cdf99c
10 changed files with 39 additions and 18 deletions

View File

@ -51,7 +51,7 @@ transform = Transform3D(1, -7.45058e-09, -2.22045e-16, 7.45058e-09, 1, 0, 0, 0,
shape = SubResource("CapsuleShape3D_dopke") shape = SubResource("CapsuleShape3D_dopke")
[node name="ThumbTip" type="BoneAttachment3D" parent="XRHandLeft"] [node name="ThumbTip" type="BoneAttachment3D" parent="XRHandLeft"]
transform = Transform3D(0.937246, 0.0284254, -0.347508, 0.0184905, 0.991216, 0.130949, 0.348178, -0.129157, 0.928488, 0.0498668, 0.0560917, -0.112777) transform = Transform3D(0.937246, 0.0284254, -0.347508, 0.0184905, 0.991216, 0.130949, 0.348178, -0.129157, 0.928487, 0.0498668, 0.0560917, -0.112777)
bone_name = "Thumb_Tip_L" bone_name = "Thumb_Tip_L"
bone_idx = 4 bone_idx = 4
use_external_skeleton = true use_external_skeleton = true
@ -61,7 +61,7 @@ external_skeleton = NodePath("../left_hand/Armature_001/Skeleton3D")
gizmo_extents = 0.02 gizmo_extents = 0.02
[node name="MiddleTip" type="BoneAttachment3D" parent="XRHandLeft"] [node name="MiddleTip" type="BoneAttachment3D" parent="XRHandLeft"]
transform = Transform3D(0.0812012, -0.650531, -0.755125, 0.996577, 0.064817, 0.051326, 0.0155558, -0.756708, 0.653568, 0.032112, 0.00654224, -0.171612) transform = Transform3D(0.0812012, -0.650531, -0.755125, 0.996576, 0.064817, 0.051326, 0.0155558, -0.756708, 0.653567, 0.032112, 0.00654224, -0.171612)
bone_name = "Middle_Tip_L" bone_name = "Middle_Tip_L"
bone_idx = 14 bone_idx = 14
use_external_skeleton = true use_external_skeleton = true
@ -112,7 +112,7 @@ transform = Transform3D(1, 0, 4.7579e-13, 0, 1, 0, -1.34149e-12, 1.77636e-15, 1,
material_override = SubResource("StandardMaterial3D_n27ki") material_override = SubResource("StandardMaterial3D_n27ki")
[node name="IndexTip" type="BoneAttachment3D" parent="XRHandRight"] [node name="IndexTip" type="BoneAttachment3D" parent="XRHandRight"]
transform = Transform3D(0.19221, 0.669966, 0.717079, -0.091543, -0.715277, 0.69282, 0.977075, -0.19881, -0.0761527, -0.0345977, -0.164767, -0.0355401) transform = Transform3D(0.19221, 0.669966, 0.717078, -0.091543, -0.715277, 0.69282, 0.977075, -0.19881, -0.0761527, -0.0345978, -0.164767, -0.0355401)
bone_name = "Index_Tip_R" bone_name = "Index_Tip_R"
bone_idx = 9 bone_idx = 9
use_external_skeleton = true use_external_skeleton = true
@ -142,7 +142,7 @@ external_skeleton = NodePath("../right_hand/Armature/Skeleton3D")
gizmo_extents = 0.02 gizmo_extents = 0.02
[node name="MiddleTip" type="BoneAttachment3D" parent="XRHandRight"] [node name="MiddleTip" type="BoneAttachment3D" parent="XRHandRight"]
transform = Transform3D(0.0812011, 0.650531, 0.755126, -0.0155557, -0.756709, 0.653568, 0.996576, -0.0648169, -0.0513262, -0.032112, -0.171612, -0.00654216) transform = Transform3D(0.0812011, 0.650531, 0.755126, -0.0155557, -0.756708, 0.653568, 0.996576, -0.0648169, -0.0513262, -0.032112, -0.171612, -0.00654216)
bone_name = "Middle_Tip_R" bone_name = "Middle_Tip_R"
bone_idx = 14 bone_idx = 14
use_external_skeleton = true use_external_skeleton = true

View File

@ -31,6 +31,7 @@ lower_fade = 0.000919435
[node name="CursorSprite" type="Sprite3D" parent="Cursor"] [node name="CursorSprite" type="Sprite3D" parent="Cursor"]
transform = Transform3D(0.03, 2.71051e-20, 0, -5.42101e-20, 0.03, -2.03288e-21, -2.46521e-33, 2.5411e-21, 0.03, 0, 0, 0) transform = Transform3D(0.03, 2.71051e-20, 0, -5.42101e-20, 0.03, -2.03288e-21, -2.46521e-33, 2.5411e-21, 0.03, 0, 0, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 90
texture = ExtResource("1_2f2iv") texture = ExtResource("1_2f2iv")
[node name="Ray" type="MeshInstance3D" parent="."] [node name="Ray" type="MeshInstance3D" parent="."]

View File

@ -43,7 +43,7 @@ text = "Example Text"
font_size = 10 font_size = 10
outline_size = 0 outline_size = 0
autowrap_mode = 3 autowrap_mode = 3
width = 40.0 width = 50.0
[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, -0.015) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.015)

View File

@ -29,7 +29,7 @@ var text_handler = preload ("res://content/ui/components/input/text_handler.gd")
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")
animation.stop() animation.stop()
caret.hide() caret.visible = false
else: else:
label.modulate = Color(1, 1, 1) label.modulate = Color(1, 1, 1)
remove_from_group("ui_focus_skip") remove_from_group("ui_focus_skip")
@ -110,7 +110,7 @@ func _on_focus_in(_event):
caret.position.x = text_handler.get_caret_position() caret.position.x = text_handler.get_caret_position()
label.text = text_handler.get_display_text() label.text = text_handler.get_display_text()
caret.show() caret.visible = true
animation.play("blink") animation.play("blink")
func update_caret_position(event): func update_caret_position(event):
@ -135,7 +135,7 @@ func _on_focus_out(_event):
return return
animation.stop() animation.stop()
caret.hide() caret.visible = false
func _draw_debug_text_gaps(): func _draw_debug_text_gaps():
if text_handler.gap_offsets == null: if text_handler.gap_offsets == null:

View File

@ -70,15 +70,15 @@ _data = {
"blink": SubResource("Animation_8ny1h") "blink": SubResource("Animation_8ny1h")
} }
[node name="Input" type="Node3D"] [node name="Input" type="Node3D" groups=["ui_focus"]]
script = ExtResource("1_uml3t") script = ExtResource("1_uml3t")
text = "Example Text" text = "Example Text"
size = Vector3(0.15, 0.03, 0.01) size = Vector3(0.15, 0.03, 0.01)
[node name="Body" type="StaticBody3D" parent="." groups=["ui_focus"]] [node name="Body" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
collision_layer = 6 collision_layer = 6
collision_mask = 0 collision_mask = 6
[node name="Box" type="MeshInstance3D" parent="Body"] [node name="Box" type="MeshInstance3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)

View File

@ -104,7 +104,7 @@ func _on_click(event: EventPointer):
func _generate_room_map(): func _generate_room_map():
var rooms = Store.house.state.rooms var rooms = Store.house.state.rooms
var target_size = Vector2(0.2, 0.24) var target_size = Vector2(0.2, 0.2)
var target_offset = Vector2(0, 0.05) var target_offset = Vector2(0, 0.05)
for old_room in rooms_map.get_children(): for old_room in rooms_map.get_children():
@ -156,6 +156,7 @@ func _generate_room_map():
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 + target_offset.x 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.position.y = current_min.y * scale_value - target_offset.y
rooms_map.position.z = 0.002
rooms_map.scale = Vector3(scale_value, scale_value, scale_value) rooms_map.scale = Vector3(scale_value, scale_value, scale_value)

View File

@ -26,7 +26,7 @@ size = Vector2(0.42, 0.32)
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.14, -0.13, 0) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.14, -0.15, 0)
[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.2, -0.28, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.28, 0)
@ -40,7 +40,6 @@ disabled = true
[node name="Background" type="MeshInstance3D" parent="."] [node name="Background" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0) transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0.16, 0)
visible = false
material_override = SubResource("ShaderMaterial_dah0r") material_override = SubResource("ShaderMaterial_dah0r")
mesh = SubResource("QuadMesh_fq44b") mesh = SubResource("QuadMesh_fq44b")
skeleton = NodePath("../..") skeleton = NodePath("../..")

View File

@ -36,6 +36,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.007, 0)
[node name="ConnectionStatus" type="Label3D" parent="Content"] [node name="ConnectionStatus" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.251, -0.151, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.251, -0.151, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Disconnected" text = "Disconnected"
font_size = 8 font_size = 8
outline_size = 0 outline_size = 0
@ -43,6 +45,8 @@ outline_size = 0
[node name="LabelURL" type="Label3D" parent="Content"] [node name="LabelURL" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.03, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.03, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "url: text = "url:
" "
font_size = 18 font_size = 18
@ -57,6 +61,8 @@ size = Vector3(0.2, 0.03, 0.01)
[node name="LabelToken" type="Label3D" parent="Content"] [node name="LabelToken" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.07, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.07, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "token:" text = "token:"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -70,6 +76,8 @@ size = Vector3(0.2, 0.03, 0.01)
[node name="LabelConnect" type="Label3D" parent="Content"] [node name="LabelConnect" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.14, -0.12, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.14, -0.12, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Connect" text = "Connect"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -90,6 +98,8 @@ shape = SubResource("BoxShape3D_3qdps")
[node name="Label" type="Label3D" parent="Content/Credits"] [node name="Label" type="Label3D" parent="Content/Credits"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.98023e-08, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.98023e-08, 0, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "credits" text = "credits"
font_size = 12 font_size = 12
outline_size = 0 outline_size = 0
@ -97,6 +107,8 @@ outline_size = 0
[node name="Hearth" type="Label3D" parent="Content/Credits"] [node name="Hearth" type="Label3D" parent="Content/Credits"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
modulate = Color(0.584314, 0, 0, 1) modulate = Color(0.584314, 0, 0, 1)
text = "favorite" text = "favorite"
font = ExtResource("5_eiwd4") font = ExtResource("5_eiwd4")
@ -109,6 +121,8 @@ script = ExtResource("3_qmg6q")
[node name="SaveLabel" type="Label3D" parent="Content"] [node name="SaveLabel" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.21, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.21, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Manual Save:" text = "Manual Save:"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -122,6 +136,8 @@ icon = true
[node name="clearSaveLabel" type="Label3D" parent="Content"] [node name="clearSaveLabel" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.26, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.26, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Clear Save:" text = "Clear Save:"
font_size = 18 font_size = 18
outline_size = 0 outline_size = 0
@ -135,6 +151,8 @@ icon = true
[node name="clearSaveWarning" type="Label3D" parent="Content"] [node name="clearSaveWarning" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.28, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.28, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
modulate = Color(1, 0, 0, 1) modulate = Color(1, 0, 0, 1)
text = "Caution! This will delete all your rooms and placed devices." text = "Caution! This will delete all your rooms and placed devices."
font_size = 8 font_size = 8
@ -152,6 +170,8 @@ toggleable = true
[node name="LabelVoiceAssist" type="Label3D" parent="Content"] [node name="LabelVoiceAssist" type="Label3D" parent="Content"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.12, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.12, 0)
pixel_size = 0.001 pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Voice- text = "Voice-
Assist:" Assist:"
font_size = 18 font_size = 18

View File

@ -1,8 +1,6 @@
extends Event extends EventBubble
## Emitted when a Node with the `ui_focus` group is focused or unfocused. ## Emitted when a Node with the `ui_focus` group is focused or unfocused.
class_name EventFocus class_name EventFocus
## The Node that is being focused or unfocused.
var target: Node
## The Node that was previously focused or unfocused. ## The Node that was previously focused or unfocused.
var previous_target: Node var previous_target: Node

View File

@ -96,8 +96,10 @@ func _handle_focus(target: Variant, event: EventBubble):
var event_focus = EventFocus.new() var event_focus = EventFocus.new()
event_focus.previous_target = _active_node event_focus.previous_target = _active_node
event_focus.target = target event_focus.target = target
event_focus.bubbling = false
if _active_node != null&&_active_node.has_method(FN_PREFIX + "focus_out"): if _active_node != null&&_active_node.has_method(FN_PREFIX + "focus_out"):
emit("focus_out", event_focus)
_active_node.call(FN_PREFIX + "focus_out", event_focus) _active_node.call(FN_PREFIX + "focus_out", event_focus)
on_focus_out.emit(event_focus) on_focus_out.emit(event_focus)