Skip to content

Commit

Permalink
Update to v1.10.3
Browse files Browse the repository at this point in the history
* Improvement
  - [WaveVRModule] Support WaveVR simulator (Enable VIVE Focus support in Editor mode)

* Bug Fix
  - [WaveVRModule] Fix WaveVR tracking glitter issue
  - [WaveVRModule] Fix VIU simulator cannot launch (ONLY enable VIU simulator)
  • Loading branch information
chengnay committed Feb 13, 2019
2 parents 054041e + 57c237c commit a95b4b4
Show file tree
Hide file tree
Showing 36 changed files with 1,949 additions and 1,272 deletions.
161 changes: 10 additions & 151 deletions Assets/HTC.UnityPlugin/VRModule/Editor/VRModuleManagerEditor.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//========= Copyright 2016-2019, HTC Corporation. All rights reserved. ===========

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditor.Callbacks;
Expand All @@ -16,7 +18,7 @@ public class VRModuleManagerEditor : UnityEditor.AssetModificationProcessor
, UnityEditor.Build.IActiveBuildTargetChanged
#endif
{
private class SymbolRequirement
public class SymbolRequirement
{
public class ReqFieldInfo
{
Expand Down Expand Up @@ -183,169 +185,26 @@ public bool Validate()
}
}

public abstract class SymbolRequirementCollection : List<SymbolRequirement> { }

private static List<SymbolRequirement> s_symbolReqList;

static VRModuleManagerEditor()
{
s_symbolReqList = new List<SymbolRequirement>();

foreach (var type in Assembly.GetAssembly(typeof(SymbolRequirementCollection)).GetTypes().Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(SymbolRequirementCollection))))
{
s_symbolReqList.AddRange((SymbolRequirementCollection)Activator.CreateInstance(type));
}

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_PLUGIN",
reqTypeNames = new string[] { "HTC.UnityPlugin.Vive.ViveInput" },
reqFileNames = new string[] { "ViveInput.cs", "VRModuleManagerEditor.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR",
reqTypeNames = new string[] { "Valve.VR.OpenVR" },
reqFileNames = new string[] { "openvr_api.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_1_1",
reqTypeNames = new string[] { "SteamVR_Utils+Event" },
reqFileNames = new string[] { "SteamVR_Utils.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_0_OR_NEWER",
reqTypeNames = new string[] { "SteamVR_Events" },
reqFileNames = new string[] { "SteamVR_Events.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_1_OR_NEWER",
reqMethods = new SymbolRequirement.ReqMethodInfo[]
{
new SymbolRequirement.ReqMethodInfo()
{
typeName = "SteamVR_Events",
name = "System",
argTypeNames = new string[] { "Valve.VR.EVREventType" },
bindingAttr = BindingFlags.Public | BindingFlags.Static,
}
},
reqFileNames = new string[] { "SteamVR_Events.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_2_OR_NEWER",
reqFields = new SymbolRequirement.ReqFieldInfo[]
{
new SymbolRequirement.ReqFieldInfo()
{
typeName = "SteamVR_ExternalCamera+Config",
name = "r",
bindingAttr = BindingFlags.Public | BindingFlags.Instance,
}
},
reqFileNames = new string[] { "SteamVR_ExternalCamera.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_3_OR_NEWER",
reqMethods = new SymbolRequirement.ReqMethodInfo[]
{
new SymbolRequirement.ReqMethodInfo()
{
typeName = "Valve.VR.CVRSystem",
name = "IsInputAvailable",
bindingAttr = BindingFlags.Public | BindingFlags.Instance,
}
},
reqFileNames = new string[] { "openvr_api.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_2_0_0_OR_NEWER",
reqTypeNames = new string[] { "Valve.VR.SteamVR" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_2_1_0_OR_NEWER",
reqTypeNames = new string[] { "Valve.VR.SteamVR_ActionSet_Manager" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_OCULUSVR",
reqTypeNames = new string[] { "OVRInput" },
reqFileNames = new string[] { "OVRInput.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_GOOGLEVR",
reqTypeNames = new string[] { "GvrUnitySdkVersion" },
reqFileNames = new string[] { "GvrUnitySdkVersion.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_GOOGLEVR_1_150_0_NEWER",
reqTypeNames = new string[] { "GvrControllerInputDevice" },
reqFileNames = new string[] { "GvrControllerInputDevice.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_WAVEVR",
reqTypeNames = new string[] { "WaveVR" },
reqFileNames = new string[] { "WaveVR.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_WAVEVR_2_0_32_OR_NEWER",
reqMethods = new SymbolRequirement.ReqMethodInfo[]
{
new SymbolRequirement.ReqMethodInfo()
{
typeName = "wvr.Interop",
name = "WVR_GetInputDeviceState",
argTypeNames = new string[]
{
"wvr.WVR_DeviceType",
"System.UInt32",
"System.UInt32&",
"System.UInt32&",
"wvr.WVR_AnalogState_t[]",
"System.UInt32",
},
bindingAttr = BindingFlags.Public | BindingFlags.Static,
}
},
reqFileNames = new string[] { "wvr.cs" },
});

s_symbolReqList.Add(new SymbolRequirement()
{
symbol = "VIU_WAVEVR_2_1_0_OR_NEWER",
reqTypeNames = new string[] { "wvr.WVR_InputId" },
validateFunc = (req) =>
{
Type wvrInputIdType;
if (SymbolRequirement.s_foundTypes.TryGetValue("wvr.WVR_InputId", out wvrInputIdType) && wvrInputIdType.IsEnum)
{
if (Enum.IsDefined(wvrInputIdType, "WVR_InputId_Alias1_Digital_Trigger"))
{
return true;
}
}
return false;
},
reqFileNames = new string[] { "wvr.cs" },
});

// Obsolete symbol, will be removed in all condition
s_symbolReqList.Add(new SymbolRequirement()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//========= Copyright 2016-2018, HTC Corporation. All rights reserved. ===========

using SymbolRequirement = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirement;
using SymbolRequirementCollection = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirementCollection;

namespace HTC.UnityPlugin.VRModuleManagement
{
public class GoogleVRSymbolRequirementCollection : SymbolRequirementCollection
{
public GoogleVRSymbolRequirementCollection()
{
Add(new SymbolRequirement()
{
symbol = "VIU_GOOGLEVR",
reqTypeNames = new string[] { "GvrUnitySdkVersion" },
reqFileNames = new string[] { "GvrUnitySdkVersion.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_GOOGLEVR_1_150_0_NEWER",
reqTypeNames = new string[] { "GvrControllerInputDevice" },
reqFileNames = new string[] { "GvrControllerInputDevice.cs" },
});
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//========= Copyright 2016-2018, HTC Corporation. All rights reserved. ===========

using SymbolRequirement = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirement;
using SymbolRequirementCollection = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirementCollection;

namespace HTC.UnityPlugin.VRModuleManagement
{
public class OculusVRSymbolRequirementCollection : SymbolRequirementCollection
{
public OculusVRSymbolRequirementCollection()
{
Add(new SymbolRequirement()
{
symbol = "VIU_OCULUSVR",
reqTypeNames = new string[] { "OVRInput" },
reqFileNames = new string[] { "OVRInput.cs" },
});
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 119 additions & 0 deletions Assets/HTC.UnityPlugin/VRModule/Modules/Editor/SteamVRModuleEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//========= Copyright 2016-2018, HTC Corporation. All rights reserved. ===========

using System.Reflection;
using SymbolRequirement = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirement;
using SymbolRequirementCollection = HTC.UnityPlugin.VRModuleManagement.VRModuleManagerEditor.SymbolRequirementCollection;

namespace HTC.UnityPlugin.VRModuleManagement
{
public class SteamVRSymbolRequirementCollection : SymbolRequirementCollection
{
public SteamVRSymbolRequirementCollection()
{
Add(new SymbolRequirement()
{
symbol = "VIU_OPENVR_API",
reqTypeNames = new string[] { "Valve.VR.OpenVR" },
reqFileNames = new string[] { "openvr_api.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR",
reqTypeNames = new string[] { "Valve.VR.OpenVR" },
reqAnyTypeNames = new string[] { "SteamVR", "Valve.VR.SteamVR" },
reqFileNames = new string[] { "openvr_api.cs", "SteamVR.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_1_1",
reqTypeNames = new string[] { "SteamVR_Utils+Event" },
reqFileNames = new string[] { "SteamVR_Utils.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_0_OR_NEWER",
reqTypeNames = new string[] { "SteamVR_Events" },
reqFileNames = new string[] { "SteamVR_Events.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_1_OR_NEWER",
reqMethods = new SymbolRequirement.ReqMethodInfo[]
{
new SymbolRequirement.ReqMethodInfo()
{
typeName = "SteamVR_Events",
name = "System",
argTypeNames = new string[] { "Valve.VR.EVREventType" },
bindingAttr = BindingFlags.Public | BindingFlags.Static,
}
},
reqFileNames = new string[] { "SteamVR_Events.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_2_OR_NEWER",
reqFields = new SymbolRequirement.ReqFieldInfo[]
{
new SymbolRequirement.ReqFieldInfo()
{
typeName = "SteamVR_ExternalCamera+Config",
name = "r",
bindingAttr = BindingFlags.Public | BindingFlags.Instance,
}
},
reqFileNames = new string[] { "SteamVR_ExternalCamera.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_1_2_3_OR_NEWER",
reqMethods = new SymbolRequirement.ReqMethodInfo[]
{
new SymbolRequirement.ReqMethodInfo()
{
typeName = "Valve.VR.CVRSystem",
name = "IsInputAvailable",
bindingAttr = BindingFlags.Public | BindingFlags.Instance,
}
},
reqFileNames = new string[] { "openvr_api.cs" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_2_0_0_OR_NEWER",
reqTypeNames = new string[] { "Valve.VR.SteamVR" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_2_1_0_OR_NEWER",
reqTypeNames = new string[] { "Valve.VR.SteamVR_ActionSet_Manager" },
});

Add(new SymbolRequirement()
{
symbol = "VIU_STEAMVR_2_2_0_OR_NEWER",
reqMethods = new SymbolRequirement.ReqMethodInfo[]
{
new SymbolRequirement.ReqMethodInfo()
{
typeName = "Valve.VR.SteamVR_ActionSet_Manager",
name = "UpdateActionStates",
argTypeNames = new string[]
{
"System.Boolean",
},
bindingAttr = BindingFlags.Public | BindingFlags.Static,
}
},
});
}
}
}
Loading

0 comments on commit a95b4b4

Please sign in to comment.