Skip to content

Commit

Permalink
Version 2.0.1 - Removed app_key, hands reactivate, fix minor build issue
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zite committed Sep 26, 2018
1 parent 87efb96 commit a97cfac
Show file tree
Hide file tree
Showing 247 changed files with 35,400 additions and 36,499 deletions.
18 changes: 9 additions & 9 deletions Assets/SteamVR/Icon.meta

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

118 changes: 59 additions & 59 deletions Assets/SteamVR/Icon/_steamvr.png.meta

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

6 changes: 5 additions & 1 deletion Assets/SteamVR/Input/Editor/SteamVR_Input_LiveWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ private void OnGUI()

float timeSinceLastChanged = -1;

if (actionLastChanged != -1)
if (action is SteamVR_Action_In && ((SteamVR_Action_In)action).GetActive(source) == false)
{
GUI.backgroundColor = Color.red;
}
else if (actionLastChanged != -1)
{
timeSinceLastChanged = Time.time - actionLastChanged;

Expand Down
47 changes: 42 additions & 5 deletions Assets/SteamVR/Input/Editor/SteamVR_Input_PostProcessBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj

File.Copy(file, newFilePath);

UpdateAppKey(newFilePath, fileInfo.Name);
//UpdateAppKey(newFilePath, fileInfo.Name);
RemoveAppKey(newFilePath, fileInfo.Name);

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

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

int stringLength = stringEnd - stringStart;

string appKey = jsonText.Substring(stringStart, stringLength);
string currentAppKey = jsonText.Substring(stringStart, stringLength);

if (string.Equals(appKey, SteamVR_Settings.instance.appKey, System.StringComparison.CurrentCultureIgnoreCase) == false)
if (string.Equals(currentAppKey, SteamVR_Settings.instance.editorAppKey, System.StringComparison.CurrentCultureIgnoreCase) == false)
{
jsonText = jsonText.Replace(appKey, SteamVR_Settings.instance.appKey);
jsonText = jsonText.Replace(currentAppKey, SteamVR_Settings.instance.editorAppKey);

FileInfo file = new FileInfo(newFilePath);
file.IsReadOnly = false;

File.WriteAllText(newFilePath, jsonText);
}
}
}

private const string findString_appKeyStart = "\"app_key\"";
private const string findString_appKeyEnd = "\",";
private static void RemoveAppKey(string newFilePath, string executableName)
{
if (File.Exists(newFilePath))
{
string jsonText = System.IO.File.ReadAllText(newFilePath);

string findString = "\"app_key\"";
int stringStart = jsonText.IndexOf(findString);

if (stringStart == -1)
return; //no app key

int stringEnd = jsonText.IndexOf("\",", stringStart);

if (stringEnd == -1)
return; //no end?

stringEnd += findString_appKeyEnd.Length;

int stringLength = stringEnd - stringStart;

string newJsonText = jsonText.Remove(stringStart, stringLength);

FileInfo file = new FileInfo(newFilePath);
file.IsReadOnly = false;

File.WriteAllText(newFilePath, newJsonText);
}
}
}
}

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

24 changes: 12 additions & 12 deletions Assets/SteamVR/Input/SteamVR_Action.cs.meta

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

24 changes: 12 additions & 12 deletions Assets/SteamVR/Input/SteamVR_ActionDirections.cs.meta

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

24 changes: 12 additions & 12 deletions Assets/SteamVR/Input/SteamVR_ActionSet.cs.meta

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

3 changes: 2 additions & 1 deletion Assets/SteamVR/Input/SteamVR_Action_Boolean.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ protected override void InitializeDictionaries(SteamVR_Input_Sources source)
public override void UpdateValue(SteamVR_Input_Sources inputSource)
{
lastActionData[inputSource] = actionData[inputSource];
lastActive[inputSource] = active[inputSource];

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

if (onActiveChange[inputSource] != null && lastActionData[inputSource].bActive != active[inputSource])
if (onActiveChange[inputSource] != null && lastActive[inputSource] != active[inputSource])
onActiveChange[inputSource].Invoke(this, active[inputSource]);
}

Expand Down
24 changes: 12 additions & 12 deletions Assets/SteamVR/Input/SteamVR_Action_Boolean.cs.meta

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

4 changes: 4 additions & 0 deletions Assets/SteamVR/Input/SteamVR_Action_In.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public abstract class SteamVR_Action_In : SteamVR_Action
[NonSerialized]
protected Dictionary<SteamVR_Input_Sources, float> lastOriginGetFrame = new Dictionary<SteamVR_Input_Sources, float>(new SteamVR_Input_Sources_Comparer());

[NonSerialized]
protected Dictionary<SteamVR_Input_Sources, bool> lastActive = new Dictionary<SteamVR_Input_Sources, bool>(new SteamVR_Input_Sources_Comparer());

[NonSerialized]
protected static uint inputOriginInfo_size = 0;

Expand Down Expand Up @@ -71,6 +74,7 @@ protected override void InitializeDictionaries(SteamVR_Input_Sources source)
onUpdate.Add(source, null);
lastInputOriginInfo.Add(source, new InputOriginInfo_t());
lastOriginGetFrame.Add(source, -1);
lastActive.Add(source, false);
}

/// <summary>
Expand Down
Loading

0 comments on commit a97cfac

Please sign in to comment.