diff --git a/app/addons/debug_draw_3d/LICENSE b/app/addons/debug_draw_3d/LICENSE index d5bafad..617a15b 100644 --- a/app/addons/debug_draw_3d/LICENSE +++ b/app/addons/debug_draw_3d/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 DmitriySalnikov +Copyright (c) 2024 DmitriySalnikov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal diff --git a/app/addons/debug_draw_3d/README.md b/app/addons/debug_draw_3d/README.md index 5f5f49d..35fed41 100644 --- a/app/addons/debug_draw_3d/README.md +++ b/app/addons/debug_draw_3d/README.md @@ -1,10 +1,12 @@ -![icon](/images/icon.png) +![icon](/images/icon_3d_128.png) # Debug drawing utility for Godot This is an add-on for debug drawing in 3D and for some 2D overlays, which is written in `C++` and can be used with `GDScript` or `C#`. -Based on my previous addon, which was developed only for C# https://github.com/DmitriySalnikov/godot_debug_draw_cs, and which was inspired by Zylann's GDScript addon https://github.com/Zylann/godot_debug_draw +Based on my previous addon, which was developed [only for C#](https://github.com/DmitriySalnikov/godot_debug_draw_cs), and which was inspired by [Zylann's GDScript addon](https://github.com/Zylann/godot_debug_draw) + +## [Documentation](https://dd3d.dmitriysalnikov.ru/docs/) ## [Godot 3 version](https://github.com/DmitriySalnikov/godot_debug_draw_3d/tree/godot_3) @@ -12,11 +14,11 @@ Based on my previous addon, which was developed only for C# https://github.com/D Your support adds motivation to develop my public projects. -[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I53VZ2D) +Boosty -[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://paypal.me/dmitriysalnikov) +USDT-TRC20 -[qiwi](https://qiwi.com/n/DMITRIYSALNIKOV) +USDT-TRC20 TEw934PrsffHsAn5M63SoHYRuZo984EF6v ## Features @@ -32,6 +34,7 @@ Your support adds motivation to develop my public projects. * Line * Line Path * Line with Arrow +* Plane * Points * Position 3D (3 crossing axes) * Sphere @@ -49,26 +52,32 @@ Overlay: Precompiled for: * Windows -* Linux -* macOS -* Android +* Linux (built on Ubuntu 20.04) +* macOS (10.14+) +* Android (5.0+) +* iOS +* Web (Firefox not supported) + +This addon also supports working with several World3D and different Viewports. + +## [Interactive Web Demo](https://dd3d.dmitriysalnikov.ru/demo/) + +[![screenshot_web](/images/screenshot_web.png)](https://dd3d.dmitriysalnikov.ru/demo/) + +> [!WARNING] +> +> * Firefox most likely can't run this demo ## Download To download, use the [Godot Asset Library](https://godotengine.org/asset-library/asset/1766) or download the archive by clicking the button at the top of the main repository page: `Code -> Download ZIP`, then unzip it to your project folder. Or use one of the stable versions from the [GitHub Releases](https://github.com/DmitriySalnikov/godot_debug_draw_3d/releases) page (just download one of the `Source Codes` in assets). -## Usage +### Installation * Close editor * Copy `addons/debug_draw_3d` to your `addons` folder, create it if the folder doesn't exist * Launch editor -### C\# - -When you start the engine for the first time, bindings for `C#` will be generated automatically. If this does not happen, you can manually generate them through the `Project - Tools - Debug Draw` menu. - -![project_tools_menu](/images/project_tools_menu.png) - ## Examples More examples can be found in the `examples_dd3d/` folder. @@ -77,65 +86,29 @@ Simple test: ```gdscript func _process(delta: float) -> void: - var _time = Time.get_ticks_msec() / 1000.0 - var box_pos = Vector3(0, sin(_time * 4), 0) - var line_begin = Vector3(-1, sin(_time * 4), 0) - var line_end = Vector3(1, cos(_time * 4), 0) + var _time = Time.get_ticks_msec() / 1000.0 + var box_pos = Vector3(0, sin(_time * 4), 0) + var line_begin = Vector3(-1, sin(_time * 4), 0) + var line_end = Vector3(1, cos(_time * 4), 0) - DebugDraw3D.draw_box(box_pos, Vector3(1, 2, 1), Color(0, 1, 0)) - DebugDraw3D.draw_line(line_begin, line_end, Color(1, 1, 0)) - DebugDraw2D.set_text("Time", _time) - DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn()) - DebugDraw2D.set_text("FPS", Engine.get_frames_per_second()) - DebugDraw2D.set_text("delta", delta) -``` - -```csharp -public override void _Process(float delta) -{ - var _time = Time.GetTicksMsec() / 1000.0f; - var box_pos = new Vector3(0, Mathf.Sin(_time * 4f), 0); - var line_begin = new Vector3(-1, Mathf.Sin(_time * 4f), 0); - var line_end = new Vector3(1, Mathf.Cos(_time * 4f), 0); - - DebugDraw3D.DrawBox(box_pos, new Vector3(1, 2, 1), new Color(0, 1, 0)); - DebugDraw3D.DrawLine(line_begin, line_end, new Color(1, 1, 0)); - DebugDraw2D.SetText("Time", _time); - DebugDraw2D.SetText("Frames drawn", Engine.GetFramesDrawn()); - DebugDraw2D.SetText("FPS", Engine.GetFramesPerSecond()); - DebugDraw2D.SetText("delta", delta); -} + DebugDraw3D.draw_box(box_pos, Vector3(1, 2, 1), Color(0, 1, 0)) + DebugDraw3D.draw_line(line_begin, line_end, Color(1, 1, 0)) + DebugDraw2D.set_text("Time", _time) + DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn()) + DebugDraw2D.set_text("FPS", Engine.get_frames_per_second()) + DebugDraw2D.set_text("delta", delta) ``` ![screenshot_1](/images/screenshot_1.png) ## API -A list of all functions is available in the documentation inside the editor. +This project has a separate [documentation](https://dd3d.dmitriysalnikov.ru/docs/) page. + +Also, a list of all functions is available in the documentation inside the editor (see `DebugDraw3D` and `DebugDraw2D`). + ![screenshot_4](/images/screenshot_4.png) -Besides `DebugDraw2D/3D`, you can also use `Dbg2/3`. - -```gdscript - DebugDraw3D.draw_box_xf(Transform3D(), Color.GREEN) - Dbg3.draw_box_xf(Transform3D(), Color.GREEN) - - DebugDraw2D.set_text("delta", delta) - Dbg2.set_text("delta", delta) -``` - -But unfortunately at the moment `GDExtension` does not support adding documentation. - -## Exporting a project - -Most likely, when exporting a release version of a game, you don't want to export the debug library along with it. But since there is still no `Conditional Compilation` in `GDScript`, so I decided to create a `dummy` library that has the same API as a regular library, but has minimal impact on performance, even if calls to its methods occur. The `dummy` library is used by default in the release version. However if you need to use debug rendering in the release version, then you can add the `forced_dd3d` feature when exporting. In this case, the release library with all the functionality will be used. - -![export_features](/images/export_features.png) - -In C#, these tags are not taken into account at compile time, so the Release build will use Runtime checks to disable draw calls. If you want to avoid this, you can manually specify the `FORCED_DD3D` symbol. - -![csharp_compilation_symbols](/images/csharp_compilation_symbols.png) - ## Known issues and limitations Enabling occlusion culing can lower fps instead of increasing it. At the moment I do not know how to speed up the calculation of the visibility of objects. @@ -155,29 +128,3 @@ The entire text overlay can only be placed in one corner, unlike `DataGraphs`. `DebugDrawDemoScene.tscn` in play mode ![screenshot_3](/images/screenshot_3.png) - -## Build - -As well as for the engine itself, you will need to configure the [environment](https://docs.godotengine.org/en/4.1/contributing/development/compiling/index.html). -And also you need to apply several patches: - -```bash -cd godot-cpp -git apply --ignore-space-change --ignore-whitespace ../patches/always_build_fix.patch -git apply --ignore-space-change --ignore-whitespace ../patches/1165.patch -# Optional -## Build only the necessary classes -git apply --ignore-space-change --ignore-whitespace ../patches/godot_cpp_exclude_unused_classes.patch -## Faster build -git apply --ignore-space-change --ignore-whitespace ../patches/unity_build.patch -``` - -Then you can just run scons as usual: - -```bash -# build for the current system. -# target=editor is used for both the editor and the debug template. -scons target=editor dev_build=yes debug_symbols=yes -# build for the android. ANDROID_NDK_ROOT is required in your environment variables. -scons platform=android target=template_release arch=arm64v8 -``` diff --git a/app/addons/debug_draw_3d/debug_draw_3d.gdextension b/app/addons/debug_draw_3d/debug_draw_3d.gdextension index c914b15..a7482b6 100644 --- a/app/addons/debug_draw_3d/debug_draw_3d.gdextension +++ b/app/addons/debug_draw_3d/debug_draw_3d.gdextension @@ -1,55 +1,90 @@ [configuration] entry_symbol = "debug_draw_3d_library_init" -compatibility_minimum = "4.1" +compatibility_minimum = "4.1.3" +reloadable = false [dependencies] -# example.x86_64 = { "relative or absolute path to the dependency" : "the path relative to the exported project", } +; example.x86_64 = { "relative or absolute path to the dependency" : "the path relative to the exported project", } +; ------------------------------------- +; debug macos = { } windows.x86_64 = { } linux.x86_64 = { } +web.wasm32 = {} + android.arm32 = { } android.arm64 = { } android.x86_32 = { } android.x86_64 = { } +ios = {} + +; ------------------------------------- +; release no debug draw macos.template_release = { } windows.template_release.x86_64 = { } linux.template_release.x86_64 = { } +web.template_release.wasm32 = { } + android.template_release.arm32 = { } android.template_release.arm64 = { } android.template_release.x86_32 = { } android.template_release.x86_64 = { } +ios.template_release = {} + +; ------------------------------------- +; release forced debug draw + +macos.template_release.forced_dd3d = { } +windows.template_release.x86_64.forced_dd3d = { } +linux.template_release.x86_64.forced_dd3d = { } + +web.template_release.wasm32.forced_dd3d = { } +ios.template_release.forced_dd3d = {} [libraries] -macos = "libs/libdd3d.macos.editor.universal.dylib" +; ------------------------------------- +; debug + +macos = "libs/libdd3d.macos.editor.universal.framework" windows.x86_64 = "libs/libdd3d.windows.editor.x86_64.dll" linux.x86_64 = "libs/libdd3d.linux.editor.x86_64.so" +web.wasm32 = "libs/libdd3d.web.template_debug.wasm32.wasm" + android.arm32 = "libs/libdd3d.android.template_debug.arm32.so" android.arm64 = "libs/libdd3d.android.template_debug.arm64.so" android.x86_32 = "libs/libdd3d.android.template_debug.x86_32.so" android.x86_64 = "libs/libdd3d.android.template_debug.x86_64.so" +ios = "libs/libdd3d.ios.template_debug.universal.dylib" -macos.template_release = "libs/libdd3d.macos.template_release.universal.dylib" +; ------------------------------------- +; release no debug draw + +macos.template_release = "libs/libdd3d.macos.template_release.universal.framework" windows.template_release.x86_64 = "libs/libdd3d.windows.template_release.x86_64.dll" linux.template_release.x86_64 = "libs/libdd3d.linux.template_release.x86_64.so" +web.template_release.wasm32 = "libs/libdd3d.web.template_release.wasm32.wasm" + android.template_release.arm32 = "libs/libdd3d.android.template_release.arm32.so" android.template_release.arm64 = "libs/libdd3d.android.template_release.arm64.so" android.template_release.x86_32 = "libs/libdd3d.android.template_release.x86_32.so" android.template_release.x86_64 = "libs/libdd3d.android.template_release.x86_64.so" +ios.template_release = "libs/libdd3d.ios.template_release.universal.dylib" -macos.template_release.forced_dd3d = "libs/libdd3d.macos.template_release.universal.enabled.dylib" +; ------------------------------------- +; release forced debug draw + +macos.template_release.forced_dd3d = "libs/libdd3d.macos.template_release.universal.enabled.framework" windows.template_release.x86_64.forced_dd3d = "libs/libdd3d.windows.template_release.x86_64.enabled.dll" linux.template_release.x86_64.forced_dd3d = "libs/libdd3d.linux.template_release.x86_64.enabled.so" -android.template_release.arm32.forced_dd3d = "libs/libdd3d.android.template_release.arm32.enabled.so" -android.template_release.arm64.forced_dd3d = "libs/libdd3d.android.template_release.arm64.enabled.so" -android.template_release.x86_32.forced_dd3d = "libs/libdd3d.android.template_release.x86_32.enabled.so" -android.template_release.x86_64.forced_dd3d = "libs/libdd3d.android.template_release.x86_64.enabled.so" +web.template_release.wasm32.forced_dd3d = "libs/libdd3d.web.template_release.wasm32.enabled.wasm" +ios.template_release.forced_dd3d = "libs/libdd3d.ios.template_release.universal.enabled.dylib" \ No newline at end of file diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so index a8c5001..8bc0a99 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0fb41898f762f555f379bc351a0d2d82bc9cbf3b701a1f9fe8035646ddad44b5 -size 2928328 +oid sha256:978f336aeab12a1dbae7810d5b741d48d4dfacbb09795d822381c35d1d873ed9 +size 2130424 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so index ae4fe93..a299c79 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1dfdb52ffe2e428ea0a0b9ff951b986546291f383f37c957d7de4c367f79892f -size 2993032 +oid sha256:fe483e08b7c1dea385c44648eff6169d6cd82a082e7fa92a1558aff187017f18 +size 2081864 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so index a6c31e2..e2bf6ca 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c580b7b4d44342c56d1990ab09358b63fa60cf99846a355c86ceb2cb5023b14 -size 3057172 +oid sha256:34ed0395761d9cf747349d6a0da81747ade72e8359eeff2cb9f577bf66db907c +size 2270604 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so index 59d21d3..cb512bf 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6c2b95269938e60e709539c8166cd9e5f450bd3fbd2b6bdfdf652fca3f594db -size 2977744 +oid sha256:1fb3bf518db7c16cd08ec134c15bc45a909f183392820d2cff03674442cebfd5 +size 2088832 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so index ac25634..c13bdcf 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c40f93bd53bc4b132d075f18814b1198e71df6b9f2601c11f0cfbc2494698cf -size 1804756 +oid sha256:2b8175a62d44c4fd39d0003b17aef3da9157d70049dc586ed1c7a06920482d7c +size 1119180 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so index 267c209..a4f4238 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0181cc7c1a08ecc39de983b1b1e35f66572479da533f744190fa803cbde44612 -size 2001576 +oid sha256:d7176ff1995b280131ce6e9157a820adb2680a5e00a38edf9b8a2b362a720321 +size 1197480 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so index 382bfdb..b0190cc 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24497f5a2ad8a7d99e2acb62d6c526017d7c365f8fd7fd6ae3042d96bd6e980a -size 1996072 +oid sha256:7804c45cc8457c01ceac20f3d076d63e723b9ff526bff4b490cb03038f60ae62 +size 1293232 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so index a38fb1e..e32c3cf 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6eab3ff00fc2d7347a6b166e67a3800d6117fa84bcfa3317429d6e0bff896654 -size 2028472 +oid sha256:7963d06c72a3c89c84118c40f585a084d676e59e9e354f2d8f54d1340d8b1ec1 +size 1230440 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib b/app/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib new file mode 100644 index 0000000..38209f4 --- /dev/null +++ b/app/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:354cf1623f4d5f4f04f352bb6a6d661d0b6837fecfe566946e215fe549edb23c +size 958088 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib b/app/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib new file mode 100644 index 0000000..52c61d4 --- /dev/null +++ b/app/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4f164f9e56953e805ae68472d91a4473e894952736cb3c34c1307df81748275 +size 645216 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib b/app/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib new file mode 100644 index 0000000..b628e34 --- /dev/null +++ b/app/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d159c981d0f12b3083e50a9883842e99997403fbae35be0a1ec73cde4d687d4 +size 941448 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so b/app/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so index 07a3f4e..a6daccf 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b39c1ca40f0a22e66e742daba8e050884caa7a3ff959824b0c99a7e061fd869 -size 3806144 +oid sha256:1a72e1c797dfc643b589ef90a2f28b423a374420f2305f14130602c2f6a51d7e +size 3126080 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so b/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so index 619483e..01ce6a4 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4bfbec2037276c6858cbfc4019bb0381eb9bd83cdcdfcfa3cc802bfc0d5f427b -size 3072224 +oid sha256:17cc6ed1e9f3ec13b5c45b8326e0c625510c12f2a67643a6dda343908263cc70 +size 2239208 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so b/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so index d9df68f..71c3530 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so +++ b/app/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7efcb3de6de7d5a878c4a221931a94a74f3741a6aeb7d7e9a4f19fb07bf1115c -size 2193840 +oid sha256:1ea1c91354de2e491548673778e5ecf04c705614431bcc01b3104cdde223eb6f +size 1403568 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.dylib b/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.dylib deleted file mode 100644 index 1ba502d..0000000 --- a/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.dylib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:818647a1234354725573918ce71972193812dd19d9ffb4bbe35f4a17ff48341f -size 5739144 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist b/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist new file mode 100644 index 0000000..88808eb --- /dev/null +++ b/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist @@ -0,0 +1,33 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + en + CFBundleExecutable + libdd3d.macos.editor.universal + CFBundleName + Debug Draw 3D + CFBundleDisplayName + Debug Draw 3D + CFBundleIdentifier + ru.dmitriysalnikov.dd3d + NSHumanReadableCopyright + Copyright (c) Dmitriy Salnikov. + CFBundleVersion + 1.4.1 + CFBundleShortVersionString + 1.4.1 + CFBundlePackageType + FMWK + CSResourcesFileMapped + + DTPlatformName + macosx + LSMinimumSystemVersion + 10.14 + + + \ No newline at end of file diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal b/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal new file mode 100644 index 0000000..924d4c1 Binary files /dev/null and b/app/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal differ diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.dylib b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.dylib deleted file mode 100644 index f05a3b9..0000000 --- a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.dylib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5bbf87c77f9c9fe6643948257e91f271825a2874172c97cdbd915a6203a6eff3 -size 3339680 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.dylib b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.dylib deleted file mode 100644 index 6ac5ee5..0000000 --- a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.dylib +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b0f280b00b057266534e477e4b33e476f108b41d1927d4db39e8d1e3a781adc5 -size 4689496 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist new file mode 100644 index 0000000..e5aff13 --- /dev/null +++ b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist @@ -0,0 +1,33 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + en + CFBundleExecutable + libdd3d.macos.template_release.universal.enabled + CFBundleName + Debug Draw 3D + CFBundleDisplayName + Debug Draw 3D + CFBundleIdentifier + ru.dmitriysalnikov.dd3d + NSHumanReadableCopyright + Copyright (c) Dmitriy Salnikov. + CFBundleVersion + 1.4.1 + CFBundleShortVersionString + 1.4.1 + CFBundlePackageType + FMWK + CSResourcesFileMapped + + DTPlatformName + macosx + LSMinimumSystemVersion + 10.14 + + + \ No newline at end of file diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled new file mode 100644 index 0000000..a766b42 Binary files /dev/null and b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled differ diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist new file mode 100644 index 0000000..ea8c402 --- /dev/null +++ b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist @@ -0,0 +1,33 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + en + CFBundleExecutable + libdd3d.macos.template_release.universal + CFBundleName + Debug Draw 3D + CFBundleDisplayName + Debug Draw 3D + CFBundleIdentifier + ru.dmitriysalnikov.dd3d + NSHumanReadableCopyright + Copyright (c) Dmitriy Salnikov. + CFBundleVersion + 1.4.1 + CFBundleShortVersionString + 1.4.1 + CFBundlePackageType + FMWK + CSResourcesFileMapped + + DTPlatformName + macosx + LSMinimumSystemVersion + 10.14 + + + \ No newline at end of file diff --git a/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal new file mode 100644 index 0000000..9452b97 Binary files /dev/null and b/app/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal differ diff --git a/app/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm b/app/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm new file mode 100644 index 0000000..5c7329e Binary files /dev/null and b/app/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm differ diff --git a/app/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm b/app/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm new file mode 100644 index 0000000..f9e5b75 Binary files /dev/null and b/app/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm differ diff --git a/app/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm b/app/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm new file mode 100644 index 0000000..fb4fe95 Binary files /dev/null and b/app/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm differ diff --git a/app/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll b/app/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll index 2206af5..23224d0 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll +++ b/app/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac3ac3647171c53e2f47564df2e25eff19fbfab8bf763d0078fe1c82476d8761 -size 1291264 +oid sha256:8b5d2a0b653d41b603acbf68a8bc1d681c114e592d0ce6379abeb256350c8919 +size 1543168 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll b/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll index 07578b6..10b5988 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll +++ b/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d3113daaa53fe431ca8ce55f127c0e41ef4243ab5aadd359dc6d2c63b31f057 -size 680448 +oid sha256:16e0f6b6bdbea5a57f6ea0b6d205d85fed55b5a436740d902cb17760494260de +size 663040 diff --git a/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll b/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll index c26c24b..fb145ed 100644 --- a/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll +++ b/app/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af5ae3a80d09e6212d21e4cf608aa38f711d230914918d0f2f427bdcc5488e24 -size 862208 +oid sha256:d1290dd070bb6255caa4aabfe9346f1b7eb16f1f00b12770751c0a37947ab828 +size 961536 diff --git a/app/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll b/app/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll index 2206af5..23224d0 100644 --- a/app/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll +++ b/app/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac3ac3647171c53e2f47564df2e25eff19fbfab8bf763d0078fe1c82476d8761 -size 1291264 +oid sha256:8b5d2a0b653d41b603acbf68a8bc1d681c114e592d0ce6379abeb256350c8919 +size 1543168 diff --git a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrkhronos-debug.aar b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrkhronos-debug.aar index dda70e1..25c2f2e 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrkhronos-debug.aar and b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrkhronos-debug.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrlynx-debug.aar b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrlynx-debug.aar index 331ed78..c0610dc 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrlynx-debug.aar and b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrlynx-debug.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrmeta-debug.aar b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrmeta-debug.aar index 9e9b286..16cf06c 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrmeta-debug.aar and b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrmeta-debug.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrpico-debug.aar b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrpico-debug.aar index 53de128..a078a25 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrpico-debug.aar and b/app/addons/godotopenxrvendors/.bin/android/debug/godotopenxrpico-debug.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrkhronos-release.aar b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrkhronos-release.aar index d1296b0..abca8d7 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrkhronos-release.aar and b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrkhronos-release.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrlynx-release.aar b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrlynx-release.aar index 5b64380..c022b39 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrlynx-release.aar and b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrlynx-release.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrmeta-release.aar b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrmeta-release.aar index ae3ff3a..3a70f18 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrmeta-release.aar and b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrmeta-release.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrpico-release.aar b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrpico-release.aar index f2492f8..bbf173d 100644 Binary files a/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrpico-release.aar and b/app/addons/godotopenxrvendors/.bin/android/release/godotopenxrpico-release.aar differ diff --git a/app/addons/godotopenxrvendors/.bin/android/template_debug/arm64/libgodotopenxrvendors.so b/app/addons/godotopenxrvendors/.bin/android/template_debug/arm64/libgodotopenxrvendors.so deleted file mode 100644 index d3b0834..0000000 --- a/app/addons/godotopenxrvendors/.bin/android/template_debug/arm64/libgodotopenxrvendors.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:59d5063a65a06775814e6a8d0ce94ba11292e6d262fd908d4e9511bd08d3879f -size 1545632 diff --git a/app/addons/godotopenxrvendors/.bin/android/template_release/arm64/libgodotopenxrvendors.so b/app/addons/godotopenxrvendors/.bin/android/template_release/arm64/libgodotopenxrvendors.so deleted file mode 100644 index 89d1b4d..0000000 --- a/app/addons/godotopenxrvendors/.bin/android/template_release/arm64/libgodotopenxrvendors.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e82ab01c93b949e0ba617774946dcdd7f2706253ee880d90a76e29db5ce742e1 -size 1421072 diff --git a/app/addons/godotopenxrvendors/.bin/linux/template_debug/x86_64/libgodotopenxrvendors.so b/app/addons/godotopenxrvendors/.bin/linux/template_debug/x86_64/libgodotopenxrvendors.so deleted file mode 100644 index 72042ef..0000000 --- a/app/addons/godotopenxrvendors/.bin/linux/template_debug/x86_64/libgodotopenxrvendors.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c70e5b762ad7e6a252d05b7942979b6e3fb6ff3954f519ef62de0d9babb5ce35 -size 1711880 diff --git a/app/addons/godotopenxrvendors/.bin/linux/template_release/x86_64/libgodotopenxrvendors.so b/app/addons/godotopenxrvendors/.bin/linux/template_release/x86_64/libgodotopenxrvendors.so deleted file mode 100644 index b0c5898..0000000 --- a/app/addons/godotopenxrvendors/.bin/linux/template_release/x86_64/libgodotopenxrvendors.so +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:32a3af490a43567c353013f5a5d453c0fc415715a91de67931cfde1d608c7064 -size 1645056 diff --git a/app/addons/godotopenxrvendors/.bin/macos/template_debug/libgodotopenxrvendors.macos.framework/libgodotopenxrvendors.macos b/app/addons/godotopenxrvendors/.bin/macos/template_debug/libgodotopenxrvendors.macos.framework/libgodotopenxrvendors.macos deleted file mode 100644 index c0da6cd..0000000 Binary files a/app/addons/godotopenxrvendors/.bin/macos/template_debug/libgodotopenxrvendors.macos.framework/libgodotopenxrvendors.macos and /dev/null differ diff --git a/app/addons/godotopenxrvendors/.bin/macos/template_release/libgodotopenxrvendors.macos.framework/libgodotopenxrvendors.macos b/app/addons/godotopenxrvendors/.bin/macos/template_release/libgodotopenxrvendors.macos.framework/libgodotopenxrvendors.macos deleted file mode 100644 index c8e3866..0000000 Binary files a/app/addons/godotopenxrvendors/.bin/macos/template_release/libgodotopenxrvendors.macos.framework/libgodotopenxrvendors.macos and /dev/null differ diff --git a/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.dll b/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.dll index e565c75..75b0b37 100644 --- a/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.dll +++ b/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:726491737bb6a42253fae56d22d51c43b2ca2ee6a0e0b5bc77b18683a388b8c6 -size 2367488 +oid sha256:6ce9734e2f9ae8ce55b1eafb5b798cf4fa00f4e69829355aaf8b9b8b2a56481b +size 1219584 diff --git a/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.exp b/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.exp new file mode 100644 index 0000000..8329c1e Binary files /dev/null and b/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.exp differ diff --git a/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.lib b/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.lib new file mode 100644 index 0000000..15da982 Binary files /dev/null and b/app/addons/godotopenxrvendors/.bin/windows/template_debug/x86_64/libgodotopenxrvendors.lib differ diff --git a/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.dll b/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.dll index 90bbbe0..d46ef7c 100644 --- a/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.dll +++ b/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0d209ab5f1224b52f0e5c523a26c7dd0be853762c53cd54241eba48cd0148e75 -size 2343936 +oid sha256:7ec8f5fa085da2d53df1f9350ac602f359eded02e8dfd8af4b5f26585298491a +size 1025536 diff --git a/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.exp b/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.exp new file mode 100644 index 0000000..22d5f01 Binary files /dev/null and b/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.exp differ diff --git a/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.lib b/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.lib new file mode 100644 index 0000000..15da982 Binary files /dev/null and b/app/addons/godotopenxrvendors/.bin/windows/template_release/x86_64/libgodotopenxrvendors.lib differ diff --git a/app/addons/godotopenxrvendors/GodotOpenXRVendors_CHANGES.md b/app/addons/godotopenxrvendors/GodotOpenXRVendors_CHANGES.md deleted file mode 100644 index 0e1d62c..0000000 --- a/app/addons/godotopenxrvendors/GodotOpenXRVendors_CHANGES.md +++ /dev/null @@ -1,48 +0,0 @@ -# Change history for the Godot OpenXR loaders asset - -## 3.0.0 -- Merge GDExtension into a single implementation -- Upgrade Android, Gradle, Godot and Kotlin dependencies -- Add XR_FB_face_tracking support -- Update to OpenXR 1.0.34 headers -- Add XR_FB_render_model extension wrapper and OpenXRFBRenderModel node -- Add XR_FB_passthrough extension wrapper -- Add XR_FB_hand_tracking_mesh extension wrapper and OpenXRFbHandTrackingMesh node -- Add XR_FB_hand_tracking_aim support -- Update Meta OpenXR mobile SDK to version 62 - -## 2.0.3 -- Migrate the export scripts from gdscript to C++ via gdextension -- Manually request eye tracking permission if it's included in the app manifest -- Change how singletons are accessed -- Fix the plugin version for the export plugins -- Add OpenXR extension wrappers for fb_scene, fb_spatial_entity, fb_spatial_entity_query, fb_spatial_entity_container - -## 2.0.0 -- Update to the new Godot 4.2 Android plugin packaging format -- Update the plugin to Godot v2 Android plugin -- Update to the Godot 4.2 Android library -- Add warning when multiple loaders are selected -- Add configs for the OpenXR Eye gaze interaction extension -- Add the ability to customize supported Meta devices -- Add support for Quest 3 devices -- Update the directory structure for the v2 plugin -- Update Meta OpenXR mobile SDK to version 57 -- Update the java version to 17 -- Rename the plugin to 'Godot OpenXR Vendors' -- Add godot-cpp dependency -- Add OpenXR 1.0.30 headers -- Add support for the Meta scene capture API (Donated by [Migeran](https://migeran.com)) - -## 1.1.0 -- Update Meta OpenXR loader to version 54 -- Update PICO OpenXR loader to version 2.2.0 -- Bump dependencies versions to match the latest Godot 4.x stable version (v4.0.3) - -## 1.0.0 -- First version -- Added support for Meta Quest loader -- Added support for Pico loader -- Added support for Khronos loader (Magic Leap 2, HTC, etc.) -- Added support for Lynx loader -- Add logic to automatically publish the Godot OpenXR loaders libraries to mavencentral on release diff --git a/app/addons/godotopenxrvendors/khronos/LICENSE b/app/addons/godotopenxrvendors/khronos/LICENSE deleted file mode 100644 index 6b0b127..0000000 --- a/app/addons/godotopenxrvendors/khronos/LICENSE +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/app/addons/godotopenxrvendors/meta/LICENSE.txt b/app/addons/godotopenxrvendors/meta/LICENSE.txt deleted file mode 100644 index 6516fa3..0000000 --- a/app/addons/godotopenxrvendors/meta/LICENSE.txt +++ /dev/null @@ -1,3 +0,0 @@ -Copyright © Facebook Technologies, LLC and its affiliates. All rights reserved. - -Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at https://developer.oculus.com/licenses/oculussdk/ \ No newline at end of file diff --git a/app/addons/godotopenxrvendors/pico/LICENSE.md b/app/addons/godotopenxrvendors/pico/LICENSE.md deleted file mode 100644 index a4f8adf..0000000 --- a/app/addons/godotopenxrvendors/pico/LICENSE.md +++ /dev/null @@ -1,63 +0,0 @@ -The Pico OpenXR loader binary is part of the [Pico OpenXR SDK](https://developer-global.pico-interactive.com/sdk?deviceId=1&platformId=3&itemId=11) v2.2.0 licensed under the "PICO IMMERSIVE PTE. LTD – SDK LICENSE TERMS" printed below. In communication with Godot developers, Pico explicitly clarified that the redistribution of the loader binary as part of the Godot export plugin and its repositories is permitted under these terms. - ---- - -# PICO IMMERSIVE PTE. LTD – SDK LICENSE TERMS - -These license terms are between You ("You") and Pico Immersive Pte. Ltd ("Pico") regarding Your use of the Pico Software Development Kit and any associated documentation, software code or other materials made available by Pico (collectively referred to in this agreement as the "SDK"). - -The SDK is made available by PICO to enable developers to build software applications for the Pico Platform. - -BY INSTALLING, ACCESSING OR OTHERWISE USING THE SDK, YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT AND CONSENT TO THE TRANSMISSION OF CERTAIN COMPUTER INFORMATION DURING USE AND FOR INTERNET-BASED SERVICES. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE AGREEMENT, DO NOT INSTALL, ACCESS OR USE THE SDK. - -1. _Installation._ You may install and use any number of copies of the SDK on your devices to design, develop and test your programs. Each copy must be complete, including all copyright and trademark notices. You must require end users to agree to terms of use that protect the SDK as much as these License terms. - -2. _Use._ You may use the SDK solely for the purpose of creating "Authorized Applications" which for the purpose of this license are applications, such as client-based applications, in object code form that are designed to run on PICO hardware devices. You are not authorized to pre-install or embed applications created using this SDK on third-party devices. You may not rent, lease or lend any of Your rights in the SDK or access to the Pico Services. You may reproduce the SDK, provided that You reproduce only complete copies, including without limitation all "read me" files, copyright notices, and other legal notices and terms that Pico has included in the SDK, and provided that You may not distribute any copy You make of the SDK. - -3. _Scope of License._ The SDK is licensed, not sold. This license only gives You some rights to use the SDK. Pico reserves all other rights. Unless applicable law gives You more rights despite this limitation, You may use the SDK only as expressly permitted in this license. In doing so, You must comply with any technical limitations in the SDK that only allow You to use it in certain ways. You may not: - - 3.1. work around any technical limitations in the SDK; - - 3.2. reverse engineer, decompile or disassemble the SDK, except and only to the extent that applicable law expressly permits, despite this limitation; - - 3.3. make more copies of the SDK than specified in this license or allowed by, except and only to the extent applicable law expressly permits, despite this limitation; or - - 3.4. publish the SDK for others to copy. - -4. _Use of the services._ Your use of the Pico Services is governed by the then-current TOUs which can be found on: https://developer-global.pico-interactive.com/terms. If any SDK for which You are granted rights hereunder make use of the Pico Services (as governed by the applicable TOU), then those SDK rights are granted subject to your compliance with the applicable TOU. - -5. _EXPORT RESTRICTIONS._ THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGdlATIONS. YOU MUST COMPLY WITH ALL UNITED STATES, AND INTERNATIONAL EXPORT LAWS AND REGdlATIONS, WHICH INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE. - -6. _Support._ Pico is not obligated to provide any technical or other support ("Support Services") for the SDK or Pico Services to You. However, if Pico chooses to provide any Support Services to You, Your use of such Support Services will be governed by then-current Pico policies. With respect to any technical or other information You provide to Pico in connection with the Support Services, You agree that Pico has an unrestricted right to use such information for its business purposes, including for product support and development. Pico will not use such information in a form that personally identifies You. - -7. _Fees._ Pico may choose in the future to charge for use of the SDK and/or Services. If Pico in its sole discretion chooses to establish fees and payment terms for such use, Pico will provide notice of such terms as provided in Section 10 below, and You may elect to stop using the SDK and/or Services rather than incurring fees. - -8. _Termination._ Pico reserves the right to discontinue offering the SDK and Pico Services or to modify the SDK and Pico Services at any time in its sole discretion. If You are dissatisfied with any aspect of the SDK or Pico Services at any time, Your sole and exclusive remedy is to cease using them. Notwithstanding anything contained in the license to the contrary, Pico may also, in its sole discretion, terminate or suspend access to the SDK and Pico Services to You or any end user at any time. You acknowledge that termination and/or monetary damages may not be a sufficient remedy if You breach this license and that Pico will be entitled, without waiving any other rights or remedies, to injunctive or equitable relief as may be deemed proper by a court of competent jurisdiction in the event of a breach. Sections 8, 9, 11, 13 and 14 will survive termination of this license or any discontinuation of the offering of the SDK or Pico Services, along with any other provisions that wodld reasonably be deemed to survive such events. - -9. _Reservation of Rights._ Except for the licenses expressly granted under this license, Pico and its suppliers retain all right, title and interest in and to the SDK, Pico Services, and all intellectual property rights therein. You are not authorized to alter, modify, copy, edit, format, create derivative works of or otherwise use any materials, content or technology provided under this license except as explicitly provided in this license or approved in advance in writing by Pico. - -10. _Modifications; Notices._ If we change this contract, then we will give you notice before the change is in force. If you do not agree to these changes, then you must cancel and stop using the SDK and Pico Services before the changes are in force. If you do not stop using the SDK or Pico Services, then your use of the SDK or Pico Services will continue under the changed contract. Pico may give notices to You, at Pico's option, by posting on any portion of https://developer-global.pico-interactive.com/console#/notification or by electronic mail to any e-mail address provided by You to Pico. - -11. _Governing Law._ If You acquired the SDK in the United States, California state law governs the interpretation of this license and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where You live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort. If you acquired the SDK in any other country, the laws of that country apply. - -12. _Legal Effect._ This agreement describes certain legal rights. You may have other rights under the laws of Your country. This agreement does not change Your rights under the laws of Your country if the laws of Your country do not permit it to do so. - -13. _Disclaimer of Warranty._ The SDK is licensed "as-is." You bear the risk of using it. Pico gives no express or implied warranties, guarantees or conditions. You may have additional consumer rights under Your local laws which this agreement cannot change. To the extent permitted under Your local laws, Pico excludes the implied warranties of merchantability, fitness for a particdlar purpose and non-infringement. - -14. _Limitation and Exclusion of Remedies and Damages._ You can recover from Pico and its suppliers only direct damages up to U.S. $100.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages. This limitation applies to - - 14.1. anything related to the SDK, Pico Services, content (including code) on third party Internet sites, or third party programs; and - - 14.2. claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law. - -15. _Eyetracking._ If you are going to develop the contents regarding eye tracking, you should follow - - 15.1. before get and transfer the eye tracking data, you should make sure that you get the approval of end users. - - 15.2. offer manual to end users to clarify the purpose to store and transfer eye tracking data, and declare that these data won’t be used for another purposes. - - 15.3. inform the end users the time when your applications start to store and transfer eye tracking date. - - 15.4. inform end users why they need to approve the storage and transfer of eye tracking data, and what you will obtain after the usage and analysis of the data. - -It applies even if Pico knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to You because Your country may not allow the exclusion or limitation of incidental, consequential or other damages. diff --git a/app/addons/promise/promise.gd b/app/addons/promise/promise.gd index c25a84f..e5c38b3 100644 --- a/app/addons/promise/promise.gd +++ b/app/addons/promise/promise.gd @@ -1,36 +1,31 @@ extends RefCounted class_name Promise - enum Status { RESOLVED, REJECTED } - signal settled(status: PromiseResult) signal resolved(value: Variant) signal rejected(reason: Rejection) - ## Generic rejection reason const PROMISE_REJECTED := "Promise rejected" - var is_settled := false - func _init(callable: Callable): resolved.connect( - func(value: Variant): - is_settled = true - settled.emit(PromiseResult.new(Status.RESOLVED, value)), + func(value: Variant): + is_settled=true + settled.emit(PromiseResult.new(Status.RESOLVED, value)), CONNECT_ONE_SHOT ) rejected.connect( func(rejection: Rejection): - is_settled = true - settled.emit(PromiseResult.new(Status.REJECTED, rejection)), + is_settled=true + settled.emit(PromiseResult.new(Status.REJECTED, rejection)), CONNECT_ONE_SHOT ) @@ -42,28 +37,25 @@ func _init(callable: Callable): if not is_settled: rejected.emit(rejection) ) - func then(resolved_callback: Callable) -> Promise: resolved.connect( - resolved_callback, + resolved_callback, CONNECT_ONE_SHOT ) return self - func catch(rejected_callback: Callable) -> Promise: rejected.connect( - rejected_callback, + rejected_callback, CONNECT_ONE_SHOT ) return self - static func from(input_signal: Signal) -> Promise: return Promise.new( func(resolve: Callable, _reject: Callable): - var number_of_args := input_signal.get_object().get_signal_list() \ + var number_of_args:=input_signal.get_object().get_signal_list() \ .filter(func(signal_info: Dictionary) -> bool: return signal_info["name"] == input_signal.get_name()) \ .map(func(signal_info: Dictionary) -> int: return signal_info["args"].size()) \ .front() as int @@ -73,23 +65,21 @@ static func from(input_signal: Signal) -> Promise: resolve.call(null) else: # only one arg in signal is allowed for now - var result = await input_signal + var result=await input_signal resolve.call(result) ) - static func from_many(input_signals: Array[Signal]) -> Array[Promise]: return input_signals.map( - func(input_signal: Signal): + func(input_signal: Signal): return Promise.from(input_signal) ) - static func all(promises: Array[Promise]) -> Promise: return Promise.new( func(resolve: Callable, reject: Callable): - var resolved_promises: Array[bool] = [] - var results := [] + var resolved_promises: Array[bool]=[] + var results:=[] results.resize(promises.size()) resolved_promises.resize(promises.size()) resolved_promises.fill(false) @@ -97,8 +87,8 @@ static func all(promises: Array[Promise]) -> Promise: for i in promises.size(): promises[i].then( func(value: Variant): - results[i] = value - resolved_promises[i] = true + results[i]=value + resolved_promises[i]=true if resolved_promises.all(func(value: bool): return value): resolve.call(results) ).catch( @@ -107,30 +97,28 @@ static func all(promises: Array[Promise]) -> Promise: ) ) - static func any(promises: Array[Promise]) -> Promise: return Promise.new( func(resolve: Callable, reject: Callable): - var rejected_promises: Array[bool] = [] - var rejections: Array[Rejection] = [] + var rejected_promises: Array[bool]=[] + var rejections: Array[Rejection]=[] rejections.resize(promises.size()) rejected_promises.resize(promises.size()) rejected_promises.fill(false) for i in promises.size(): promises[i].then( - func(value: Variant): + func(value: Variant): resolve.call(value) ).catch( func(rejection: Rejection): - rejections[i] = rejection - rejected_promises[i] = true + rejections[i]=rejection + rejected_promises[i]=true if rejected_promises.all(func(value: bool): return value): reject.call(PromiseAnyRejection.new(PROMISE_REJECTED, rejections)) ) ) - class PromiseResult: var status: Status var payload: Variant @@ -139,7 +127,6 @@ class PromiseResult: status = _status payload = _payload - class Rejection: var reason: String var stack: Array @@ -148,14 +135,12 @@ class Rejection: reason = _reason stack = get_stack() if OS.is_debug_build() else [] - func as_string() -> String: return ("%s\n" % reason) + "\n".join( stack.map( - func(dict: Dictionary) -> String: + func(dict: Dictionary) -> String: return "At %s:%i:%s" % [dict["source"], dict["line"], dict["function"]] )) - class PromiseAnyRejection extends Rejection: var group: Array[Rejection] diff --git a/app/android/.build_version b/app/android/.build_version index 3e30b07..0a6ad9b 100644 --- a/app/android/.build_version +++ b/app/android/.build_version @@ -1 +1 @@ -4.3.dev6 +4.3.dev diff --git a/app/assets/environment.tres b/app/assets/environment.tres index bb3fb95..d2731a1 100644 --- a/app/assets/environment.tres +++ b/app/assets/environment.tres @@ -7,9 +7,10 @@ sky_material = SubResource("ProceduralSkyMaterial_i4xao") [resource] background_mode = 1 -background_color = Color(0.441, 0.962033, 0.98, 1) +background_color = Color(1, 1, 1, 1) sky = SubResource("Sky_vhymk") ambient_light_source = 2 ambient_light_color = Color(1, 1, 1, 1) ssao_radius = 6.52 ssao_intensity = 5.68 +adjustment_contrast = 2.23 diff --git a/app/assets/environment_passthrough.tres b/app/assets/environment_passthrough.tres index 043b190..5fdd4f4 100644 --- a/app/assets/environment_passthrough.tres +++ b/app/assets/environment_passthrough.tres @@ -6,7 +6,7 @@ sky_material = SubResource("ProceduralSkyMaterial_i4xao") [resource] -background_color = Color(0, 0, 0, 0) +background_color = Color(1, 1, 1, 0) background_energy_multiplier = 0.0 sky = SubResource("Sky_vhymk") ambient_light_source = 2 diff --git a/app/assets/fonts/Montserrat-VariableFont_wght.ttf.import b/app/assets/fonts/Montserrat-VariableFont_wght.ttf.import index 359fe9e..994a105 100644 --- a/app/assets/fonts/Montserrat-VariableFont_wght.ttf.import +++ b/app/assets/fonts/Montserrat-VariableFont_wght.ttf.import @@ -14,20 +14,27 @@ dest_files=["res://.godot/imported/Montserrat-VariableFont_wght.ttf-e7d36c45e6f3 Rendering=null antialiasing=1 -generate_mipmaps=false +generate_mipmaps=true +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 -msdf_size=48 +msdf_size=100 allow_system_fallback=true force_autohinter=false hinting=1 subpixel_positioning=1 -oversampling=3.0 +oversampling=4.0 Fallbacks=null fallbacks=[] Compress=null compress=true -preload=[] +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0), +"variation_embolden": 0.0 +}] language_support={} script_support={} opentype_features={} diff --git a/app/assets/icons/base_icons.woff2.import b/app/assets/icons/base_icons.woff2.import index df1a070..233ae49 100644 --- a/app/assets/icons/base_icons.woff2.import +++ b/app/assets/icons/base_icons.woff2.import @@ -14,20 +14,27 @@ dest_files=["res://.godot/imported/base_icons.woff2-e891c7009d71889de458845dfeb3 Rendering=null antialiasing=1 -generate_mipmaps=false +generate_mipmaps=true +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 -msdf_size=48 +msdf_size=100 allow_system_fallback=true force_autohinter=false hinting=1 subpixel_positioning=1 -oversampling=4.0 +oversampling=3.0 Fallbacks=null fallbacks=[] Compress=null compress=true -preload=[] +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0), +"variation_embolden": 0.0 +}] language_support={} script_support={} opentype_features={} diff --git a/app/content/entities/camera/camera.gd b/app/content/entities/camera/camera.gd index ad6401a..cc5e6fe 100644 --- a/app/content/entities/camera/camera.gd +++ b/app/content/entities/camera/camera.gd @@ -48,8 +48,6 @@ func _ready(): ) func set_state(stateInfo): - print("Setting state: ", stateInfo) - if stateInfo == null: view.texture = null mesh.visible = true diff --git a/app/content/entities/entity.gd b/app/content/entities/entity.gd index a3e408f..2333a67 100644 --- a/app/content/entities/entity.gd +++ b/app/content/entities/entity.gd @@ -9,5 +9,5 @@ func _ready(): if movable: movable.on_moved.connect(func(): - House.body.save_all_entities() + App.house.save_all_entities() ) diff --git a/app/content/entities/sensor/sensor.gd b/app/content/entities/sensor/sensor.gd index 6d2a760..f85b02f 100644 --- a/app/content/entities/sensor/sensor.gd +++ b/app/content/entities/sensor/sensor.gd @@ -26,7 +26,7 @@ func _ready(): remove_child(chart_button) chart_button.on_button_down.connect(func(): - House.body.create_entity(entity_id, global_position, "line_chart") + App.house.create_entity(entity_id, global_position, "line_chart") remove_child(chart_button) ) diff --git a/app/content/entities/weather/weather.gd b/app/content/entities/weather/weather.gd index 4f6de73..15df062 100644 --- a/app/content/entities/weather/weather.gd +++ b/app/content/entities/weather/weather.gd @@ -22,8 +22,6 @@ func set_state(stateInfo): if stateInfo == null: return - print(stateInfo) - var state = stateInfo["state"] var attributes = stateInfo["attributes"] @@ -39,7 +37,7 @@ func set_state(stateInfo): animation.play("clear-night") "cloudy": weather_label.text = "Cloudy" - animation.play("cloudy") + animation.play("partly-cloudy-day") "fog": weather_label.text = "Fog" animation.play("fog") diff --git a/app/content/entities/weather/weather.tscn b/app/content/entities/weather/weather.tscn index 1123a29..052f299 100644 --- a/app/content/entities/weather/weather.tscn +++ b/app/content/entities/weather/weather.tscn @@ -30426,8 +30426,7 @@ transform = Transform3D(0.28, 0, 0, 0, 0.28, 0, 0, 0, 0.28, -0.14, 0.01, 0) pixel_size = 0.001 render_priority = 15 sprite_frames = SubResource("SpriteFrames_71wxj") -animation = &"sleet" -frame_progress = 0.689981 +animation = &"partly-cloudy-day" [node name="WeatherLabel" type="Label3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.05, 0.02, 0) diff --git a/app/content/main.gd b/app/content/main.gd index b22c126..d60e637 100644 --- a/app/content/main.gd +++ b/app/content/main.gd @@ -2,20 +2,19 @@ extends Node3D 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") @onready var environment: WorldEnvironment = $WorldEnvironment -@onready var camera: XRCamera3D = $XROrigin3D/XRCamera3D -@onready var controller_left = $XROrigin3D/XRControllerLeft -@onready var controller_right = $XROrigin3D/XRControllerRight +@onready var camera: XRCamera3D = %XRCamera3D +@onready var controller_left = %XRControllerLeft +@onready var controller_right = %XRControllerRight @onready var house = $House -@onready var menu = $Menu -@onready var keyboard = $Keyboard +@onready var menu: Menu = $Menu @onready var xr: XRToolsStartXR = $StartXR var voice_assistant = null func _ready(): - # In case we're running on the headset, use the passthrough sky - if OS.get_name() == "Android": # OS.request_permissions() environment.environment = environment_passthrough_material @@ -25,51 +24,24 @@ func _ready(): create_voice_assistant() - controller_left.button_pressed.connect(func(name): - _emit_action(name, true, false) - ) - - controller_right.button_pressed.connect(func(name): - _emit_action(name, true, true) - ) - - controller_left.button_released.connect(func(name): - _emit_action(name, false, false) - ) - - controller_right.button_released.connect(func(name): - _emit_action(name, false, true) - ) - - remove_child(keyboard) - - EventSystem.on_action_down.connect(func(action): - if action.name == "menu_button": - toggle_menu() - elif action.name == "by_button": - House.body.mini_view.small.value=!House.body.mini_view.small.value - ) - - EventSystem.on_focus_in.connect(func(event): - if keyboard.is_inside_tree(): - return - - add_child(keyboard) - keyboard.global_transform=menu.get_node("AnimationContainer/KeyboardPlace").global_transform - ) - - EventSystem.on_focus_out.connect(func(event): - if !keyboard.is_inside_tree(): - return - - remove_child(keyboard) - ) - xr.xr_started.connect(func(): if HomeApi.has_connected() == false: HomeApi.start() ) + HomeApi.on_connect.connect(func(): + start_setup_flow.call_deferred() + ) + +func start_setup_flow(): + var onboarding = OnboardingScene.instantiate() + add_child(onboarding) + + await onboarding.tree_exited + + if Store.house.state.rooms.size() == 0: + house.create_room("Room 1") + func create_voice_assistant(): if Store.settings.is_loaded() == false: await Store.settings.on_loaded @@ -85,47 +57,37 @@ func create_voice_assistant(): voice_assistant.queue_free() ) -func toggle_menu(): - menu.show_menu.value = !menu.show_menu.value - -func _emit_action(name: String, value, right_controller: bool=true): - var event = EventAction.new() - event.name = name - event.value = value - event.right_controller = right_controller - - match typeof(value): - TYPE_BOOL: - EventSystem.emit("action_down" if value else "action_up", event) - TYPE_FLOAT, TYPE_VECTOR2: - EventSystem.emit("action_value", event) - func _process(delta): - if OS.get_name() != "Android": - - var camera_basis = camera.get_global_transform().basis - - camera_basis.x.y = 0 - camera_basis.z.y = 0 - camera_basis.y = Vector3(0, 1, 0) - camera_basis.x = camera_basis.x.normalized() - camera_basis.z = camera_basis.z.normalized() - - var movement = camera_basis * vector_key_mapping(KEY_D, KEY_A, KEY_S, KEY_W) * delta - - camera.position += movement - controller_left.position += movement - controller_right.position += movement + _move_camera_pc(delta) func _input(event): + + # Debugging Features if event is InputEventKey and Input.is_key_pressed(KEY_F10): var vp = get_viewport() vp.debug_draw = (vp.debug_draw + 1) % 5 if event is InputEventKey and Input.is_key_pressed(KEY_M): - toggle_menu() + menu.toggle_open() -func vector_key_mapping(key_positive_x: int, key_negative_x: int, key_positive_y: int, key_negative_y: int): +func _move_camera_pc(delta): + if OS.get_name() == "Android": return + + var camera_basis = camera.get_global_transform().basis + + camera_basis.x.y = 0 + camera_basis.z.y = 0 + camera_basis.y = Vector3(0, 1, 0) + camera_basis.x = camera_basis.x.normalized() + camera_basis.z = camera_basis.z.normalized() + + var movement = camera_basis * _vector_key_mapping(KEY_D, KEY_A, KEY_S, KEY_W) * delta + + camera.position += movement + controller_left.position += movement + controller_right.position += movement + +func _vector_key_mapping(key_positive_x: int, key_negative_x: int, key_positive_y: int, key_negative_y: int): var x = 0 var y = 0 if Input.is_physical_key_pressed(key_positive_y): diff --git a/app/content/main.tscn b/app/content/main.tscn index 88ebabf..01ce597 100644 --- a/app/content/main.tscn +++ b/app/content/main.tscn @@ -8,13 +8,12 @@ [ext_resource type="PackedScene" uid="uid://ctltchlf2j2r4" path="res://addons/xr-simulator/XRSimulator.tscn" id="5_3qc8g"] [ext_resource type="PackedScene" uid="uid://biu66ihmvmku3" path="res://content/system/controller_right/controller_right.tscn" id="7_0b3tc"] [ext_resource type="PackedScene" uid="uid://c3kdssrmv84kv" path="res://content/ui/menu/menu.tscn" id="8_du83w"] -[ext_resource type="PackedScene" uid="uid://lrehk38exd5n" path="res://content/system/keyboard/keyboard.tscn" id="9_e5n3p"] [ext_resource type="PackedScene" uid="uid://cbemihbxkd4ll" path="res://content/system/house/house.tscn" id="9_np6mw"] [ext_resource type="Script" path="res://lib/utils/screenshot.gd" id="12_e13ym"] +[ext_resource type="PackedScene" uid="uid://ds60i5n211hi3" path="res://content/system/miniature/miniature.tscn" id="12_lmxhs"] [ext_resource type="PackedScene" uid="uid://bhyddd1f0ry1x" path="res://content/ui/onboarding/onboarding.tscn" id="12_uq2nj"] [node name="Main" type="Node3D"] -transform = Transform3D(1, -0.000296142, 0.000270963, 0.000296143, 1, -4.5899e-06, -0.000270962, 4.67014e-06, 1, 0, 0, 0) script = ExtResource("1_uvrd4") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] @@ -22,6 +21,7 @@ environment = ExtResource("2_lsndp") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] transform = Transform3D(1, -2.51787e-05, 0.000567105, -0.000567105, 4.3985e-08, 1, -2.51784e-05, -1, 2.97105e-08, -4.65661e-10, 7.21041, 2.06458) +visible = false shadow_enabled = true [node name="StartXR" parent="." instance=ExtResource("1_i4c04")] @@ -30,43 +30,40 @@ enable_passthrough = true [node name="XROrigin3D" type="XROrigin3D" parent="."] [node name="XRCamera3D" parent="XROrigin3D" instance=ExtResource("3_rj4ac")] +unique_name_in_owner = true [node name="XRControllerLeft" parent="XROrigin3D" instance=ExtResource("2_2lraw")] +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="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.00665808, 0.0427912, -0.169868) +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) [node name="ThumbTip" parent="XROrigin3D/XRControllerLeft" index="5"] -transform = Transform3D(0.967043, 0.24582, -0.0663439, -0.0663439, 0.494837, 0.86645, 0.24582, -0.833492, 0.494837, 0.0261569, 0.0891963, -0.0934418) +transform = Transform3D(0.967043, 0.24582, -0.0663439, -0.0663439, 0.494837, 0.866449, 0.24582, -0.833492, 0.494837, 0.0261569, 0.0891963, -0.0934418) [node name="MiddleTip" parent="XROrigin3D/XRControllerLeft" index="6"] transform = Transform3D(0.98042, 0.196912, 0.00149799, 0.001498, -0.015065, 0.999885, 0.196912, -0.980305, -0.0150651, -0.00327212, -0.00771427, -0.176318) -[node name="Palm" parent="XROrigin3D/XRControllerLeft" index="7"] -transform = Transform3D(1, 3.12361e-06, -3.13859e-06, -3.12371e-06, 1, -1.97886e-05, 3.13859e-06, 1.97889e-05, 1, 0.0307807, -0.0419722, -0.0399505) - [node name="XRControllerRight" parent="XROrigin3D" instance=ExtResource("7_0b3tc")] +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")] min_camera_height = 0.01 xr_origin = NodePath("../XROrigin3D") +[node name="House" parent="." instance=ExtResource("9_np6mw")] + +[node name="Miniature" parent="." instance=ExtResource("12_lmxhs")] + [node name="Menu" parent="." instance=ExtResource("8_du83w")] transform = Transform3D(0.999999, -1.39633e-11, 0, 1.60657e-10, 1, -4.54747e-13, 0, 0, 0.999999, -0.0165677, 0.766337, -0.634317) -[node name="Keyboard" parent="." instance=ExtResource("9_e5n3p")] -transform = Transform3D(0.5, 5.24309e-05, 0.000144384, -0.000139169, 0.353553, 0.353553, -6.50204e-05, -0.353553, 0.353553, -0.0199266, 0.550784, -0.47368) - -[node name="Rooms" type="Node3D" parent="."] - -[node name="House" parent="." instance=ExtResource("9_np6mw")] - [node name="Onboarding" parent="." instance=ExtResource("12_uq2nj")] transform = Transform3D(1, -1.39636e-11, 0, 4.42413e-11, 1, 0, 0, 0, 1, -0.576793, 0.820168, -0.60016) -[node name="Node" type="Node" parent="."] +[node name="Screenshot" type="Node" parent="."] script = ExtResource("12_e13ym") [editable path="XROrigin3D/XRControllerLeft"] diff --git a/app/content/system/assist/assist.gd b/app/content/system/assist/assist.gd index 71959ec..5e6fa2c 100644 --- a/app/content/system/assist/assist.gd +++ b/app/content/system/assist/assist.gd @@ -17,7 +17,6 @@ var effect: AudioEffectCapture @onready var chat_user: Chat = $ChatUser @onready var chat_assistant: Chat = $ChatAssistant @onready var loader: Node3D = $Loader -@onready var camera = $"/root/Main/XROrigin3D/XRCamera3D" var running := false var voice_assistant: VoiceAssistant @@ -50,9 +49,9 @@ func _ready(): loader.visible=true chat_user.visible=false chat_assistant.visible=false - global_position=camera.global_position + camera.global_transform.basis.z * - 0.5 + global_position=App.camera.global_position + App.camera.global_transform.basis.z * - 0.5 global_position.y *= 0.7 - global_transform.basis=Basis.looking_at((camera.global_position - global_position) * - 1) + global_transform.basis=Basis.looking_at((App.camera.global_position - global_position) * - 1) running=true ) diff --git a/app/content/system/camera/camera.gd b/app/content/system/camera/camera.gd index 486d514..1060e04 100644 --- a/app/content/system/camera/camera.gd +++ b/app/content/system/camera/camera.gd @@ -7,7 +7,7 @@ func _physics_process(_delta): update_room() func update_room(): - var room = House.body.find_room_at(global_position) + var room = App.house.find_room_at(global_position) if room != last_room: if room: diff --git a/app/content/system/controller_left/controller_left.gd b/app/content/system/controller_left/controller_left.gd index 25428b0..7104a2d 100644 --- a/app/content/system/controller_left/controller_left.gd +++ b/app/content/system/controller_left/controller_left.gd @@ -5,9 +5,8 @@ const Initiator = preload ("res://lib/utils/pointer/initiator.gd") 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/house/mini/miniature.gd") +const Miniature = preload ("res://content/system/miniature/miniature.gd") -@onready var main = $"/root/Main" @onready var hand = $hand_l @onready var hand_mesh = $hand_l/Armature/Skeleton3D/mesh_Hand_L @onready var auto_hand = $AutoHandtracker @@ -35,6 +34,13 @@ var pressed = false var grabbed = false func _ready(): + button_pressed.connect(func(action_name): + EventSystem.emit_action(action_name, true, false) + ) + + button_released.connect(func(action_name): + EventSystem.emit_action(action_name, false, false) + ) _setup_hand() @@ -43,7 +49,7 @@ func _process(_delta): if quick_actions.is_inside_tree(): palm.remove_child(quick_actions) return - if main.camera.global_transform.basis.z.dot(palm.global_transform.basis.x) > 0.85: + if App.camera.global_transform.basis.z.dot(palm.global_transform.basis.x) > 0.85: if quick_actions.is_inside_tree() == false: palm.add_child(quick_actions) else: if quick_actions.is_inside_tree(): palm.remove_child(quick_actions) @@ -74,7 +80,7 @@ func _physics_process(_delta): func _setup_hand(): TouchManager.add_finger(Finger.Type.INDEX_LEFT, $IndexTip/TouchArea) - collide = Collide.new(hand, hand_mesh, index_tip) + collide = Collide.new(hand, hand_mesh, index_tip.get_node("Marker3D")) add_child(collide) auto_hand.hand_active_changed.connect(func(hand: int, active: bool): @@ -87,21 +93,21 @@ func _setup_hand(): ) mini_view_button.on_button_up.connect(func(): - House.body.mini_view.small.value=!House.body.mini_view.small.value + App.miniature.small.value=!App.miniature.small.value ) temperature_button.on_button_up.connect(func(): - if House.body.mini_view.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE: - House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.NONE + if App.miniature.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE: + App.miniature.heatmap_type.value=Miniature.HeatmapType.NONE else: - House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.TEMPERATURE + App.miniature.heatmap_type.value=Miniature.HeatmapType.TEMPERATURE ) humidity_button.on_button_up.connect(func(): - if House.body.mini_view.heatmap_type.value == Miniature.HeatmapType.HUMIDITY: - House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.NONE + if App.miniature.heatmap_type.value == Miniature.HeatmapType.HUMIDITY: + App.miniature.heatmap_type.value=Miniature.HeatmapType.NONE else: - House.body.mini_view.heatmap_type.value=Miniature.HeatmapType.HUMIDITY + App.miniature.heatmap_type.value=Miniature.HeatmapType.HUMIDITY ) initiator.type = Initiator.Type.HAND_LEFT diff --git a/app/content/system/controller_left/controller_left.tscn b/app/content/system/controller_left/controller_left.tscn index 01f80e0..905c147 100644 --- a/app/content/system/controller_left/controller_left.tscn +++ b/app/content/system/controller_left/controller_left.tscn @@ -55,6 +55,7 @@ use_external_skeleton = true external_skeleton = NodePath("../hand_l/Armature/Skeleton3D") [node name="Marker3D" type="Marker3D" parent="IndexTip"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.01, 0) gizmo_extents = 0.02 [node name="TouchArea" type="Area3D" parent="IndexTip"] diff --git a/app/content/system/controller_right/controller_right.gd b/app/content/system/controller_right/controller_right.gd index 36cff06..9c96734 100644 --- a/app/content/system/controller_right/controller_right.gd +++ b/app/content/system/controller_right/controller_right.gd @@ -5,9 +5,8 @@ const Initiator = preload ("res://lib/utils/pointer/initiator.gd") 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/house/mini/miniature.gd") +const Miniature = preload ("res://content/system/miniature/miniature.gd") -@onready var main = $"/root/Main" @onready var ray: RayCast3D = $Raycast @onready var hand: Node3D = $hand_r @onready var hand_mesh = $hand_r/Armature/Skeleton3D/mesh_Hand_R @@ -28,9 +27,17 @@ var pressed = false var grabbed = false func _ready(): + button_pressed.connect(func(action_name): + EventSystem.emit_action(action_name, true, true) + ) + button_released.connect(func(action_name): + EventSystem.emit_action(action_name, false, true) + ) + +func _setup_hand(): TouchManager.add_finger(Finger.Type.INDEX_RIGHT, $IndexTip/TouchArea) - collide = Collide.new(hand, hand_mesh, index_tip) + collide = Collide.new(hand, hand_mesh, index_tip.get_node("Marker3D")) add_child(collide) initiator.type = Initiator.Type.HAND_RIGHT diff --git a/app/content/system/controller_right/controller_right.tscn b/app/content/system/controller_right/controller_right.tscn index e618885..364096c 100644 --- a/app/content/system/controller_right/controller_right.tscn +++ b/app/content/system/controller_right/controller_right.tscn @@ -45,6 +45,7 @@ use_external_skeleton = true external_skeleton = NodePath("../hand_r/Armature/Skeleton3D") [node name="Marker3D" type="Marker3D" parent="IndexTip"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.01, 0) gizmo_extents = 0.02 [node name="TouchArea" type="Area3D" parent="IndexTip"] diff --git a/app/content/system/dot/dot.gd b/app/content/system/dot/dot.gd index fb01195..50ffd7c 100644 --- a/app/content/system/dot/dot.gd +++ b/app/content/system/dot/dot.gd @@ -16,8 +16,6 @@ var touched_enter = 0.0 var moved_ran = false var touch_ran = false -var miniature = House.body.mini_view - func _ready(): R.effect(func(_arg): label.text=entity.icon.value @@ -37,15 +35,15 @@ func _ready(): ) func _on_click(_event: EventPointer): - if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false: + if entity.has_method("quick_action")&&App.miniature.entity_select.selection_active() == false: entity.quick_action() snap_sound.play() else: - miniature.entity_select.toggle(entity) + App.miniature.entity_select.toggle(entity) func _on_press_move(_event: EventPointer): if moved_ran: return - miniature.entity_select.toggle(entity) + App.miniature.entity_select.toggle(entity) moved_ran = true func _on_press_up(_event: EventPointer): @@ -58,15 +56,15 @@ func _on_touch_enter(_event: EventTouch): func _on_touch_move(_event: EventTouch): if touch_ran||Time.get_ticks_msec() - touched_enter < TOUCH_LONG: return - miniature.entity_select.toggle(entity) + App.miniature.entity_select.toggle(entity) touch_ran = true func _on_touch_leave(_event: EventTouch): if touch_ran: return - if entity.has_method("quick_action")&&miniature.entity_select.selection_active() == false: + if entity.has_method("quick_action")&&App.miniature.entity_select.selection_active() == false: snap_sound.play() entity.quick_action() else: - miniature.entity_select.toggle(entity) + App.miniature.entity_select.toggle(entity) diff --git a/app/content/system/dot/dot.tscn b/app/content/system/dot/dot.tscn index 147f700..efbc792 100644 --- a/app/content/system/dot/dot.tscn +++ b/app/content/system/dot/dot.tscn @@ -21,8 +21,6 @@ shape = SubResource("SphereShape3D_3wgjq") [node name="Label3D" type="Label3D" parent="."] pixel_size = 0.002 billboard = 1 -render_priority = 15 -outline_render_priority = 14 text = "lightbulb" font = ExtResource("4_504vw") font_size = 100 diff --git a/app/content/system/house/align_reference.gd b/app/content/system/house/align_reference.gd index 23c9f28..12dc651 100644 --- a/app/content/system/house/align_reference.gd +++ b/app/content/system/house/align_reference.gd @@ -19,7 +19,7 @@ extends Node3D edge.visible = !disabled func _ready(): - update_initial_positions() + update_initial_positions.call_deferred() corner1.get_node("Movable").on_move.connect(func(position, rotation): edge.align_to_corners(corner1.global_position, corner2.global_position) @@ -40,8 +40,11 @@ func _ready(): return corner1.position + delta_new_pos_corner1 func update_initial_positions(): + if App.main.is_node_ready() == false: + await App.main.ready + edge.align_to_corners(corner1.global_position, corner2.global_position) - marker.global_transform = House.body.transform + marker.global_transform = App.house.transform func get_new_transform(): marker.scale = Vector3(1, 1, 1) @@ -61,4 +64,4 @@ func update_align_reference(): func update_store(): Store.house.state.align_position1 = corner1.global_position - Store.house.state.align_position2 = corner2.global_position \ No newline at end of file + Store.house.state.align_position2 = corner2.global_position diff --git a/app/content/system/house/doors/doors.gd b/app/content/system/house/doors/doors.gd index 9d6ed45..f658a2a 100644 --- a/app/content/system/house/doors/doors.gd +++ b/app/content/system/house/doors/doors.gd @@ -50,8 +50,8 @@ func edit(door): break if existing_door != null: - room1 = House.body.find_room(existing_door.room1) - room2 = House.body.find_room(existing_door.room2) + room1 = App.house.find_room(existing_door.room1) + room2 = App.house.find_room(existing_door.room2) room1_corner1 = WallCornerScene.instantiate() room1_corner1.global_position = existing_door.room1_position1 @@ -73,13 +73,13 @@ func edit(door): room2_corner2.get_node("Clickable").on_grab_move.connect(_move_corner.bind(room2, room2_corner2)) add_child(room2_corner2) - for room in House.body.get_rooms(0): + for room in App.house.get_rooms(): if room != room1&&room != room2: room.get_node("WallCollision/Clickable").on_click.connect(_add_corner.bind(room)) else: room.get_node("WallCollision/Clickable").on_click.disconnect(_add_corner.bind(room)) - for room in House.body.get_rooms(0): + for room in App.house.get_rooms(): if door != null: room.get_node("WallCollision/Clickable").on_click.connect(_add_corner.bind(room)) else: diff --git a/app/content/system/house/house.gd b/app/content/system/house/house.gd index 9c2e4df..592ef12 100644 --- a/app/content/system/house/house.gd +++ b/app/content/system/house/house.gd @@ -2,15 +2,12 @@ extends Node3D const Room = preload ("./room/room.tscn") const RoomType = preload ("./room/room.gd") -const Miniature = preload ("./mini/miniature.gd") const Doors = preload ("./doors/doors.gd") const AlignReference = preload ("./align_reference.gd") -@onready var levels = $Levels -@onready var collision_shape = $Levels/CollisionShape3D +@onready var rooms = $Rooms @onready var align_reference: AlignReference = $AlignReference -@onready var mini_view: Miniature = $Levels/Miniature -@onready var doors: Doors = $Levels/Doors +@onready var doors: Doors = $Doors var fixing_reference: bool = false var editing_room: RoomType = null @@ -23,7 +20,7 @@ func _ready(): func update_house(): loaded.value = false - for old_room in get_rooms(0): + for old_room in get_rooms(): old_room.get_parent().remove_child(old_room) old_room.queue_free() @@ -37,7 +34,7 @@ func update_house(): Store.house.save_local() continue - create_room(new_room.name, 0) + create_room(new_room.name) for entity_index in range(Store.house.state.entities.size()): var entity = Store.house.state.entities[entity_index] @@ -53,7 +50,7 @@ func update_house(): loaded.value = true -func create_room(room_name: String, level: int) -> RoomType: +func create_room(room_name: String) -> RoomType: var existing_room = Store.house.get_room(room_name) if existing_room == null: @@ -66,7 +63,7 @@ func create_room(room_name: String, level: int) -> RoomType: var room = Room.instantiate() room.name = room_name - get_level(level).add_child(room) + rooms.add_child(room) return room @@ -116,13 +113,13 @@ func is_editiong(room_name): return editing_room != null&&editing_room.name == room_name func find_room(room_name): - for room in get_rooms(0): + for room in get_rooms(): if room.name == room_name: return room return null func find_room_at(entity_position: Vector3): - for room in get_rooms(0): + for room in get_rooms(): if room.has_point(entity_position): return room return null @@ -143,11 +140,8 @@ func rename_room(old_room: String, new_name: String): save_all_entities() Store.house.save_local() -func get_level(level: int): - return levels.get_child(level) - -func get_level_aabb(level: int): - var rooms = get_level(level).get_children() +func get_rooms_aabb(): + var rooms = get_rooms() if rooms.size() == 0: return AABB() @@ -168,8 +162,8 @@ func get_level_aabb(level: int): return AABB(min_pos, max_pos - min_pos) -func get_rooms(level: int): - return get_level(level).get_children() +func get_rooms(): + return rooms.get_children() func create_entity(entity_id: String, entity_position: Vector3, type=null): var room = find_room_at(entity_position) @@ -218,7 +212,7 @@ func fix_reference(): func save_reference(): if fixing_reference: - for room in get_rooms(0): + for room in get_rooms(): room.editable = true var align_transform = align_reference.global_transform @@ -227,7 +221,7 @@ func save_reference(): align_reference.update_store() - for room in get_rooms(0): + for room in get_rooms(): room.editable = false save_all_entities() @@ -241,7 +235,7 @@ func save_reference(): func save_all_entities(): Store.house.state.entities.clear() - for room in get_rooms(0): + for room in get_rooms(): for entity in room.get_node("Entities").get_children(): var entity_data = { "id": entity.entity_id, diff --git a/app/content/system/house/house.tscn b/app/content/system/house/house.tscn index 405b470..a2ffe4d 100644 --- a/app/content/system/house/house.tscn +++ b/app/content/system/house/house.tscn @@ -1,21 +1,16 @@ -[gd_scene load_steps=5 format=3 uid="uid://cbemihbxkd4ll"] +[gd_scene load_steps=4 format=3 uid="uid://cbemihbxkd4ll"] [ext_resource type="Script" path="res://content/system/house/house.gd" id="1_p8amj"] [ext_resource type="PackedScene" uid="uid://jls16btb8nko" path="res://content/system/house/align_reference.tscn" id="3_e1tcn"] [ext_resource type="PackedScene" uid="uid://c8nh8582vwc8u" path="res://content/system/house/doors/doors.tscn" id="4_bb3c2"] -[ext_resource type="PackedScene" uid="uid://ds60i5n211hi3" path="res://content/system/house/mini/miniature.tscn" id="4_qjbly"] [node name="House" type="Node3D"] script = ExtResource("1_p8amj") -[node name="Levels" type="Node3D" parent="."] - -[node name="Level0" type="Node3D" parent="Levels"] - -[node name="Miniature" parent="Levels" instance=ExtResource("4_qjbly")] - -[node name="Doors" parent="Levels" instance=ExtResource("4_bb3c2")] +[node name="Rooms" type="Node3D" parent="."] [node name="AlignReference" parent="." instance=ExtResource("3_e1tcn")] visible = false disabled = true + +[node name="Doors" parent="." instance=ExtResource("4_bb3c2")] diff --git a/app/content/system/keyboard/keyboard.gd b/app/content/system/keyboard/keyboard.gd index 59d1192..ac8ae7b 100644 --- a/app/content/system/keyboard/keyboard.gd +++ b/app/content/system/keyboard/keyboard.gd @@ -20,9 +20,35 @@ var caps = false: update_labels() func _ready(): + get_parent().remove_child.call_deferred(self) + + _create_keys() + _prepare_keyboard_spawn() + _connect_key_events() + +func _prepare_keyboard_spawn(): + if Engine.is_editor_hint(): + return + + EventSystem.on_focus_in.connect(func(event): + if is_inside_tree(): + return + + App.main.add_child(self) + global_transform=App.menu.get_node("AnimationContainer/KeyboardPlace").global_transform + ) + + EventSystem.on_focus_out.connect(func(event): + if !is_inside_tree(): + return + + App.main.remove_child(self) + ) + +func _create_keys(): for row in key_list: for key in row: - var key_node = create_key(key) + var key_node = _create_key(key) keys.add_child(key_node) if Engine.is_editor_hint(): @@ -37,6 +63,7 @@ func _ready(): keys.columns = key_list[0].size() +func _connect_key_events(): if Engine.is_editor_hint(): return @@ -67,7 +94,7 @@ func _ready(): _emit_event("key_up", KEY_INSERT) ) -func create_key(key: Key): +func _create_key(key: Key): var key_node = button_scene.instantiate() key_node.label = EventKey.key_to_string(key, caps) diff --git a/app/content/system/house/mini/Entity.gd b/app/content/system/miniature/entity_select.gd similarity index 80% rename from app/content/system/house/mini/Entity.gd rename to app/content/system/miniature/entity_select.gd index 490e992..0c892e2 100644 --- a/app/content/system/house/mini/Entity.gd +++ b/app/content/system/miniature/entity_select.gd @@ -4,20 +4,17 @@ const DotScene = preload ("res://content/system/dot/dot.tscn") const Entity = preload ("res://content/entities/entity.gd") @onready var dots = $"../Small/Dots" -@onready var main = $"/root/Main" var active_type = null var editing = R.state([]) var group_entity = null -var house_small = null - func _ready(): - await House.body.ready + await App.main.ready # Update Group Entity R.effect(func(_arg): - if house_small.value == false||editing.value.size() == 0: + if App.miniature.small.value == false||editing.value.size() == 0: if group_entity != null: remove_child(group_entity) group_entity.queue_free() @@ -29,19 +26,19 @@ func _ready(): if entity_node is Movable: entity_node.disabled=true - group_entity.transform=Transform3D().looking_at(to_local((main.camera.global_position)), Vector3.UP, true) + group_entity.transform=Transform3D().looking_at(to_local((App.camera.global_position)), Vector3.UP, true) add_child(group_entity) else: HomeApi.groups.update_entities(group_entity.entity_id, editing.value.map(func(entity): return entity.entity_id)) ) var dots_disabled = R.computed(func(_arg): - return House.body.mini_view.small.value == false + return App.miniature.small.value == false ) # Update Entities R.effect(func(_arg): - if House.body.loaded.value == false: + if App.house.loaded.value == false: return if Store.house.state.entities.size() == 0: @@ -51,11 +48,11 @@ func _ready(): dots.remove_child(old_dot) old_dot.free() - for room in House.body.get_rooms(0): + for room in App.house.get_rooms(): for entity in room.get_node("Entities").get_children(): var dot=DotScene.instantiate() - dot.position=House.body.to_local(entity.global_position) + dot.position=App.house.to_local(entity.global_position) dot.entity=entity dot.active=R.computed(func(_arg2): return editing.value.has(entity) diff --git a/app/content/system/house/mini/humid_gradient.tres b/app/content/system/miniature/humid_gradient.tres similarity index 100% rename from app/content/system/house/mini/humid_gradient.tres rename to app/content/system/miniature/humid_gradient.tres diff --git a/app/content/system/house/mini/mini_view_options.gd b/app/content/system/miniature/mini_view_options.gd similarity index 100% rename from app/content/system/house/mini/mini_view_options.gd rename to app/content/system/miniature/mini_view_options.gd diff --git a/app/content/system/house/mini/mini_wall.tres b/app/content/system/miniature/mini_wall.tres similarity index 64% rename from app/content/system/house/mini/mini_wall.tres rename to app/content/system/miniature/mini_wall.tres index 1ae9ebb..91512fe 100644 --- a/app/content/system/house/mini/mini_wall.tres +++ b/app/content/system/miniature/mini_wall.tres @@ -1,14 +1,14 @@ [gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://bcfcough6ucvc"] -[ext_resource type="Shader" path="res://content/system/house/mini/mini_wall_shader.gdshader" id="1_sbr3e"] -[ext_resource type="Texture2D" uid="uid://bbuq4wn7e5o2q" path="res://content/system/house/mini/temp_gradient.tres" id="2_3lwi8"] +[ext_resource type="Shader" path="res://content/system/miniature/mini_wall_shader.gdshader" id="1_sbr3e"] +[ext_resource type="Texture2D" uid="uid://bbuq4wn7e5o2q" path="res://content/system/miniature/temp_gradient.tres" id="2_3lwi8"] [resource] -render_priority = 9 +render_priority = 0 shader = ExtResource("1_sbr3e") shader_parameter/data = PackedFloat32Array() shader_parameter/data_size = 0 -shader_parameter/alpha = 0.3 +shader_parameter/alpha = 1.0 shader_parameter/roughness = 0.15 shader_parameter/edge_color = Color(0, 0, 0, 1) shader_parameter/color_gradient = ExtResource("2_3lwi8") diff --git a/app/content/system/house/mini/mini_wall_shader.gdshader b/app/content/system/miniature/mini_wall_shader.gdshader similarity index 83% rename from app/content/system/house/mini/mini_wall_shader.gdshader rename to app/content/system/miniature/mini_wall_shader.gdshader index e7dd184..b5972c0 100644 --- a/app/content/system/house/mini/mini_wall_shader.gdshader +++ b/app/content/system/miniature/mini_wall_shader.gdshader @@ -1,5 +1,5 @@ shader_type spatial; -render_mode blend_mix, depth_draw_opaque, cull_disabled, diffuse_burley, specular_schlick_ggx, shadows_disabled; +render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, shadows_disabled; uniform vec4 data[100]; uniform int data_size: hint_range(0, 100, 1); @@ -27,37 +27,37 @@ float SchlickFresnel(float u) { } void vertex() { - color = vec3(1.0, 1.0, 1.0); - + color = vec3(0.9, 0.9, 0.9); + if(data_size > 0) { float distances[100]; float dist_sum = 0.0; float data_sum = 0.0; - + float closest_dist = -1.0; int closest_index = 0; - + // Calculate Global Coordinates //vec3 world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; - + closest_dist = distance(data[0].xyz, VERTEX); - + // Inverse distance weighting using Shepard's method for(int i = 0; i < data_size; i++) { distances[i] = sphere_weight(i, VERTEX, 5.0); dist_sum += distances[i]; data_sum += distances[i] * data[i].w; - + float dist = distance(data[i].xyz, VERTEX); - + if(dist < closest_dist) { closest_dist = dist; closest_index = i; } } - + float value = (1.0 / dist_sum) * data_sum; - + if( value > 0.0 || value < 1.0) { color.xyz = texture(color_gradient, vec2(value, 0)).xyz; } else { @@ -68,16 +68,16 @@ void vertex() { void fragment() { ALBEDO = vec3(color.xyz); - ALPHA = alpha; - + //ALPHA = alpha; + float VdotN = dot(VIEW, NORMAL); float fresnel = clamp(SchlickFresnel(VdotN), 0.0, 1.0); - + // apply glass look - float a = mix(0.001, 1.0, ALPHA); - ALPHA = mix(fresnel * edge_color.a, 1.0, a); - ALBEDO = mix(edge_color.rgb * edge_color.a, ALBEDO, a); + //float a = mix(0.001, 1.0, ALPHA); + //ALPHA = mix(fresnel * edge_color.a, 1.0, a); + //ALBEDO = mix(edge_color.rgb * edge_color.a, ALBEDO, a); ROUGHNESS = roughness; - SPECULAR = 0.5 * inversesqrt(ALPHA); + //SPECULAR = 0.5 * inversesqrt(ALPHA); DEPTH = FRAGCOORD.z - 0.00001; } \ No newline at end of file diff --git a/app/content/system/house/mini/miniature.gd b/app/content/system/miniature/miniature.gd similarity index 90% rename from app/content/system/house/mini/miniature.gd rename to app/content/system/miniature/miniature.gd index b35e403..ca3fc90 100644 --- a/app/content/system/house/mini/miniature.gd +++ b/app/content/system/miniature/miniature.gd @@ -11,7 +11,6 @@ const temperature_gradient = preload ("./temp_gradient.tres") @onready var player = $Body/Small/Player @onready var collision_shape = $Body/CollisionShape3D @onready var entity_select = $Body/EntitySelect -@onready var main = $"/root/Main" enum HeatmapType { NONE = 0, @@ -39,7 +38,10 @@ func _ready(): wall_material.set_shader_parameter("data", []) wall_material.set_shader_parameter("data_size", 0) - entity_select.house_small = small + EventSystem.on_action_down.connect(func(action): + if action.name == "by_button": + small.value=!small.value + ) if Store.house.is_loaded() == false: await Store.house.on_loaded @@ -87,7 +89,7 @@ func _ready(): tween.set_parallel(true) if small.value: - var aabb=House.body.get_level_aabb(0) + var aabb=App.house.get_level_aabb(0) var height=aabb.size.y aabb.position.y=- 0.03 @@ -99,9 +101,8 @@ func _ready(): collision_shape.position=center * 0.1 entity_select.position=Vector3(0, height * 0.1 + 0.1, 0) - var camera=$"/root/Main/XROrigin3D/XRCamera3D" - var camera_position=camera.global_position - var camera_direction=- camera.global_transform.basis.z + var camera_position=App.camera.global_position + var camera_direction=- App.camera.global_transform.basis.z camera_position.y *= 0.5 camera_direction.y=0 @@ -119,10 +120,7 @@ func _ready(): # Update Walls R.effect(func(_arg): - var show_map=heatmap_type.value != HeatmapType.NONE - var show_small=small.value - - model.visible=show_map||show_small + model.visible=heatmap_type.value != HeatmapType.NONE||small.value ) # Update Heatmap @@ -144,7 +142,7 @@ func _ready(): ) func _process(delta): - var cam_pos = main.camera.global_position + var cam_pos = App.camera.global_position cam_pos.y += 0.1 player.mesh.height = cam_pos.y player.position = Vector3(cam_pos.x, cam_pos.y / 2, cam_pos.z) @@ -157,7 +155,7 @@ func get_base_scale() -> Vector2: func get_sensor_data(): var data_list = [] - for room in House.body.get_rooms(0): + for room in App.house.get_rooms(): for entity in room.get_node("Entities").get_children(): if entity is SensorEntity: var sensor = entity as SensorEntity @@ -165,14 +163,14 @@ func get_sensor_data(): if data == null: continue - var sensor_pos = House.body.to_local(sensor.global_position) + var sensor_pos = App.house.to_local(sensor.global_position) data_list.append(Vector4(sensor_pos.x, sensor_pos.y, sensor_pos.z, float(data))) return data_list func get_sensor_unit(): - for room in House.body.get_rooms(0): + for room in App.house.get_rooms(): for entity in room.get_node("Entities").get_children(): if entity is SensorEntity: var sensor = entity as SensorEntity diff --git a/app/content/system/house/mini/miniature.tscn b/app/content/system/miniature/miniature.tscn similarity index 87% rename from app/content/system/house/mini/miniature.tscn rename to app/content/system/miniature/miniature.tscn index e40b9d3..cf3f350 100644 --- a/app/content/system/house/mini/miniature.tscn +++ b/app/content/system/miniature/miniature.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=7 format=3 uid="uid://ds60i5n211hi3"] -[ext_resource type="Script" path="res://content/system/house/mini/miniature.gd" id="1_b53yn"] +[ext_resource type="Script" path="res://content/system/miniature/miniature.gd" id="1_b53yn"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="2_x7oed"] -[ext_resource type="Script" path="res://content/system/house/mini/Entity.gd" id="3_tgpny"] +[ext_resource type="Script" path="res://content/system/miniature/entity_select.gd" id="3_tgpny"] [sub_resource type="BoxShape3D" id="BoxShape3D_bckw3"] diff --git a/app/content/system/house/mini/temp_gradient.tres b/app/content/system/miniature/temp_gradient.tres similarity index 100% rename from app/content/system/house/mini/temp_gradient.tres rename to app/content/system/miniature/temp_gradient.tres diff --git a/app/content/system/trash_bin/trash_bin.gd b/app/content/system/trash_bin/trash_bin.gd index c3c46e5..20704bd 100644 --- a/app/content/system/trash_bin/trash_bin.gd +++ b/app/content/system/trash_bin/trash_bin.gd @@ -73,7 +73,7 @@ func _ready(): trash_bin_large=false trash_bin_visible=false - House.body.save_all_entities() + App.house.save_all_entities() ) func _get_entity(node: Node): diff --git a/app/content/ui/menu/edit/edit_menu.gd b/app/content/ui/menu/edit/edit_menu.gd index b541c94..8a9fed7 100644 --- a/app/content/ui/menu/edit/edit_menu.gd +++ b/app/content/ui/menu/edit/edit_menu.gd @@ -20,7 +20,7 @@ func _ready(): entities_page.on_select_entity.connect(func(entity_name): spawn_sound.play() - var entity=House.body.create_entity(entity_name, global_position) + var entity=App.house.create_entity(entity_name, global_position) if typeof(entity) == TYPE_BOOL&&entity == false: EventSystem.notify("Entity is not in Room", EventNotify.Type.INFO) diff --git a/app/content/ui/menu/menu.gd b/app/content/ui/menu/menu.gd index ca458f5..755e07a 100644 --- a/app/content/ui/menu/menu.gd +++ b/app/content/ui/menu/menu.gd @@ -6,18 +6,15 @@ const Notification = preload ("res://content/ui/components/notification/notifica @onready var open_sound = $OpenSound @onready var close_sound = $CloseSound @onready var notify_place = $AnimationContainer/NotifyPlace -@onready var main = $"/root/Main" var show_menu = R.state(false) func _ready(): - await main.ready - - main.remove_child(self) + App.main.remove_child(self) R.effect(func(_arg): if show_menu.value: - main.add_child(self) + App.main.add_child(self) move_into_view() animation_player.play_backwards("hide_menu") open_sound.play() @@ -30,7 +27,12 @@ func _ready(): animation_player.animation_finished.connect(func(_animation): if show_menu.value == false: - main.remove_child(self) + App.main.remove_child(self) + ) + + EventSystem.on_action_down.connect(func(action): + if action.name == "menu_button": + toggle_open() ) EventSystem.on_notify.connect(func(event: EventNotify): @@ -44,8 +46,11 @@ func _ready(): notify_place.add_child(notification_node) ) +func toggle_open(): + show_menu.value = !show_menu.value + func move_into_view(): - var camera_transform = main.camera.global_transform + var camera_transform = App.camera.global_transform camera_transform.origin -= camera_transform.basis.z * 0.5 global_transform = camera_transform \ No newline at end of file diff --git a/app/content/ui/menu/menu.tscn b/app/content/ui/menu/menu.tscn index 0ceb679..332fe98 100644 --- a/app/content/ui/menu/menu.tscn +++ b/app/content/ui/menu/menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://c3kdssrmv84kv"] +[gd_scene load_steps=22 format=3 uid="uid://c3kdssrmv84kv"] [ext_resource type="Script" path="res://content/ui/menu/menu.gd" id="1_ng4u3"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="2_8coxu"] @@ -7,7 +7,6 @@ [ext_resource type="PackedScene" uid="uid://crrb0l3ekuotj" path="res://content/ui/menu/edit/edit_menu.tscn" id="4_r2raj"] [ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_w4i01"] [ext_resource type="Script" path="res://content/ui/components/tabs/tabs_content.gd" id="6_7rntr"] -[ext_resource type="ArrayMesh" uid="uid://cbqhhnknyium2" path="res://assets/immersive_home_panels/immersive_home_panels.obj" id="7_f4u4o"] [ext_resource type="PackedScene" uid="uid://ddpxthb414unp" path="res://content/ui/menu/view/view_menu.tscn" id="8_71pkg"] [ext_resource type="PackedScene" uid="uid://c01gkeldvjwtr" path="res://content/ui/menu/room/room_menu.tscn" id="10_u4i1x"] [ext_resource type="PackedScene" uid="uid://c6r4higceibif" path="res://content/ui/menu/settings/settings_menu.tscn" id="11_7wm6b"] @@ -26,7 +25,7 @@ shader_parameter/edge_color = Color(0, 0, 0, 1) shader_parameter/size = Vector2(0.42, 0.32) shader_parameter/border_size = 0.001 shader_parameter/border_fade_in = 0.005 -shader_parameter/border_fade_out = 0.0 +shader_parameter/border_fade_out = 0.001 shader_parameter/corner_radius = 0.02 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 @@ -272,8 +271,10 @@ tabs = NodePath("../Tabs") visible = false [node name="EditMenu" parent="AnimationContainer/TabsContent" instance=ExtResource("4_r2raj")] +visible = false [node name="RoomMenu" parent="AnimationContainer/TabsContent" instance=ExtResource("10_u4i1x")] +visible = false [node name="AutomateMenu" type="Node3D" parent="AnimationContainer/TabsContent"] visible = false @@ -289,11 +290,6 @@ gizmo_extents = 0.02 transform = Transform3D(0.5, 0, 0, 0, 0.433012, 0.25, 0, -0.25, 0.433012, 0.2, -0.38, 0.11) gizmo_extents = 0.02 -[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) -visible = false -mesh = ExtResource("7_f4u4o") - [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { "": SubResource("AnimationLibrary_s30cd") diff --git a/app/content/ui/menu/room/room_menu.gd b/app/content/ui/menu/room/room_menu.gd index 3293953..34f6296 100644 --- a/app/content/ui/menu/room/room_menu.gd +++ b/app/content/ui/menu/room/room_menu.gd @@ -1,6 +1,6 @@ extends Node3D -const window_scene = preload("./window.tscn") +const window_scene = preload ("./window.tscn") @onready var background = $Background @@ -8,7 +8,7 @@ func _ready(): background.visible = false HomeApi.on_connect.connect(func(): - # var rooms = House.body.get_rooms(0) + # var rooms = App.house.get_rooms(0) # for room in rooms: # var mesh = room.wall_mesh diff --git a/app/content/ui/menu/room/views/doors.gd b/app/content/ui/menu/room/views/doors.gd index c355e34..607e9d9 100644 --- a/app/content/ui/menu/room/views/doors.gd +++ b/app/content/ui/menu/room/views/doors.gd @@ -45,20 +45,20 @@ func _ready(): door_button.on_button_up.connect(func(): if doors_map.selected_door.value == null: - var id=House.body.doors.add() + var id=App.house.doors.add() editing_door.value=true doors_map.selected_door.value=id elif editing_door.value == false: editing_door.value=true - House.body.doors.edit(doors_map.selected_door.value) + App.house.doors.edit(doors_map.selected_door.value) else: - House.body.doors.save() + App.house.doors.save() editing_door.value=false ) delete_button.on_button_up.connect(func(): if doors_map.selected_door.value != null: - House.body.doors.delete(doors_map.selected_door.value) + App.house.doors.delete(doors_map.selected_door.value) doors_map.selected_door.value=null ) \ No newline at end of file diff --git a/app/content/ui/menu/room/views/overview.gd b/app/content/ui/menu/room/views/overview.gd index 2cb31f1..567777d 100644 --- a/app/content/ui/menu/room/views/overview.gd +++ b/app/content/ui/menu/room/views/overview.gd @@ -19,13 +19,13 @@ func _ready(): edit_button.on_button_down.connect(func(): if active: - House.body.save_reference() + App.house.save_reference() else: - House.body.edit_reference() - active = !active + App.house.edit_reference() + active=!active ) fix_button.on_button_down.connect(func(): - House.body.fix_reference() - active = true + App.house.fix_reference() + active=true ) diff --git a/app/content/ui/menu/room/views/rooms.gd b/app/content/ui/menu/room/views/rooms.gd index 49c7b10..07d7ea1 100644 --- a/app/content/ui/menu/room/views/rooms.gd +++ b/app/content/ui/menu/room/views/rooms.gd @@ -46,8 +46,8 @@ func _ready(): EventSystem.notify("Name already taken", EventNotify.Type.WARNING) return - House.body.create_room(room_name, 0) - House.body.edit_room(room_name) + App.house.create_room(room_name) + App.house.edit_room(room_name) selected_room.value=room_name editing_room.value=true rooms_map.selectable.value=false @@ -56,17 +56,17 @@ func _ready(): rooms_map.selectable.value=!editing_room.value if editing_room.value == false: - if !House.body.is_valid_room(selected_room.value): + if !App.house.is_valid_room(selected_room.value): EventSystem.notify("Room was deleted as it had less than 3 corners.", EventNotify.Type.WARNING) - House.body.delete_room(selected_room.value) + App.house.delete_room(selected_room.value) selected_room.value=null return if selected_room.value != null&&selected_room.value != input.text: - House.body.rename_room(selected_room.value, input.text) + App.house.rename_room(selected_room.value, input.text) selected_room.value=input.text - House.body.edit_room(null) + App.house.edit_room(null) else: - House.body.edit_room(selected_room.value) + App.house.edit_room(selected_room.value) ) diff --git a/app/content/ui/menu/settings/menus/features_menu.gd b/app/content/ui/menu/settings/menus/features_menu.gd index 0288217..68d6a18 100644 --- a/app/content/ui/menu/settings/menus/features_menu.gd +++ b/app/content/ui/menu/settings/menus/features_menu.gd @@ -40,7 +40,6 @@ func _ready(): cursor_options.on_select.connect(func(option): settings_store.cursor_style=option settings_store.cursor_style=option - print("cursor_style", option) Store.settings.save_local() ) diff --git a/app/content/ui/menu/settings/menus/features_menu.tscn b/app/content/ui/menu/settings/menus/features_menu.tscn index 57ac73a..1df95c9 100644 --- a/app/content/ui/menu/settings/menus/features_menu.tscn +++ b/app/content/ui/menu/settings/menus/features_menu.tscn @@ -8,7 +8,7 @@ [ext_resource type="Texture2D" uid="uid://bl33klueufwja" path="res://assets/cursors/pointer.png" id="6_ypel5"] [ext_resource type="Texture2D" uid="uid://churthrr24yhw" path="res://assets/cursors/old.png" id="7_un12x"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_0hxn1"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_jrgbl"] resource_local_to_scene = true render_priority = 10 shader = ExtResource("4_v4u0l") @@ -23,7 +23,7 @@ shader_parameter/corner_radius = 0.2 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 -[sub_resource type="QuadMesh" id="QuadMesh_1x032"] +[sub_resource type="QuadMesh" id="QuadMesh_si7x8"] size = Vector2(0.04, 0.04) [sub_resource type="BoxShape3D" id="BoxShape3D_01skh"] @@ -34,7 +34,7 @@ size = Vector3(0.04, 0.04, 0.01) resource_local_to_scene = true size = Vector3(0.04, 0.04, 0.03) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_pnxr8"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_arcnd"] resource_local_to_scene = true render_priority = 10 shader = ExtResource("4_v4u0l") @@ -49,7 +49,7 @@ shader_parameter/corner_radius = 0.2 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 -[sub_resource type="QuadMesh" id="QuadMesh_6ehqp"] +[sub_resource type="QuadMesh" id="QuadMesh_ajawk"] size = Vector2(0.04, 0.04) [node name="FeaturesMenu" type="Node3D"] @@ -93,8 +93,8 @@ icon = true toggleable = true [node name="Panel3D" parent="CursorOptions/CircleCursor/Body" index="0"] -material_override = SubResource("ShaderMaterial_0hxn1") -mesh = SubResource("QuadMesh_1x032") +material_override = SubResource("ShaderMaterial_jrgbl") +mesh = SubResource("QuadMesh_si7x8") [node name="CollisionShape3D" parent="CursorOptions/CircleCursor/Body" index="1"] shape = SubResource("BoxShape3D_01skh") @@ -126,8 +126,8 @@ icon = true toggleable = true [node name="Panel3D" parent="CursorOptions/RetroCursor/Body" index="0"] -material_override = SubResource("ShaderMaterial_pnxr8") -mesh = SubResource("QuadMesh_6ehqp") +material_override = SubResource("ShaderMaterial_arcnd") +mesh = SubResource("QuadMesh_ajawk") [node name="CollisionShape3D" parent="CursorOptions/RetroCursor/Body" index="1"] shape = SubResource("BoxShape3D_01skh") diff --git a/app/content/ui/menu/settings/menus/save_menu.gd b/app/content/ui/menu/settings/menus/save_menu.gd index 5e8d8c3..9541120 100644 --- a/app/content/ui/menu/settings/menus/save_menu.gd +++ b/app/content/ui/menu/settings/menus/save_menu.gd @@ -6,11 +6,11 @@ extends Node3D func _ready(): save.on_button_down.connect(func(): - House.body.save_all_entities() + App.house.save_all_entities() Store.house.save_local() ) clear_save.on_button_down.connect(func(): Store.house.clear() - House.body.update_house() + App.house.update_house() ) diff --git a/app/content/ui/menu/view/view_menu.gd b/app/content/ui/menu/view/view_menu.gd index 2fb3dd5..7c0dbe8 100644 --- a/app/content/ui/menu/view/view_menu.gd +++ b/app/content/ui/menu/view/view_menu.gd @@ -1,6 +1,6 @@ extends Node3D -const Miniature = preload ("res://content/system/house/mini/miniature.gd") +const Miniature = preload ("res://content/system/miniature/miniature.gd") @onready var mini_view_button = $Content/MiniView @onready var heat_map_button = $Content/HeatMap @@ -13,81 +13,79 @@ const Miniature = preload ("res://content/system/house/mini/miniature.gd") func _ready(): background.visible = false - if !House.body.is_node_ready(): - await House.body.ready - - var mini_view = House.body.mini_view + if App.miniature.is_node_ready() == false: + await App.miniature.ready mini_view_button.on_toggled.connect(func(active): - mini_view.small.value=active + App.miniature.small.value=active ) heat_map_button.on_toggled.connect(func(active): if active == false: - if mini_view.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE: - mini_view.heatmap_type.value=Miniature.HeatmapType.NONE + if App.miniature.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE: + App.miniature.heatmap_type.value=Miniature.HeatmapType.NONE return - mini_view.heatmap_type.value=Miniature.HeatmapType.TEMPERATURE + App.miniature.heatmap_type.value=Miniature.HeatmapType.TEMPERATURE ) humudity_map_button.on_toggled.connect(func(active): if active == false: - if mini_view.heatmap_type.value == Miniature.HeatmapType.HUMIDITY: - mini_view.heatmap_type.value=Miniature.HeatmapType.NONE + if App.miniature.heatmap_type.value == Miniature.HeatmapType.HUMIDITY: + App.miniature.heatmap_type.value=Miniature.HeatmapType.NONE return - mini_view.heatmap_type.value=Miniature.HeatmapType.HUMIDITY + App.miniature.heatmap_type.value=Miniature.HeatmapType.HUMIDITY ) R.effect(func(_arg): - heat_map_button.active=mini_view.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE - humudity_map_button.active=mini_view.heatmap_type.value == Miniature.HeatmapType.HUMIDITY + heat_map_button.active=App.miniature.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE + humudity_map_button.active=App.miniature.heatmap_type.value == Miniature.HeatmapType.HUMIDITY ) min_slider.on_value_changed.connect(func(value): - if value >= mini_view.selected_scale.value.y: - min_slider.value=mini_view.selected_scale.value.y + if value >= App.miniature.selected_scale.value.y: + min_slider.value=App.miniature.selected_scale.value.y return - mini_view.selected_scale.value.x=value + App.miniature.selected_scale.value.x=value ) max_slider.on_value_changed.connect(func(value): - if value <= mini_view.selected_scale.value.x: - max_slider.value=mini_view.selected_scale.value.x + if value <= App.miniature.selected_scale.value.x: + max_slider.value=App.miniature.selected_scale.value.x return - mini_view.selected_scale.value.y=value + App.miniature.selected_scale.value.y=value ) R.effect(func(_arg): - min_slider.value=mini_view.selected_scale.value.x - max_slider.value=mini_view.selected_scale.value.y + min_slider.value=App.miniature.selected_scale.value.x + max_slider.value=App.miniature.selected_scale.value.y ) # Update Slider R.effect(func(_arg): - var minmax=mini_view.get_base_scale() + var minmax=App.miniature.get_base_scale() min_slider.min=minmax.x min_slider.max=minmax.y max_slider.min=minmax.x max_slider.max=minmax.y - var sensor_minmax=mini_view.get_sensor_scale() + var sensor_minmax=App.miniature.get_sensor_scale() sensor_minmax.x=floor(sensor_minmax.x) sensor_minmax.y=ceil(sensor_minmax.y) - mini_view.selected_scale.value=sensor_minmax + App.miniature.selected_scale.value=sensor_minmax min_slider.value=sensor_minmax.x max_slider.value=sensor_minmax.y - var unit=mini_view.get_sensor_unit() + var unit=App.miniature.get_sensor_unit() min_slider.label_unit=unit max_slider.label_unit=unit ) - R.bind(opacity_slider, "value", mini_view.opacity, opacity_slider.on_value_changed) + R.bind(opacity_slider, "value", App.miniature.opacity, opacity_slider.on_value_changed) diff --git a/app/content/ui/onboarding/onboarding.gd b/app/content/ui/onboarding/onboarding.gd index 7aac25e..1bf5cb4 100644 --- a/app/content/ui/onboarding/onboarding.gd +++ b/app/content/ui/onboarding/onboarding.gd @@ -2,7 +2,6 @@ extends Node3D @onready var getting_started_button = $GettingStartedButton @onready var close_button = $CloseButton -@onready var camera = $"/root/Main/XROrigin3D/XRCamera3D" var next_new_position = null func _ready(): @@ -30,11 +29,11 @@ func close(): queue_free() func _slow_tick(delta): - var new_position = camera.global_position + camera.global_transform.basis.z * - 0.5 + 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((camera.global_position - new_position) * - 1) + var new_direction = Basis.looking_at((App.camera.global_position - new_position) * - 1) var tween = create_tween() tween.set_parallel(true) diff --git a/app/lib/globals/console.gd b/app/lib/globals/console.gd index f65e9a5..ee9d8cf 100644 --- a/app/lib/globals/console.gd +++ b/app/lib/globals/console.gd @@ -1,6 +1,5 @@ extends Node -const console_scene = preload ("res://content/ui/console.tscn") @onready var main = $"/root/Main" @onready var console = $"/root/Main/Console" diff --git a/app/lib/globals/event_system.gd b/app/lib/globals/event_system.gd index 0c0b67f..866f7fd 100644 --- a/app/lib/globals/event_system.gd +++ b/app/lib/globals/event_system.gd @@ -82,6 +82,19 @@ func notify(message: String, type:=EventNotify.Type.INFO): event.type = type emit("notify", event) +## Helper for emitting controller actions +func emit_action(name: String, value, right_controller: bool=true): + var event = EventAction.new() + event.name = name + event.value = value + event.right_controller = right_controller + + match typeof(value): + TYPE_BOOL: + EventSystem.emit("action_down" if value else "action_up", event) + TYPE_FLOAT, TYPE_VECTOR2: + EventSystem.emit("action_value", event) + ## Returns true when the node is focused func is_focused(node: Node): return _active_node == node diff --git a/app/lib/globals/home_api.gd b/app/lib/globals/home_api.gd index 82bd92c..17a2271 100644 --- a/app/lib/globals/home_api.gd +++ b/app/lib/globals/home_api.gd @@ -1,24 +1,14 @@ extends Node ## Manages the connection to the home automation system and provides a unified interface to the different home automation systems. -const Hass = preload ("res://lib/home_apis/hass/hass.gd") const EntityGroups = preload ("res://lib/utils/entity_group.gd") const HassWebSocket = preload ("res://lib/home_apis/hass_ws/hass.gd") const VoiceAssistant = preload ("res://lib/home_apis/voice_handler.gd") const apis = { - "hass": Hass, "hass_ws": HassWebSocket } -const methods = [ - "get_devices", - "get_device", - "get_state", - "set_state", - "watch_state" -] - var groups = EntityGroups.new() ## Emitted when the connection to the home automation system is established @@ -32,7 +22,6 @@ var api: Node var reconnect_timer := Timer.new() func _ready(): - print("HomeApi ready") start() reconnect_timer.wait_time = 60 @@ -75,9 +64,6 @@ func start_adapter(type: String, url: String, token: String): on_disconnect.emit() ) - for method in methods: - assert(api.has_method(method), "%s Api does not implement method: %s" % [type, method]) - func _on_connect(): on_connect.emit() diff --git a/app/lib/globals/house_body.gd b/app/lib/globals/house_body.gd deleted file mode 100644 index 2339687..0000000 --- a/app/lib/globals/house_body.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Node -## Shortcut to get the House node from the Main scene - -const HouseClass = preload ("res://content/system/house/house.gd") - -@onready var body: HouseClass = get_node_or_null("/root/Main/House") \ No newline at end of file diff --git a/app/lib/globals/main.gd b/app/lib/globals/main.gd new file mode 100644 index 0000000..4892d27 --- /dev/null +++ b/app/lib/globals/main.gd @@ -0,0 +1,16 @@ +extends Node + +const Main = preload ("res://content/main.gd") +const House = preload ("res://content/system/house/house.gd") +const Menu = preload ("res://content/ui/menu/menu.gd") +const Miniature = preload ("res://content/system/miniature/miniature.gd") +const ControllerLeft = preload ("res://content/system/controller_left/controller_left.gd") +const ControllerRight = preload ("res://content/system/controller_right/controller_right.gd") + +@onready var main: Main = get_node_or_null("/root/Main") +@onready var house: House = get_node_or_null("/root/Main/House") +@onready var menu: Menu = get_node_or_null("/root/Main/Menu") +@onready var camera: XRCamera3D = get_node_or_null("/root/Main/XROrigin3D/XRCamera3D") +@onready var miniature: Miniature = get_node_or_null("/root/Main/Miniature") +@onready var controller_left: ControllerLeft = get_node_or_null("/root/Main/XROrigin3D/XRControllerLeft") +@onready var controller_right: ControllerRight = get_node_or_null("/root/Main/XROrigin3D/XRControllerRight") \ No newline at end of file diff --git a/app/lib/home_apis/hass/hass.gd b/app/lib/home_apis/hass/hass.gd deleted file mode 100644 index 88e101c..0000000 --- a/app/lib/home_apis/hass/hass.gd +++ /dev/null @@ -1,58 +0,0 @@ -extends Node - -var url: String = "http://192.168.33.33:8123" -var token: String = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzZjQ0ZGM2N2Y3YzY0MDc1OGZlMWI2ZjJlNmIxZjRkNSIsImlhdCI6MTY5ODAxMDcyOCwiZXhwIjoyMDEzMzcwNzI4fQ.K6ydLUC-4Q7BNIRCU1nWlI2s6sg9UCiOu-Lpedw2zJc" -var headers: PackedStringArray = PackedStringArray([]) - -var devices_template = FileAccess.get_file_as_string("res://lib/home_apis/hass/templates/devices.j2") - -func _init(url := self.url, token := self.token): - self.url = url - self.token = token - - headers = PackedStringArray(["Authorization: Bearer %s" % token, "Content-Type: application/json"]) - devices_template = devices_template.replace("\n", " ").replace("\t", "").replace("\r", " ").replace("\"", "\\\"") - -func get_devices(): - Request.request("%s/api/template" % [url], headers, HTTPClient.METHOD_POST, "{\"template\": \"%s\"}" % [devices_template]) - var response = await Request.request_completed - var data_string = response[3].get_string_from_utf8().replace("'", "\"") - var json = JSON.parse_string(data_string).data - - return json - -func get_state(entity: String): - var type = entity.split('.')[0] - - Request.request("%s/api/states/%s" % [url, entity], headers, HTTPClient.METHOD_GET) - var response = await Request.request_completed - - var data_string = response[3].get_string_from_utf8().replace("'", "\"") - var json = JSON.parse_string(data_string) - - return json - -func set_state(entity: String, state: String, attributes: Dictionary = {}): - var type = entity.split('.')[0] - var response - - if type == 'switch': - if state == 'on': - Request.request("%s/api/services/switch/turn_on" % [url], headers, HTTPClient.METHOD_POST, "{\"entity_id\": \"%s\"}" % [entity]) - response = await Request.request_completed - elif state == 'off': - Request.request("%s/api/services/switch/turn_off" % [url], headers, HTTPClient.METHOD_POST, "{\"entity_id\": \"%s\"}" % [entity]) - response = await Request.request_completed - elif type == 'light': - if state == 'on': - Request.request("%s/api/services/light/turn_on" % [url], headers, HTTPClient.METHOD_POST, "{\"entity_id\": \"%s\"}" % [entity]) - response = await Request.request_completed - elif state == 'off': - Request.request("%s/api/services/light/turn_off" % [url], headers, HTTPClient.METHOD_POST, "{\"entity_id\": \"%s\"}" % [entity]) - response = await Request.request_completed - - var data_string = response[3].get_string_from_utf8().replace("'", "\"") - var json = JSON.parse_string(data_string) - - return json - diff --git a/app/lib/home_apis/hass/templates/devices.j2 b/app/lib/home_apis/hass/templates/devices.j2 deleted file mode 100644 index d1750ba..0000000 --- a/app/lib/home_apis/hass/templates/devices.j2 +++ /dev/null @@ -1,12 +0,0 @@ -{% set devices = states | map(attribute='entity_id') | map('device_id') | unique | reject('eq',None) | list %} - -{%- set ns = namespace(devices = []) %} -{%- for device in devices %} - {%- set entities = device_entities(device) | list %} - {%- if entities %} - {%- set ns.devices = ns.devices + [ {device: {"name": device_attr(device, "name"), "entities": entities }} ] %} - {%- endif %} -{%- endfor %} -{ - "data": {{ ns.devices }} -} \ No newline at end of file diff --git a/app/lib/home_apis/hass_ws/auth.gd b/app/lib/home_apis/hass_ws/auth.gd new file mode 100644 index 0000000..3d29c80 --- /dev/null +++ b/app/lib/home_apis/hass_ws/auth.gd @@ -0,0 +1,53 @@ +extends Node + +const Connection = preload ("connection.gd") +const TimedSignal = preload ("res://lib/utils/timed_signal.gd") + +signal on_authenticated() +signal _try_auth(success: bool) + +enum AuthError { + OK = 0, + INVALID_TOKEN = 1, + TIMEOUT = 2, + UNKNOWN = 3 +} + +var connection: Connection +var token: String + +var authenticated := false + +func _init(connection: Connection): + self.connection = connection + +func authenticate(token: String=self.token) -> AuthError: + self.token = token + connection.on_packed_received.connect(_handle_message) + + var error = await TimedSignal.timed_signal(self, _try_auth, 10.0) + + if error == Error.ERR_TIMEOUT: + return AuthError.TIMEOUT + elif error == Error.ERR_CANT_RESOLVE: + return AuthError.INVALID_TOKEN + elif error == Error.OK: + return AuthError.OK + + return AuthError.UNKNOWN + +func _handle_message(message): + match message["type"]: + "auth_required": + connection.send_packet({"type": "auth", "access_token": self.token}) + "auth_ok": + authenticated = true + _try_auth.emit(Error.OK) + on_authenticated.emit() + "auth_invalid": + _try_auth.emit(Error.ERR_CANT_RESOLVE) + EventSystem.notify("Failed to authenticate with Home Assistant. Check your token and try again.", EventNotify.Type.DANGER) + connection.handle_disconnect() + +func on_disconnect(): + authenticated = false \ No newline at end of file diff --git a/app/lib/home_apis/hass_ws/connection.gd b/app/lib/home_apis/hass_ws/connection.gd new file mode 100644 index 0000000..2cb2109 --- /dev/null +++ b/app/lib/home_apis/hass_ws/connection.gd @@ -0,0 +1,187 @@ +extends Node + +const HASS_API = preload ("hass.gd") +const Auth = preload ("./auth.gd") +const TimedSignal = preload ("res://lib/utils/timed_signal.gd") + +signal on_connect() +signal on_disconnect() + +signal on_packed_received(packet: Dictionary) + +signal _try_connect(success: bool) + +const LOG_MESSAGES := false + +var socket := WebSocketPeer.new() +var packet_callbacks := CallbackMap.new() +var api: HASS_API +var auth: Auth + +var request_timeout := 10.0 # in seconds +var connection_timeout := 10.0 # in seconds + +var connecting := false +var connected := false +var url := "" +var id := 1 + +enum ConnectionError { + OK = 0, + INVALID_URL = 1, + CONNECTION_FAILED = 2, + TIMEOUT = 3, + INVALID_TOKEN = 4 +} + +func _init(api: HASS_API): + self.api = api + auth = Auth.new(self) + add_child(auth) + + # https://github.com/godotengine/godot/issues/84423 + # Otherwise the WebSocketPeer will crash when receiving large packets + socket.set_inbound_buffer_size(pow(2, 23)) # ~8MB buffer + +func start(url: String, token: String) -> ConnectionError: + if url == "": + return ConnectionError.INVALID_URL + + if socket.get_ready_state() != WebSocketPeer.STATE_CLOSED: + socket.close() + + if connecting or connected: + return ConnectionError.OK + + connecting = true + + print("Connecting to %s" % url + "/api/websocket") + var error = socket.connect_to_url(url + "/api/websocket") + + if error != OK: + print("Error connecting to %s: %s" % [url, error]) + return ConnectionError.CONNECTION_FAILED + + set_process(true) + + error = await TimedSignal.timed_signal(self, _try_connect, connection_timeout) + + if error == Error.ERR_TIMEOUT: + print("Failed to connect to %s: Exceeded %ss" % [url, connection_timeout]) + return ConnectionError.TIMEOUT + + error = await auth.authenticate(token) + + if error == Auth.AuthError.TIMEOUT: + return ConnectionError.TIMEOUT + elif error != Auth.AuthError.OK: + return ConnectionError.INVALID_TOKEN + + connected = true + on_connect.emit() + return ConnectionError.OK + +func _process(_delta): + socket.poll() + + var state = socket.get_ready_state() + if state == WebSocketPeer.STATE_OPEN: + if connecting: + connecting = false + _try_connect.emit(Error.OK) + + while socket.get_available_packet_count(): + var packet = _decode_packet(socket.get_packet()) + if typeof(packet) == TYPE_DICTIONARY: + handle_packet(packet) + elif typeof(packet) == TYPE_ARRAY: + for p in packet: + handle_packet(p) + elif state == WebSocketPeer.STATE_CLOSING: + pass + elif state == WebSocketPeer.STATE_CLOSED: + var code = socket.get_close_code() + var reason = socket.get_close_reason() + + if reason == "": + reason = "Invalid URL" + + print("WS connection closed with code: %s, reason: %s" % [code, reason]) + set_process(false) + connecting = false + connected = false + on_disconnect.emit() + +func handle_packet(packet: Dictionary): + if LOG_MESSAGES: print("Received packet: %s" % str(packet).substr(0, 1000)) + + on_packed_received.emit(packet) + + if packet.has("id"): + packet_callbacks.call_key(int(packet.id), [packet]) + +func send_subscribe_packet(packet: Dictionary, callback: Callable): + packet.id = id + id += 1 + + packet_callbacks.add(packet.id, callback) + send_packet(packet) + + return func(): + packet_callbacks.remove(packet.id, callback) + send_packet({ + id: id, + "type": packet.type.replace("subscribe", "unsubscribe"), + "subscription": packet.id + }) + id += 1 + +func send_request_packet(packet: Dictionary, ignore_initial:=false): + packet.id = id + id += 1 + + var promise = Promise.new(func(resolve: Callable, reject: Callable): + var fn: Callable + + if ignore_initial: + fn=func(packet: Dictionary): + if packet.type == "event": + resolve.call(packet) + packet_callbacks.remove(packet.id, fn) + + packet_callbacks.add(packet.id, fn) + else: + packet_callbacks.add_once(packet.id, resolve) + + var timeout=get_tree().create_timer(request_timeout) + + timeout.timeout.connect(func(): + reject.call(Promise.Rejection.new("Request timed out")) + if ignore_initial: + packet_callbacks.remove(packet.id, fn) + else: + packet_callbacks.remove(packet.id, resolve) + ) + ) + + send_packet(packet) + + return await promise.settled + +func send_raw(packet: PackedByteArray): + if LOG_MESSAGES: print("Sending binary: %s" % packet.hex_encode()) + socket.send(packet) + +func send_packet(packet: Dictionary, with_id:=false): + if with_id: + packet.id = id + id += 1 + + if LOG_MESSAGES: print("Sending packet: %s" % _encode_packet(packet)) + socket.send_text(_encode_packet(packet)) + +func _decode_packet(packet: PackedByteArray): + return JSON.parse_string(packet.get_string_from_utf8()) + +func _encode_packet(packet: Dictionary): + return JSON.stringify(packet) diff --git a/app/lib/home_apis/hass_ws/handlers/assist.gd b/app/lib/home_apis/hass_ws/handlers/assist.gd index 0efbfcb..7deb83e 100644 --- a/app/lib/home_apis/hass_ws/handlers/assist.gd +++ b/app/lib/home_apis/hass_ws/handlers/assist.gd @@ -33,11 +33,13 @@ var tts_sound = null: func _init(hass: HASS_API): self.api = hass + api.connection.on_packed_received.connect(handle_message) + func start_wakeword(): if pipe_running: return - api.send_packet({ + api.connection.send_packet({ "type": "assist_pipeline/run", "start_stage": "wake_word", "end_stage": "tts", diff --git a/app/lib/home_apis/hass_ws/handlers/auth.gd b/app/lib/home_apis/hass_ws/handlers/auth.gd deleted file mode 100644 index 036ccd2..0000000 --- a/app/lib/home_apis/hass_ws/handlers/auth.gd +++ /dev/null @@ -1,28 +0,0 @@ -const HASS_API = preload ("../hass.gd") - -signal on_authenticated() - -var api: HASS_API -var url: String -var token: String - -var authenticated := false - -func _init(hass: HASS_API, url: String, token: String): - self.api = hass - self.url = url - self.token = token - -func handle_message(message): - match message["type"]: - "auth_required": - api.send_packet({"type": "auth", "access_token": self.token}) - "auth_ok": - authenticated = true - on_authenticated.emit() - "auth_invalid": - EventSystem.notify("Failed to authenticate with Home Assistant. Check your token and try again.", EventNotify.Type.DANGER) - api.handle_disconnect() - -func on_disconnect(): - authenticated = false \ No newline at end of file diff --git a/app/lib/home_apis/hass_ws/handlers/history.gd b/app/lib/home_apis/hass_ws/handlers/history.gd index 7dcce36..283694a 100644 --- a/app/lib/home_apis/hass_ws/handlers/history.gd +++ b/app/lib/home_apis/hass_ws/handlers/history.gd @@ -7,7 +7,7 @@ func _init(hass: HASS_API): self.api = hass func get_history(entity_id: String, start: String, end=null): - var meta_response = await api.send_request_packet({ + var meta_response = await api.connection.send_request_packet({ "type": "recorder/get_statistics_metadata", "statistic_ids": [ entity_id @@ -17,7 +17,7 @@ func get_history(entity_id: String, start: String, end=null): if meta_response.status != OK: return null - var data_response = await api.send_request_packet({ + var data_response = await api.connection.send_request_packet({ "type": "recorder/statistics_during_period", "start_time": start, "statistic_ids": [ diff --git a/app/lib/home_apis/hass_ws/handlers/integration.gd b/app/lib/home_apis/hass_ws/handlers/integration.gd index 7e55162..21291dc 100644 --- a/app/lib/home_apis/hass_ws/handlers/integration.gd +++ b/app/lib/home_apis/hass_ws/handlers/integration.gd @@ -5,9 +5,10 @@ var integration_exists: bool = false func _init(hass: HASS_API): self.api = hass + test_integration.call_deferred() -func on_connect(): - var response = await api.send_request_packet({ +func test_integration(): + var response = await api.connection.send_request_packet({ "type": "immersive_home/register", "device_id": OS.get_unique_id(), "name": OS.get_model_name(), @@ -16,4 +17,4 @@ func on_connect(): }) if response.status == Promise.Status.RESOLVED: - integration_exists = true \ No newline at end of file + integration_exists = true diff --git a/app/lib/home_apis/hass_ws/hass.gd b/app/lib/home_apis/hass_ws/hass.gd index cb2e26e..860955b 100644 --- a/app/lib/home_apis/hass_ws/hass.gd +++ b/app/lib/home_apis/hass_ws/hass.gd @@ -1,100 +1,47 @@ extends Node -const AuthHandler = preload ("./handlers/auth.gd") const IntegrationHandler = preload ("./handlers/integration.gd") const AssistHandler = preload ("./handlers/assist.gd") const HistoryHandler = preload ("./handlers/history.gd") +const Connection = preload ("./connection.gd") signal on_connect() signal on_disconnect() -var connected := false var devices_template := FileAccess.get_file_as_string("res://lib/home_apis/hass_ws/templates/devices.j2") -var socket := WebSocketPeer.new() -# in seconds -var request_timeout := 10.0 -# var url := "wss://8ybjhqcinfcdyvzu.myfritz.net:8123/api/websocket" -var url := "" -var token := "" - -var LOG_MESSAGES := false - -var id := 1 var entities: Dictionary = {} var entitiy_callbacks := CallbackMap.new() -var packet_callbacks := CallbackMap.new() -var auth_handler: AuthHandler +var connection: Connection var integration_handler: IntegrationHandler var assist_handler: AssistHandler var history_handler: HistoryHandler -func _init(url:=self.url, token:=self.token): - self.url = url - self.token = token +func _init(url: String, token: String): + connection = Connection.new(self) + add_child(connection) + + connection.on_disconnect.connect(func(): + on_disconnect.emit() + ) + + var error = await connection.start(url, token) + + if error != Connection.ConnectionError.OK: + print("Error starting connection: ", error) + return - auth_handler = AuthHandler.new(self, url, token) integration_handler = IntegrationHandler.new(self) assist_handler = AssistHandler.new(self) history_handler = HistoryHandler.new(self) + start_subscriptions() + devices_template = devices_template.replace("\n", " ").replace("\t", "").replace("\r", " ") - connect_ws() - - auth_handler.on_authenticated.connect(func(): - start_subscriptions() - ) - -func connect_ws(): - if url == ""||token == "": - return - - print("Connecting to %s" % url + "/api/websocket") - socket.connect_to_url(url + "/api/websocket") - set_process(true) - - # https://github.com/godotengine/godot/issues/84423 - # Otherwise the WebSocketPeer will crash when receiving large packets - socket.set_inbound_buffer_size(pow(2, 23)) # ~8MB buffer - -func _process(delta): - socket.poll() - - var state = socket.get_ready_state() - if state == WebSocketPeer.STATE_OPEN: - while socket.get_available_packet_count(): - var packet = decode_packet(socket.get_packet()) - if typeof(packet) == TYPE_DICTIONARY: - handle_packet(packet) - elif typeof(packet) == TYPE_ARRAY: - for p in packet: - handle_packet(p) - elif state == WebSocketPeer.STATE_CLOSING: - pass - elif state == WebSocketPeer.STATE_CLOSED: - var code = socket.get_close_code() - var reason = socket.get_close_reason() - - if reason == "": - reason = "Invalid URL" - - var message = "WS connection closed with code: %s, reason: %s" % [code, reason] - EventSystem.notify(message, EventNotify.Type.DANGER) - print(message) - handle_disconnect() - -func handle_packet(packet: Dictionary): - if LOG_MESSAGES: print("Received packet: %s" % str(packet).substr(0, 1000)) - - auth_handler.handle_message(packet) - assist_handler.handle_message(packet) - - if packet.has("id"): - packet_callbacks.call_key(int(packet.id), [packet]) func start_subscriptions(): - send_subscribe_packet({ + connection.send_subscribe_packet({ "type": "subscribe_entities" }, func(packet: Dictionary): if packet.type != "event": @@ -107,7 +54,7 @@ func start_subscriptions(): "attributes": packet.event.a[entity]["a"] } entitiy_callbacks.call_key(entity, [entities[entity]]) - handle_connect() + on_connect.emit() if packet.event.has("c"): for entity in packet.event.c.keys(): @@ -122,90 +69,11 @@ func start_subscriptions(): entitiy_callbacks.call_key(entity, [entities[entity]]) ) -func handle_connect(): - integration_handler.on_connect() - connected = true - on_connect.emit() - -func handle_disconnect(): - auth_handler.on_disconnect() - set_process(false) - on_disconnect.emit() - -func send_subscribe_packet(packet: Dictionary, callback: Callable): - packet.id = id - id += 1 - - packet_callbacks.add(packet.id, callback) - send_packet(packet) - - return func(): - packet_callbacks.remove(packet.id, callback) - send_packet({ - id: id, - "type": packet.type.replace("subscribe", "unsubscribe"), - "subscription": packet.id - }) - id += 1 - -func send_request_packet(packet: Dictionary, ignore_initial:=false): - packet.id = id - id += 1 - - var promise = Promise.new(func(resolve: Callable, reject: Callable): - var fn: Callable - - if ignore_initial: - fn=func(packet: Dictionary): - if packet.type == "event": - resolve.call(packet) - packet_callbacks.remove(packet.id, fn) - - packet_callbacks.add(packet.id, fn) - else: - packet_callbacks.add_once(packet.id, resolve) - - var timeout=Timer.new() - timeout.set_wait_time(request_timeout) - timeout.set_one_shot(true) - timeout.timeout.connect(func(): - reject.call(Promise.Rejection.new("Request timed out")) - if ignore_initial: - packet_callbacks.remove(packet.id, fn) - else: - packet_callbacks.remove(packet.id, resolve) - ) - add_child(timeout) - timeout.start() - ) - - send_packet(packet) - - return await promise.settled - -func send_raw(packet: PackedByteArray): - if LOG_MESSAGES: print("Sending binary: %s" % packet.hex_encode()) - socket.send(packet) - -func send_packet(packet: Dictionary, with_id:=false): - if with_id: - packet.id = id - id += 1 - - if LOG_MESSAGES: print("Sending packet: %s" % encode_packet(packet)) - socket.send_text(encode_packet(packet)) - -func decode_packet(packet: PackedByteArray): - return JSON.parse_string(packet.get_string_from_utf8()) - -func encode_packet(packet: Dictionary): - return JSON.stringify(packet) - func has_connected(): - return connected + return connection.connected func get_devices(): - var result = await send_request_packet({ + var result = await connection.send_request_packet({ "type": "render_template", "template": devices_template, "timeout": 3, @@ -270,7 +138,7 @@ func set_state(entity: String, state: Variant, attributes: Dictionary={}): if service == null: return null - return await send_request_packet({ + return await connection.send_request_packet({ "type": "call_service", "domain": domain, "service": service, @@ -284,7 +152,7 @@ func has_integration(): return integration_handler.integration_exists func update_room(room: String): - var response = await send_request_packet({ + var response = await connection.send_request_packet({ "type": "immersive_home/update", "device_id": OS.get_unique_id(), "room": room diff --git a/app/lib/utils/mesh/construct_room_mesh.gd b/app/lib/utils/mesh/construct_room_mesh.gd index 2ea55e6..20b9049 100644 --- a/app/lib/utils/mesh/construct_room_mesh.gd +++ b/app/lib/utils/mesh/construct_room_mesh.gd @@ -35,6 +35,9 @@ static func generate_wall_mesh_with_doors(corners, height, doors): var mesh = ArrayMesh.new() + if Geometry2D.is_polygon_clockwise(PackedVector2Array(corners)) == false: + corners.reverse() + for i in range(0, corners.size()): var corner = corners[i] var next_corner = corners[(i + 1) % corners.size()] diff --git a/app/lib/utils/timed_signal.gd b/app/lib/utils/timed_signal.gd new file mode 100644 index 0000000..a3b6650 --- /dev/null +++ b/app/lib/utils/timed_signal.gd @@ -0,0 +1,14 @@ +static func timed_signal(target: Node, target_signal: Signal, timeout: int): + var promise = Promise.new(func(resolve, reject): + var timer=target.get_tree().create_timer(timeout) + + timer.timeout.connect(func(): + resolve.call(Error.ERR_TIMEOUT) + ) + + target_signal.connect(func(result): + resolve.call(result)) + ) + + var result = await promise.settled + return result.payload \ No newline at end of file diff --git a/app/lib/utils/touch/collide.gd b/app/lib/utils/touch/collide.gd index 3572ace..82ee753 100644 --- a/app/lib/utils/touch/collide.gd +++ b/app/lib/utils/touch/collide.gd @@ -17,8 +17,9 @@ func _init(hand: Node3D, hand_mesh: MeshInstance3D, tip: Node3D): func _ready(): var body_container = Node3D.new() body_container.name = "HandBodyContainer" + body_container.top_level = true - get_node("/root/Main/").add_child.call_deferred(body_container) + add_child(body_container) tip_body = TipCollider.instantiate() tip_body.global_position = tip.global_position diff --git a/app/project.godot b/app/project.godot index 8ee7307..da95eeb 100644 --- a/app/project.godot +++ b/app/project.godot @@ -22,10 +22,10 @@ driver/enable_input=true [autoload] XRToolsUserSettings="*res://addons/godot-xr-tools/user_settings/user_settings.gd" +App="*res://lib/globals/main.gd" HomeApi="*res://lib/globals/home_api.gd" Store="*res://lib/globals/main_store.gd" EventSystem="*res://lib/globals/event_system.gd" -House="*res://lib/globals/house_body.gd" Request="*res://lib/globals/request.gd" TouchManager="*res://lib/utils/touch/touch.gd" @@ -71,6 +71,7 @@ renderer/rendering_method="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility" textures/vram_compression/import_etc2_astc=true environment/ssao/quality=0 +anti_aliasing/quality/msaa_3d=2 viewport/transparent_background=true [xr] diff --git a/app/test/lib/home_apis/hass_ws/debug.gd b/app/test/lib/home_apis/hass_ws/debug.gd new file mode 100644 index 0000000..12dfb87 --- /dev/null +++ b/app/test/lib/home_apis/hass_ws/debug.gd @@ -0,0 +1,34 @@ +extends Control + +@onready var url_input = $HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/LineEdit +@onready var token_input = $HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2/LineEdit2 +@onready var connect_button = $HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/Button +@onready var log_label = $HBoxContainer/PanelContainer2/MarginContainer/VBoxContainer/Label +@onready var code_input = $HBoxContainer/PanelContainer2/MarginContainer/VBoxContainer/CodeEdit + +var expression = Expression.new() + +func _ready(): + connect_button.button_up.connect(func(): + var url=url_input.text + var token=token_input.text + + HomeApi.start_adapter("hass_ws", url, token) + HomeApi.api.LOG_MESSAGES=true + ) + + code_input.text_submitted.connect(func(text): + var error=expression.parse(text) + if error != OK: + print(expression.get_error_text()) + return + expression.execute.call_deferred([], HomeApi) + ) + + HomeApi.on_connect.connect(func(): + connect_button.text="Connected ✅" + ) + + HomeApi.on_disconnect.connect(func(): + connect_button.text="Connect" + ) diff --git a/app/test/lib/home_apis/hass_ws/debug.tscn b/app/test/lib/home_apis/hass_ws/debug.tscn new file mode 100644 index 0000000..656a5de --- /dev/null +++ b/app/test/lib/home_apis/hass_ws/debug.tscn @@ -0,0 +1,93 @@ +[gd_scene load_steps=2 format=3 uid="uid://c1hfl4sj7u0bw"] + +[ext_resource type="Script" path="res://test/lib/home_apis/hass_ws/debug.gd" id="1_rncfy"] + +[node name="Debug" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_rncfy") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 20 + +[node name="PanelContainer" type="PanelContainer" parent="HBoxContainer"] +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/PanelContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/PanelContainer/MarginContainer"] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="Label" type="Label" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +text = "URL" + +[node name="LineEdit" type="LineEdit" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +text = "ws://192.168.33.33:8123" + +[node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="Label2" type="Label" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +text = "Token" + +[node name="LineEdit2" type="LineEdit" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +placeholder_text = "enter token..." + +[node name="HBoxContainer3" type="HBoxContainer" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="Button" type="Button" parent="HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Connect" + +[node name="PanelContainer2" type="PanelContainer" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/PanelContainer2"] +layout_mode = 2 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/PanelContainer2/MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="Label" type="Label" parent="HBoxContainer/PanelContainer2/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="CodeEdit" type="LineEdit" parent="HBoxContainer/PanelContainer2/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 8 +placeholder_text = "set_state(\"light.my-lamp\", \"on\")"