Permalink
Browse files

feat(SDKManager): runtime SDK switching using SDK Setups

  > **Breaking Changes**

The SDK Manager is changed by this and therefore users of VRTK will need
to update their SDK Manager configuration to use the new SDK Setups.

Changing the used SDKs at runtime is useful when supporting multiple
devices. Up to now that meant to do some clever hacky stuff with VRTK's
SDK Manager. This change adds a new class `VRTK_SDKSetup` which bundles
specifying the used SDKs and the needed configuration in form of
referenced objects for VRTK.

The SDK Manager now accepts an ordered list of these SDK Setups. This
list can be used automatically at runtime to try initializing and using
the needed VR Devices. If a given Setup can't be used because the VR
Device isn't working or connected, the next entry in the list will be
tried. If no Device is working correctly it will fall back to disable VR
support completely. There are events on both the SDK Manager and Setups
available to be notified about loading or unloading a Setup.

The SDK Manager also allows automatically managing the VR Settings in
the Player Settings based on the SDK Setups list. This only works
correctly if there is only one SDK Manager per project. The introduction
of the SDK Setups should mean there's no need for multiple SDK Manager
anymore, though. If you see the need for multiple SDK Manager after this
change please let @bddckr on the VRTK Slack know about the use case.

Additionally a new prefab and associated script is added to give a GUI
to switch the used SDK Setup at runtime easily.

The SDK Manager editor has been updated to support the SDK Setups and
the button to clear the scripting define symbols now has a friendlier
look that still uses a red background to emphasize its destructive
nature.

The Controller Tracker script has been removed and its logic has been
integrated into the SDK Setup instead. The Tracked Controller now no
longer uses coroutines.

This change also updates the various SDKs to support runtime switching.
Some callback methods have been introduced to `SDK_Base` to allow the
SDKs to react to usage in SDK Setups. The SteamVR Controller SDK has
been updated to use one of those methods to make sure it's possible to
toggle SteamVR off and on at runtime.

The SDKs can now specify multiple different platforms if they support
them. The Ximmerse SDK has been updated to do so.
In addition to that SDKs now specify their used VR Device.

All the example scenes now use the new SDK Manager configuration in
addition to the SDK Setups.

This resolves #817.
  • Loading branch information...
