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

Support making hybrid apps for Meta headsets #245

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Jan 15, 2025

This is moved over from godot-sdk-integrations/godot-meta-toolkit#1, and reworked in such a way that it should be easy to support other headset vendors (but this PR only has Meta support). In fact, since godotengine/godot#101387 works, I think we should be able to make this work on Pico as well, but I haven't tried it yet.

UPDATE: I made PR #246 that builds on this one to add support for Pico headsets.

NOTE: This PR only works with Godot v4.4-beta1 and later (and so I've put this on the 4.x milestone).

You can use this export setting to make a hybrid app:

Selection_261

You can choose Start As Immersive or Start As Panel.

And it provides this API for developers (no longer built in GDScript - it's now a singleton implemented in C++):

# Returns true or false for if this is a hybrid app
OpenXRHybridApp.is_hybrid_app()

# Returns an enum with values: HYBRID_MODE_NONE, HYBRID_MODE_IMMERSIVE or HYBRID_MODE_PANEL
OpenXRHybridApp.get_mode()

# Allows switching modes and passing a string as "launch data"
OpenXRHybridApp.switch_mode(OpenXRHybridApp.HYBRID_MODE_PANEL, '{"info": "the info!"}')

# And this function lets you get the "launch data"
OpenXRHybridApp.get_launch_data()

I've included a sample app, with the "famous" rotating turkey. The turkey's current rotation is passed as "launch data" when switching modes, so it'll start from the same rotation that it left off on.

@dsnopek dsnopek added the enhancement New feature or request label Jan 15, 2025
@dsnopek dsnopek added this to the 4.x milestone Jan 15, 2025
@dsnopek dsnopek requested a review from m4gr3d January 15, 2025 21:03
@dsnopek dsnopek force-pushed the meta-hybrid-apps branch 6 times, most recently from f8cb9bf to 41ecb73 Compare January 15, 2025 22:52
@dsnopek dsnopek changed the title Support making hybrid apps Support making hybrid apps for Meta headsets Jan 15, 2025
@dsnopek dsnopek force-pushed the meta-hybrid-apps branch 2 times, most recently from 5d447e9 to ec7d8af Compare January 16, 2025 17:56
config.gradle Outdated Show resolved Hide resolved
@dsnopek
Copy link
Collaborator Author

dsnopek commented Jan 16, 2025

Thanks! All review should be addressed in my latest push.

However, moving from an export option to a project setting didn't work when using the "Remote Debug" button (it wouldn't recognize changes to the setting). I just posted PR godotengine/godot#101658 which will fix this.

(FYI, it worked as an export setting, because changing an export setting causes the export options overrides to be updated. However, updating a project setting doesn't. But Godot is updating the export options overrides before attempting an export in all other situations aside from "Remote Debug", so my PR changes that, rather than directly responding to project settings changes.)

@dsnopek dsnopek requested a review from m4gr3d January 16, 2025 23:17
@dsnopek dsnopek force-pushed the meta-hybrid-apps branch 2 times, most recently from fe8c4b0 to b6b9842 Compare January 16, 2025 23:20
Copy link
Collaborator

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking great! Just a few feedback to address and it should be good to go!

plugin/src/main/cpp/export/khronos_export_plugin.cpp Outdated Show resolved Hide resolved
plugin/src/main/cpp/export/meta_export_plugin.cpp Outdated Show resolved Hide resolved
samples/hybrid-app-sample/panel_switcher.gd Show resolved Hide resolved
@dsnopek dsnopek force-pushed the meta-hybrid-apps branch 3 times, most recently from 854d9ab to a4eab4c Compare January 17, 2025 22:30
@dsnopek
Copy link
Collaborator Author

dsnopek commented Jan 21, 2025

This is updated for all review, and the last CI run passed (however, it's started a new run now because I just rebased after PR #250 was merged) so this should be ready to go as soon as CI passes again :-)

@dsnopek dsnopek requested a review from m4gr3d January 21, 2025 15:50
Copy link
Collaborator

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@dsnopek dsnopek merged commit 7df9262 into GodotVR:master Jan 21, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants