Skip to content

Commit bc79dcf

Browse files
author
lawwong
committed
Update to v1.10.5
* Improvement - Add platform supported define symbols - Add VIVE Cosmos support - Add Valve Index support - Update bindings for Index controller to allow trackpad and thumbstick to work individually - Add Oculus Quest support - Add Oculus Rift S support - Add Unity XR input supports Oculus (Android) - Update support WaveVR SDK 3.0.2 requires VR Supported - Add support to WaveVR SDK 3.1 - Add default and custom AndroidManifest path in VIU Settings - Add custom controller model in Simulator - Add system input for left Oculus controller (OculusVRModule/UnityNativeModule) - Reduce Component Menu path (HTC/VIU -> VIU) - [VIUSettings] Update VIVE to OpenVR - [VIUSettings] Update VIVE Focus to WaveVR - [VIUSettings] Update Oculus (Android) to Oculus Android - [VIUSettings] Update Oculus Rift & Touch to Oculus Desktop - [VIUSettings] Update Oculus VR SDK download link - [VIUSettings] Update Oculus Go to Oculus (Android) * Bug Fix - [GoogleVRModule] Fix null exception and no input issue - [PackageManager] Fix assertion error and null exception - [VIUSettings] Fix no Oculus (Android) option - [WaveVRModule] Fix cannot teleport in ControllerManagerSample scene - [SteamVRInputBinding] Fix partial input bindings for VIVE Tracker - [SteamVRModule] Fix Override Model bug - [OculusVRModule] Fix no Axis2D(Touchpad) for Oculus Go controller - [SteamVRModule] Fix no Cosmos grip button input
2 parents 0fe69c1 + 9468e44 commit bc79dcf

File tree

95 files changed

+80681
-685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+80681
-685
lines changed

Assets/HTC.UnityPlugin/Pointer3D/RaycastMethod/CanvasRaycastTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface ICanvasRaycastTarget
1212
bool ignoreReversedGraphics { get; }
1313
}
1414

15-
[AddComponentMenu("HTC/VIU/UI Pointer/Canvas Raycast Target", 6)]
15+
[AddComponentMenu("VIU/UI Pointer/Canvas Raycast Target", 6)]
1616
[RequireComponent(typeof(Canvas))]
1717
[DisallowMultipleComponent]
1818
public class CanvasRaycastTarget : UIBehaviour, ICanvasRaycastTarget

Assets/HTC.UnityPlugin/Pointer3D/StandaloneRaycaster/StandaloneRaycaster.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace HTC.UnityPlugin.Pointer3D
77
{
8-
[AddComponentMenu("HTC/VIU/UI Pointer/Standalone Raycaster (Standalone Input)", 5)]
8+
[AddComponentMenu("VIU/UI Pointer/Standalone Raycaster (Standalone Input)", 5)]
99
public class StandaloneRaycaster : Pointer3DRaycaster
1010
{
1111
protected override void Start()

Assets/HTC.UnityPlugin/VRModule/Editor/VRModuleManagerEditor.cs

Lines changed: 115 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ public class ReqMethodInfo
4040
public string[] reqTypeNames = null;
4141
public string[] reqAnyTypeNames = null;
4242
public string[] reqFileNames = null;
43+
public string[] reqAnyFileNames = null;
4344
public ReqFieldInfo[] reqFields = null;
45+
public ReqFieldInfo[] reqAnyFields = null;
4446
public ReqMethodInfo[] reqMethods = null;
47+
public ReqMethodInfo[] reqAnyMethods = null;
4548
public Func<SymbolRequirement, bool> validateFunc = null;
4649

4750
public static Dictionary<string, Type> s_foundTypes;
@@ -80,6 +83,14 @@ public void FindRequiredTypesInAssembly(Assembly assembly)
8083
}
8184
}
8285

