Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix launching XR apps from the Android editor #96868

Merged

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Sep 11, 2024

Fixes #96831
Regression caused by #96780

We actually don't want to initialize OpenXR when the editor loads, so we were disabling it by checking xr/openxr/enabled.editor, which previously wasn't set and hence false. But when launching an XR app from the editor, we do want to initialize OpenXR, which we can tell by checking the xr/openxr/enabled project setting.

This was broken when #96780 actually set xr/openxr/enabled.editor to false, because GodotLib.getGlobal() will get project settings with overrides, and "editor" is a valid feature tag, so all of sudden xr/openxr/enabled would return false (because of the override for editor), even though the "vanilla" project setting is set to true.

This PR adds GodotLib.getProjectSetting() which can get the "vanilla" project setting without overrides, and uses it to check if we are launching an XR app (and hence need to initialize OpenXR).

So, in a sort of way, this doesn't actually fix #96831 because the editor will still run at 1FPS if xr/openxr/enabled.editor is true, but it removes the need for users to enable that setting in the first place.

An alternate fix could be just removing the xr/openxr/enabled.editor setting and hard-coding OpenXR as disabled when the editor launches for now? One day, we may want to actually initialize it, but at the moment we're not using it, and it messes up rendering by OpenXR taking over the render loop.

UPDATE: After chatting with @m4gr3d, we decided to go for this "alternative fix", and this PR now removes the xr/openxr/enabled.editor project setting, and just hard-codes OpenXR as disabled when the editor launches.

@dsnopek dsnopek force-pushed the android-editor-launching-xr-app-fix branch from 47aefbc to 30a6339 Compare September 11, 2024 19:32
@dsnopek dsnopek requested review from a team as code owners September 11, 2024 19:32
@dsnopek
Copy link
Contributor Author

dsnopek commented Sep 11, 2024

After chatting with @m4gr3d, we decided to go for the "alternative fix", and this PR now removes the xr/openxr/enabled.editor project setting, and just hard-codes OpenXR as disabled when the editor launches.

@JD-The-65th
Copy link

JD-The-65th commented Sep 11, 2024

My two cents on this, unless we really need the ability to switch between flatscreen and XR on the fly (which we really shouldn't,) if we were to initialize the OpenXR runtime for an XR editor, it should be before we open the project, and there should be an "Open In XR" button in the Project Manager if Godot detects an XR runtime.

The only way I'd see that we'd want to switch between flatscreen and XR on the fly is if a user wanted to use Pass through, and even then, we can just enable pass through while the XR editor is running. I think it was a recent update where Meta allowed for multitasking, so that takes care of the edge case where a user wants to use multiple apps while developing.

That's my viewpoint on the "one day" we may want to initialize the runtime. I think the solution this PR provides is good.

(Sidenote, it'd be interesting to see what the XR editor featureset would look like if a Desktop Editor could do Remote Filesystem to an XR headset. Maybe a possible feature to consider 🤔)

@akien-mga akien-mga merged commit 55f1ae0 into godotengine:master Sep 12, 2024
20 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants