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 #1

Closed
wants to merge 1 commit into from

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Jan 9, 2025

This uses Godot 4.4-dev5 and must be used with godot_openxr_vendors PR GodotVR/godot_openxr_vendors#231

You use an export setting to make a hybrid app:

Selection_245

You can choose Start As Immersive or Start As Panel, but when run from the Godot editor, it'll always start in immersive mode because the editor directly names the activity it launches (it's hard-coded) and the normal Godot game activity is always the immersive one (see notes below).

There is a decent GDScript API:

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

# Returns an enum with values: NONE, IMMERSIVE or PANEL
MetaHybridApp.get_mode()

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

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

The demo shows a simple way to use these.

@dsnopek dsnopek added the enhancement New feature or request label Jan 9, 2025
@dsnopek dsnopek requested a review from m4gr3d January 9, 2025 21:12
@dsnopek dsnopek added this to the 1.0.0 milestone Jan 9, 2025
@@ -160,9 +192,24 @@ Dictionary MetaToolkitExportPlugin::_get_export_options_overrides(
overrides["xr_features/enable_meta_plugin"] = true;
overrides["xr_features/enable_pico_plugin"] = false;

// Unless this is a hybrid app that launches as a panel, then we want to force this option on.
// Otherwise, it needs to be off, so that the panel activity can be the one that's launched by default.
overrides["package/show_in_app_library"] = (hybrid_type != HYBRID_TYPE_START_AS_PANEL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be under a if (hybrid_type != HYBRID_TYPE_DISABLED) check so we don't override this option when hybrid is disabled; e.g: if the user sets this to false we would override it back to true with the current logic if hybrid is disabled.

Comment on lines +254 to +256
manifest_text +=
" </intent-filter>\n"
" <meta-data android:name=\"com.oculus.vrshell.free_resizing_lock_aspect_ratio\" android:value=\"true\" />"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note that this manifest entry constrains the panel resizing so as to maintain the panel's aspect ratio; I'm fine with this being the default behavior, just to ensure this is intended behavior since it's hardcoded.

Comment on lines +266 to +269
String manifest_text =
" <horizonos:uses-horizonos-sdk xmlns:horizonos=\"http://schemas.horizonos/sdk\" "
"horizonos:minSdkVersion=\"69\" "
"horizonos:targetSdkVersion=\"69\" />\n";
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can include this directly in the manifest for the meta vendor plugin once the PR is moved. In general if the manifest entry is not modifiable, then it should be included directly in the vendor specific manifest file.

@dsnopek
Copy link
Collaborator Author

dsnopek commented Jan 15, 2025

As discussed, I've moved this to PR GodotVR/godot_openxr_vendors#245 against "godot_openxr_vendors", and addressed the review here as well as the other things we discussed.

Closing as superseded.

@dsnopek dsnopek closed this Jan 15, 2025
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