Skip to content

Commit 4453664

Browse files
author
ChengNan
committed
Fix Wave XR enable handtracking and tracker
* Latest SDK uses WaveXRSettings
1 parent b9ee634 commit 4453664

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/Editor/HTC.ViveInputUtility.Editor.asmdef

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
"precompiledReferences": [],
3131
"autoReferenced": true,
3232
"defineConstraints": [],
33-
"versionDefines": [],
33+
"versionDefines": [
34+
{
35+
"name": "com.htc.upm.wave.native",
36+
"expression": "5.0.0",
37+
"define": "VIU_WAVE_NATIVE_5_0_OR_NEWER"
38+
},
39+
{
40+
"name": "com.htc.upm.wave.native",
41+
"expression": "5.1.1",
42+
"define": "VIU_WAVE_NATIVE_5_1_1_OR_NEWER"
43+
}
44+
],
3445
"noEngineReferences": false
3546
}

Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/Editor/VRPlatformSettings/WaveVRSettings.cs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,24 @@ public override void OnPreferenceGUI()
309309
EditorGUILayout.BeginHorizontal();
310310
#if VIU_WAVEVR_HAND_TRACKING_CHECK && VIU_WAVEVR_HAND_TRACKING
311311
{
312-
var supported = EditorPrefs.GetBool("Wave/HandTracking/EnableHandTracking", false) && VRModuleSettings.activateWaveHandTrackingSubmodule;
312+
#if VIU_WAVE_NATIVE_5_0_OR_NEWER
313+
Wave.XR.Settings.WaveXRSettings settings = Wave.XR.Settings.WaveXRSettings.GetInstance();
314+
if (settings != null)
315+
{
316+
var supported = settings.EnableNaturalHand && VRModuleSettings.activateWaveHandTrackingSubmodule;
317+
var shouldSupport = EditorGUILayout.ToggleLeft(new GUIContent(enableWaveHandTrackingTitle), supported);
318+
if (supported != shouldSupport)
319+
{
320+
settings.EnableNaturalHand = shouldSupport;
321+
VRModuleSettings.activateWaveHandTrackingSubmodule = shouldSupport;
322+
// can manually disable gesture data fetching by setting enableWaveHandGesture to false if needed
323+
// so far the hardware/runtime will start gesture detaction whenever hand tracking detaction is started,
324+
// disabling enableWaveHandGesture only save some data fetching time, it doesn't stop hardware/runtime gesture detaction
325+
if (shouldSupport) { VRModuleSettings.enableWaveHandGesture = true; }
326+
}
327+
}
328+
#else
329+
var supported = EditorPrefs.GetBool("Wave/Hand Tracking/Enable Hand Tracking", false) && VRModuleSettings.activateWaveHandTrackingSubmodule;
313330
var shouldSupport = EditorGUILayout.ToggleLeft(new GUIContent(enableWaveHandTrackingTitle), supported);
314331
if (supported != shouldSupport)
315332
{
@@ -320,6 +337,7 @@ public override void OnPreferenceGUI()
320337
// disabling enableWaveHandGesture only save some data fetching time, it doesn't stop hardware/runtime gesture detaction
321338
if (shouldSupport) { VRModuleSettings.enableWaveHandGesture = true; }
322339
}
340+
#endif
323341
}
324342
#elif UNITY_2018_1_OR_NEWER
325343
GUI.enabled = false;
@@ -357,13 +375,27 @@ public override void OnPreferenceGUI()
357375
EditorGUILayout.BeginHorizontal();
358376
#if VIU_WAVEVR_TRACKER_CHECK && VIU_WAVEVR_TRACKER
359377
{
360-
var supported = EditorPrefs.GetBool("Wave/Tracker/EnableTracker", false) && VRModuleSettings.activateWaveTrackerSubmodule;
378+
#if VIU_WAVE_NATIVE_5_1_1_OR_NEWER
379+
Wave.XR.Settings.WaveXRSettings settings = Wave.XR.Settings.WaveXRSettings.GetInstance();
380+
if (settings != null)
381+
{
382+
var supported = settings.EnableTracker && VRModuleSettings.activateWaveTrackerSubmodule;
383+
var shouldSupport = EditorGUILayout.ToggleLeft(new GUIContent(enableWaveTrackerTitle), supported);
384+
if (supported != shouldSupport)
385+
{
386+
settings.EnableTracker = shouldSupport;
387+
VRModuleSettings.activateWaveTrackerSubmodule = shouldSupport;
388+
}
389+
}
390+
#else
391+
var supported = EditorPrefs.GetBool("Wave/Tracker/Enable Tracker", false) && VRModuleSettings.activateWaveTrackerSubmodule;
361392
var shouldSupport = EditorGUILayout.ToggleLeft(new GUIContent(enableWaveTrackerTitle), supported);
362393
if (supported != shouldSupport)
363394
{
364395
Wave.XR.BuildCheck.CheckIfTrackerEnabled.PerformAction(shouldSupport);
365396
VRModuleSettings.activateWaveTrackerSubmodule = shouldSupport;
366397
}
398+
#endif
367399
}
368400
#elif UNITY_2018_1_OR_NEWER
369401
GUI.enabled = false;

0 commit comments

Comments
 (0)