Skip to content

Commit 794f0de

Browse files
author
lawwong
committed
Now with out VIU_BINDING_INTERFACE_SWITCH defined, Binding Interface can't be enabled by hotkey even that hotkey is defined in config file
1 parent c55bfb7 commit 794f0de

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/Editor/VIUVersionCheck.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private struct RepoInfo
3030
private static string doNotShowSetupSwitch;
3131

3232
private readonly static string s_enableBindUISwitchInfo = "This project will enable binding interface switch! Press RightShift + B to open the binding interface in play mode.";
33-
private readonly static string s_disableBindUISwitchInfo = "This project will NOT enable binding interface switch! You can only enable it manually by calling ViveRoleBindingsHelper.EnableBindingInterface() in script, or copy \"ViveInputUtility/Scripts/ViveRole/BindingInterface/BindingConfigSample/vive_role_bindings.cfg\" file into project folder before you can press RightShift + B to open the binding interface in play mode.";
33+
private readonly static string s_disableBindUISwitchInfo = "This project will NOT enable binding interface switch! You can only enable it manually by calling ViveRoleBindingsHelper.EnableBindingInterface() in script.";
3434
private readonly static string s_enableExternalCamSwitcInfo = "This project will enable external camera switch! Press RightShift + M to toggle the quad view when external camera is enabled.";
3535
private readonly static string s_disableExternalCamSwitcInfo = "This project will NOT enable external camera switch! Enable the switch let you toggle the quad view by pressing RightShift + M when external camera is enabled.";
3636
private static bool s_waitingForCompile;
@@ -54,6 +54,7 @@ static VIUVersionCheck()
5454
// check vive input utility version on github
5555
private static void CheckVersion()
5656
{
57+
// On Windows, PlaterSetting is stored at \HKEY_CURRENT_USER\Software\Unity Technologies\Unity Editor 5.x
5758
nextVersionCheckTimeKey = "ViveInputUtility." + PlayerSettings.productGUID + ".LastVersionCheckTime";
5859
doNotShowUpdateKey = "ViveInputUtility." + PlayerSettings.productGUID + ".DoNotShowUpdate.v{0}";
5960
doNotShowSetupSwitch = "ViveInputUtility." + PlayerSettings.productGUID + ".DoNotShowSetupSwitch";
@@ -168,22 +169,22 @@ public void OnGUI()
168169
{
169170
if (toggleBindUISwithState)
170171
{
171-
EditorGUILayout.HelpBox(s_enableBindUISwitchInfo, MessageType.Warning);
172+
EditorGUILayout.HelpBox(s_enableBindUISwitchInfo, MessageType.Info);
172173
}
173174
else
174175
{
175-
EditorGUILayout.HelpBox(s_disableBindUISwitchInfo, MessageType.Warning);
176+
EditorGUILayout.HelpBox(s_disableBindUISwitchInfo, MessageType.Info);
176177
}
177178

178179
toggleBindUISwithState = GUILayout.Toggle(toggleBindUISwithState, "Enable Binding Interface Switch");
179180

180181
if (toggleExCamSwithState)
181182
{
182-
EditorGUILayout.HelpBox(s_enableExternalCamSwitcInfo, MessageType.Warning);
183+
EditorGUILayout.HelpBox(s_enableExternalCamSwitcInfo, MessageType.Info);
183184
}
184185
else
185186
{
186-
EditorGUILayout.HelpBox(s_disableExternalCamSwitcInfo, MessageType.Warning);
187+
EditorGUILayout.HelpBox(s_disableExternalCamSwitcInfo, MessageType.Info);
187188
}
188189

189190
toggleExCamSwithState = GUILayout.Toggle(toggleExCamSwithState, "Enable External Camera Switch");
@@ -223,6 +224,11 @@ public void OnGUI()
223224
}
224225
}
225226
}
227+
228+
if (GUILayout.Button("Close"))
229+
{
230+
Close();
231+
}
226232
}
227233

228234
private void OnDestroy()
@@ -323,7 +329,6 @@ public static void OnVIUPreferenceGUI()
323329
}
324330
else
325331
{
326-
GUILayout.Space(30f);
327332
GUILayout.Button("Re-compiling...");
328333
}
329334
}

Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/ViveRole/ViveRoleBindingsHelper.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ public struct RoleData
3434
public class BindingConfig
3535
{
3636
public bool apply_bindings_on_load = true;
37-
#if VIU_BINDING_INTERFACE_SWITCH
3837
public string toggle_interface_key_code = KeyCode.B.ToString(); // Default key to enable binding interface
39-
#else
40-
public string toggle_interface_key_code = KeyCode.None.ToString(); // Default key to enable binding interface
41-
#endif
4238
public string toggle_interface_modifier = KeyCode.RightShift.ToString(); // Default key modifier to enable binding interface
4339
public string interface_prefab = DEFAULT_INTERFACE_PREFAB;
4440
public RoleData[] roles = new RoleData[0];
@@ -67,6 +63,11 @@ static ViveRoleBindingsHelper()
6763
SetDefaultInitGameObjectGetter(VRModule.GetInstanceGameObject);
6864
}
6965

66+
private void Awake()
67+
{
68+
AutoLoadConfig();
69+
}
70+
7071
[RuntimeInitializeOnLoadMethod]
7172
public static void AutoLoadConfig()
7273
{
@@ -75,12 +76,12 @@ public static void AutoLoadConfig()
7576

7677
var configPath = AUTO_LOAD_CONFIG_PATH;
7778

78-
if (Active && string.IsNullOrEmpty(Instance.m_overrideConfigPath))
79+
if (Active)
7980
{
8081
configPath = Instance.m_overrideConfigPath;
8182
}
8283

83-
if (File.Exists(configPath))
84+
if (!string.IsNullOrEmpty(configPath) && File.Exists(configPath))
8485
{
8586
LoadBindingConfigFromFile(configPath);
8687

@@ -97,6 +98,7 @@ public static void AutoLoadConfig()
9798
}
9899
}
99100

101+
#if VIU_BINDING_INTERFACE_SWITCH
100102
private static void UpdateInterfaceKeyMonitor()
101103
{
102104
// Moniter input key to open up the binding interface
@@ -134,11 +136,6 @@ private static void UpdateInterfaceKeyMonitor()
134136
}
135137
}
136138

137-
private void Awake()
138-
{
139-
AutoLoadConfig();
140-
}
141-
142139
private void Update()
143140
{
144141
if (!IsInstance) { return; }
@@ -148,6 +145,9 @@ private void Update()
148145
ToggleBindingInterface();
149146
}
150147
}
148+
#else
149+
private static void UpdateInterfaceKeyMonitor() { }
150+
#endif
151151

152152
public static VRModuleDeviceModel GetDeviceModelHint(string deviceSN)
153153
{

0 commit comments

Comments
 (0)