Skip to content

Commit a97cfac

Browse files
committed
Version 2.0.1 - Removed app_key, hands reactivate, fix minor build issue
Changes for v2.0.1: * Changed SteamVR to identify only when in editor. SteamVR_Setting.appKey has been replaced with SteamVR_Setting.editorAppKey. This means that downloads from steam will always use proper bindings but builds run separate from Steam will have their own autogenerated app key. Remember to replace your default bindings in the binding ui before creating a build. * Fixed bug where hands were not reactivating properly after visiting the dashboard (#118) * Fixed bug with multiple items being grabbed at once (#121) * Fixed bug where Linear Drive would freeze when grabbed twice (#120) * Fixed bug with bindings that were readonly not copying correctly. * Fixed some other bugs with multiple pickup types being activated at once.
1 parent 87efb96 commit a97cfac

File tree

247 files changed

+35400
-36499
lines changed

Some content is hidden

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

247 files changed

+35400
-36499
lines changed

Assets/SteamVR/Icon.meta

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SteamVR/Icon/_steamvr.png.meta

Lines changed: 59 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SteamVR/Input/Editor/SteamVR_Input_LiveWindow.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ private void OnGUI()
9393

9494
float timeSinceLastChanged = -1;
9595

96-
if (actionLastChanged != -1)
96+
if (action is SteamVR_Action_In && ((SteamVR_Action_In)action).GetActive(source) == false)
97+
{
98+
GUI.backgroundColor = Color.red;
99+
}
100+
else if (actionLastChanged != -1)
97101
{
98102
timeSinceLastChanged = Time.time - actionLastChanged;
99103

Assets/SteamVR/Input/Editor/SteamVR_Input_PostProcessBuild.cs

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj
3939

4040
File.Copy(file, newFilePath);
4141

42-
UpdateAppKey(newFilePath, fileInfo.Name);
42+
//UpdateAppKey(newFilePath, fileInfo.Name);
43+
RemoveAppKey(newFilePath, fileInfo.Name);
4344

4445
Debug.Log("[SteamVR] Copied (overwrote) SteamVR Input file at build path: " + newFilePath);
4546
}
@@ -51,7 +52,8 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj
5152
else
5253
{
5354
File.Copy(file, newFilePath);
54-
UpdateAppKey(newFilePath, fileInfo.Name);
55+
//UpdateAppKey(newFilePath, fileInfo.Name);
56+
RemoveAppKey(newFilePath, fileInfo.Name);
5557

5658
Debug.Log("[SteamVR] Copied SteamVR Input file to build folder: " + newFilePath);
5759
}
@@ -82,15 +84,50 @@ private static void UpdateAppKey(string newFilePath, string executableName)
8284

8385
int stringLength = stringEnd - stringStart;
8486

85-
string appKey = jsonText.Substring(stringStart, stringLength);
87+
string currentAppKey = jsonText.Substring(stringStart, stringLength);
8688

87-
if (string.Equals(appKey, SteamVR_Settings.instance.appKey, System.StringComparison.CurrentCultureIgnoreCase) == false)
89+
if (string.Equals(currentAppKey, SteamVR_Settings.instance.editorAppKey, System.StringComparison.CurrentCultureIgnoreCase) == false)
8890
{
89-
jsonText = jsonText.Replace(appKey, SteamVR_Settings.instance.appKey);
91+
jsonText = jsonText.Replace(currentAppKey, SteamVR_Settings.instance.editorAppKey);
92+
93+
FileInfo file = new FileInfo(newFilePath);
94+
file.IsReadOnly = false;
9095

9196
File.WriteAllText(newFilePath, jsonText);
9297
}
9398
}
9499
}
100+
101+
private const string findString_appKeyStart = "\"app_key\"";
102+
private const string findString_appKeyEnd = "\",";
103+
private static void RemoveAppKey(string newFilePath, string executableName)
104+
{
105+
if (File.Exists(newFilePath))
106+
{
107+
string jsonText = System.IO.File.ReadAllText(newFilePath);
108+
109+
string findString = "\"app_key\"";
110+
int stringStart = jsonText.IndexOf(findString);
111+
112+
if (stringStart == -1)
113+
return; //no app key
114+
115+
int stringEnd = jsonText.IndexOf("\",", stringStart);
116+
117+
if (stringEnd == -1)
118+
return; //no end?
119+
120+
stringEnd += findString_appKeyEnd.Length;
121+
122+
int stringLength = stringEnd - stringStart;
123+
124+
string newJsonText = jsonText.Remove(stringStart, stringLength);
125+
126+
FileInfo file = new FileInfo(newFilePath);
127+
file.IsReadOnly = false;
128+
129+
File.WriteAllText(newFilePath, newJsonText);
130+
}
131+
}
95132
}
96133
}

Assets/SteamVR/Input/ExampleJSON/bindings_holographic_controller.json.meta

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SteamVR/Input/SteamVR_Action.cs.meta

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SteamVR/Input/SteamVR_ActionDirections.cs.meta

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SteamVR/Input/SteamVR_ActionSet.cs.meta

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/SteamVR/Input/SteamVR_Action_Boolean.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ protected override void InitializeDictionaries(SteamVR_Input_Sources source)
5353
public override void UpdateValue(SteamVR_Input_Sources inputSource)
5454
{
5555
lastActionData[inputSource] = actionData[inputSource];
56+
lastActive[inputSource] = active[inputSource];
5657

5758
EVRInputError err = OpenVR.Input.GetDigitalActionData(handle, ref tempActionData, actionData_size, SteamVR_Input_Source.GetHandle(inputSource));
5859
if (err != EVRInputError.None)
@@ -80,7 +81,7 @@ public override void UpdateValue(SteamVR_Input_Sources inputSource)
8081
if (onUpdate[inputSource] != null)
8182
onUpdate[inputSource].Invoke(this);
8283

83-
if (onActiveChange[inputSource] != null && lastActionData[inputSource].bActive != active[inputSource])
84+
if (onActiveChange[inputSource] != null && lastActive[inputSource] != active[inputSource])
8485
onActiveChange[inputSource].Invoke(this, active[inputSource]);
8586
}
8687

Assets/SteamVR/Input/SteamVR_Action_Boolean.cs.meta

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)