bddckr committed Apr 9, 2017
1 parent 2065a7f commit f544015f353fa6cf3e9ab57571addef825d80076
Showing with 44,441 additions and 49,462 deletions.
  1. +16 −8 Assets/VRTK/Editor/VRTK_EditorUtilities.cs
  2. +391 −251 Assets/VRTK/Editor/VRTK_SDKManagerEditor.cs
  3. +470 −0 Assets/VRTK/Editor/VRTK_SDKSetupEditor.cs
  4. +3 −0 Assets/VRTK/Editor/VRTK_SDKSetupEditor.cs.meta
  5. +513 −346 Assets/VRTK/Examples/001_CameraRig_VRPlayArea.unity
  6. +255 −747 Assets/VRTK/Examples/002_Controller_Events.unity
  7. +342 −816 Assets/VRTK/Examples/003_Controller_SimplePointer.unity
  8. +345 −816 Assets/VRTK/Examples/004_CameraRig_BasicTeleport.unity
  9. +408 −869 Assets/VRTK/Examples/005_Controller_BasicObjectGrabbing.unity
  10. +419 −878 Assets/VRTK/Examples/006_Controller_UsingADoor.unity
  11. +473 −920 Assets/VRTK/Examples/007_CameraRig_HeightAdjustTeleport.unity
  12. +564 −999 Assets/VRTK/Examples/008_Controller_UsingAGrabbedObject.unity
  13. +522 −955 Assets/VRTK/Examples/009_Controller_BezierPointer.unity
  14. +318 −787 Assets/VRTK/Examples/010_CameraRig_TerrainTeleporting.unity
  15. +278 −764 Assets/VRTK/Examples/011_Camera_HeadSetCollisionFading.unity
  16. +495 −922 Assets/VRTK/Examples/012_Controller_PointerWithAreaCollision.unity
  17. +477 −930 Assets/VRTK/Examples/013_Controller_UsingAndGrabbingMultipleObjects.unity
  18. +536 −983 Assets/VRTK/Examples/014_Controller_SnappingObjectsOnGrab.unity
  19. +542 −980 Assets/VRTK/Examples/015_Controller_TouchpadAxisControl.unity
  20. +1,724 −1,925 Assets/VRTK/Examples/016_Controller_HapticRumble.unity
  21. +561 −1,005 Assets/VRTK/Examples/017_CameraRig_TouchpadWalking.unity
  22. +324 −802 Assets/VRTK/Examples/018_CameraRig_FramesPerSecondCounter.unity
  23. +443 −904 Assets/VRTK/Examples/019_Controller_InteractingWithPointer.unity
  24. +329 −344 Assets/VRTK/Examples/020_CameraRig_MeshTeleporting.unity
  25. +2,389 −1,821 Assets/VRTK/Examples/021_Controller_GrabbingObjectsWithJoints.unity
  26. +517 −950 Assets/VRTK/Examples/022_Controller_CustomBezierPointer.unity
  27. +619 −1,054 Assets/VRTK/Examples/023_Controller_ChildOfControllerOnGrab.unity
  28. +462 −907 Assets/VRTK/Examples/024_CameraRig_ExcludeTeleportLocations.unity
  29. +5,097 −4,696 Assets/VRTK/Examples/025_Controls_Overview.unity
  30. +1,729 −1,926 Assets/VRTK/Examples/026_Controller_ForceHoldObject.unity
  31. +422 −889 Assets/VRTK/Examples/027_CameraRig_TeleportByModelVillage.unity
  32. +879 −1,262 Assets/VRTK/Examples/028_CameraRig_RoomExtender.unity
  33. +278 −769 Assets/VRTK/Examples/029_Controller_Tooltips.unity
  34. +295 −780 Assets/VRTK/Examples/030_Controls_RadialTouchpadMenu.unity
  35. +501 −938 Assets/VRTK/Examples/031_CameraRig_HeadsetGazePointer.unity
  36. +554 −1,007 Assets/VRTK/Examples/032_Controller_CustomControllerModel.unity
  37. +317 −790 Assets/VRTK/Examples/033_CameraRig_TeleportingInNavMesh.unity
  38. +1,270 −1,764 Assets/VRTK/Examples/034_Controls_InteractingWithUnityUI.unity
  39. +283 −774 Assets/VRTK/Examples/035_Controller_OpacityAndHighlighting.unity
  40. +524 −512 Assets/VRTK/Examples/036_Controller_CustomCompoundPointer.unity
  41. +1,991 −2,195 Assets/VRTK/Examples/037_CameraRig_ClimbingFalling.unity
  42. +536 −977 Assets/VRTK/Examples/038_CameraRig_DashTeleport.unity
  43. +335 −812 Assets/VRTK/Examples/039_CameraRig_AdaptiveQuality.unity
  44. +580 −1,057 Assets/VRTK/Examples/040_Controls_PanelMenu.unity
  45. +997 −1,368 Assets/VRTK/Examples/041_Controller_ObjectSnappingToDropZones.unity
  46. +490 −929 Assets/VRTK/Examples/042_CameraRig_MoveInPlace.unity
  47. +448 −911 Assets/VRTK/Examples/043_Controller_SecondaryControllerActions.unity
  48. +641 −1,065 Assets/VRTK/Examples/044_CameraRig_RestrictedTeleportZones.unity
  49. +7,469 −0 Assets/VRTK/Examples/ExampleResources/Prefabs/SDKSetups.prefab
  50. +8 −0 Assets/VRTK/Examples/ExampleResources/Prefabs/SDKSetups.prefab.meta
  51. +13 −0 Assets/VRTK/Examples/ExampleResources/Scripts/ExampleSceneSimulatorCameraRigMover.cs
  52. +3 −0 Assets/VRTK/Examples/ExampleResources/Scripts/ExampleSceneSimulatorCameraRigMover.cs.meta
  53. +11 −8 Assets/VRTK/Prefabs/Resources/Scripts/VRTK_ControllerTooltips.cs
  54. +10 −0 Assets/VRTK/Prefabs/Resources/Scripts/VRTK_DestinationPoint.cs
  55. +6 −0 Assets/VRTK/Prefabs/Resources/Scripts/VRTK_IndependentRadialMenuController.cs
  56. +6 −0 Assets/VRTK/Prefabs/Resources/Scripts/VRTK_PanelMenuController.cs
  57. +1,418 −0 Assets/VRTK/Prefabs/SDKSetupSwitcher.prefab
  58. +8 −0 Assets/VRTK/Prefabs/SDKSetupSwitcher.prefab.meta
  59. +90 −78 Assets/VRTK/Prefabs/VRSimulatorCameraRig.prefab
  60. +35 −0 Assets/VRTK/SDK/Base/SDK_Base.cs
  61. +2 −2 Assets/VRTK/SDK/Base/SDK_BaseBoundaries.cs
  62. +10 −10 Assets/VRTK/SDK/Base/SDK_BaseController.cs
  63. +2 −2 Assets/VRTK/SDK/Base/SDK_BaseHeadset.cs
  64. +92 −14 Assets/VRTK/SDK/Base/SDK_DescriptionAttribute.cs
  65. +12 −6 Assets/VRTK/SDK/Base/SDK_ScriptingDefineSymbolPredicateAttribute.cs
  66. +1 −1 Assets/VRTK/SDK/Daydream/SDK_DaydreamSystem.cs
  67. +1 −0 Assets/VRTK/SDK/Fallback/SDK_FallbackBoundaries.cs
  68. +1 −0 Assets/VRTK/SDK/Fallback/SDK_FallbackController.cs
  69. +1 −0 Assets/VRTK/SDK/Fallback/SDK_FallbackHeadset.cs
  70. +1 −0 Assets/VRTK/SDK/Fallback/SDK_FallbackSystem.cs
  71. 0 Assets/VRTK/SDK/{OculusVR.meta → Oculus.meta}
  72. +9 −9 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRBoundaries.cs → Oculus/SDK_OculusBoundaries.cs}
  73. 0 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRBoundaries.cs.meta → Oculus/SDK_OculusBoundaries.cs.meta}
  74. +33 −22 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRController.cs → Oculus/SDK_OculusController.cs}
  75. 0 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRController.cs.meta → Oculus/SDK_OculusController.cs.meta}
  76. +12 −12 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRDefines.cs → Oculus/SDK_OculusDefines.cs}
  77. 0 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRDefines.cs.meta → Oculus/SDK_OculusDefines.cs.meta}
  78. +11 −11 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRHeadset.cs → Oculus/SDK_OculusHeadset.cs}
  79. 0 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRHeadset.cs.meta → Oculus/SDK_OculusHeadset.cs.meta}
  80. +6 −6 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRSystem.cs → Oculus/SDK_OculusSystem.cs}
  81. 0 Assets/VRTK/SDK/{OculusVR/SDK_OculusVRSystem.cs.meta → Oculus/SDK_OculusSystem.cs.meta}
  82. +6 −0 Assets/VRTK/SDK/Simulator/SDK_InputSimulator.cs
  83. +1 −1 Assets/VRTK/SDK/Simulator/SDK_SimSystem.cs
  84. +31 −6 Assets/VRTK/SDK/SteamVR/SDK_SteamVRController.cs
  85. +1 −1 Assets/VRTK/SDK/SteamVR/SDK_SteamVRSystem.cs
  86. +8 −8 Assets/VRTK/SDK/VRTK_SDK_Bridge.cs
  87. +15 −8 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRBoundaries.cs → SDK_XimmerseBoundaries.cs}
  88. 0 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRBoundaries.cs.meta → SDK_XimmerseBoundaries.cs.meta}
  89. +14 −13 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRController.cs → SDK_XimmerseController.cs}
  90. 0 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRController.cs.meta → SDK_XimmerseController.cs.meta}
  91. +7 −7 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRDefines.cs → SDK_XimmerseDefines.cs}
  92. 0 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRDefines.cs.meta → SDK_XimmerseDefines.cs.meta}
  93. +11 −10 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRHeadset.cs → SDK_XimmerseHeadset.cs}
  94. 0 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRHeadset.cs.meta → SDK_XimmerseHeadset.cs.meta}
  95. +7 −6 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRSystem.cs → SDK_XimmerseSystem.cs}
  96. 0 Assets/VRTK/SDK/Ximmerse/{SDK_XimmerseVRSystem.cs.meta → SDK_XimmerseSystem.cs.meta}
  97. +11 −1 Assets/VRTK/Scripts/Interactions/VRTK_ControllerActions.cs
  98. +10 −0 Assets/VRTK/Scripts/Interactions/VRTK_ControllerEvents.cs
  99. +15 −2 Assets/VRTK/Scripts/Interactions/VRTK_ControllerHighlighter.cs
  100. +14 −3 Assets/VRTK/Scripts/Interactions/VRTK_InteractGrab.cs
  101. +10 −3 Assets/VRTK/Scripts/Interactions/VRTK_InteractTouch.cs
  102. +0 −28 Assets/VRTK/Scripts/Internal/VRTK_ControllerTracker.cs
  103. +0 −12 Assets/VRTK/Scripts/Internal/VRTK_ControllerTracker.cs.meta
  104. +19 −10 Assets/VRTK/Scripts/Internal/VRTK_Logger.cs
  105. +10 −0 Assets/VRTK/Scripts/Internal/VRTK_RoomExtender_PlayAreaGizmo.cs
  106. +10 −28 Assets/VRTK/Scripts/Internal/VRTK_TrackedController.cs
  107. +10 −0 Assets/VRTK/Scripts/Locomotion/ObjectControlActions/VRTK_BaseObjectControlAction.cs
  108. +10 −0 Assets/VRTK/Scripts/Locomotion/VRTK_BasicTeleport.cs
  109. +10 −0 Assets/VRTK/Scripts/Locomotion/VRTK_MoveInPlace.cs
  110. +10 −0 Assets/VRTK/Scripts/Locomotion/VRTK_ObjectControl.cs
  111. +13 −2 Assets/VRTK/Scripts/Locomotion/VRTK_PlayerClimb.cs
  112. +14 −10 Assets/VRTK/Scripts/Locomotion/VRTK_RoomExtender.cs
  113. +10 −6 Assets/VRTK/Scripts/Locomotion/VRTK_TouchpadMovement.cs
  114. +10 −3 Assets/VRTK/Scripts/Locomotion/VRTK_TouchpadWalking.cs
  115. +12 −3 Assets/VRTK/Scripts/Pointers/VRTK_BasePointer.cs
  116. +10 −0 Assets/VRTK/Scripts/Pointers/VRTK_PlayAreaCursor.cs
  117. +13 −2 Assets/VRTK/Scripts/Pointers/VRTK_Pointer.cs
  118. +10 −0 Assets/VRTK/Scripts/Presence/VRTK_BodyPhysics.cs
  119. +10 −0 Assets/VRTK/Scripts/Presence/VRTK_HeadsetCollision.cs
  120. +10 −0 Assets/VRTK/Scripts/Presence/VRTK_HeadsetControllerAware.cs
  121. +11 −1 Assets/VRTK/Scripts/Presence/VRTK_HeadsetFade.cs
  122. +10 −0 Assets/VRTK/Scripts/Presence/VRTK_HipTracking.cs
  123. +10 −0 Assets/VRTK/Scripts/Presence/VRTK_PositionRewind.cs
  124. +13 −1 Assets/VRTK/Scripts/UI/VRTK_UIPointer.cs
  125. +3 −0 Assets/VRTK/Scripts/Utilities/SDK.meta
  126. +58 −48 Assets/VRTK/Scripts/Utilities/{ → SDK}/VRTK_SDKInfo.cs
  127. 0 Assets/VRTK/Scripts/Utilities/{ → SDK}/VRTK_SDKInfo.cs.meta
  128. +842 −0 Assets/VRTK/Scripts/Utilities/SDK/VRTK_SDKManager.cs
  129. 0 Assets/VRTK/Scripts/Utilities/{ → SDK}/VRTK_SDKManager.cs.meta
  130. +540 −0 Assets/VRTK/Scripts/Utilities/SDK/VRTK_SDKSetup.cs
  131. +12 −0 Assets/VRTK/Scripts/Utilities/SDK/VRTK_SDKSetup.cs.meta
  132. +176 −0 Assets/VRTK/Scripts/Utilities/SDK/VRTK_SDKSetupSwitcher.cs
  133. +12 −0 Assets/VRTK/Scripts/Utilities/SDK/VRTK_SDKSetupSwitcher.cs.meta
  134. +28 −0 Assets/VRTK/Scripts/Utilities/UnityEvents/VRTK_SDKManager_UnityEvents.cs
  135. +12 −0 Assets/VRTK/Scripts/Utilities/UnityEvents/VRTK_SDKManager_UnityEvents.cs.meta
  136. +36 −0 Assets/VRTK/Scripts/Utilities/UnityEvents/VRTK_SDKSetup_UnityEvents.cs
  137. +12 −0 Assets/VRTK/Scripts/Utilities/UnityEvents/VRTK_SDKSetup_UnityEvents.cs.meta
  138. +11 −4 Assets/VRTK/Scripts/Utilities/VRTK_AdaptiveQuality.cs
  139. +0 −810 Assets/VRTK/Scripts/Utilities/VRTK_SDKManager.cs
  140. +10 −3 Assets/VRTK/Scripts/Utilities/VRTK_SharedMethods.cs
  141. +11 −1 Assets/VRTK/Scripts/Utilities/VRTK_Simulator.cs
  142. +6 −3 EXAMPLES.md
  143. +86 −108 GETTING_STARTED.md
  144. +5 −8 ProjectSettings/ProjectSettings.asset
  145. +12 −17 README.md
@@ -32,16 +32,24 @@ public static void AddHeader(string header, bool spaceBeforeHeader = true)
EditorGUILayout.LabelField(header, EditorStyles.boldLabel);
}
public static GUIStyle CreateStyle(GUIStyle styleType, Color contentColor, Color backgroundColor)
public static void DrawUsingDestructiveStyle(GUIStyle styleToCopy, Action<GUIStyle> drawAction)
{
GUIStyle generatedStyle = new GUIStyle(styleType);
generatedStyle.normal.textColor = contentColor;
Texture2D backgroundTexture = new Texture2D(1, 1);
backgroundTexture.SetPixel(1, 1, backgroundColor);
backgroundTexture.Apply();
generatedStyle.normal.background = backgroundTexture;
Color previousBackgroundColor = GUI.backgroundColor;
GUIStyle destructiveButtonStyle = new GUIStyle(styleToCopy)
{
normal =
{
textColor = Color.white
},
active =
{
textColor = Color.white
}
};
return generatedStyle;
GUI.backgroundColor = Color.red;
drawAction(destructiveButtonStyle);
GUI.backgroundColor = previousBackgroundColor;
}
}
}

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit f544015

Please sign in to comment.