Merge pull request #160 from Nitwel/imp2
Add basic room importing (Quest), fix delete button, add entity settings and color_wheel component
This commit is contained in:
commit
231f64f4f5
|
@ -1,3 +0,0 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f523eb87489026aa87814b63b31e0ce83ca91a0729ef7d93079e39a67e348fb5
|
||||
size 237647
|
|
@ -1,36 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://hy2f6is7qjyv"
|
||||
path.s3tc="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/canvas.png"
|
||||
dest_files=["res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.s3tc.ctex", "res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
17
app/assets/materials/wall.tres
Normal file
17
app/assets/materials/wall.tres
Normal file
|
@ -0,0 +1,17 @@
|
|||
[gd_resource type="StandardMaterial3D" load_steps=4 format=3 uid="uid://ce6lspn6sno1o"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_jxq6i"]
|
||||
offsets = PackedFloat32Array(0, 0.492147, 1)
|
||||
colors = PackedColorArray(1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1)
|
||||
metadata/_snap_count = 2
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_ihydr"]
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_qcr8e"]
|
||||
color_ramp = SubResource("Gradient_jxq6i")
|
||||
noise = SubResource("FastNoiseLite_ihydr")
|
||||
|
||||
[resource]
|
||||
albedo_texture = SubResource("NoiseTexture2D_qcr8e")
|
||||
metallic = 0.38
|
||||
roughness = 0.29
|
|
@ -11,3 +11,6 @@ func _ready():
|
|||
movable.on_moved.connect(func():
|
||||
App.house.save_all_entities()
|
||||
)
|
||||
|
||||
func get_options():
|
||||
return {}
|
|
@ -1,7 +1,6 @@
|
|||
extends Entity
|
||||
|
||||
const Entity = preload ("../entity.gd")
|
||||
const color_wheel_img := preload ("res://assets/canvas.png")
|
||||
|
||||
@export var color_off = Color(0.23, 0.23, 0.23)
|
||||
@export var color_on = Color(1.0, 0.85, 0.0)
|
||||
|
@ -9,17 +8,24 @@ const color_wheel_img := preload ("res://assets/canvas.png")
|
|||
@onready var lightbulb = $Lightbulb
|
||||
@onready var slider: Slider3D = $Slider
|
||||
@onready var color_wheel = $ColorWheel
|
||||
@onready var color_puck = $ColorWheel/Puck
|
||||
@onready var modes = $Modes
|
||||
@onready var mode_next = $Modes/Next
|
||||
@onready var mode_before = $Modes/Previous
|
||||
@onready var mode_label = $Modes/Label
|
||||
@onready var snap_sound = $SnapSound
|
||||
@onready var settings = $Settings
|
||||
@onready var movable = $Movable
|
||||
@onready var camera_follower = $CameraFollower
|
||||
|
||||
var active = R.state(false)
|
||||
var brightness = R.state(0) # 0-255
|
||||
var color = R.state(color_on)
|
||||
var color_supported = false
|
||||
var show_color_wheel = R.state(true)
|
||||
var color_wheel_supported = R.state(false)
|
||||
var show_brightness = R.state(true)
|
||||
var show_modes = R.state(true)
|
||||
var modes_supported = R.state(false)
|
||||
var show_settings = R.state(false)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
@ -32,7 +38,41 @@ func _ready():
|
|||
var stateInfo = await HomeApi.get_state(entity_id)
|
||||
set_state(stateInfo)
|
||||
|
||||
remove_child(settings)
|
||||
|
||||
R.effect(func(_arg):
|
||||
if show_settings.value:
|
||||
add_child(settings)
|
||||
elif settings.is_inside_tree():
|
||||
remove_child(settings)
|
||||
camera_follower.reset()
|
||||
App.house.save_all_entities()
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
if show_color_wheel.value&&color_wheel_supported.value:
|
||||
add_child(color_wheel)
|
||||
else:
|
||||
remove_child(color_wheel)
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
if show_brightness.value:
|
||||
add_child(slider)
|
||||
else:
|
||||
remove_child(slider)
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
if show_modes.value&&modes_supported.value:
|
||||
add_child(modes)
|
||||
else:
|
||||
remove_child(modes)
|
||||
)
|
||||
|
||||
if stateInfo.has("attributes")&&stateInfo["attributes"].has("effect_list")&&stateInfo["attributes"]["effect_list"].size() > 0:
|
||||
modes_supported.value = true
|
||||
|
||||
if stateInfo["attributes"].has("effect")&&stateInfo["attributes"]["effect"] != null:
|
||||
mode_label.text = stateInfo["attributes"]["effect"]
|
||||
|
||||
|
@ -59,38 +99,29 @@ func _ready():
|
|||
|
||||
HomeApi.set_state(entity_id, "on", {"effect": stateInfo["attributes"]["effect_list"][index]})
|
||||
)
|
||||
else:
|
||||
remove_child(modes)
|
||||
|
||||
if stateInfo.has("attributes")&&stateInfo["attributes"].has("supported_color_modes")&&stateInfo["attributes"]["supported_color_modes"].has("rgb"):
|
||||
color_wheel.get_node("Clickable").on_press_down.connect(func(event: EventPointer):
|
||||
var target_point=color_wheel.to_local(event.ray.get_collision_point())
|
||||
|
||||
var delta=Vector2(target_point.x, target_point.z) * (1.0 / 0.08)
|
||||
if delta.length() > 1:
|
||||
delta=delta.normalized()
|
||||
|
||||
var picked_color=color_wheel_img.get_image().get_pixel((delta.x * 0.5 + 0.5) * 1000, (delta.y * 0.5 + 0.5) * 1000)
|
||||
|
||||
color_puck.material_override.albedo_color=picked_color
|
||||
color_puck.position=Vector3(target_point.x, color_puck.position.y, target_point.z)
|
||||
|
||||
var attributes={
|
||||
"rgb_color": [int(picked_color.r * 255), int(picked_color.g * 255), int(picked_color.b * 255)],
|
||||
}
|
||||
|
||||
snap_sound.play()
|
||||
|
||||
HomeApi.set_state(entity_id, "on", attributes)
|
||||
)
|
||||
color_supported = true
|
||||
else:
|
||||
remove_child(color_wheel)
|
||||
color_wheel_supported.value = true
|
||||
|
||||
await HomeApi.watch_state(entity_id, func(new_state):
|
||||
set_state(new_state)
|
||||
)
|
||||
|
||||
color_wheel.on_color_changed.connect(func(new_color):
|
||||
if color.value == new_color:
|
||||
return
|
||||
|
||||
var attributes={
|
||||
"rgb_color": [int(new_color.r * 255), int(new_color.g * 255), int(new_color.b * 255)],
|
||||
}
|
||||
|
||||
snap_sound.play()
|
||||
|
||||
print("set color", new_color, attributes["rgb_color"])
|
||||
|
||||
HomeApi.set_state(entity_id, "on", attributes)
|
||||
)
|
||||
|
||||
slider.on_value_changed.connect(func(new_value):
|
||||
var value=new_value / 100 * 255
|
||||
HomeApi.set_state(entity_id, "on" if active.value else "off", {"brightness": int(value)})
|
||||
|
@ -110,6 +141,8 @@ func set_state(stateInfo):
|
|||
|
||||
if attributes.has("rgb_color")&&attributes["rgb_color"] != null:
|
||||
color.value = Color(attributes["rgb_color"][0] / 255.0, attributes["rgb_color"][1] / 255.0, attributes["rgb_color"][2] / 255.0, 1)
|
||||
print("got color", color.value, attributes["rgb_color"])
|
||||
color_wheel.color = color.value
|
||||
|
||||
var tween = create_tween()
|
||||
|
||||
|
@ -117,9 +150,9 @@ func set_state(stateInfo):
|
|||
|
||||
if active.value:
|
||||
if brightness.value == null:
|
||||
target_color = color.value if color_supported else color_on
|
||||
target_color = color.value if show_color_wheel.value else color_on
|
||||
else:
|
||||
target_color = color_off.lerp(color.value if color_supported else color_on, brightness.value / 255.0)
|
||||
target_color = color_off.lerp(color.value if show_color_wheel.value else color_on, brightness.value / 255.0)
|
||||
|
||||
icon_color.value = target_color
|
||||
tween.tween_property(lightbulb, "material_override:albedo_color", target_color, 0.3)
|
||||
|
@ -134,3 +167,22 @@ func quick_action():
|
|||
|
||||
func _toggle():
|
||||
HomeApi.set_state(entity_id, "off" if active.value else "on")
|
||||
|
||||
func toggle_settings():
|
||||
if show_settings.value == false:
|
||||
show_settings.value = true
|
||||
camera_follower.enabled = true
|
||||
else:
|
||||
show_settings.value = false
|
||||
|
||||
func get_options():
|
||||
return {
|
||||
"color_wheel": show_color_wheel.value,
|
||||
"brightness": show_brightness.value,
|
||||
"modes": show_modes.value,
|
||||
}
|
||||
|
||||
func set_options(options):
|
||||
show_color_wheel.value = options["color_wheel"]
|
||||
show_brightness.value = options["brightness"]
|
||||
show_modes.value = options["modes"]
|
|
@ -1,35 +1,18 @@
|
|||
[gd_scene load_steps=15 format=3 uid="uid://cw86rc42dv2d8"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://cw86rc42dv2d8"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/entities/light/light.gd" id="1_ykxy3"]
|
||||
[ext_resource type="Script" path="res://content/functions/movable.gd" id="4_4sfxb"]
|
||||
[ext_resource type="Material" uid="uid://vce66e7sbc3n" path="res://content/entities/light/light_on.tres" id="5_50gph"]
|
||||
[ext_resource type="PackedScene" uid="uid://chrjqr4l7atrc" path="res://content/ui/components/color_wheel/color_wheel.tscn" id="5_qj75k"]
|
||||
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="6_mhjlm"]
|
||||
[ext_resource type="Texture2D" uid="uid://hy2f6is7qjyv" path="res://assets/canvas.png" id="7_ximu1"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="8_1sfll"]
|
||||
[ext_resource type="AudioStream" uid="uid://du7ur0lu28cvn" path="res://assets/sound/finger-snap.mp3" id="8_3togy"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="8_nhcff"]
|
||||
[ext_resource type="Script" path="res://content/functions/camera_follower.gd" id="9_a7u7m"]
|
||||
[ext_resource type="PackedScene" uid="uid://de34yde00ngkv" path="res://content/entities/light/settings.tscn" id="10_su84f"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"]
|
||||
radius = 0.05
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_k3ob2"]
|
||||
points = PackedVector3Array(0, -0.005, -0.08, -0.00784652, -0.005, -0.0796241, 0, 0.005, -0.08, 0.00783085, -0.005, -0.0796241, -0.00784652, 0.005, -0.0796241, -0.0156147, -0.005, -0.0784651, 0.00783085, 0.005, -0.0796241, 0.0155991, -0.005, -0.0784651, -0.0156147, 0.005, -0.0784651, -0.0232263, -0.005, -0.0765701, 0.0155991, 0.005, -0.0784651, 0.0232106, -0.005, -0.0765701, -0.0232263, 0.005, -0.0765701, -0.0306186, -0.005, -0.0739233, 0.0232106, 0.005, -0.0765701, 0.030603, -0.005, -0.0739233, -0.0306186, 0.005, -0.0739233, -0.0377134, -0.005, -0.070556, 0.030603, 0.005, -0.0739233, 0.0376977, -0.005, -0.070556, -0.0377134, 0.005, -0.070556, -0.0444479, -0.005, -0.0665309, 0.0376977, 0.005, -0.070556, 0.0444323, -0.005, -0.0665309, -0.0444479, 0.005, -0.0665309, -0.0507596, -0.005, -0.0618481, 0.0444323, 0.005, -0.0665309, 0.0507439, -0.005, -0.0618481, -0.0507596, 0.005, -0.0618481, -0.0565701, -0.005, -0.0565701, 0.0507439, 0.005, -0.0618481, 0.0565544, -0.005, -0.0565701, -0.0565701, 0.005, -0.0565701, -0.0618481, -0.005, -0.0507596, 0.0565544, 0.005, -0.0565701, 0.0618324, -0.005, -0.0507596, -0.0618481, 0.005, -0.0507596, -0.0665309, -0.005, -0.0444479, 0.0618324, 0.005, -0.0507596, 0.0665153, -0.005, -0.0444479, -0.0665309, 0.005, -0.0444479, -0.070556, -0.005, -0.0377134, 0.0665153, 0.005, -0.0444479, 0.0705403, -0.005, -0.0377134, -0.070556, 0.005, -0.0377134, -0.0739233, -0.005, -0.0306186, 0.0705403, 0.005, -0.0377134, 0.0739076, -0.005, -0.0306186, -0.0739233, 0.005, -0.0306186, -0.0765701, -0.005, -0.0232263, 0.0739076, 0.005, -0.0306186, 0.0765544, -0.005, -0.0232263, -0.0765701, 0.005, -0.0232263, -0.0784651, -0.005, -0.0156147, 0.0765544, 0.005, -0.0232263, 0.0784495, -0.005, -0.0156147, -0.0784651, 0.005, -0.0156147, -0.0796241, -0.005, -0.00784652, 0.0784495, 0.005, -0.0156147, 0.0796085, -0.005, -0.00784652, -0.0796241, 0.005, -0.00784652, -0.08, -0.005, 0, 0.0796085, 0.005, -0.00784652, 0.08, -0.005, 0, -0.08, 0.005, 0, -0.0796241, -0.005, 0.00783085, 0.08, 0.005, 0, 0.0796085, -0.005, 0.00783085, -0.0796241, 0.005, 0.00783085, -0.0784651, -0.005, 0.0155991, 0.0796085, 0.005, 0.00783085, 0.0784495, -0.005, 0.0155991, -0.0784651, 0.005, 0.0155991, -0.0765701, -0.005, 0.0232106, 0.0784495, 0.005, 0.0155991, 0.0765544, -0.005, 0.0232106, -0.0765701, 0.005, 0.0232106, -0.0739233, -0.005, 0.030603, 0.0765544, 0.005, 0.0232106, 0.0739076, -0.005, 0.030603, -0.0739233, 0.005, 0.030603, -0.070556, -0.005, 0.0376977, 0.0739076, 0.005, 0.030603, 0.0705403, -0.005, 0.0376977, -0.070556, 0.005, 0.0376977, -0.0665309, -0.005, 0.0444323, 0.0705403, 0.005, 0.0376977, 0.0665153, -0.005, 0.0444323, -0.0665309, 0.005, 0.0444323, -0.0618481, -0.005, 0.0507439, 0.0665153, 0.005, 0.0444323, 0.0618324, -0.005, 0.0507439, -0.0618481, 0.005, 0.0507439, -0.0565701, -0.005, 0.0565544, 0.0618324, 0.005, 0.0507439, 0.0565544, -0.005, 0.0565544, -0.0565701, 0.005, 0.0565544, -0.0507596, -0.005, 0.0618324, 0.0565544, 0.005, 0.0565544, 0.0507439, -0.005, 0.0618324, -0.0507596, 0.005, 0.0618324, -0.0444479, -0.005, 0.0665153, 0.0507439, 0.005, 0.0618324, 0.0444323, -0.005, 0.0665153, -0.0444479, 0.005, 0.0665153, -0.0377134, -0.005, 0.0705403, 0.0444323, 0.005, 0.0665153, 0.0376977, -0.005, 0.0705403, -0.0377134, 0.005, 0.0705403, -0.0306186, -0.005, 0.0739076, 0.0376977, 0.005, 0.0705403, 0.030603, -0.005, 0.0739076, -0.0306186, 0.005, 0.0739076, -0.0232263, -0.005, 0.0765544, 0.030603, 0.005, 0.0739076, 0.0232106, -0.005, 0.0765544, -0.0232263, 0.005, 0.0765544, -0.0156147, -0.005, 0.0784495, 0.0232106, 0.005, 0.0765544, 0.0155991, -0.005, 0.0784495, -0.0156147, 0.005, 0.0784495, -0.00784652, -0.005, 0.0796085, 0.0155991, 0.005, 0.0784495, 0.00783085, -0.005, 0.0796085, -0.00784652, 0.005, 0.0796085, 0, -0.005, 0.08, 0.00783085, 0.005, 0.0796085, 0, 0.005, 0.08)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7p762"]
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_c10un"]
|
||||
top_radius = 0.08
|
||||
bottom_radius = 0.08
|
||||
height = 0.01
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1jd14"]
|
||||
resource_local_to_scene = true
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_x68ys"]
|
||||
top_radius = 0.01
|
||||
bottom_radius = 0.01
|
||||
height = 0.005
|
||||
|
||||
[node name="Light" type="StaticBody3D"]
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_ykxy3")
|
||||
|
@ -62,31 +45,10 @@ max = 100.0
|
|||
value = 100.0
|
||||
step = 1.0
|
||||
|
||||
[node name="ColorWheel" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.15, 0, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="ColorWheel"]
|
||||
shape = SubResource("ConvexPolygonShape3D_k3ob2")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="ColorWheel"]
|
||||
transform = Transform3D(0.15, 0, 0, 0, -6.55671e-09, -0.15, 0, 0.15, -6.55671e-09, 0, 0.004, 0)
|
||||
flip_v = true
|
||||
pixel_size = 0.001
|
||||
texture = ExtResource("7_ximu1")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="ColorWheel"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.002, 0)
|
||||
material_override = SubResource("StandardMaterial3D_7p762")
|
||||
mesh = SubResource("CylinderMesh_c10un")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Clickable" type="Node" parent="ColorWheel"]
|
||||
script = ExtResource("8_1sfll")
|
||||
|
||||
[node name="Puck" type="MeshInstance3D" parent="ColorWheel"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.65661e-10, 0.01, 0)
|
||||
material_override = SubResource("StandardMaterial3D_1jd14")
|
||||
mesh = SubResource("CylinderMesh_x68ys")
|
||||
[node name="ColorWheel" parent="." instance=ExtResource("5_qj75k")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.15, 0, 0)
|
||||
color = Color(0, 0.616667, 1, 1)
|
||||
size = Vector3(0.15, 0.2, 0.01)
|
||||
|
||||
[node name="Modes" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.11, 0)
|
||||
|
@ -110,3 +72,15 @@ horizontal_alignment = 0
|
|||
[node name="SnapSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("8_3togy")
|
||||
volume_db = -20.0
|
||||
|
||||
[node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")]
|
||||
script = ExtResource("9_a7u7m")
|
||||
enabled = false
|
||||
focus_point = NodePath("../FocusPoint")
|
||||
|
||||
[node name="FocusPoint" type="Marker3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29, 0, 0)
|
||||
gizmo_extents = 0.1
|
||||
|
||||
[node name="Settings" parent="." instance=ExtResource("10_su84f")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29, 0, 0)
|
||||
|
|
36
app/content/entities/light/settings.gd
Normal file
36
app/content/entities/light/settings.gd
Normal file
|
@ -0,0 +1,36 @@
|
|||
extends Node3D
|
||||
|
||||
const Light = preload ("./light.gd")
|
||||
|
||||
@onready var close_button: Button3D = $Close
|
||||
@onready var id_input: Input3D = $IDInput
|
||||
@onready var color_wheel_button: Button3D = $ColorWheelButton
|
||||
@onready var brightness_button: Button3D = $BrightnessButton
|
||||
@onready var modes_button: Button3D = $ModesButton
|
||||
|
||||
var light: Light
|
||||
|
||||
func _ready():
|
||||
light = get_parent()
|
||||
|
||||
close_button.on_button_up.connect(func():
|
||||
light.show_settings.value=false
|
||||
)
|
||||
|
||||
id_input.text = light.entity_id
|
||||
|
||||
R.effect(func(_arg):
|
||||
color_wheel_button.label="check" if light.show_color_wheel.value else "close"
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
brightness_button.label="check" if light.show_brightness.value else "close"
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
modes_button.label="check" if light.show_modes.value else "close"
|
||||
)
|
||||
|
||||
R.bind(color_wheel_button, "active", light.show_color_wheel, color_wheel_button.on_toggled)
|
||||
R.bind(brightness_button, "active", light.show_brightness, brightness_button.on_toggled)
|
||||
R.bind(modes_button, "active", light.show_modes, modes_button.on_toggled)
|
112
app/content/entities/light/settings.tscn
Normal file
112
app/content/entities/light/settings.tscn
Normal file
|
@ -0,0 +1,112 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://de34yde00ngkv"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dnam3fe36gg62" path="res://content/ui/components/panel/panel.tscn" id="1_78ups"]
|
||||
[ext_resource type="Script" path="res://content/entities/light/settings.gd" id="1_gw2gi"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_m4moa"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_2gpr3"]
|
||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="4_upyp3"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vmdy0"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 10
|
||||
shader = ExtResource("2_m4moa")
|
||||
shader_parameter/color = Color(1, 1, 1, 0.3)
|
||||
shader_parameter/border_color = Color(1, 1, 1, 1)
|
||||
shader_parameter/edge_color = Color(0, 0, 0, 1)
|
||||
shader_parameter/size = Vector2(7.5, 6.25)
|
||||
shader_parameter/border_size = 0.01
|
||||
shader_parameter/border_fade_in = 0.05
|
||||
shader_parameter/border_fade_out = 0.0
|
||||
shader_parameter/corner_radius = 0.2
|
||||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_qu5ku"]
|
||||
size = Vector2(0.3, 0.25)
|
||||
|
||||
[node name="Settings" type="Node3D"]
|
||||
script = ExtResource("1_gw2gi")
|
||||
|
||||
[node name="Panel" parent="." instance=ExtResource("1_78ups")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -7.45058e-09, 0)
|
||||
material_override = SubResource("ShaderMaterial_vmdy0")
|
||||
mesh = SubResource("QuadMesh_qu5ku")
|
||||
skeleton = NodePath("../..")
|
||||
size = Vector2(0.3, 0.25)
|
||||
|
||||
[node name="Close" parent="." instance=ExtResource("3_2gpr3")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.12, 0.1, 0)
|
||||
label = "close"
|
||||
icon = true
|
||||
|
||||
[node name="Name" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, 0.1, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Light Settings"
|
||||
font_size = 24
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="IDLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, 0.06, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "ID:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="IDInput" parent="." instance=ExtResource("4_upyp3")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0.06, 0)
|
||||
disabled = true
|
||||
|
||||
[node name="ColorWheelLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, 0.02, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Color Wheel:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="ColorWheelButton" parent="." instance=ExtResource("3_2gpr3")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00999999, 0.02, 0)
|
||||
label = "check"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="BrightnessLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.03, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Brightness:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="BrightnessButton" parent="." instance=ExtResource("3_2gpr3")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00999999, -0.03, 0)
|
||||
label = "check"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="ModesLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.08, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Modes:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="ModesButton" parent="." instance=ExtResource("3_2gpr3")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00999999, -0.08, 0)
|
||||
label = "check"
|
||||
icon = true
|
||||
toggleable = true
|
|
@ -93,4 +93,4 @@ func load_image(url: String):
|
|||
|
||||
var texture = ImageTexture.create_from_image(image)
|
||||
logo.texture = texture
|
||||
logo.pixel_size = pixel_size
|
||||
logo.pixel_size = pixel_size
|
||||
|
|
55
app/content/functions/camera_follower.gd
Normal file
55
app/content/functions/camera_follower.gd
Normal file
|
@ -0,0 +1,55 @@
|
|||
extends Function
|
||||
class_name CameraFollower
|
||||
|
||||
@export var enabled = true:
|
||||
set(value):
|
||||
enabled = value
|
||||
if enabled:
|
||||
_update_initial_transform()
|
||||
EventSystem.on_slow_tick.connect(_slow_tick)
|
||||
else:
|
||||
EventSystem.on_slow_tick.disconnect(_slow_tick)
|
||||
|
||||
@export var focus_point: Node3D = null
|
||||
|
||||
var next_new_transform = null
|
||||
var initial_transform = null
|
||||
|
||||
func _ready():
|
||||
next_new_transform = get_parent().global_transform
|
||||
_update_initial_transform()
|
||||
|
||||
func _update_initial_transform():
|
||||
if get_parent() == null||get_parent().is_inside_tree() == false:
|
||||
return
|
||||
|
||||
initial_transform = get_parent().global_transform
|
||||
|
||||
func reset():
|
||||
enabled = false
|
||||
if initial_transform != null:
|
||||
get_parent().global_transform = initial_transform
|
||||
|
||||
func reset_animated():
|
||||
enabled = false
|
||||
if initial_transform == null:
|
||||
var tween = create_tween()
|
||||
tween.set_trans(Tween.TransitionType.TRANS_QUAD)
|
||||
tween.tween_property(get_parent(), "global_transform", initial_transform, 0.6)
|
||||
|
||||
func _slow_tick(delta):
|
||||
if get_parent().is_inside_tree() == false:
|
||||
return
|
||||
|
||||
var new_transform = App.camera.global_transform.translated_local(Vector3(0, 0, -0.5))
|
||||
|
||||
if focus_point != null:
|
||||
new_transform = new_transform * (get_parent().global_transform.affine_inverse() * focus_point.global_transform).affine_inverse()
|
||||
|
||||
if next_new_transform.origin.distance_to(new_transform.origin) > 0.2:
|
||||
next_new_transform = new_transform
|
||||
|
||||
var tween = create_tween()
|
||||
tween.set_parallel(true)
|
||||
tween.set_trans(Tween.TransitionType.TRANS_QUAD)
|
||||
tween.tween_property(get_parent(), "global_transform", new_transform, 0.6)
|
12
app/content/functions/facing_camera.gd
Normal file
12
app/content/functions/facing_camera.gd
Normal file
|
@ -0,0 +1,12 @@
|
|||
extends Function
|
||||
class_name FacingCamera
|
||||
|
||||
@export var enabled = true
|
||||
@export var upright = true
|
||||
|
||||
func _process(_delta):
|
||||
if enabled == false||get_parent().is_inside_tree() == false:
|
||||
return
|
||||
|
||||
var basis = Basis.looking_at( - App.camera.global_transform.basis.z, Vector3.UP if upright else App.camera.global_transform.basis.y)
|
||||
get_parent().global_transform.basis = basis
|
|
@ -25,11 +25,20 @@ var initial_up = Vector3()
|
|||
var initial_transform = Transform3D()
|
||||
var distances = Vector2()
|
||||
|
||||
# For Resetting
|
||||
var initial_global_transform = Transform3D()
|
||||
|
||||
func _process(delta):
|
||||
if get_tree().debug_collisions_hint&&initiator2 != null:
|
||||
DebugDraw3D.draw_line(initial_position, initial_position + initial_direction, Color(1, 0, 0))
|
||||
DebugDraw3D.draw_line(initial_position, initial_position + initial_up, Color(0, 1, 0))
|
||||
|
||||
func reset():
|
||||
get_parent().global_transform = initial_global_transform
|
||||
initiator = null
|
||||
initiator2 = null
|
||||
on_moved.emit()
|
||||
|
||||
func _on_grab_down(event: EventPointer):
|
||||
if disabled:
|
||||
return
|
||||
|
@ -57,6 +66,7 @@ func _on_grab_down(event: EventPointer):
|
|||
initiator = event.initiator
|
||||
|
||||
_update_relative_transform()
|
||||
initial_global_transform = get_parent().global_transform
|
||||
|
||||
if lock_rotation:
|
||||
initial_point = get_parent().to_local(event.ray.get_collision_point())
|
||||
|
|
|
@ -4,6 +4,7 @@ const VoiceAssistant = preload ("res://content/system/assist/assist.tscn")
|
|||
const environment_passthrough_material = preload ("res://assets/environment_passthrough.tres")
|
||||
const Menu = preload ("res://content/ui/menu/menu.gd")
|
||||
const OnboardingScene = preload ("res://content/ui/onboarding/onboarding.tscn")
|
||||
const MetaSceneEntity = preload ("res://content/system/house/meta_scene_entity/meta_scene_entity.tscn")
|
||||
|
||||
@onready var environment: WorldEnvironment = $WorldEnvironment
|
||||
@onready var camera: XRCamera3D = %XRCamera3D
|
||||
|
@ -12,7 +13,10 @@ const OnboardingScene = preload ("res://content/ui/onboarding/onboarding.tscn")
|
|||
@onready var house = $House
|
||||
@onready var menu: Menu = $Menu
|
||||
@onready var xr: XRToolsStartXR = $StartXR
|
||||
@onready var xr_origin: XROrigin3D = $XROrigin3D
|
||||
|
||||
var voice_assistant = null
|
||||
var meta_scene_manager = null
|
||||
|
||||
func _ready():
|
||||
if OS.get_name() == "Android":
|
||||
|
@ -29,6 +33,18 @@ func _ready():
|
|||
HomeApi.start()
|
||||
)
|
||||
|
||||
if OS.get_model_name() == "Quest":
|
||||
meta_scene_manager = OpenXRFbSceneManager.new()
|
||||
meta_scene_manager.auto_create = false
|
||||
meta_scene_manager.visible = false
|
||||
meta_scene_manager.default_scene = MetaSceneEntity
|
||||
|
||||
meta_scene_manager.openxr_fb_scene_data_missing.connect(func():
|
||||
meta_scene_manager.request_scene_capture()
|
||||
)
|
||||
|
||||
xr_origin.add_child(meta_scene_manager)
|
||||
|
||||
HomeApi.on_connect.connect(func():
|
||||
start_setup_flow.call_deferred()
|
||||
)
|
||||
|
|
|
@ -36,11 +36,6 @@ unique_name_in_owner = true
|
|||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.999999, -1.39633e-11, 0, 9.48075e-12, 1, 0, 0, 0, 1, -0.355145, 0.550439, -0.477945)
|
||||
|
||||
[node name="AutoHandtracker" parent="XROrigin3D/XRControllerLeft" index="2"]
|
||||
applymiddlefingerfix = null
|
||||
applyscaling = null
|
||||
coincidewristorknuckle = null
|
||||
|
||||
[node name="IndexTip" parent="XROrigin3D/XRControllerLeft" index="4"]
|
||||
transform = Transform3D(0.967526, 0.252326, -0.0150302, -0.0150302, 0.116784, 0.993043, 0.252326, -0.960569, 0.116784, -0.00665802, 0.0427912, -0.169868)
|
||||
|
||||
|
@ -55,6 +50,7 @@ unique_name_in_owner = true
|
|||
transform = Transform3D(0.999999, -1.39635e-11, 0, 1.31553e-10, 1, 0, 0, 0, 1, 0.336726, 0.575093, -0.437942)
|
||||
|
||||
[node name="XRSimulator" parent="." instance=ExtResource("5_3qc8g")]
|
||||
disable_xr_in_editor = false
|
||||
min_camera_height = 0.01
|
||||
xr_origin = NodePath("../XROrigin3D")
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ const Finger = preload ("res://lib/utils/touch/finger.gd")
|
|||
const Touch = preload ("res://lib/utils/touch/touch.gd")
|
||||
const Collide = preload ("res://lib/utils/touch/collide.gd")
|
||||
const Miniature = preload ("res://content/system/miniature/miniature.gd")
|
||||
const Entity = preload ("res://content/entities/entity.gd")
|
||||
|
||||
@onready var hand = $hand_l
|
||||
@onready var hand_mesh = $hand_l/Armature/Skeleton3D/mesh_Hand_L
|
||||
|
@ -22,6 +23,8 @@ const Miniature = preload ("res://content/system/miniature/miniature.gd")
|
|||
@onready var palm = $Palm
|
||||
@onready var ray: RayCast3D = $Raycast
|
||||
@onready var quick_actions = $Palm/QuickActions
|
||||
@onready var entity_settings = $Palm/Settings
|
||||
@onready var entity_settings_button = $Palm/Settings/SettingsButton
|
||||
|
||||
@export var show_grid = false:
|
||||
set(value):
|
||||
|
@ -46,6 +49,8 @@ var grip_distance = 0.02
|
|||
var pressed = false
|
||||
var grabbed = false
|
||||
|
||||
var moving_entity = null
|
||||
|
||||
func _ready():
|
||||
button_pressed.connect(func(action_name):
|
||||
EventSystem.emit_action(action_name, true, false)
|
||||
|
@ -57,6 +62,35 @@ func _ready():
|
|||
|
||||
_setup_hand()
|
||||
|
||||
palm.remove_child(entity_settings)
|
||||
|
||||
EventSystem.on_ray_enter.connect(func(event: EventPointer):
|
||||
if event.initiator.is_right() == true: return
|
||||
if moving_entity != null: return
|
||||
|
||||
var entity=_get_entity(event.target)
|
||||
|
||||
if entity != null&&entity.has_method("toggle_settings")&&entity_settings.is_inside_tree() == false:
|
||||
palm.add_child(entity_settings)
|
||||
moving_entity=entity
|
||||
)
|
||||
|
||||
EventSystem.on_ray_leave.connect(func(event: EventPointer):
|
||||
if event.initiator.is_right() == true: return
|
||||
var entity=_get_entity(event.target)
|
||||
|
||||
if moving_entity != null&&moving_entity == entity&&entity_settings.is_inside_tree():
|
||||
palm.remove_child(entity_settings)
|
||||
moving_entity=null
|
||||
)
|
||||
|
||||
entity_settings_button.on_button_up.connect(func():
|
||||
if moving_entity == null:
|
||||
return
|
||||
|
||||
moving_entity.toggle_settings()
|
||||
)
|
||||
|
||||
func _process(_delta):
|
||||
if !hand_active:
|
||||
if quick_actions.is_inside_tree(): palm.remove_child(quick_actions)
|
||||
|
@ -127,4 +161,13 @@ func _setup_hand():
|
|||
initiator.node = self
|
||||
|
||||
pointer = Pointer.new(initiator, ray)
|
||||
add_child(pointer)
|
||||
add_child(pointer)
|
||||
|
||||
func _get_entity(node: Node):
|
||||
if node is Entity:
|
||||
return node
|
||||
|
||||
if node.get_parent() == null:
|
||||
return null
|
||||
|
||||
return _get_entity(node.get_parent())
|
|
@ -115,6 +115,14 @@ transform = Transform3D(1, 1.73472e-18, 0, 0, 1, 0, 0, 0, 1, 0.0600001, -5.68873
|
|||
label = "humidity_mid"
|
||||
icon = true
|
||||
|
||||
[node name="Settings" type="Node3D" parent="Palm"]
|
||||
transform = Transform3D(-4.37114e-08, -1, 0, -4.37114e-08, 0, 1, -1, 4.37114e-08, -4.37114e-08, -0.02, 0.09, 0.09)
|
||||
|
||||
[node name="SettingsButton" parent="Palm/Settings" instance=ExtResource("6_x5vuc")]
|
||||
transform = Transform3D(0.499999, 0, 0, 0, 0.499999, 0, 0, 0, 0.5, 0, 0, 0)
|
||||
label = "settings"
|
||||
icon = true
|
||||
|
||||
[node name="TrashBin" parent="." instance=ExtResource("7_vigb6")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.109418, -0.126353, 0.0278937)
|
||||
|
||||
|
|
|
@ -38,6 +38,9 @@ func delete(door):
|
|||
Store.house.state.doors = Store.house.state.doors.filter(func(d): return d.id != door)
|
||||
Store.house.save_local()
|
||||
|
||||
App.controller_left.show_grid = false
|
||||
App.controller_right.show_grid = false
|
||||
|
||||
func edit(door):
|
||||
var doors = Store.house.state.doors
|
||||
editing_door = door
|
||||
|
@ -49,6 +52,9 @@ func edit(door):
|
|||
existing_door = doors[i]
|
||||
break
|
||||
|
||||
App.controller_left.show_grid = true
|
||||
App.controller_right.show_grid = true
|
||||
|
||||
if existing_door != null:
|
||||
room1 = App.house.find_room(existing_door.room1)
|
||||
room2 = App.house.find_room(existing_door.room2)
|
||||
|
@ -131,6 +137,9 @@ func _clear():
|
|||
room1 = null
|
||||
room2 = null
|
||||
|
||||
App.controller_left.show_grid = true
|
||||
App.controller_right.show_grid = true
|
||||
|
||||
if room1_corner1 != null:
|
||||
remove_child(room1_corner1)
|
||||
room1_corner1.queue_free()
|
||||
|
|
|
@ -48,6 +48,9 @@ func update_house():
|
|||
entity_instance.global_rotation = entity.rotation
|
||||
entity_instance.scale = Vector3(entity.scale, entity.scale, entity.scale) if entity.has("scale") else Vector3(1, 1, 1)
|
||||
|
||||
if entity.has("options")&&entity_instance.has_method("set_options"):
|
||||
entity_instance.set_options(entity.options)
|
||||
|
||||
loaded.value = true
|
||||
|
||||
func create_room(room_name: String) -> RoomType:
|
||||
|
@ -103,14 +106,10 @@ func delete_room(room_name):
|
|||
if editing_room == room:
|
||||
editing_room = null
|
||||
|
||||
room.get_parent().remove_child(room)
|
||||
rooms.remove_child(room)
|
||||
room.queue_free()
|
||||
await room.tree_exited
|
||||
|
||||
var store_room = Store.house.get_room(room_name)
|
||||
|
||||
if store_room != null:
|
||||
Store.house.state.rooms.erase(store_room)
|
||||
Store.house.state.rooms = Store.house.state.rooms.filter(func(r): return r.name != room_name)
|
||||
|
||||
Store.house.save_local()
|
||||
|
||||
|
@ -247,12 +246,15 @@ func save_all_entities():
|
|||
"position": entity.global_position,
|
||||
"rotation": entity.global_rotation,
|
||||
"scale": entity.scale.x,
|
||||
"room": String(room.name),
|
||||
"room": String(room.name)
|
||||
}
|
||||
|
||||
if entity.has_method("get_interface"):
|
||||
entity_data["interface"] = entity.get_interface()
|
||||
|
||||
if entity.has_method("get_options"):
|
||||
entity_data["options"] = entity.get_options()
|
||||
|
||||
Store.house.state.entities.append(entity_data)
|
||||
|
||||
Store.house.state.entities = Store.house.state.entities
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
extends Node3D
|
||||
|
||||
const Wall = preload ("res://assets/materials/wall.tres")
|
||||
|
||||
var wall_mesh
|
||||
|
||||
func setup_scene(entity: OpenXRFbSpatialEntity):
|
||||
var name = entity.get_semantic_labels()[0]
|
||||
|
||||
if name == "invisible_wall_face":
|
||||
name = "wall_face"
|
||||
|
||||
if name != "wall_face":
|
||||
return
|
||||
|
||||
add_to_group("meta_" + name)
|
||||
|
||||
wall_mesh = entity.create_mesh_instance()
|
||||
wall_mesh.material_override = Wall
|
||||
add_child(wall_mesh)
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://d12n8fxqsjhah"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/system/house/meta_scene_entity/meta_scene_entity.gd" id="1_crxvl"]
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_wxifi"]
|
||||
|
||||
[node name="MetaSceneEntity" type="Node3D"]
|
||||
script = ExtResource("1_crxvl")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
|
||||
mesh = SubResource("PlaneMesh_wxifi")
|
|
@ -11,7 +11,7 @@ const ConstructRoomMesh = preload ("res://lib/utils/mesh/construct_room_mesh.gd"
|
|||
@onready var room_floor = $Floor
|
||||
@onready var room_ceiling = $Ceiling
|
||||
|
||||
@onready var state_machine = $StateMachine
|
||||
@onready var state_machine: StateMachine = $StateMachine
|
||||
|
||||
var editable: bool = false:
|
||||
set(value):
|
||||
|
|
|
@ -16,19 +16,7 @@ func _on_enter():
|
|||
if room_store == null:
|
||||
return
|
||||
|
||||
var corners = room_store.corners
|
||||
|
||||
if corners.size() > 0:
|
||||
add_floor_corner(room.to_local(Vector3(corners[0].x, 0, corners[0].y)))
|
||||
add_height_corner(room.to_local(Vector3(corners[0].x, 0, corners[0].y)))
|
||||
room.room_ceiling.position.y = room_store.height
|
||||
height_edge.align_to_corners(floor_corner.position, floor_corner.position + Vector3.UP * room.room_ceiling.position.y)
|
||||
|
||||
for i in range(1, corners.size()):
|
||||
add_corner(room.to_local(Vector3(corners[i].x, 0, corners[i].y)))
|
||||
|
||||
room.room_ceiling.get_node("CollisionShape3D").disabled = (floor_corner == null&&height_corner == null)
|
||||
room.room_floor.get_node("CollisionShape3D").disabled = false
|
||||
create_from_corners(room_store.corners, room_store.height)
|
||||
|
||||
var ceiling_shape = WorldBoundaryShape3D.new()
|
||||
ceiling_shape.plane = Plane(Vector3.DOWN, 0)
|
||||
|
@ -41,7 +29,40 @@ func _on_enter():
|
|||
|
||||
func _on_leave():
|
||||
update_store()
|
||||
clear()
|
||||
|
||||
room.room_ceiling.get_node("CollisionShape3D").disabled = true
|
||||
room.room_floor.get_node("CollisionShape3D").disabled = true
|
||||
|
||||
room.room_ceiling.get_node("Clickable").on_click.disconnect(_on_click_ceiling)
|
||||
room.room_floor.get_node("Clickable").on_click.disconnect(_on_click_floor)
|
||||
|
||||
func create_from_corners(corners, height):
|
||||
clear()
|
||||
|
||||
if corners.size() > 0:
|
||||
add_floor_corner(room.to_local(Vector3(corners[0].x, 0, corners[0].y)))
|
||||
add_height_corner(room.to_local(Vector3(corners[0].x, 0, corners[0].y)))
|
||||
room.room_ceiling.position.y = height
|
||||
height_edge.align_to_corners(floor_corner.position, floor_corner.position + Vector3.UP * room.room_ceiling.position.y)
|
||||
|
||||
for i in range(1, corners.size()):
|
||||
add_corner(room.to_local(Vector3(corners[i].x, 0, corners[i].y)))
|
||||
|
||||
room.room_ceiling.get_node("CollisionShape3D").disabled = (floor_corner == null&&height_corner == null)
|
||||
room.room_floor.get_node("CollisionShape3D").disabled = false
|
||||
|
||||
func get_corner(index: int) -> MeshInstance3D:
|
||||
return room.wall_corners.get_child(index % room.wall_corners.get_child_count())
|
||||
|
||||
func get_edge(index: int) -> MeshInstance3D:
|
||||
return room.wall_edges.get_child(index % room.wall_edges.get_child_count())
|
||||
|
||||
func remove_corner(index: int):
|
||||
get_corner(index).queue_free()
|
||||
get_edge(index).queue_free()
|
||||
|
||||
func clear():
|
||||
for child in room.wall_corners.get_children():
|
||||
room.wall_corners.remove_child(child)
|
||||
child.queue_free()
|
||||
|
@ -53,24 +74,10 @@ func _on_leave():
|
|||
if floor_corner != null:
|
||||
room.remove_child(floor_corner)
|
||||
floor_corner.queue_free()
|
||||
floor_corner = null
|
||||
room.remove_child(height_edge)
|
||||
height_edge.queue_free()
|
||||
|
||||
room.room_ceiling.get_node("CollisionShape3D").disabled = true
|
||||
room.room_floor.get_node("CollisionShape3D").disabled = true
|
||||
|
||||
room.room_ceiling.get_node("Clickable").on_click.disconnect(_on_click_ceiling)
|
||||
room.room_floor.get_node("Clickable").on_click.disconnect(_on_click_floor)
|
||||
|
||||
func get_corner(index: int) -> MeshInstance3D:
|
||||
return room.wall_corners.get_child(index % room.wall_corners.get_child_count())
|
||||
|
||||
func get_edge(index: int) -> MeshInstance3D:
|
||||
return room.wall_edges.get_child(index % room.wall_edges.get_child_count())
|
||||
|
||||
func remove_corner(index: int):
|
||||
get_corner(index).queue_free()
|
||||
get_edge(index).queue_free()
|
||||
height_edge = null
|
||||
|
||||
func _on_click_floor(event):
|
||||
if floor_corner != null&&height_corner != null:
|
||||
|
|
|
@ -79,5 +79,5 @@ void fragment() {
|
|||
//ALBEDO = mix(edge_color.rgb * edge_color.a, ALBEDO, a);
|
||||
ROUGHNESS = roughness;
|
||||
//SPECULAR = 0.5 * inversesqrt(ALPHA);
|
||||
DEPTH = FRAGCOORD.z - 0.00001;
|
||||
DEPTH = FRAGCOORD.z + 0.0001;
|
||||
}
|
|
@ -17,8 +17,6 @@ const ECHO_WAIT_REPEAT = 0.1
|
|||
@onready var label_node: Label3D = $Body/Label
|
||||
@onready var finger_area: Area3D = $FingerArea
|
||||
@onready var finger_area_collision: CollisionShape3D = $FingerArea/CollisionShape3D
|
||||
@onready var touch_collision: CollisionShape3D = $TouchBody/CollisionShape3D
|
||||
@onready var touch: StaticBody3D = $TouchBody
|
||||
@onready var click_sound = $ClickSound
|
||||
|
||||
@export var focusable: bool = true:
|
||||
|
@ -71,12 +69,11 @@ const ECHO_WAIT_REPEAT = 0.1
|
|||
|
||||
var active: bool = false:
|
||||
set(value):
|
||||
if active == value:
|
||||
return
|
||||
|
||||
on_toggled.emit(value)
|
||||
if active != value:
|
||||
on_toggled.emit(value)
|
||||
|
||||
active = value
|
||||
if !is_inside_tree(): return
|
||||
if !is_node_ready(): return
|
||||
panel.active = active
|
||||
update_animation(1.0 if active else 0.0)
|
||||
|
||||
|
@ -202,24 +199,15 @@ func _on_touch_leave(event: EventTouch):
|
|||
on_button_up.emit()
|
||||
|
||||
func _touch_change(event: EventTouch):
|
||||
var click_pos = to_local(event.fingers[0].area.global_position)
|
||||
|
||||
var pos = Vector3(0, 1, 0)
|
||||
for finger in event.fingers:
|
||||
var finger_pos = to_local(finger.area.global_position)
|
||||
if pos.z > finger_pos.z:
|
||||
pos = finger_pos
|
||||
|
||||
var button_height = 0.2
|
||||
var button_center = 0.1
|
||||
|
||||
var percent = clamp((button_center + button_height / 2 - pos.z) / (button_height / 2), 0, 1)
|
||||
var percent = (click_pos.z - size.z / 2) / (size.z / 2)
|
||||
percent = clamp(percent, 0.0, 1.0)
|
||||
|
||||
update_animation(percent)
|
||||
|
||||
func _update():
|
||||
body.position = Vector3(0, 0, size.z / 2)
|
||||
finger_area.position = Vector3(0, 0, -0.015)
|
||||
touch.position = Vector3(0, 0, size.z / 2)
|
||||
|
||||
panel.size = Vector2(size.x, size.y)
|
||||
panel.position = Vector3(0, 0, size.z / 2)
|
||||
|
@ -227,4 +215,5 @@ func _update():
|
|||
label_node.width = size.x / label_node.pixel_size
|
||||
label_node.position = Vector3(0, 0, size.z / 2 + 0.001)
|
||||
|
||||
finger_area_collision.shape.size = Vector3(size.x, size.y, 0.03)
|
||||
finger_area.position = Vector3(0, 0, size.z * 0.75)
|
||||
finger_area_collision.shape.size = Vector3(size.x, size.y, size.z / 2)
|
|
@ -5,7 +5,7 @@
|
|||
[ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="3_skm86"]
|
||||
[ext_resource type="AudioStream" uid="uid://c1yu80uj3fsn7" path="res://assets/sound/click.wav" id="4_51sb0"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_826v7"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_syops"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 10
|
||||
shader = ExtResource("2_db5by")
|
||||
|
@ -20,7 +20,7 @@ shader_parameter/corner_radius = 0.2
|
|||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_02501"]
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_btecp"]
|
||||
size = Vector2(0.04, 0.04)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"]
|
||||
|
@ -29,7 +29,7 @@ size = Vector3(0.04, 0.04, 0.01)
|
|||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_bqjii"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector3(0.04, 0.04, 0.03)
|
||||
size = Vector3(0.04, 0.04, 0.005)
|
||||
|
||||
[node name="Button" type="Node3D" groups=["ui_focus"]]
|
||||
script = ExtResource("1_74x7g")
|
||||
|
@ -38,13 +38,13 @@ size = Vector3(0.04, 0.04, 0.01)
|
|||
|
||||
[node name="Body" type="StaticBody3D" parent="." groups=["ui_focus_skip"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
collision_layer = 2
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
|
||||
[node name="Panel3D" type="MeshInstance3D" parent="Body"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
material_override = SubResource("ShaderMaterial_826v7")
|
||||
mesh = SubResource("QuadMesh_02501")
|
||||
material_override = SubResource("ShaderMaterial_syops")
|
||||
mesh = SubResource("QuadMesh_btecp")
|
||||
skeleton = NodePath("../..")
|
||||
script = ExtResource("3_skm86")
|
||||
size = Vector2(0.04, 0.04)
|
||||
|
@ -64,7 +64,7 @@ autowrap_mode = 3
|
|||
width = 40.0
|
||||
|
||||
[node name="FingerArea" type="Area3D" parent="." groups=["ui_focus_skip"]]
|
||||
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.0075)
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
|
@ -72,14 +72,6 @@ monitoring = false
|
|||
[node name="CollisionShape3D" type="CollisionShape3D" parent="FingerArea"]
|
||||
shape = SubResource("BoxShape3D_bqjii")
|
||||
|
||||
[node name="TouchBody" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005)
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TouchBody"]
|
||||
shape = SubResource("BoxShape3D_xwopm")
|
||||
|
||||
[node name="ClickSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_51sb0")
|
||||
volume_db = -18.0
|
||||
|
|
111
app/content/ui/components/color_wheel/color_wheel.gd
Normal file
111
app/content/ui/components/color_wheel/color_wheel.gd
Normal file
|
@ -0,0 +1,111 @@
|
|||
@tool
|
||||
|
||||
extends Container3D
|
||||
class_name ColorPicker3D
|
||||
|
||||
signal on_color_changed(color: Color)
|
||||
|
||||
@onready var puck = $Puck
|
||||
@onready var touch_area = $TouchArea
|
||||
@onready var touch_area_collision = $TouchArea/CollisionShape3D
|
||||
@onready var collision = $Body/CollisionShape3D
|
||||
@onready var sprite: Sprite3D = $Body/Sprite3D
|
||||
|
||||
var move_plane: Plane
|
||||
|
||||
@export var color: Color = Color(1, 1, 1, 1):
|
||||
set(value):
|
||||
if color != value:
|
||||
on_color_changed.emit(value)
|
||||
|
||||
color = value
|
||||
|
||||
if is_node_ready() == false: return
|
||||
|
||||
_update_puck()
|
||||
|
||||
func _ready():
|
||||
Update.props(self, ["color"])
|
||||
|
||||
move_plane = Plane(Vector3.BACK, Vector3(0, 0, size.z))
|
||||
_update()
|
||||
|
||||
func _update_puck():
|
||||
var coords = _color_to_coords(color) * (size.x / 2.0)
|
||||
|
||||
var tween = create_tween()
|
||||
tween.set_trans(Tween.TRANS_BOUNCE)
|
||||
tween.set_parallel(true)
|
||||
|
||||
tween.tween_property(puck, "position", Vector3(coords.x, coords.y, size.z), 0.2)
|
||||
tween.tween_property(puck.material_override, "albedo_color", color, 0.2)
|
||||
|
||||
func _on_press_down(event: EventPointer):
|
||||
_handle_press(event)
|
||||
|
||||
func _on_press_move(event: EventPointer):
|
||||
_handle_press(event)
|
||||
|
||||
func _on_touch_enter(event: EventTouch):
|
||||
_handle_touch(event)
|
||||
|
||||
func _handle_press(event: EventPointer):
|
||||
var ray_pos = event.ray.global_position
|
||||
var ray_dir = -event.ray.global_transform.basis.z
|
||||
|
||||
var local_pos = to_local(ray_pos)
|
||||
var local_dir = global_transform.basis.inverse() * ray_dir
|
||||
|
||||
var click_pos = move_plane.intersects_ray(local_pos, local_dir)
|
||||
|
||||
if click_pos == null:
|
||||
return
|
||||
|
||||
color = _coords_to_color(Vector2(click_pos.x, click_pos.y) / (size.x / 2.0))
|
||||
|
||||
func _handle_touch(event: EventTouch):
|
||||
var click_pos = to_local(event.fingers[0].area.global_position)
|
||||
|
||||
if click_pos == null:
|
||||
return
|
||||
|
||||
color = _coords_to_color(Vector2(click_pos.x, click_pos.y) / (size.x / 2.0))
|
||||
|
||||
func _coords_to_color(coords: Vector2) -> Color:
|
||||
if coords.length() > 1:
|
||||
coords = coords.normalized()
|
||||
|
||||
var hue = (atan2(coords.y, coords.x) + PI) / (2 * PI)
|
||||
var saturation = coords.length()
|
||||
var value = 1.0
|
||||
|
||||
return Color.from_hsv(hue, saturation, value)
|
||||
|
||||
func _color_to_coords(color: Color) -> Vector2:
|
||||
var hue = color.h * 2 * PI - PI
|
||||
var saturation = color.s
|
||||
var coords = Vector2(cos(hue), sin(hue)) * saturation
|
||||
|
||||
return coords
|
||||
|
||||
func _generate_color_wheel():
|
||||
var image = Image.create(1000, 1000, true, Image.FORMAT_RGBA8)
|
||||
|
||||
for x in range(1000):
|
||||
for y in range(1000):
|
||||
var delta = Vector2(x, y) / 1000 * 2 - Vector2(1, 1)
|
||||
if delta.length() <= 1:
|
||||
image.set_pixel(x, y, _coords_to_color(delta))
|
||||
|
||||
ResourceSaver.save(ImageTexture.create_from_image(image), "res://content/ui/components/color_wheel/color_wheel.tres")
|
||||
|
||||
func _update():
|
||||
sprite.pixel_size = size.x / 1000
|
||||
collision.shape.height = size.z
|
||||
collision.shape.radius = size.x / 2
|
||||
collision.position.z = size.z / 2
|
||||
sprite.position.z = size.z
|
||||
puck.position.z = size.z
|
||||
touch_area_collision.shape.height = size.z + 0.02
|
||||
touch_area_collision.shape.radius = size.x / 2
|
||||
touch_area_collision.position.z = (size.z + 0.02) / 2
|
13
app/content/ui/components/color_wheel/color_wheel.tres
Normal file
13
app/content/ui/components/color_wheel/color_wheel.tres
Normal file
File diff suppressed because one or more lines are too long
67
app/content/ui/components/color_wheel/color_wheel.tscn
Normal file
67
app/content/ui/components/color_wheel/color_wheel.tscn
Normal file
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,7 @@ const Notification = preload ("res://content/ui/components/notification/notifica
|
|||
var show_menu = R.state(false)
|
||||
|
||||
func _ready():
|
||||
App.main.remove_child(self)
|
||||
App.main.remove_child.call_deferred(self)
|
||||
|
||||
R.effect(func(_arg):
|
||||
if show_menu.value:
|
||||
|
|
|
@ -268,7 +268,6 @@ script = ExtResource("6_7rntr")
|
|||
tabs = NodePath("../Tabs")
|
||||
|
||||
[node name="ViewMenu" parent="AnimationContainer/TabsContent" instance=ExtResource("8_71pkg")]
|
||||
visible = false
|
||||
|
||||
[node name="EditMenu" parent="AnimationContainer/TabsContent" instance=ExtResource("4_r2raj")]
|
||||
visible = false
|
||||
|
|
|
@ -60,9 +60,9 @@ tabs = NodePath("../Tabs3D")
|
|||
visible = false
|
||||
|
||||
[node name="Rooms" parent="Interface/TabsContent3D" instance=ExtResource("7_2f8e0")]
|
||||
visible = false
|
||||
|
||||
[node name="Doors" parent="Interface/TabsContent3D" instance=ExtResource("7_fl4l8")]
|
||||
visible = false
|
||||
|
||||
[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)
|
||||
|
|
|
@ -53,6 +53,7 @@ icon = true
|
|||
|
||||
[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)
|
||||
visible = false
|
||||
material_override = SubResource("ShaderMaterial_dah0r")
|
||||
mesh = SubResource("QuadMesh_fq44b")
|
||||
skeleton = NodePath("../..")
|
||||
|
|
|
@ -6,6 +6,9 @@ const RoomsMap = preload ("rooms_map.gd")
|
|||
@onready var room_button = $Button
|
||||
@onready var input = $Input
|
||||
@onready var rooms_map: RoomsMap = $Rooms
|
||||
@onready var sync_room_button: Button3D = $SyncRoomsButton
|
||||
@onready var delete_button: Button3D = $DeleteButton
|
||||
@onready var sync_room_label: Label3D = $SyncRoomsLabel
|
||||
|
||||
var editing_room = R.state(false)
|
||||
|
||||
|
@ -35,8 +38,40 @@ func _ready():
|
|||
input.text=rooms_map.selected_room.value
|
||||
)
|
||||
|
||||
R.effect(func(_arg):
|
||||
sync_room_button.visible=editing_room.value
|
||||
sync_room_label.visible=editing_room.value
|
||||
sync_room_button.disabled=!editing_room.value
|
||||
delete_button.visible=rooms_map.selected_room.value != null
|
||||
delete_button.disabled=rooms_map.selected_room.value == null
|
||||
)
|
||||
|
||||
if !Store.house.is_loaded(): await Store.house.on_loaded
|
||||
|
||||
if App.main.meta_scene_manager == null:
|
||||
remove_child(sync_room_button)
|
||||
remove_child(sync_room_label)
|
||||
else:
|
||||
sync_room_button.on_button_up.connect(func():
|
||||
App.main.meta_scene_manager.create_scene_anchors()
|
||||
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
|
||||
var data=MetaTools.spatial_entites.get_corners_and_height()
|
||||
|
||||
App.house.editing_room.state_machine.current_state.create_from_corners(data.corners, data.height)
|
||||
)
|
||||
|
||||
delete_button.on_button_up.connect(func():
|
||||
var selected_room=rooms_map.selected_room
|
||||
|
||||
if selected_room.value != null:
|
||||
App.house.delete_room(selected_room.value)
|
||||
selected_room.value=null
|
||||
editing_room.value=false
|
||||
rooms_map.selectable.value=true
|
||||
)
|
||||
|
||||
room_button.on_button_down.connect(func():
|
||||
var selected_room=rooms_map.selected_room
|
||||
|
||||
|
|
|
@ -53,3 +53,21 @@ visible = false
|
|||
material_override = SubResource("ShaderMaterial_dah0r")
|
||||
mesh = SubResource("QuadMesh_fq44b")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="SyncRoomsLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, -0.23, 0)
|
||||
pixel_size = 0.001
|
||||
text = "Sync Room"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="SyncRoomsButton" parent="." instance=ExtResource("1_y3lty")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.38, -0.23, 0)
|
||||
label = "sync"
|
||||
icon = true
|
||||
|
||||
[node name="DeleteButton" parent="." instance=ExtResource("1_y3lty")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, -0.28, 0)
|
||||
label = "delete"
|
||||
icon = true
|
||||
|
|
|
@ -2,10 +2,8 @@ extends Node3D
|
|||
|
||||
@onready var getting_started_button = $GettingStartedButton
|
||||
@onready var close_button = $CloseButton
|
||||
var next_new_position = null
|
||||
|
||||
func _ready():
|
||||
next_new_position = global_position
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
|
@ -21,23 +19,7 @@ func _ready():
|
|||
close()
|
||||
)
|
||||
|
||||
EventSystem.on_slow_tick.connect(_slow_tick)
|
||||
|
||||
func close():
|
||||
Store.settings.state.onboarding_complete = true
|
||||
Store.settings.save_local()
|
||||
queue_free()
|
||||
|
||||
func _slow_tick(delta):
|
||||
var new_position = App.camera.global_position + App.camera.global_transform.basis.z * - 0.5
|
||||
|
||||
if next_new_position.distance_to(new_position) > 0.2:
|
||||
next_new_position = new_position
|
||||
var new_direction = Basis.looking_at((App.camera.global_position - new_position) * - 1)
|
||||
|
||||
var tween = create_tween()
|
||||
tween.set_parallel(true)
|
||||
tween.set_trans(Tween.TransitionType.TRANS_QUAD)
|
||||
|
||||
tween.tween_property(self, "global_position", new_position, 0.6)
|
||||
tween.tween_property(self, "global_transform:basis", new_direction, 0.6)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://bhyddd1f0ry1x"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://bhyddd1f0ry1x"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/onboarding/onboarding.gd" id="1_k4yvw"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_87aan"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_hlpow"]
|
||||
[ext_resource type="Script" path="res://content/functions/camera_follower.gd" id="4_u1o74"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_nfwtf"]
|
||||
size = Vector3(0.5, 0.3, 0.01)
|
||||
|
@ -86,3 +87,7 @@ outline_size = 0
|
|||
horizontal_alignment = 2
|
||||
autowrap_mode = 3
|
||||
width = 470.0
|
||||
|
||||
[node name="CameraFollower" type="Node" parent="."]
|
||||
script = ExtResource("4_u1o74")
|
||||
enabled = null
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
extends Node3D
|
|
@ -1,42 +0,0 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cmtp5kof0ah2b"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://bnwimm214q67g" path="res://assets/materials/sec-500.material" id="1_mxydb"]
|
||||
[ext_resource type="Script" path="res://content/ui/sub_menu/sub_menu.gd" id="1_xpjuw"]
|
||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="2_64uue"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ti5t2"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_aisgf"]
|
||||
material = SubResource("StandardMaterial3D_ti5t2")
|
||||
size = Vector3(0.3, 0.01, 0.3)
|
||||
|
||||
[node name="SubMenu" type="Node3D"]
|
||||
script = ExtResource("1_xpjuw")
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0, 0.15)
|
||||
material_override = ExtResource("1_mxydb")
|
||||
mesh = SubResource("BoxMesh_aisgf")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Content" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.006, 0)
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.02)
|
||||
pixel_size = 0.001
|
||||
text = "Entity Name"
|
||||
font_size = 24
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Label3D2" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0.06)
|
||||
pixel_size = 0.001
|
||||
text = "ID:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Input" parent="Content" instance=ExtResource("2_64uue")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.12, 0, 0.06)
|
|
@ -217,7 +217,7 @@ meta_xr_features/eye_tracking=0
|
|||
meta_xr_features/hand_tracking=1
|
||||
meta_xr_features/hand_tracking_frequency=1
|
||||
meta_xr_features/passthrough=2
|
||||
meta_xr_features/use_anchor_api=false
|
||||
meta_xr_features/use_anchor_api=true
|
||||
meta_xr_features/quest_1_support=false
|
||||
meta_xr_features/quest_2_support=true
|
||||
meta_xr_features/quest_3_support=true
|
||||
|
@ -225,12 +225,17 @@ meta_xr_features/quest_pro_support=true
|
|||
xr_features/enable_pico_plugin=false
|
||||
xr_features/enable_lynx_plugin=false
|
||||
xr_features/enable_khronos_plugin=false
|
||||
meta_xr_features/use_scene_api=false
|
||||
meta_xr_features/use_scene_api=true
|
||||
meta_xr_features/face_tracking=0
|
||||
meta_xr_features/render_model=0
|
||||
meta_xr_features/use_overlay_keyboard=false
|
||||
meta_xr_features/use_experimental_features=false
|
||||
meta_xr_features/boundary_mode=0
|
||||
meta_xr_features/boundary_mode=2
|
||||
khronos_xr_features/htc/hand_tracking=0
|
||||
khronos_xr_features/htc/tracker=0
|
||||
khronos_xr_features/htc/eye_tracking=0
|
||||
khronos_xr_features/htc/lip_expression=0
|
||||
meta_xr_features/body_tracking=0
|
||||
|
||||
[preset.1]
|
||||
|
||||
|
@ -451,7 +456,7 @@ meta_xr_features/eye_tracking=0
|
|||
meta_xr_features/hand_tracking=1
|
||||
meta_xr_features/hand_tracking_frequency=1
|
||||
meta_xr_features/passthrough=2
|
||||
meta_xr_features/use_anchor_api=false
|
||||
meta_xr_features/use_anchor_api=true
|
||||
meta_xr_features/quest_1_support=false
|
||||
meta_xr_features/quest_2_support=true
|
||||
meta_xr_features/quest_3_support=true
|
||||
|
@ -459,12 +464,17 @@ meta_xr_features/quest_pro_support=true
|
|||
xr_features/enable_pico_plugin=false
|
||||
xr_features/enable_lynx_plugin=false
|
||||
xr_features/enable_khronos_plugin=false
|
||||
meta_xr_features/use_scene_api=false
|
||||
meta_xr_features/use_scene_api=true
|
||||
meta_xr_features/face_tracking=0
|
||||
meta_xr_features/render_model=0
|
||||
meta_xr_features/use_overlay_keyboard=false
|
||||
meta_xr_features/use_experimental_features=false
|
||||
meta_xr_features/boundary_mode=1
|
||||
meta_xr_features/boundary_mode=0
|
||||
khronos_xr_features/htc/hand_tracking=0
|
||||
khronos_xr_features/htc/tracker=0
|
||||
khronos_xr_features/htc/eye_tracking=0
|
||||
khronos_xr_features/htc/lip_expression=0
|
||||
meta_xr_features/body_tracking=0
|
||||
|
||||
[preset.2]
|
||||
|
||||
|
@ -699,6 +709,11 @@ meta_xr_features/render_model=0
|
|||
meta_xr_features/use_overlay_keyboard=false
|
||||
meta_xr_features/use_experimental_features=false
|
||||
meta_xr_features/boundary_mode=0
|
||||
khronos_xr_features/htc/hand_tracking=0
|
||||
khronos_xr_features/htc/tracker=0
|
||||
khronos_xr_features/htc/eye_tracking=0
|
||||
khronos_xr_features/htc/lip_expression=0
|
||||
meta_xr_features/body_tracking=0
|
||||
|
||||
[preset.3]
|
||||
|
||||
|
@ -933,3 +948,8 @@ meta_xr_features/render_model=0
|
|||
meta_xr_features/use_overlay_keyboard=false
|
||||
meta_xr_features/use_experimental_features=false
|
||||
meta_xr_features/boundary_mode=0
|
||||
khronos_xr_features/htc/hand_tracking=0
|
||||
khronos_xr_features/htc/tracker=0
|
||||
khronos_xr_features/htc/eye_tracking=0
|
||||
khronos_xr_features/htc/lip_expression=0
|
||||
meta_xr_features/body_tracking=0
|
||||
|
|
3
app/lib/utils/meta/meta_tools.gd
Normal file
3
app/lib/utils/meta/meta_tools.gd
Normal file
|
@ -0,0 +1,3 @@
|
|||
class_name MetaTools
|
||||
|
||||
const spatial_entites = preload ("res://lib/utils/meta/spatial_entites.gd")
|
44
app/lib/utils/meta/spatial_entites.gd
Normal file
44
app/lib/utils/meta/spatial_entites.gd
Normal file
|
@ -0,0 +1,44 @@
|
|||
extends RefCounted
|
||||
|
||||
static func get_corners_and_height() -> Dictionary:
|
||||
print("get corners")
|
||||
|
||||
var lines = []
|
||||
var height = 2.8
|
||||
|
||||
var walls = App.main.get_tree().get_nodes_in_group("meta_wall_face")
|
||||
|
||||
for wall in walls:
|
||||
var mesh: MeshInstance3D = wall.wall_mesh
|
||||
|
||||
var corner2 = mesh.to_global(Vector3( - mesh.mesh.size.x / 2.0, 0, 0))
|
||||
var corner1 = mesh.to_global(Vector3(mesh.mesh.size.x / 2.0, 0, 0))
|
||||
|
||||
corner1 = Vector2(corner1.x, corner1.z)
|
||||
corner2 = Vector2(corner2.x, corner2.z)
|
||||
|
||||
height = mesh.mesh.size.y
|
||||
lines.append([corner1, corner2])
|
||||
|
||||
return {
|
||||
"corners": lines_to_polygon(lines),
|
||||
"height": height
|
||||
}
|
||||
|
||||
static func lines_to_polygon(lines: Array) -> Array:
|
||||
var polygon = [lines[0][0],lines[0][1]]
|
||||
var added_lines = [0]
|
||||
|
||||
while len(polygon) < len(lines):
|
||||
for i in range(len(lines)):
|
||||
if i in added_lines:
|
||||
continue
|
||||
|
||||
if polygon[- 1].distance_to(lines[i][0]) < 0.01:
|
||||
polygon.append(lines[i][1])
|
||||
added_lines.append(i)
|
||||
elif polygon[- 1].distance_to(lines[i][1]) < 0.01:
|
||||
polygon.append(lines[i][0])
|
||||
added_lines.append(i)
|
||||
|
||||
return polygon
|
Loading…
Reference in New Issue
Block a user