86+
if (reqAnyFields != null)
87+
{
88+
foreach (var field in reqAnyFields)
89+
{
90+
TryAddTypeFromAssembly(field.typeName, assembly);
91+
}
92+
}
93+
8394
if (reqMethods != null)
8495
{
8596
foreach (var method in reqMethods)
@@ -95,6 +106,22 @@ public void FindRequiredTypesInAssembly(Assembly assembly)
95106
}
96107
}
97108
}
109+
110+
if (reqAnyMethods != null)
111+
{
112+
foreach (var method in reqAnyMethods)
113+
{
114+
TryAddTypeFromAssembly(method.typeName, assembly);
115+
116+
if (method.argTypeNames != null)
117+
{
118+
foreach (var typeName in method.argTypeNames)
119+
{
120+
TryAddTypeFromAssembly(typeName, assembly);
121+
}
122+
}
123+
}
124+
}
98125
}
99126

100127
private bool TryAddTypeFromAssembly(string name, Assembly assembly)
@@ -140,6 +167,32 @@ public bool Validate()
140167
if (!found) { return false; }
141168
}
142169

170+
if (reqFileNames != null)
171+
{
172+
foreach (var requiredFile in reqFileNames)
173+
{
174+
var files = Directory.GetFiles(Application.dataPath, requiredFile, SearchOption.AllDirectories);
175+
if (files == null || files.Length == 0) { return false; }
176+
}
177+
}
178+
179+
if (reqAnyFileNames != null)
180+
{
181+
var found = false;
182+
183+
foreach (var requiredFile in reqAnyFileNames)
184+
{
185+
var files = Directory.GetFiles(Application.dataPath, requiredFile, SearchOption.AllDirectories);
186+
if (files != null && files.Length > 0)
187+
{
188+
found = true;
189+
break;
190+
}
191+
}
192+
193+
if (!found) { return false; }
194+
}
195+
143196
if (reqFields != null)
144197
{
145198
foreach (var field in reqFields)
@@ -150,6 +203,23 @@ public bool Validate()
150203
}
151204
}
152205

206+
if (reqAnyFields != null)
207+
{
208+
var found = false;
209+
210+
foreach (var field in reqAnyFields)
211+
{
212+
Type type;
213+
if (!s_foundTypes.TryGetValue(field.typeName, out type)) { continue; }
214+
if (type.GetField(field.name, field.bindingAttr) == null) { continue; }
215+
216+
found = true;
217+
break;
218+
}
219+
220+
if (!found) { return false; }
221+
}
222+
153223
if (reqMethods != null)
154224
{
155225
foreach (var method in reqMethods)
@@ -167,13 +237,28 @@ public bool Validate()
167237
}
168238
}
169239

170-
if (reqFileNames != null)
240+
if (reqAnyMethods != null)
171241
{
172-
foreach (var requiredFile in reqFileNames)
242+
var found = false;
243+
244+
foreach (var method in reqAnyMethods)
173245
{
174-
var files = Directory.GetFiles(Application.dataPath, requiredFile, SearchOption.AllDirectories);
175-
if (files == null || files.Length == 0) { return false; }
246+
Type type;
247+
if (!s_foundTypes.TryGetValue(method.typeName, out type)) { continue; }
248+
249+
var argTypes = new Type[method.argTypeNames == null ? 0 : method.argTypeNames.Length];
250+
for (int i = argTypes.Length - 1; i >= 0; --i)
251+
{
252+
if (!s_foundTypes.TryGetValue(method.argTypeNames[i], out argTypes[i])) { continue; }
253+
}
254+
255+
if (type.GetMethod(method.name, method.bindingAttr, null, CallingConventions.Any, argTypes, method.argModifiers ?? new ParameterModifier[0]) == null) { continue; }
256+
257+
found = true;
258+
break;
176259
}
260+
261+
if (!found) { return false; }
177262
}
178263

179264
if (validateFunc != null)
@@ -205,18 +290,24 @@ static VRModuleManagerEditor()
205290
reqFileNames = new string[] { "ViveInput.cs", "VRModuleManagerEditor.cs" },
206291
});
207292

