Skip to content

Commit a19e2a6

Browse files
author
lawwong
committed
Add compatibility with Wave 4.2.90
Enum changed from WVR_HandGestureType_Inverse to WVR_HandGestureType_Palm_Pinch
1 parent 977051e commit a19e2a6

2 files changed

Lines changed: 49 additions & 23 deletions

File tree

Assets/HTC.UnityPlugin/VRModule/Modules/Editor/WaveVRModuleEditor.cs

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@ public WaveVRSymbolRequirementCollection()
3939
reqFileNames = new string[] { "RenderModel.cs", "ButtonEffect.cs", "ControllerTips.cs" },
4040
});
4141

42-
Add(new SymbolRequirement()
43-
{
44-
symbol = "VIU_WAVE_XRSDK_3_99_31_OR_NEWER",
45-
reqMethods = new SymbolRequirement.ReqMethodInfo[]
46-
{
47-
new SymbolRequirement.ReqMethodInfo()
48-
{
49-
typeName = "Wave.Native.Interop",
50-
name = "WVR_SetControllerPoseMode",
51-
argTypeNames = new string[]
52-
{
53-
"Wave.Native.WVR_DeviceType",
54-
"Wave.Native.WVR_ControllerPoseMode",
55-
},
56-
bindingAttr = BindingFlags.Public | BindingFlags.Static,
57-
}
58-
},
59-
reqFileNames = new string[] { "wvr.cs" },
60-
});
61-
6242
Add(new SymbolRequirement()
6343
{
6444
symbol = "VIU_WAVEVR_2_0_32_OR_NEWER",
@@ -155,6 +135,45 @@ public WaveVRSymbolRequirementCollection()
155135
reqFileNames = new string[] { "wvr.cs" },
156136
});
157137

138+
Add(new SymbolRequirement()
139+
{
140+
symbol = "VIU_WAVE_XRSDK_3_99_31_OR_NEWER",
141+
reqMethods = new SymbolRequirement.ReqMethodInfo[]
142+
{
143+
new SymbolRequirement.ReqMethodInfo()
144+
{
145+
typeName = "Wave.Native.Interop",
146+
name = "WVR_SetControllerPoseMode",
147+
argTypeNames = new string[]
148+
{
149+
"Wave.Native.WVR_DeviceType",
150+
"Wave.Native.WVR_ControllerPoseMode",
151+
},
152+
bindingAttr = BindingFlags.Public | BindingFlags.Static,
153+
}
154+
},
155+
reqFileNames = new string[] { "wvr.cs" },
156+
});
157+
158+
Add(new SymbolRequirement()
159+
{
160+
symbol = "VIU_WAVE_XRSDK_4_2_90_OR_NEWER",
161+
reqTypeNames = new string[] { "Wave.Native.WVR_HandGestureType" },
162+
validateFunc = (req) =>
163+
{
164+
Type wvrGestureType;
165+
if (SymbolRequirement.s_foundTypes.TryGetValue("Wave.Native.WVR_HandGestureType", out wvrGestureType) && wvrGestureType.IsEnum)
166+
{
167+
if (Enum.IsDefined(wvrGestureType, "WVR_HandGestureType_Palm_Pinch"))
168+
{
169+
return true;
170+
}
171+
}
172+
return false;
173+
},
174+
reqFileNames = new string[] { "wvr.cs" },
175+
});
176+
158177
Add(new SymbolRequirement()
159178
{
160179
symbol = "VIU_WAVEVR_LEGACY_HAND_TRACKING",

Assets/HTC.UnityPlugin/VRModule/Submodules/WaveHandTrackingSubmodule.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,13 @@ public static GestureActivator Default
741741
}
742742
}
743743

744+
private const WVR_HandGestureType WVR_HandGestureType_WVR_HandGestureType_Palm_Pinch =
745+
#if VIU_WAVE_XRSDK_4_2_90_OR_NEWER
746+
WVR_HandGestureType.WVR_HandGestureType_Palm_Pinch;
747+
#else
748+
WVR_HandGestureType.WVR_HandGestureType_Inverse;
749+
#endif
750+
744751
private static Func<WVR_Result> GenerateStarter()
745752
{
746753
return () =>
@@ -750,7 +757,7 @@ private static Func<WVR_Result> GenerateStarter()
750757
m_GestureValue |= 1 << (int)WVR_HandGestureType.WVR_HandGestureType_OK;
751758
m_GestureValue |= 1 << (int)WVR_HandGestureType.WVR_HandGestureType_ThumbUp;
752759
m_GestureValue |= 1 << (int)WVR_HandGestureType.WVR_HandGestureType_IndexUp;
753-
m_GestureValue |= 1 << (int)WVR_HandGestureType.WVR_HandGestureType_Inverse;
760+
m_GestureValue |= 1 << (int)WVR_HandGestureType_WVR_HandGestureType_Palm_Pinch;
754761
return Interop.WVR_StartHandGesture(m_GestureValue);
755762
};
756763
}
@@ -788,13 +795,13 @@ public void UpdateGestureInput(IVRModuleDeviceStateRW state, bool isLeft)
788795
state.SetButtonPress(VRModuleRawButton.GestureIndexUp, gesture == WVR_HandGestureType.WVR_HandGestureType_IndexUp);
789796
state.SetButtonPress(VRModuleRawButton.GestureOk, gesture == WVR_HandGestureType.WVR_HandGestureType_OK);
790797
state.SetButtonPress(VRModuleRawButton.GestureThumbUp, gesture == WVR_HandGestureType.WVR_HandGestureType_ThumbUp);
791-
state.SetButtonPress(VRModuleRawButton.System, gesture == WVR_HandGestureType.WVR_HandGestureType_Inverse);
798+
state.SetButtonPress(VRModuleRawButton.System, gesture == WVR_HandGestureType_WVR_HandGestureType_Palm_Pinch);
792799
state.SetButtonTouch(VRModuleRawButton.GestureFist, gesture == WVR_HandGestureType.WVR_HandGestureType_Fist);
793800
state.SetButtonTouch(VRModuleRawButton.GestureFive, gesture == WVR_HandGestureType.WVR_HandGestureType_Five);
794801
state.SetButtonTouch(VRModuleRawButton.GestureIndexUp, gesture == WVR_HandGestureType.WVR_HandGestureType_IndexUp);
795802
state.SetButtonTouch(VRModuleRawButton.GestureOk, gesture == WVR_HandGestureType.WVR_HandGestureType_OK);
796803
state.SetButtonTouch(VRModuleRawButton.GestureThumbUp, gesture == WVR_HandGestureType.WVR_HandGestureType_ThumbUp);
797-
state.SetButtonTouch(VRModuleRawButton.System, gesture == WVR_HandGestureType.WVR_HandGestureType_Inverse);
804+
state.SetButtonTouch(VRModuleRawButton.System, gesture == WVR_HandGestureType_WVR_HandGestureType_Palm_Pinch);
798805
}
799806

800807
public bool isLeftValid { get { return gestureData.left != WVR_HandGestureType.WVR_HandGestureType_Invalid; } }

0 commit comments

Comments
 (0)