From 39fb0f0ba24447c87f806d4f2c9d50de9380e295 Mon Sep 17 00:00:00 2001 From: Cedrik Schimschar Date: Tue, 8 Oct 2024 17:05:42 +0200 Subject: [PATCH] Add two modes of pico hand tracking to selectable export features --- .../main/cpp/export/pico_export_plugin.cpp | 25 +++++++++++++++++++ .../cpp/include/export/pico_export_plugin.h | 5 ++++ 2 files changed, 30 insertions(+) diff --git a/plugin/src/main/cpp/export/pico_export_plugin.cpp b/plugin/src/main/cpp/export/pico_export_plugin.cpp index 429f6436..f8efc53b 100644 --- a/plugin/src/main/cpp/export/pico_export_plugin.cpp +++ b/plugin/src/main/cpp/export/pico_export_plugin.cpp @@ -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() {} @@ -83,6 +93,7 @@ TypedArray PicoEditorExportPlugin::_get_export_options(const Ref pico::HAND_TRACKING_NONE_VALUE) { + return "\"Hand tracking\" requires \"XR Mode\" to be \"OpenXR\".\n"; + } } return OpenXREditorExportPlugin::_get_export_option_warning(platform, option); @@ -175,5 +191,14 @@ String PicoEditorExportPlugin::_get_android_manifest_application_element_content contents += " \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 += " \n"; + } + if (hand_tracking > pico::HAND_TRACKING_LOWFREQUENCY_VALUE) { + contents += " \n"; + } + return contents; } diff --git a/plugin/src/main/cpp/include/export/pico_export_plugin.h b/plugin/src/main/cpp/include/export/pico_export_plugin.h index fbf2c22f..6bd332f6 100644 --- a/plugin/src/main/cpp/include/export/pico_export_plugin.h +++ b/plugin/src/main/cpp/include/export/pico_export_plugin.h @@ -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 { @@ -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;