Skip to content

Commit a8c1f87

Browse files
author
lawwong
committed
Add "Enable Oculus Controller Render Model" settings option
1 parent a75d54e commit a8c1f87

2 files changed

Lines changed: 56 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,9 @@ public override void OnPreferenceGUI()
675675
GUILayout.EndHorizontal();
676676
}
677677

678-
if (m_foldouter.isExpended)
678+
if (support && m_foldouter.isExpended)
679679
{
680-
if (support) { EditorGUI.BeginChangeCheck(); } else { GUI.enabled = false; }
680+
EditorGUI.BeginChangeCheck();
681681
{
682682
EditorGUI.indentLevel += 2;
683683

@@ -797,7 +797,7 @@ public override void OnPreferenceGUI()
797797

798798
EditorGUI.indentLevel -= 2;
799799
}
800-
if (support) { s_guiChanged |= EditorGUI.EndChangeCheck(); } else { GUI.enabled = true; }
800+
s_guiChanged |= EditorGUI.EndChangeCheck();
801801
}
802802
}
803803

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

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public static bool supportOculus
108108

109109
private class OculusSettings : VRPlatformSetting
110110
{
111+
private Foldouter m_foldouter = new Foldouter();
112+
111113
public static OculusSettings instance { get; private set; }
112114

113115
public OculusSettings() { instance = this; }
@@ -188,7 +190,7 @@ public override void OnPreferenceGUI()
188190
if (canSupport)
189191
{
190192
var wasSupported = support;
191-
var shouldSupport = Foldouter.ShowFoldoutBlankWithEnabledToggle(new GUIContent(title, "Oculus Rift, Oculus Rift S"), wasSupported);
193+
var shouldSupport = m_foldouter.ShowFoldoutButtonWithEnabledToggle(new GUIContent(title, "Oculus Rift, Oculus Rift S, Oculus Link"), wasSupported);
192194
if (wasSupported != shouldSupport)
193195
{
194196
support = shouldSupport;
@@ -247,6 +249,56 @@ public override void OnPreferenceGUI()
247249

248250
GUILayout.EndHorizontal();
249251
}
252+
253+
if (support && m_foldouter.isExpended)
254+
{
255+
EditorGUI.BeginChangeCheck();
256+
{
257+
EditorGUI.indentLevel += 2;
258+
259+
#pragma warning disable 0162
260+
// Controller Render Model
261+
const string enableControllerRenderModelTitle = "Enable Oculus Controller Render Model";
262+
const string enableControllerRenderModelSkeletonTitle = "Enable Hand Attached to Oculus Controller Render Model";
263+
if (OculusVRExtension.VIUOvrAvatar.SUPPORTED)
264+
{
265+
VIUSettings.EnableOculusSDKControllerRenderModel = EditorGUILayout.ToggleLeft(new GUIContent(enableControllerRenderModelTitle, VIUSettings.ENABLE_OCULUS_SDK_CONTROLLER_RENDER_MODEL_TOOLTIP), VIUSettings.EnableOculusSDKControllerRenderModel);
266+
267+
if (VIUSettings.EnableOculusSDKControllerRenderModel)
268+
{
269+
VIUSettings.EnableOculusSDKControllerRenderModelSkeleton = EditorGUILayout.ToggleLeft(new GUIContent(enableControllerRenderModelSkeletonTitle, VIUSettings.ENABLE_OCULUS_SDK_CONTROLLER_RENDER_MODEL_SKELETON_TOOLTIP), VIUSettings.EnableOculusSDKControllerRenderModelSkeleton);
270+
}
271+
else
272+
{
273+
var wasGUIEnabled = GUI.enabled;
274+
GUI.enabled = false;
275+
EditorGUILayout.ToggleLeft(new GUIContent(enableControllerRenderModelSkeletonTitle, VIUSettings.ENABLE_OCULUS_SDK_CONTROLLER_RENDER_MODEL_SKELETON_TOOLTIP), false);
276+
GUI.enabled = wasGUIEnabled;
277+
}
278+
}
279+
else
280+
{
281+
var wasGUIEnabled = GUI.enabled;
282+
GUI.enabled = false;
283+
284+
EditorGUILayout.BeginHorizontal();
285+
EditorGUILayout.ToggleLeft(new GUIContent(enableControllerRenderModelTitle, "OvrAvatar not found. Please import latest Oculus Integration."), false, GUILayout.Width(280f));
286+
GUILayout.FlexibleSpace();
287+
GUI.enabled = true;
288+
ShowUrlLinkButton(URL_OCULUS_VR_PLUGIN, "Update Oculus Integration");
289+
EditorGUILayout.EndHorizontal();
290+
291+
GUI.enabled = false;
292+
EditorGUILayout.ToggleLeft(new GUIContent(enableControllerRenderModelSkeletonTitle, VIUSettings.ENABLE_OCULUS_SDK_CONTROLLER_RENDER_MODEL_SKELETON_TOOLTIP), false);
293+
294+
GUI.enabled = wasGUIEnabled;
295+
}
296+
#pragma warning restore 0162
297+
298+
EditorGUI.indentLevel -= 2;
299+
}
300+
s_guiChanged |= EditorGUI.EndChangeCheck();
301+
}
250302
}
251303
}
252304
}

0 commit comments

Comments
 (0)