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

Add two modes of pico hand tracking to selectable export features #216

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions plugin/src/main/cpp/export/pico_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ PicoEditorExportPlugin::PicoEditorExportPlugin() {
PROPERTY_USAGE_DEFAULT,
pico::FACE_TRACKING_NONE_VALUE,
false);

_hand_tracking_option = _generate_export_option(
"pico_xr_features/hand_tracking",
"",
Variant::Type::INT,
PROPERTY_HINT_ENUM,
"No,Low frequency,High frequency (60Hz)",
PROPERTY_USAGE_DEFAULT,
pico::HAND_TRACKING_NONE_VALUE,
false);
}

void PicoEditorExportPlugin::_bind_methods() {}
Expand All @@ -83,6 +93,7 @@ TypedArray<Dictionary> PicoEditorExportPlugin::_get_export_options(const Ref<Edi
export_options.append(_get_vendor_toggle_option());
export_options.append(_eye_tracking_option);
export_options.append(_face_tracking_option);
export_options.append(_hand_tracking_option);

return export_options;
}
Expand Down Expand Up @@ -133,6 +144,11 @@ String PicoEditorExportPlugin::_get_export_option_warning(const Ref<EditorExport
if (!record_audio && face_tracking == pico::FACE_TRACKING_HYBRID_VALUE) {
return "\"Hybrid face tracking\" requires \"Record Audio\" to be checked.\n";
}
} else if (option == "pico_xr_features/hand_tracking") {
int hand_tracking = _get_int_option(option, pico::HAND_TRACKING_NONE_VALUE);
if (!openxr_enabled && hand_tracking > pico::HAND_TRACKING_NONE_VALUE) {
return "\"Hand tracking\" requires \"XR Mode\" to be \"OpenXR\".\n";
}
}

return OpenXREditorExportPlugin::_get_export_option_warning(platform, option);
Expand Down Expand Up @@ -175,5 +191,14 @@ String PicoEditorExportPlugin::_get_android_manifest_application_element_content
contents += " <meta-data tools:node=\"replace\" android:name=\"picovr.software.face_tracking\" android:value=\"1\" />\n";
}

//Hand tracking
int hand_tracking = _get_int_option("pico_xr_features/hand_tracking", pico::HAND_TRACKING_NONE_VALUE);
if (hand_tracking > pico::HAND_TRACKING_NONE_VALUE) {
contents += " <meta-data tools:node=\"replace\" android:name=\"handtracking\" android:value=\"1\" />\n";
}
if (hand_tracking > pico::HAND_TRACKING_LOWFREQUENCY_VALUE) {
contents += " <meta-data tools:node=\"replace\" android:name=\"Hand_Tracking_HighFrequency\" android:value=\"1\" />\n";
}

return contents;
}
5 changes: 5 additions & 0 deletions plugin/src/main/cpp/include/export/pico_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ static const int FACE_TRACKING_NONE_VALUE = 0;
static const int FACE_TRACKING_FACEONLY_VALUE = 1;
static const int FACE_TRACKING_LIPSYNCONLY_VALUE = 2;
static const int FACE_TRACKING_HYBRID_VALUE = 3;

static const int HAND_TRACKING_NONE_VALUE = 0;
static const int HAND_TRACKING_LOWFREQUENCY_VALUE = 1;
static const int HAND_TRACKING_HIGHFREQUENCY_VALUE = 2;
} //namespace pico

class PicoEditorExportPlugin : public OpenXREditorExportPlugin {
Expand All @@ -65,6 +69,7 @@ class PicoEditorExportPlugin : public OpenXREditorExportPlugin {

Dictionary _eye_tracking_option;
Dictionary _face_tracking_option;
Dictionary _hand_tracking_option;

private:
bool _is_eye_tracking_enabled() const;
Expand Down
Loading