Skip to content

Commit

Permalink
Add two modes of pico hand tracking to selectable export features
Browse files Browse the repository at this point in the history
  • Loading branch information
ckschim committed Oct 22, 2024
1 parent f1f71de commit 39fb0f0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
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

0 comments on commit 39fb0f0

Please sign in to comment.