293+
s_symbolReqList.Add(new SymbolRequirement()
294+
{
295+
symbol = "VIU_SIUMULATOR_SUPPORT",
296+
validateFunc = (req) => Vive.VIUSettingsEditor.supportSimulator,
297+
});
298+
208299
// Obsolete symbol, will be removed in all condition
209300
s_symbolReqList.Add(new SymbolRequirement()
210301
{
211302
symbol = "VIU_EXTERNAL_CAMERA_SWITCH",
212-
reqFileNames = new string[] { "" },
303+
validateFunc = (req) => false,
213304
});
214305

215306
// Obsolete symbol, will be removed in all condition
216307
s_symbolReqList.Add(new SymbolRequirement()
217308
{
218309
symbol = "VIU_BINDING_INTERFACE_SWITCH",
219-
reqFileNames = new string[] { "" },
310+
validateFunc = (req) => false,
220311
});
221312

222313
#if !UNITY_2017_1_OR_NEWER
@@ -236,6 +327,21 @@ public void OnActiveBuildTargetChanged(BuildTarget previousTarget, BuildTarget n
236327
[DidReloadScripts]
237328
public static void UpdateScriptingDefineSymbols()
238329
{
330+
if (!s_isUpdatingScriptingDefineSymbols)
331+
{
332+
s_isUpdatingScriptingDefineSymbols = true;
333+
EditorApplication.update += DoUpdateScriptingDefineSymbols;
334+
}
335+
}
336+
337+
private static bool s_isUpdatingScriptingDefineSymbols = false;
338+
private static void DoUpdateScriptingDefineSymbols()
339+
{
340+
// some symbolRequirement depends on installed packages (only works when UNITY_2018_1_OR_NEWER)
341+
Vive.VIUSettingsEditor.PackageManagerHelper.PreparePackageList();
342+
343+
if (Vive.VIUSettingsEditor.PackageManagerHelper.isPreparingList) { return; }
344+
239345
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
240346
{
241347
try
@@ -284,6 +390,9 @@ public static void UpdateScriptingDefineSymbols()
284390
}
285391

286392
SymbolRequirement.ResetFoundTypes();
393+
394+
s_isUpdatingScriptingDefineSymbols = false;
395+
EditorApplication.update -= DoUpdateScriptingDefineSymbols;
287396
}
288397

289398
private static bool s_delayCallRemoveRegistered;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ public class GoogleVRSymbolRequirementCollection : SymbolRequirementCollection
99
{
1010
public GoogleVRSymbolRequirementCollection()
1111
{
12+
Add(new SymbolRequirement()
13+
{
14+
symbol = "VIU_GOOGLEVR_SUPPORT",
15+
validateFunc = (req) => Vive.VIUSettingsEditor.supportDaydream,
16+
});
17+
1218
Add(new SymbolRequirement()
1319
{
1420
symbol = "VIU_GOOGLEVR",

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//========= Copyright 2016-2018, HTC Corporation. All rights reserved. ===========
22

3+
using System;
34
using SymbolRequirement = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirement;
45
using SymbolRequirementCollection = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirementCollection;
56

@@ -9,12 +10,43 @@ public class OculusVRSymbolRequirementCollection : SymbolRequirementCollection
910
{
1011
public OculusVRSymbolRequirementCollection()
1112
{
13+
Add(new SymbolRequirement()
14+
{
15+
symbol = "VIU_OCULUSVR_DESKTOP_SUPPORT",
16+
validateFunc = (req) => Vive.VIUSettingsEditor.supportOculus,
17+
});
18+
19+
Add(new SymbolRequirement()
20+
{
21+
symbol = "VIU_OCULUSVR_ANDROID_SUPPORT",
22+
validateFunc = (req) => Vive.VIUSettingsEditor.supportOculusGo,
23+
});
24+
1225
Add(new SymbolRequirement()
1326
{
1427
symbol = "VIU_OCULUSVR",
1528
reqTypeNames = new string[] { "OVRInput" },
1629
reqFileNames = new string[] { "OVRInput.cs" },
1730
});
31+
32+
Add(new SymbolRequirement()
33+
{
34+
symbol = "VIU_OCULUSVR_1_37_0_OR_NEWER",
35+
reqTypeNames = new string[] { "OVRPlugin+SystemHeadset" },
36+
validateFunc = (req) =>
37+
{
38+
Type oculusQuest;
39+
if (SymbolRequirement.s_foundTypes.TryGetValue("OVRPlugin+SystemHeadset", out oculusQuest) && oculusQuest.IsEnum)
40+
{
41+
if (Enum.IsDefined(oculusQuest, "Oculus_Quest") && Enum.IsDefined(oculusQuest, "Rift_S"))
42+
{
43+
return true;
44+
}
45+
}
46+
return false;
47+
},
48+
reqFileNames = new string[] { "OVRPlugin.cs" },
49+
});
1850
}
1951
}
2052
}

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ public class SteamVRSymbolRequirementCollection : SymbolRequirementCollection
1010
{
1111
public SteamVRSymbolRequirementCollection()
1212
{
13+
Add(new SymbolRequirement()
14+
{
15+
symbol = "VIU_OPENVR_SUPPORT",
16+
validateFunc = (req) => Vive.VIUSettingsEditor.supportOpenVR,
17+
});
18+
1319
Add(new SymbolRequirement()
1420
{
1521
symbol = "VIU_OPENVR_API",
@@ -35,21 +41,28 @@ public SteamVRSymbolRequirementCollection()
3541
Add(new SymbolRequirement()
3642
{
3743
symbol = "VIU_STEAMVR_1_2_0_OR_NEWER",
38-
reqTypeNames = new string[] { "SteamVR_Events" },
44+
reqAnyTypeNames = new string[] { "SteamVR_Events", "Valve.VR.SteamVR_Events" },
3945
reqFileNames = new string[] { "SteamVR_Events.cs" },
4046
});
4147

4248
Add(new SymbolRequirement()
4349
{
4450
symbol = "VIU_STEAMVR_1_2_1_OR_NEWER",
45-
reqMethods = new SymbolRequirement.ReqMethodInfo[]
51+
reqAnyMethods = new SymbolRequirement.ReqMethodInfo[]
4652
{
4753
new SymbolRequirement.ReqMethodInfo()
4854
{
4955
typeName = "SteamVR_Events",
5056
name = "System",
5157
argTypeNames = new string[] { "Valve.VR.EVREventType" },
5258
bindingAttr = BindingFlags.Public | BindingFlags.Static,
59+
},
60+
new SymbolRequirement.ReqMethodInfo()
61+
{
62+
typeName = "Valve.VR.SteamVR_Events",
63+
name = "System",
64+
argTypeNames = new string[] { "Valve.VR.EVREventType" },
65+
bindingAttr = BindingFlags.Public | BindingFlags.Static,
5366
}
5467
},
5568
reqFileNames = new string[] { "SteamVR_Events.cs" },
@@ -58,13 +71,19 @@ public SteamVRSymbolRequirementCollection()
5871
Add(new SymbolRequirement()
5972
{
6073
symbol = "VIU_STEAMVR_1_2_2_OR_NEWER",
61-
reqFields = new SymbolRequirement.ReqFieldInfo[]
74+
reqAnyFields = new SymbolRequirement.ReqFieldInfo[]
6275
{
6376
new SymbolRequirement.ReqFieldInfo()
6477
{
6578
typeName = "SteamVR_ExternalCamera+Config",
6679
name = "r",
6780
bindingAttr = BindingFlags.Public | BindingFlags.Instance,
81+
},
82+
new SymbolRequirement.ReqFieldInfo()
83+
{
84+
typeName = "Valve.VR.SteamVR_ExternalCamera+Config",
85+
name = "r",
86+
bindingAttr = BindingFlags.Public | BindingFlags.Instance,
6887
}
6988
},
7089
reqFileNames = new string[] { "SteamVR_ExternalCamera.cs" },

0 commit comments

Comments
 (0)