Skip to content

Commit

Permalink
Misc cleanup based on feedback from #238 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
m4gr3d committed Jan 28, 2025
1 parent 593a72b commit 134ab90
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 59 deletions.
2 changes: 1 addition & 1 deletion plugin/src/main/cpp/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Dictionary OpenXREditorExportPlugin::_get_vendor_toggle_option(const String &ven
"",
PROPERTY_USAGE_DEFAULT,
false,
false);
true);
}

OpenXREditorExportPlugin::HybridType OpenXREditorExportPlugin::_get_hybrid_app_setting_value() const {
Expand Down
38 changes: 19 additions & 19 deletions plugin/src/main/cpp/export/pico_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PicoEditorExportPlugin::PicoEditorExportPlugin() {
PROPERTY_HINT_ENUM,
"No,Yes",
PROPERTY_USAGE_DEFAULT,
pico::MANIFEST_FALSE_VALUE,
MANIFEST_FALSE_VALUE,
false);

_face_tracking_option = _generate_export_option(
Expand All @@ -68,7 +68,7 @@ PicoEditorExportPlugin::PicoEditorExportPlugin() {
PROPERTY_HINT_ENUM,
"No,Face only,Lipsync only,Hybrid",
PROPERTY_USAGE_DEFAULT,
pico::FACE_TRACKING_NONE_VALUE,
FACE_TRACKING_NONE_VALUE,
false);

_hand_tracking_option = _generate_export_option(
Expand All @@ -78,7 +78,7 @@ PicoEditorExportPlugin::PicoEditorExportPlugin() {
PROPERTY_HINT_ENUM,
"No,Low frequency,High frequency (60Hz)",
PROPERTY_USAGE_DEFAULT,
pico::HAND_TRACKING_NONE_VALUE,
HAND_TRACKING_NONE_VALUE,
false);
}

Expand All @@ -104,8 +104,8 @@ bool PicoEditorExportPlugin::_is_eye_tracking_enabled() const {
return false;
}

int eye_tracking_option_value = _get_int_option("pico_xr_features/eye_tracking", pico::MANIFEST_FALSE_VALUE);
return eye_tracking_option_value == pico::MANIFEST_TRUE_VALUE;
int eye_tracking_option_value = _get_int_option("pico_xr_features/eye_tracking", MANIFEST_FALSE_VALUE);
return eye_tracking_option_value == MANIFEST_TRUE_VALUE;
}

PackedStringArray PicoEditorExportPlugin::_get_export_features(const Ref<EditorExportPlatform> &platform, bool debug) const {
Expand All @@ -129,24 +129,24 @@ String PicoEditorExportPlugin::_get_export_option_warning(const Ref<EditorExport

bool openxr_enabled = _is_openxr_enabled();
if (option == "pico_xr_features/eye_tracking") {
if (!openxr_enabled && _get_int_option(option, pico::MANIFEST_FALSE_VALUE) == pico::MANIFEST_TRUE_VALUE) {
if (!openxr_enabled && _get_int_option(option, MANIFEST_FALSE_VALUE) == MANIFEST_TRUE_VALUE) {
return "\"Eye tracking\" requires \"XR Mode\" to be \"OpenXR\".\n";
}
} else if (option == "pico_xr_features/face_tracking") {
int face_tracking = _get_int_option(option, pico::FACE_TRACKING_NONE_VALUE);
if (!openxr_enabled && face_tracking > pico::FACE_TRACKING_NONE_VALUE) {
int face_tracking = _get_int_option(option, FACE_TRACKING_NONE_VALUE);
if (!openxr_enabled && face_tracking > FACE_TRACKING_NONE_VALUE) {
return "\"Face tracking\" requires \"XR Mode\" to be \"OpenXR\".\n";
}
bool record_audio = _get_bool_option("permissions/record_audio");
if (!record_audio && face_tracking == pico::FACE_TRACKING_LIPSYNCONLY_VALUE) {
if (!record_audio && face_tracking == FACE_TRACKING_LIPSYNCONLY_VALUE) {
return "\"Lipsync face tracking\" requires \"Record Audio\" to be checked.\n";
}
if (!record_audio && face_tracking == pico::FACE_TRACKING_HYBRID_VALUE) {
if (!record_audio && face_tracking == 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) {
int hand_tracking = _get_int_option(option, HAND_TRACKING_NONE_VALUE);
if (!openxr_enabled && hand_tracking > HAND_TRACKING_NONE_VALUE) {
return "\"Hand tracking\" requires \"XR Mode\" to be \"OpenXR\".\n";
}
}
Expand All @@ -166,8 +166,8 @@ String PicoEditorExportPlugin::_get_android_manifest_element_contents(const Ref<
}

// Face tracking
int face_tracking = _get_int_option("pico_xr_features/face_tracking", pico::FACE_TRACKING_NONE_VALUE);
if (face_tracking == pico::FACE_TRACKING_FACEONLY_VALUE || face_tracking == pico::FACE_TRACKING_HYBRID_VALUE) {
int face_tracking = _get_int_option("pico_xr_features/face_tracking", FACE_TRACKING_NONE_VALUE);
if (face_tracking == FACE_TRACKING_FACEONLY_VALUE || face_tracking == FACE_TRACKING_HYBRID_VALUE) {
contents += " <uses-permission android:name=\"com.picovr.permission.FACE_TRACKING\" />\n";
}

Expand All @@ -186,17 +186,17 @@ String PicoEditorExportPlugin::_get_android_manifest_application_element_content
}

// Face tracking
int face_tracking = _get_int_option("pico_xr_features/face_tracking", pico::FACE_TRACKING_NONE_VALUE);
if (face_tracking > pico::FACE_TRACKING_NONE_VALUE) {
int face_tracking = _get_int_option("pico_xr_features/face_tracking", FACE_TRACKING_NONE_VALUE);
if (face_tracking > FACE_TRACKING_NONE_VALUE) {
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) {
int hand_tracking = _get_int_option("pico_xr_features/hand_tracking", HAND_TRACKING_NONE_VALUE);
if (hand_tracking > 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) {
if (hand_tracking > HAND_TRACKING_LOWFREQUENCY_VALUE) {
contents += " <meta-data tools:node=\"replace\" android:name=\"Hand_Tracking_HighFrequency\" android:value=\"1\" />\n";
}

Expand Down
50 changes: 24 additions & 26 deletions plugin/src/main/cpp/include/export/meta_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,38 @@

using namespace godot;

namespace {
static const int EYE_TRACKING_NONE_VALUE = 0;
static const int EYE_TRACKING_OPTIONAL_VALUE = 1;
static const int EYE_TRACKING_REQUIRED_VALUE = 2;
class MetaEditorExportPlugin : public OpenXREditorExportPlugin {
GDCLASS(MetaEditorExportPlugin, OpenXREditorExportPlugin)

static const int FACE_TRACKING_NONE_VALUE = 0;
static const int FACE_TRACKING_OPTIONAL_VALUE = 1;
static const int FACE_TRACKING_REQUIRED_VALUE = 2;
static const int EYE_TRACKING_NONE_VALUE = 0;
static const int EYE_TRACKING_OPTIONAL_VALUE = 1;
static const int EYE_TRACKING_REQUIRED_VALUE = 2;

static const int BODY_TRACKING_NONE_VALUE = 0;
static const int BODY_TRACKING_OPTIONAL_VALUE = 1;
static const int BODY_TRACKING_REQUIRED_VALUE = 2;
static const int FACE_TRACKING_NONE_VALUE = 0;
static const int FACE_TRACKING_OPTIONAL_VALUE = 1;
static const int FACE_TRACKING_REQUIRED_VALUE = 2;

static const int PASSTHROUGH_NONE_VALUE = 0;
static const int PASSTHROUGH_OPTIONAL_VALUE = 1;
static const int PASSTHROUGH_REQUIRED_VALUE = 2;
static const int BODY_TRACKING_NONE_VALUE = 0;
static const int BODY_TRACKING_OPTIONAL_VALUE = 1;
static const int BODY_TRACKING_REQUIRED_VALUE = 2;

static const int RENDER_MODEL_NONE_VALUE = 0;
static const int RENDER_MODEL_OPTIONAL_VALUE = 1;
static const int RENDER_MODEL_REQUIRED_VALUE = 2;
static const int PASSTHROUGH_NONE_VALUE = 0;
static const int PASSTHROUGH_OPTIONAL_VALUE = 1;
static const int PASSTHROUGH_REQUIRED_VALUE = 2;

static const int HAND_TRACKING_NONE_VALUE = 0;
static const int HAND_TRACKING_OPTIONAL_VALUE = 1;
static const int HAND_TRACKING_REQUIRED_VALUE = 2;
static const int RENDER_MODEL_NONE_VALUE = 0;
static const int RENDER_MODEL_OPTIONAL_VALUE = 1;
static const int RENDER_MODEL_REQUIRED_VALUE = 2;

static const int HAND_TRACKING_FREQUENCY_LOW_VALUE = 0;
static const int HAND_TRACKING_FREQUENCY_HIGH_VALUE = 1;
static const int HAND_TRACKING_NONE_VALUE = 0;
static const int HAND_TRACKING_OPTIONAL_VALUE = 1;
static const int HAND_TRACKING_REQUIRED_VALUE = 2;

static const int BOUNDARY_ENABLED_VALUE = 0;
static const int BOUNDARY_DISABLED_VALUE = 1;
} // namespace
static const int HAND_TRACKING_FREQUENCY_LOW_VALUE = 0;
static const int HAND_TRACKING_FREQUENCY_HIGH_VALUE = 1;

class MetaEditorExportPlugin : public OpenXREditorExportPlugin {
GDCLASS(MetaEditorExportPlugin, OpenXREditorExportPlugin)
static const int BOUNDARY_ENABLED_VALUE = 0;
static const int BOUNDARY_DISABLED_VALUE = 1;

public:
MetaEditorExportPlugin();
Expand Down
24 changes: 11 additions & 13 deletions plugin/src/main/cpp/include/export/pico_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,20 @@

using namespace godot;

namespace pico {
static const int MANIFEST_FALSE_VALUE = 0;
static const int MANIFEST_TRUE_VALUE = 1;
class PicoEditorExportPlugin : public OpenXREditorExportPlugin {
GDCLASS(PicoEditorExportPlugin, OpenXREditorExportPlugin)

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 MANIFEST_FALSE_VALUE = 0;
static const int MANIFEST_TRUE_VALUE = 1;

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
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;

class PicoEditorExportPlugin : public OpenXREditorExportPlugin {
GDCLASS(PicoEditorExportPlugin, OpenXREditorExportPlugin)
static const int HAND_TRACKING_NONE_VALUE = 0;
static const int HAND_TRACKING_LOWFREQUENCY_VALUE = 1;
static const int HAND_TRACKING_HIGHFREQUENCY_VALUE = 2;

public:
PicoEditorExportPlugin();
Expand Down

0 comments on commit 134ab90

Please sign in to comment.