clean up and fixes

This commit is contained in:
Nitwel 2024-01-25 12:23:07 +01:00
parent 9328e9ba89
commit 13157c9f84
7 changed files with 20 additions and 27 deletions

View File

@ -26,12 +26,11 @@ func _on_grab_move(_event: EventPointer):
get_parent().global_position = hit_node.global_position
if !lock_rotation:
get_parent().global_rotation = hit_node.global_rotation
get_parent().global_basis = hit_node.global_basis
on_move.emit(get_parent().global_position, get_parent().global_rotation)
else:
on_move.emit(get_parent().global_position, Vector3(0, 0, 0))
func _on_grab_up(event: EventPointer):
event.initiator.node.remove_child(hit_node)

View File

@ -50,8 +50,7 @@ func _ready():
return
add_child(keyboard)
if event.previous_target == null:
keyboard.global_transform = menu.get_node("AnimationContainer/KeyboardPlace").global_transform
keyboard.global_transform = menu.get_node("AnimationContainer/KeyboardPlace").global_transform
)
EventSystem.on_focus_out.connect(func(event):

View File

@ -1,9 +1,15 @@
[gd_scene load_steps=5 format=3 uid="uid://jls16btb8nko"]
[gd_scene load_steps=7 format=3 uid="uid://jls16btb8nko"]
[ext_resource type="Script" path="res://content/system/house/align_reference.gd" id="1_8fatp"]
[ext_resource type="PackedScene" uid="uid://brf6mm2gxj7y2" path="res://content/system/house/room/wall_corner.tscn" id="2_ppkie"]
[ext_resource type="PackedScene" uid="uid://dlj5chj7ndgua" path="res://content/system/house/room/wall_edge.tscn" id="3_6o3xn"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="3_7ktdq"]
[ext_resource type="Material" uid="uid://dxyuncqxagt28" path="res://content/system/house/room/walls_mini.tres" id="4_jkpj4"]
[sub_resource type="CylinderMesh" id="CylinderMesh_k2m3v"]
top_radius = 0.001
bottom_radius = 0.05
height = 0.1
[node name="AlignReference" type="Node3D"]
script = ExtResource("1_8fatp")
@ -18,6 +24,11 @@ lock_rotation = true
[node name="Corner2" parent="Corner1" instance=ExtResource("2_ppkie")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
[node name="MeshInstance3D" parent="Corner1/Corner2" index="1"]
transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0)
material_override = ExtResource("4_jkpj4")
mesh = SubResource("CylinderMesh_k2m3v")
[node name="Movable" type="Node" parent="Corner1/Corner2"]
script = ExtResource("3_7ktdq")
lock_rotation = true
@ -26,3 +37,5 @@ lock_rotation = true
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0.5, 0, 0)
[node name="Marker3D" type="Marker3D" parent="Edge"]
[editable path="Corner1/Corner2"]

View File

@ -23,4 +23,5 @@ restricted = true
lock_rotation = true
[node name="AlignReference" parent="." instance=ExtResource("3_e1tcn")]
visible = false
disabled = true

View File

@ -50,23 +50,4 @@ func get_aabb():
min_pos.y = room_floor.position.y
max_pos.y = room_ceiling.position.y
return AABB(to_global(min_pos), to_global(max_pos) - to_global(min_pos))
func _save():
return {
"corners": wall_corners.get_children().map(func(corner): return corner.position),
"name": name
}
func _load(data):
await ready
return
name = data["name"]
state_machine.change_to("Edit")
for corner in data["corners"]:
state_machine.current_state.add_corner(corner)
state_machine.change_to("View")
return AABB(to_global(min_pos), to_global(max_pos) - to_global(min_pos))

View File

@ -15,7 +15,7 @@ var selected_room = null:
set(value):
if selected_room != null && value == null:
room_button.label = "add"
input.text = "New Room %s" % (rooms_map.get_child_count() + 1)
input.text = "Room %s" % (rooms_map.get_child_count() + 1)
if selected_room != null:
var old_room = get_room(selected_room)

View File

@ -17,4 +17,4 @@ icon = true
[node name="Input" parent="." instance=ExtResource("2_hstw7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.12, 0.005, 0.27)
text = ""
text = "Room 1"