Merge pull request #21 from Nitwel/testing
Add navigation buttons to the menu
This commit is contained in:
commit
c669a76840
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -11,3 +11,5 @@
|
|||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.blend filter=lfs diff=lfs merge=lfs -text
|
||||
*.gltf filter=lfs diff=lfs merge=lfs -text
|
||||
*.obj filter=lfs diff=lfs merge=lfs -text
|
||||
*.mtl filter=lfs diff=lfs merge=lfs -text
|
||||
|
|
|
@ -84,6 +84,8 @@ Each time a button is pressed on the primary controller, a ray-cast is done to b
|
|||
Additionally, each event will bubble up until the root node is reached, allowing to handle events on parents.
|
||||
In case that an event of a specific node has to be reacted on, use the `Clickable` function node.
|
||||
|
||||
It is also possible to bubble up information by returning a dictionary from a function like `_on_click`.
|
||||
|
||||
```python
|
||||
InteractionEvent {
|
||||
"controller": XRController3D, # The controller that triggered the event
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:991ebe1738a0621dd536436b99a7b5149d10e6b185008ec533eb2c5ca79fec0c
|
||||
size 3087839
|
||||
oid sha256:a8a8155035309697c511a28e0e7ca8912f19cb4ddb705be118ec5a0740336d29
|
||||
size 4088828
|
||||
|
|
3
assets/icons/schema_white_24dp.svg
Normal file
3
assets/icons/schema_white_24dp.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:06023dd670a93311f9c757dac2c72c2b5dde6682a800456841715c6dd422f505
|
||||
size 341
|
39
assets/icons/schema_white_24dp.svg.import
Normal file
39
assets/icons/schema_white_24dp.svg.import
Normal file
|
@ -0,0 +1,39 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dch6rwihrl3i2"
|
||||
path.s3tc="res://.godot/imported/schema_white_24dp.svg-78416867d0323ea24692e91bbbd6eccf.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/schema_white_24dp.svg-78416867d0323ea24692e91bbbd6eccf.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/icons/schema_white_24dp.svg"
|
||||
dest_files=["res://.godot/imported/schema_white_24dp.svg-78416867d0323ea24692e91bbbd6eccf.s3tc.ctex", "res://.godot/imported/schema_white_24dp.svg-78416867d0323ea24692e91bbbd6eccf.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
|
||||
svg/scale=8.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
3
assets/icons/settings_white_24dp.svg
Normal file
3
assets/icons/settings_white_24dp.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:85603fc1d26b1cc7300b47368ea1324ee639685c7e081ec1753db8fe6e890ebf
|
||||
size 1462
|
39
assets/icons/settings_white_24dp.svg.import
Normal file
39
assets/icons/settings_white_24dp.svg.import
Normal file
|
@ -0,0 +1,39 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dyh0ax51xqp8n"
|
||||
path.s3tc="res://.godot/imported/settings_white_24dp.svg-00489b947e07e7f772d9a02d10ec99e3.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/settings_white_24dp.svg-00489b947e07e7f772d9a02d10ec99e3.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/icons/settings_white_24dp.svg"
|
||||
dest_files=["res://.godot/imported/settings_white_24dp.svg-00489b947e07e7f772d9a02d10ec99e3.s3tc.ctex", "res://.godot/imported/settings_white_24dp.svg-00489b947e07e7f772d9a02d10ec99e3.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
|
||||
svg/scale=8.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
3
assets/icons/view_in_ar_white_24dp.svg
Normal file
3
assets/icons/view_in_ar_white_24dp.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7bd032062986d308937d62aca2c753cd5bedfe34c50ede397e596c6c9593df51
|
||||
size 870
|
39
assets/icons/view_in_ar_white_24dp.svg.import
Normal file
39
assets/icons/view_in_ar_white_24dp.svg.import
Normal file
|
@ -0,0 +1,39 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://jodf3dm654j3"
|
||||
path.s3tc="res://.godot/imported/view_in_ar_white_24dp.svg-5b49634cd6aa27ec8f9e11a0780ef941.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/view_in_ar_white_24dp.svg-5b49634cd6aa27ec8f9e11a0780ef941.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/icons/view_in_ar_white_24dp.svg"
|
||||
dest_files=["res://.godot/imported/view_in_ar_white_24dp.svg-5b49634cd6aa27ec8f9e11a0780ef941.s3tc.ctex", "res://.godot/imported/view_in_ar_white_24dp.svg-5b49634cd6aa27ec8f9e11a0780ef941.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
|
||||
svg/scale=8.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
3
assets/icons/visibility_white_24dp.svg
Normal file
3
assets/icons/visibility_white_24dp.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1259941b0164449141d01ea7db1e1ceaf224aed6010c1a8a425625f891c09570
|
||||
size 493
|
39
assets/icons/visibility_white_24dp.svg.import
Normal file
39
assets/icons/visibility_white_24dp.svg.import
Normal file
|
@ -0,0 +1,39 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cattgsppxnbq4"
|
||||
path.s3tc="res://.godot/imported/visibility_white_24dp.svg-78a4c7f3f7d3e93235e396c65d5f8e8c.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/visibility_white_24dp.svg-78a4c7f3f7d3e93235e396c65d5f8e8c.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/icons/visibility_white_24dp.svg"
|
||||
dest_files=["res://.godot/imported/visibility_white_24dp.svg-78a4c7f3f7d3e93235e396c65d5f8e8c.s3tc.ctex", "res://.godot/imported/visibility_white_24dp.svg-78a4c7f3f7d3e93235e396c65d5f8e8c.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
|
||||
svg/scale=8.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
3
assets/icons/widgets_white_24dp.svg
Normal file
3
assets/icons/widgets_white_24dp.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:602db8fb276c43354096ff9144a94e99ec0d271e7d8216db80a5467f804c247e
|
||||
size 348
|
39
assets/icons/widgets_white_24dp.svg.import
Normal file
39
assets/icons/widgets_white_24dp.svg.import
Normal file
|
@ -0,0 +1,39 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://csq5a4gk6ba5b"
|
||||
path.s3tc="res://.godot/imported/widgets_white_24dp.svg-4200d261601a457250005cb067bd0ad7.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/widgets_white_24dp.svg-4200d261601a457250005cb067bd0ad7.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/icons/widgets_white_24dp.svg"
|
||||
dest_files=["res://.godot/imported/widgets_white_24dp.svg-4200d261601a457250005cb067bd0ad7.s3tc.ctex", "res://.godot/imported/widgets_white_24dp.svg-4200d261601a457250005cb067bd0ad7.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
|
||||
svg/scale=8.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
102
assets/immersive_home/immersive_home.mtl
Normal file
102
assets/immersive_home/immersive_home.mtl
Normal file
|
@ -0,0 +1,102 @@
|
|||
# Blender 3.4.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl PhongF3EF37
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.952941 0.937255 0.215686
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl Reflective53504B
|
||||
Ns 925.000061
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.325490 0.313726 0.294118
|
||||
Ks 0.800000 0.800000 0.800000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl ReflectiveA5B3A8
|
||||
Ns 925.000061
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.647059 0.701961 0.658823
|
||||
Ks 0.800000 0.800000 0.800000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl Standard000000.001
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.000000 0.000000 0.000000
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl Standard5DD756
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.364706 0.843137 0.337255
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl Standard9F9F9F.001
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.623529 0.623529 0.623529
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl StandardD3D237
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.827451 0.823529 0.215686
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl StandardD3D23789
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.827451 0.823529 0.215686
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 0.537255
|
||||
illum 1
|
||||
|
||||
newmtl StandardD82429
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.847059 0.141177 0.160784
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl StandardE72C34
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.905882 0.172549 0.203922
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
52468
assets/immersive_home/immersive_home.obj
Normal file
52468
assets/immersive_home/immersive_home.obj
Normal file
File diff suppressed because it is too large
Load Diff
21
assets/immersive_home/immersive_home.obj.import
Normal file
21
assets/immersive_home/immersive_home.obj.import
Normal file
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="wavefront_obj"
|
||||
importer_version=1
|
||||
type="Mesh"
|
||||
uid="uid://ibv3j8a6punc"
|
||||
path="res://.godot/imported/immersive_home.obj-80e9509dc5c96b9f5522ea6ac8cd2d99.mesh"
|
||||
|
||||
[deps]
|
||||
|
||||
files=["res://.godot/imported/immersive_home.obj-80e9509dc5c96b9f5522ea6ac8cd2d99.mesh"]
|
||||
|
||||
source_file="res://assets/immersive_home/immersive_home.obj"
|
||||
dest_files=["res://.godot/imported/immersive_home.obj-80e9509dc5c96b9f5522ea6ac8cd2d99.mesh", "res://.godot/imported/immersive_home.obj-80e9509dc5c96b9f5522ea6ac8cd2d99.mesh"]
|
||||
|
||||
[params]
|
||||
|
||||
generate_tangents=true
|
||||
scale_mesh=Vector3(1, 1, 1)
|
||||
offset_mesh=Vector3(0, 0, 0)
|
||||
optimize_mesh=true
|
62
assets/immersive_home_panels/immersive_home_panels.mtl
Normal file
62
assets/immersive_home_panels/immersive_home_panels.mtl
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Blender 3.4.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Standard000000
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.000000 0.000000 0.000000
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl Standard3AE864
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.227451 0.909804 0.392157
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl Standard626262
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.384314 0.384314 0.384314
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl Standard7BFFC5
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.482353 1.000000 0.772549
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl Standard9F9F9F
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.623529 0.623529 0.623529
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
|
||||
newmtl StandardFFFFFF
|
||||
Ns 0.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 1.000000 1.000000 1.000000
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
331487
assets/immersive_home_panels/immersive_home_panels.obj
Normal file
331487
assets/immersive_home_panels/immersive_home_panels.obj
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="wavefront_obj"
|
||||
importer_version=1
|
||||
type="Mesh"
|
||||
uid="uid://cejvc23wfwjqj"
|
||||
path="res://.godot/imported/immersive_home_panels.obj-25bf3167534aaaf96f611e3e962c5139.mesh"
|
||||
|
||||
[deps]
|
||||
|
||||
files=["res://.godot/imported/immersive_home_panels.obj-25bf3167534aaaf96f611e3e962c5139.mesh"]
|
||||
|
||||
source_file="res://assets/immersive_home_panels/immersive_home_panels.obj"
|
||||
dest_files=["res://.godot/imported/immersive_home_panels.obj-25bf3167534aaaf96f611e3e962c5139.mesh", "res://.godot/imported/immersive_home_panels.obj-25bf3167534aaaf96f611e3e962c5139.mesh"]
|
||||
|
||||
[params]
|
||||
|
||||
generate_tangents=true
|
||||
scale_mesh=Vector3(1, 1, 1)
|
||||
offset_mesh=Vector3(0, 0, 0)
|
||||
optimize_mesh=true
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7d62537d8aa4fee28ed5484c8c7ba96c2c9a7fa7bc0740e79420f01105602ca5
|
||||
size 43035
|
||||
oid sha256:68e2b9d5e723a2009f341e45e2968893dd2a1dd5077fe1d9ba970f01d0d75e02
|
||||
size 56989
|
||||
|
|
|
@ -66,6 +66,8 @@ target_position = Vector3(0, -5, 0)
|
|||
transform = Transform3D(0.999999, -0.000567105, -2.5179e-05, -2.51789e-05, 4.39886e-08, -0.999999, 0.000567105, 1, 2.97064e-08, -0.000775784, -1.09076e-05, -2.46767)
|
||||
size = Vector3(0.02, 5, 0.02)
|
||||
texture_albedo = ExtResource("4_wcfej")
|
||||
upper_fade = 0.000985425
|
||||
lower_fade = 0.000919435
|
||||
|
||||
[node name="StartXR" parent="." instance=ExtResource("1_i4c04")]
|
||||
enable_passthrough = true
|
||||
|
|
|
@ -77,27 +77,34 @@ func _on_button_released(button):
|
|||
_is_grabbed = false
|
||||
_moved = false
|
||||
|
||||
func _call_fn(collider: Object, fn_name: String, node: Node3D = null):
|
||||
func _call_fn(collider: Object, fn_name: String, node: Node3D = null, event = null):
|
||||
if collider == null:
|
||||
return
|
||||
|
||||
if node == null:
|
||||
node = collider
|
||||
|
||||
var event = {
|
||||
event = {
|
||||
"controller": _controller,
|
||||
"ray": ray,
|
||||
"target": collider,
|
||||
}
|
||||
|
||||
if node.has_method(fn_name):
|
||||
var result = node.call(fn_name, event)
|
||||
|
||||
if result != null && result is Dictionary:
|
||||
result.merge(event, true)
|
||||
|
||||
if result != null && result is bool && result == false:
|
||||
# Stop the event from bubbling up
|
||||
return
|
||||
|
||||
for child in node.get_children():
|
||||
if child is Function && child.has_method(fn_name):
|
||||
child.call(fn_name, event)
|
||||
|
||||
if node.has_method(fn_name):
|
||||
node.call(fn_name, event)
|
||||
|
||||
var parent = node.get_parent()
|
||||
|
||||
if parent != null && parent is Node3D:
|
||||
_call_fn(collider, fn_name, parent)
|
||||
_call_fn(collider, fn_name, parent, event)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
extends StaticBody3D
|
||||
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
|
||||
func _on_press_down(_event):
|
||||
animation_player.play("down")
|
||||
|
||||
func _on_press_up(_event):
|
||||
animation_player.play("up")
|
58
content/ui/components/button/button.gd
Normal file
58
content/ui/components/button/button.gd
Normal file
|
@ -0,0 +1,58 @@
|
|||
extends StaticBody3D
|
||||
class_name Button3D
|
||||
|
||||
@export var toggleable: bool = false
|
||||
@export var disabled: bool = false
|
||||
var active: bool = false :
|
||||
set(value):
|
||||
print("set active", value)
|
||||
animation_player.stop()
|
||||
if value == active:
|
||||
return
|
||||
|
||||
active = value
|
||||
|
||||
if active:
|
||||
animation_player.play("down")
|
||||
else:
|
||||
animation_player.play_backwards("down")
|
||||
|
||||
|
||||
|
||||
get:
|
||||
return active
|
||||
|
||||
|
||||
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
|
||||
func _on_click(_event):
|
||||
if disabled:
|
||||
return false
|
||||
|
||||
if !toggleable:
|
||||
return
|
||||
|
||||
active = !active
|
||||
|
||||
return {
|
||||
"active": active
|
||||
}
|
||||
|
||||
func _on_press_down(_event):
|
||||
if disabled:
|
||||
return false
|
||||
|
||||
if toggleable:
|
||||
return
|
||||
|
||||
animation_player.play("down")
|
||||
|
||||
func _on_press_up(_event):
|
||||
if disabled:
|
||||
return false
|
||||
|
||||
if toggleable:
|
||||
return
|
||||
|
||||
animation_player.play_backwards("down")
|
|
@ -1,18 +1,56 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://bsjqdvkt0u87c"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://bsjqdvkt0u87c"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/button/button.gd" id="1_g5u54"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/button/button.gd" id="1_74x7g"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_peqek"]
|
||||
albedo_color = Color(0.151534, 0.211909, 0.619523, 1)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_jwpm5"]
|
||||
resource_local_to_scene = true
|
||||
material = SubResource("StandardMaterial3D_peqek")
|
||||
size = Vector3(0.05, 0.02, 0.05)
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_o4j7g"]
|
||||
points = PackedVector3Array(-0.025, -0.01, -0.025, -0.025, 0.01, -0.025, 0.025, -0.01, -0.025, -0.025, -0.01, 0.025, -0.025, 0.01, 0.025, 0.025, 0.01, -0.025, 0.025, -0.01, 0.025, 0.025, 0.01, 0.025)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_04k6i"]
|
||||
[sub_resource type="Animation" id="Animation_iu2ed"]
|
||||
resource_name = "down"
|
||||
length = 0.2
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:position:y")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, -0.01, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.2)
|
||||
}
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("MeshInstance3D:mesh:size:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0.02, -0.25, 0, 0.25, 0, 0.01, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.2)
|
||||
}
|
||||
tracks/2/type = "bezier"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("MeshInstance3D:position:y")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0.005, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.2)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gvfrg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
|
@ -22,50 +60,29 @@ tracks/0/interp = 1
|
|||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(0.01, -0.25, 0, 0.25, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_iu2ed"]
|
||||
resource_name = "down"
|
||||
length = 0.4
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:position:y")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0.01, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.4)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_y7xum"]
|
||||
resource_name = "up"
|
||||
length = 0.4
|
||||
tracks/0/type = "bezier"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:position:y")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"handle_modes": PackedInt32Array(0, 0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0.01, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0, 0.4)
|
||||
tracks/1/type = "bezier"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("MeshInstance3D:position:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"handle_modes": PackedInt32Array(0),
|
||||
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sbgno"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_04k6i"),
|
||||
"down": SubResource("Animation_iu2ed"),
|
||||
"up": SubResource("Animation_y7xum")
|
||||
"RESET": SubResource("Animation_gvfrg"),
|
||||
"down": SubResource("Animation_iu2ed")
|
||||
}
|
||||
|
||||
[node name="Button" type="StaticBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0)
|
||||
script = ExtResource("1_g5u54")
|
||||
script = ExtResource("1_74x7g")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("BoxMesh_jwpm5")
|
157
content/ui/menu/edit/edit_menu.gd
Normal file
157
content/ui/menu/edit/edit_menu.gd
Normal file
|
@ -0,0 +1,157 @@
|
|||
extends Node3D
|
||||
|
||||
const Device = preload("res://content/ui/device/device.tscn")
|
||||
const Entity = preload("res://content/ui/entity/entity.tscn")
|
||||
const Switch = preload("res://content/entities/switch/switch.tscn")
|
||||
const Light = preload("res://content/entities/light/light.tscn")
|
||||
const Sensor = preload("res://content/entities/sensor/sensor.tscn")
|
||||
|
||||
@onready var devices_node: GridContainer3D = $Devices
|
||||
@onready var next_page_button = $Buttons/NextPageButton
|
||||
@onready var previous_page_button = $Buttons/PreviousPageButton
|
||||
@onready var page_number_label = $PageNumberLabel
|
||||
var devices
|
||||
var page = 0
|
||||
var last_device_page = 0
|
||||
var page_size = 20
|
||||
var pages = 0
|
||||
|
||||
var selected_device = null
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
devices = await HomeAdapters.adapter.get_devices()
|
||||
|
||||
next_page_button.get_node("Clickable").on_click.connect(func(_event):
|
||||
print("next page")
|
||||
next_page()
|
||||
)
|
||||
|
||||
previous_page_button.get_node("Clickable").on_click.connect(func(_event):
|
||||
previous_page()
|
||||
)
|
||||
|
||||
render()
|
||||
|
||||
func update_pages():
|
||||
if selected_device == null:
|
||||
pages = ceil(float(devices.size()) / page_size)
|
||||
else:
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device:
|
||||
pages = ceil(float(device.values()[0]["entities"].size()) / page_size)
|
||||
|
||||
func get_page():
|
||||
if selected_device == null:
|
||||
return devices.slice(page * page_size, page * page_size + page_size)
|
||||
else:
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device:
|
||||
return device.values()[0]["entities"].slice(page * page_size, page * page_size + page_size)
|
||||
|
||||
func next_page():
|
||||
if page >= pages - 1:
|
||||
return
|
||||
page += 1
|
||||
render()
|
||||
|
||||
func previous_page():
|
||||
if page <= 0:
|
||||
return
|
||||
|
||||
page -= 1
|
||||
render()
|
||||
|
||||
func render():
|
||||
update_pages()
|
||||
page_number_label.set_text(str(page + 1) + " / " + str(pages))
|
||||
|
||||
previous_page_button.visible = page > 0
|
||||
next_page_button.visible = page < pages - 1
|
||||
|
||||
clear_menu()
|
||||
if selected_device == null:
|
||||
render_devices()
|
||||
else:
|
||||
render_entities()
|
||||
|
||||
func render_devices():
|
||||
var page_devices = get_page()
|
||||
|
||||
for device in page_devices:
|
||||
var info = device.values()[0]
|
||||
|
||||
var device_instance = Device.instantiate()
|
||||
device_instance.id = device.keys()[0]
|
||||
device_instance.get_node("Clickable").on_click.connect(func(_event):
|
||||
_on_device_click(device_instance.id)
|
||||
)
|
||||
devices_node.add_child(device_instance)
|
||||
device_instance.set_device_name(info["name"])
|
||||
|
||||
devices_node._update_container()
|
||||
|
||||
func render_entities():
|
||||
var entities = get_page()
|
||||
|
||||
var back_button = Entity.instantiate()
|
||||
back_button.get_node("Clickable").on_click.connect(func(_event):
|
||||
_on_entity_click("#back")
|
||||
)
|
||||
devices_node.add_child(back_button)
|
||||
back_button.set_entity_name("#back")
|
||||
|
||||
for entity in entities:
|
||||
var entity_instance = Entity.instantiate()
|
||||
entity_instance.get_node("Clickable").on_click.connect(func(_event):
|
||||
_on_entity_click(entity)
|
||||
)
|
||||
devices_node.add_child(entity_instance)
|
||||
entity_instance.set_entity_name(entity)
|
||||
|
||||
devices_node._update_container()
|
||||
|
||||
func _on_device_click(device_id):
|
||||
selected_device = device_id
|
||||
last_device_page = page
|
||||
page = 0
|
||||
|
||||
render()
|
||||
|
||||
func _on_entity_click(entity_name):
|
||||
if entity_name == "#back":
|
||||
selected_device = null
|
||||
page = last_device_page
|
||||
render()
|
||||
return
|
||||
|
||||
var type = entity_name.split(".")[0]
|
||||
print(type)
|
||||
|
||||
if type == "switch":
|
||||
var switch = Switch.instantiate()
|
||||
switch.entity_id = entity_name
|
||||
|
||||
switch.set_position(global_position)
|
||||
get_node("/root").add_child(switch)
|
||||
|
||||
if type == "light":
|
||||
var light = Light.instantiate()
|
||||
light.entity_id = entity_name
|
||||
|
||||
light.set_position(global_position)
|
||||
get_node("/root").add_child(light)
|
||||
|
||||
if type == "sensor":
|
||||
var sensor = Sensor.instantiate()
|
||||
sensor.entity_id = entity_name
|
||||
|
||||
sensor.set_position(global_position)
|
||||
get_node("/root").add_child(sensor)
|
||||
|
||||
func clear_menu():
|
||||
for child in devices_node.get_children():
|
||||
devices_node.remove_child(child)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
45
content/ui/menu/edit/edit_menu.tscn
Normal file
45
content/ui/menu/edit/edit_menu.tscn
Normal file
|
@ -0,0 +1,45 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://crrb0l3ekuotj"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/edit/edit_menu.gd" id="1_34cbn"]
|
||||
[ext_resource type="Script" path="res://content/ui/menu/grid.gd" id="3_0xvyw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_tvimg"]
|
||||
[ext_resource type="Texture2D" uid="uid://tr8yrx470k03" path="res://assets/materials/arrow_right.png" id="5_0uvv4"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="6_pf8jy"]
|
||||
|
||||
[node name="EditMenu" type="Node3D"]
|
||||
script = ExtResource("1_34cbn")
|
||||
|
||||
[node name="Devices" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0.01, 0.03)
|
||||
script = ExtResource("3_0xvyw")
|
||||
depth_gap = 0.06
|
||||
size = Vector3(0.24, 0.1, 0.1)
|
||||
|
||||
[node name="PageNumberLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(0.1, 0, 0, 0, -4.37114e-09, 0.1, 0, -0.1, -4.37114e-09, 0.26, 0.01, 0.27)
|
||||
text = "1 / 3"
|
||||
font_size = 36
|
||||
|
||||
[node name="Buttons" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, 0.01, 0.27)
|
||||
|
||||
[node name="NextPageButton" parent="Buttons" instance=ExtResource("4_tvimg")]
|
||||
|
||||
[node name="Decal" type="Decal" parent="Buttons/NextPageButton"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0)
|
||||
size = Vector3(0.04, 0.04, 0.04)
|
||||
texture_albedo = ExtResource("5_0uvv4")
|
||||
|
||||
[node name="Clickable" type="Node" parent="Buttons/NextPageButton"]
|
||||
script = ExtResource("6_pf8jy")
|
||||
|
||||
[node name="PreviousPageButton" parent="Buttons" instance=ExtResource("4_tvimg")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.08, 0, 0)
|
||||
|
||||
[node name="Decal" type="Decal" parent="Buttons/PreviousPageButton"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0.02, 0)
|
||||
size = Vector3(0.04, 0.04, 0.04)
|
||||
texture_albedo = ExtResource("5_0uvv4")
|
||||
|
||||
[node name="Clickable" type="Node" parent="Buttons/PreviousPageButton"]
|
||||
script = ExtResource("6_pf8jy")
|
|
@ -1,157 +1,76 @@
|
|||
extends Node3D
|
||||
|
||||
const Device = preload("res://content/ui/device/device.tscn")
|
||||
const Entity = preload("res://content/ui/entity/entity.tscn")
|
||||
const Switch = preload("res://content/entities/switch/switch.tscn")
|
||||
const Light = preload("res://content/entities/light/light.tscn")
|
||||
const Sensor = preload("res://content/entities/sensor/sensor.tscn")
|
||||
@onready var nav_view = $Navigation/View
|
||||
@onready var nav_edit: Button3D = $Navigation/Edit
|
||||
@onready var menu_edit: Node3D = $Content/EditMenu
|
||||
@onready var nav_room = $Navigation/Room
|
||||
@onready var nav_automate = $Navigation/Automate
|
||||
@onready var nav_settings = $Navigation/Settings
|
||||
|
||||
@onready var devices_node: GridContainer3D = $Devices
|
||||
@onready var next_page_button = $NextPageButton
|
||||
@onready var previous_page_button = $PreviousPageButton
|
||||
@onready var page_number_label = $PageNumberLabel
|
||||
var devices
|
||||
var page = 0
|
||||
var last_device_page = 0
|
||||
var page_size = 20
|
||||
var pages = 0
|
||||
enum Menu {
|
||||
VIEW,
|
||||
EDIT,
|
||||
ROOM,
|
||||
AUTOMATE,
|
||||
SETTINGS
|
||||
}
|
||||
|
||||
var selected_menu := Menu.EDIT
|
||||
|
||||
var selected_device = null
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
devices = await HomeAdapters.adapter.get_devices()
|
||||
select_menu(selected_menu)
|
||||
|
||||
next_page_button.get_node("Clickable").on_click.connect(func(_event):
|
||||
print("next page")
|
||||
next_page()
|
||||
)
|
||||
func _on_click(event):
|
||||
if event.target == nav_view:
|
||||
select_menu(Menu.VIEW)
|
||||
elif event.target == nav_edit:
|
||||
select_menu(Menu.EDIT)
|
||||
elif event.target == nav_room:
|
||||
select_menu(Menu.ROOM)
|
||||
elif event.target == nav_automate:
|
||||
select_menu(Menu.AUTOMATE)
|
||||
elif event.target == nav_settings:
|
||||
select_menu(Menu.SETTINGS)
|
||||
|
||||
previous_page_button.get_node("Clickable").on_click.connect(func(_event):
|
||||
previous_page()
|
||||
)
|
||||
func select_menu(menu: Menu):
|
||||
selected_menu = menu
|
||||
for child in $Content.get_children():
|
||||
if child.is_visible():
|
||||
child.hide()
|
||||
|
||||
render()
|
||||
var menu_node = enum_to_menu(menu)
|
||||
var nav_node = enum_to_nav(menu)
|
||||
|
||||
func update_pages():
|
||||
if selected_device == null:
|
||||
pages = ceil(float(devices.size()) / page_size)
|
||||
else:
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device:
|
||||
pages = ceil(float(device.values()[0]["entities"].size()) / page_size)
|
||||
if menu_node != null:
|
||||
menu_node.show()
|
||||
|
||||
func get_page():
|
||||
if selected_device == null:
|
||||
return devices.slice(page * page_size, page * page_size + page_size)
|
||||
else:
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device:
|
||||
return device.values()[0]["entities"].slice(page * page_size, page * page_size + page_size)
|
||||
for child in $Navigation.get_children():
|
||||
if child.active && child != nav_node:
|
||||
child.active = false
|
||||
child.disabled = false
|
||||
|
||||
func next_page():
|
||||
if page >= pages - 1:
|
||||
return
|
||||
page += 1
|
||||
render()
|
||||
func enum_to_nav(menu: Menu):
|
||||
match menu:
|
||||
Menu.VIEW:
|
||||
return nav_view
|
||||
Menu.EDIT:
|
||||
return nav_edit
|
||||
Menu.ROOM:
|
||||
return nav_room
|
||||
Menu.AUTOMATE:
|
||||
return nav_automate
|
||||
Menu.SETTINGS:
|
||||
return nav_settings
|
||||
|
||||
func previous_page():
|
||||
if page <= 0:
|
||||
return
|
||||
|
||||
page -= 1
|
||||
render()
|
||||
|
||||
func render():
|
||||
update_pages()
|
||||
page_number_label.set_text(str(page + 1) + " / " + str(pages))
|
||||
|
||||
previous_page_button.visible = page > 0
|
||||
next_page_button.visible = page < pages - 1
|
||||
|
||||
clear_menu()
|
||||
if selected_device == null:
|
||||
render_devices()
|
||||
else:
|
||||
render_entities()
|
||||
|
||||
func render_devices():
|
||||
var page_devices = get_page()
|
||||
|
||||
for device in page_devices:
|
||||
var info = device.values()[0]
|
||||
|
||||
var device_instance = Device.instantiate()
|
||||
device_instance.id = device.keys()[0]
|
||||
device_instance.get_node("Clickable").on_click.connect(func(_event):
|
||||
_on_device_click(device_instance.id)
|
||||
)
|
||||
devices_node.add_child(device_instance)
|
||||
device_instance.set_device_name(info["name"])
|
||||
|
||||
devices_node._update_container()
|
||||
|
||||
func render_entities():
|
||||
var entities = get_page()
|
||||
|
||||
var back_button = Entity.instantiate()
|
||||
back_button.get_node("Clickable").on_click.connect(func(_event):
|
||||
_on_entity_click("#back")
|
||||
)
|
||||
devices_node.add_child(back_button)
|
||||
back_button.set_entity_name("#back")
|
||||
|
||||
for entity in entities:
|
||||
var entity_instance = Entity.instantiate()
|
||||
entity_instance.get_node("Clickable").on_click.connect(func(_event):
|
||||
_on_entity_click(entity)
|
||||
)
|
||||
devices_node.add_child(entity_instance)
|
||||
entity_instance.set_entity_name(entity)
|
||||
|
||||
devices_node._update_container()
|
||||
|
||||
func _on_device_click(device_id):
|
||||
selected_device = device_id
|
||||
last_device_page = page
|
||||
page = 0
|
||||
|
||||
render()
|
||||
|
||||
func _on_entity_click(entity_name):
|
||||
if entity_name == "#back":
|
||||
selected_device = null
|
||||
page = last_device_page
|
||||
render()
|
||||
return
|
||||
|
||||
var type = entity_name.split(".")[0]
|
||||
print(type)
|
||||
|
||||
if type == "switch":
|
||||
var switch = Switch.instantiate()
|
||||
switch.entity_id = entity_name
|
||||
|
||||
switch.set_position(global_position)
|
||||
get_node("/root").add_child(switch)
|
||||
|
||||
if type == "light":
|
||||
var light = Light.instantiate()
|
||||
light.entity_id = entity_name
|
||||
|
||||
light.set_position(global_position)
|
||||
get_node("/root").add_child(light)
|
||||
|
||||
if type == "sensor":
|
||||
var sensor = Sensor.instantiate()
|
||||
sensor.entity_id = entity_name
|
||||
|
||||
sensor.set_position(global_position)
|
||||
get_node("/root").add_child(sensor)
|
||||
|
||||
func clear_menu():
|
||||
for child in devices_node.get_children():
|
||||
devices_node.remove_child(child)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
func enum_to_menu(menu: Menu):
|
||||
match menu:
|
||||
Menu.VIEW:
|
||||
return null
|
||||
Menu.EDIT:
|
||||
return menu_edit
|
||||
Menu.ROOM:
|
||||
return null
|
||||
Menu.AUTOMATE:
|
||||
return null
|
||||
Menu.SETTINGS:
|
||||
return null
|
|
@ -1,52 +1,81 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://c3kdssrmv84kv"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://c3kdssrmv84kv"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"]
|
||||
[ext_resource type="Material" uid="uid://bertj8bp8b5l1" path="res://assets/materials/interface.tres" id="2_nsukb"]
|
||||
[ext_resource type="Script" path="res://content/ui/menu/grid.gd" id="3_35a5r"]
|
||||
[ext_resource type="Texture2D" uid="uid://tr8yrx470k03" path="res://assets/materials/arrow_right.png" id="4_7frvc"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="4_f385t"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/button/button.tscn" id="5_w4i01"]
|
||||
[ext_resource type="PackedScene" uid="uid://crrb0l3ekuotj" path="res://content/ui/menu/edit/edit_menu.tscn" id="4_r2raj"]
|
||||
[ext_resource type="Texture2D" uid="uid://cattgsppxnbq4" path="res://assets/icons/visibility_white_24dp.svg" id="5_8o1rb"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_w4i01"]
|
||||
[ext_resource type="Texture2D" uid="uid://csq5a4gk6ba5b" path="res://assets/icons/widgets_white_24dp.svg" id="6_344ot"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://cejvc23wfwjqj" path="res://assets/immersive_home_panels/immersive_home_panels.obj" id="7_f4u4o"]
|
||||
[ext_resource type="Texture2D" uid="uid://jodf3dm654j3" path="res://assets/icons/view_in_ar_white_24dp.svg" id="7_wvovx"]
|
||||
[ext_resource type="Texture2D" uid="uid://dch6rwihrl3i2" path="res://assets/icons/schema_white_24dp.svg" id="8_3d082"]
|
||||
[ext_resource type="Texture2D" uid="uid://dyh0ax51xqp8n" path="res://assets/icons/settings_white_24dp.svg" id="9_mel13"]
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_6t3dn"]
|
||||
material = ExtResource("2_nsukb")
|
||||
size = Vector2(0.3, 0.3)
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_08du6"]
|
||||
size = Vector3(0.3, 0.01, 0.3)
|
||||
|
||||
[node name="Menu" type="Node3D"]
|
||||
script = ExtResource("1_ng4u3")
|
||||
|
||||
[node name="Background" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.15, 0, 0.15)
|
||||
mesh = SubResource("PlaneMesh_6t3dn")
|
||||
mesh = SubResource("BoxMesh_08du6")
|
||||
|
||||
[node name="Devices" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.03, 0, 0.03)
|
||||
script = ExtResource("3_35a5r")
|
||||
depth_gap = 0.06
|
||||
size = Vector3(0.24, 0.1, 0.1)
|
||||
[node name="ImmersiveHomePanels" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(-4.37114e-10, 0, 0.01, 0, 0.01, 0, -0.01, 0, -4.37114e-10, 0.32, 0, -0.0500001)
|
||||
mesh = ExtResource("7_f4u4o")
|
||||
|
||||
[node name="NextPageButton" parent="." instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, 0.01, 0.27)
|
||||
[node name="Navigation" type="Node3D" parent="."]
|
||||
|
||||
[node name="Decal" type="Decal" parent="NextPageButton"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0)
|
||||
size = Vector3(0.04, 0.04, 0.04)
|
||||
texture_albedo = ExtResource("4_7frvc")
|
||||
[node name="View" parent="Navigation" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.03)
|
||||
toggleable = true
|
||||
|
||||
[node name="Clickable" type="Node" parent="NextPageButton"]
|
||||
script = ExtResource("4_f385t")
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Navigation/View"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.012, 0)
|
||||
pixel_size = 0.0002
|
||||
axis = 1
|
||||
texture = ExtResource("5_8o1rb")
|
||||
|
||||
[node name="PreviousPageButton" parent="." instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.11, 0.01, 0.27)
|
||||
[node name="Edit" parent="Navigation" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.09)
|
||||
toggleable = true
|
||||
|
||||
[node name="Decal" type="Decal" parent="PreviousPageButton"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0.02, 0)
|
||||
size = Vector3(0.04, 0.04, 0.04)
|
||||
texture_albedo = ExtResource("4_7frvc")
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Navigation/Edit"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.012, 0)
|
||||
pixel_size = 0.0002
|
||||
axis = 1
|
||||
texture = ExtResource("6_344ot")
|
||||
|
||||
[node name="Clickable" type="Node" parent="PreviousPageButton"]
|
||||
script = ExtResource("4_f385t")
|
||||
[node name="Room" parent="Navigation" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.15)
|
||||
toggleable = true
|
||||
|
||||
[node name="PageNumberLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(0.1, 0, 0, 0, -4.37114e-09, 0.1, 0, -0.1, -4.37114e-09, 0.26, 0.01, 0.27)
|
||||
text = "1 / 3"
|
||||
font_size = 36
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Navigation/Room"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.012, 0)
|
||||
pixel_size = 0.0002
|
||||
axis = 1
|
||||
texture = ExtResource("7_wvovx")
|
||||
|
||||
[node name="Automate" parent="Navigation" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.21)
|
||||
toggleable = true
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Navigation/Automate"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.012, 0)
|
||||
pixel_size = 0.0002
|
||||
axis = 1
|
||||
texture = ExtResource("8_3d082")
|
||||
|
||||
[node name="Settings" parent="Navigation" instance=ExtResource("5_w4i01")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0, 0.27)
|
||||
toggleable = true
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Navigation/Settings"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.012, 0)
|
||||
pixel_size = 0.0002
|
||||
axis = 1
|
||||
texture = ExtResource("9_mel13")
|
||||
|
||||
[node name="Content" type="Node3D" parent="."]
|
||||
|
||||
[node name="EditMenu" parent="Content" instance=ExtResource("4_r2raj")]
|
||||
|
|
|
@ -34,6 +34,7 @@ func _init(url := self.url, token := self.token):
|
|||
func connect_ws():
|
||||
print("Connecting to %s" % self.url)
|
||||
socket.connect_to_url(self.url)
|
||||
set_process(true)
|
||||
|
||||
# https://github.com/godotengine/godot/issues/84423
|
||||
# Otherwise the WebSocketPeer will crash when receiving large packets
|
||||
|
@ -126,6 +127,9 @@ func handle_disconnect():
|
|||
set_process(false)
|
||||
on_disconnect.emit()
|
||||
|
||||
# Reconnect
|
||||
connect_ws()
|
||||
|
||||
func send_subscribe_packet(packet: Dictionary, callback: Callable):
|
||||
packet.id = id
|
||||
id += 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user