Fix launching XR apps from the Android editor #96868
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 hencefalse
. But when launching an XR app from the editor, we do want to initialize OpenXR, which we can tell by checking thexr/openxr/enabled
project setting.This was broken when #96780 actually set
xr/openxr/enabled.editor
tofalse
, becauseGodotLib.getGlobal()
will get project settings with overrides, and "editor" is a valid feature tag, so all of suddenxr/openxr/enabled
would returnfalse
(because of the override foreditor
), even though the "vanilla" project setting is set totrue
.This PR addsGodotLib.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 ifxr/openxr/enabled.editor
istrue
, 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.