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 8, 2024
1 parent f1f71de commit 86d9f1b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
33 changes: 29 additions & 4 deletions plugin/src/main/cpp/export/pico_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ void PicoEditorPlugin::_exit_tree() {
PicoEditorExportPlugin::PicoEditorExportPlugin() {
set_vendor_name(PICO_VENDOR_NAME);

_face_tracking_option = _generate_export_option(
"pico_xr_features/face_tracking",
"",
Variant::Type::INT,
PROPERTY_HINT_ENUM,
"No,Face only,Lipsync only,Hybrid",
PROPERTY_USAGE_DEFAULT,
pico::FACE_TRACKING_NONE_VALUE,
false);

_eye_tracking_option = _generate_export_option(
"pico_xr_features/eye_tracking",
"",
Expand All @@ -61,14 +71,14 @@ PicoEditorExportPlugin::PicoEditorExportPlugin() {
pico::MANIFEST_FALSE_VALUE,
false);

_face_tracking_option = _generate_export_option(
"pico_xr_features/face_tracking",
_hand_tracking_option = _generate_export_option(
"pico_xr_features/hand_tracking",
"",
Variant::Type::INT,
PROPERTY_HINT_ENUM,
"No,Face only,Lipsync only,Hybrid",
"No,Low frequency,High frequency (60Hz)",
PROPERTY_USAGE_DEFAULT,
pico::FACE_TRACKING_NONE_VALUE,
pico::HAND_TRACKING_NONE_VALUE,
false);
}

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;
}
6 changes: 6 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,9 +69,11 @@ class PicoEditorExportPlugin : public OpenXREditorExportPlugin {

Dictionary _eye_tracking_option;
Dictionary _face_tracking_option;
Dictionary _hand_tracking_option;

private:
bool _is_eye_tracking_enabled() const;
bool _is_hand_tracking_enabled() const;
};

class PicoEditorPlugin : public EditorPlugin {
Expand Down

0 comments on commit 86d9f1b

Please sign in to comment.