Skip to content

Commit 8e44d2d

Browse files
committed
Version 2.2RC5 - Fix for controllers that don't support Skeleton Input
Changes for v2.2RC5: * Fix for controllers that don't support Skeleton Input yet (WinMR) * Fixing issue where sometimes SteamVR would load legacy bindings for SteamVR Input projects while in the editor.
1 parent 3b51e17 commit 8e44d2d

File tree

4 files changed

+55
-22
lines changed

4 files changed

+55
-22
lines changed

Assets/SteamVR/InteractionSystem/Core/Scripts/Hand.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ public void HideSkeleton(bool permanent = false)
275275
hoverhighlightRenderModel.SetHandVisibility(false, permanent);
276276
}
277277

278+
public bool HasSkeleton()
279+
{
280+
return mainRenderModel != null && mainRenderModel.GetSkeleton() != null;
281+
}
282+
278283
public void Show()
279284
{
280285
SetVisibility(true);
@@ -454,7 +459,7 @@ public void AttachObject(GameObject objectToAttach, GrabTypes grabbedWithType, A
454459

455460
if (attachedObject.HasAttachFlag(AttachmentFlags.SnapOnAttach))
456461
{
457-
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null)
462+
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null && HasSkeleton())
458463
{
459464
SteamVR_Skeleton_PoseSnapshot pose = attachedObject.interactable.skeletonPoser.GetBlendedPose(skeleton);
460465

@@ -491,7 +496,7 @@ public void AttachObject(GameObject objectToAttach, GrabTypes grabbedWithType, A
491496
}
492497
else
493498
{
494-
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null)
499+
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null && HasSkeleton())
495500
{
496501
attachedObject.initialPositionalOffset = attachedObject.handAttachmentPointTransform.InverseTransformPoint(objectToAttach.transform.position);
497502
attachedObject.initialRotationalOffset = Quaternion.Inverse(attachedObject.handAttachmentPointTransform.rotation) * objectToAttach.transform.rotation;
@@ -637,7 +642,7 @@ public void DetachObject(GameObject objectToDetach, bool restoreOriginalParent =
637642
}
638643
}
639644

640-
if (attachedObjects[index].interactable != null && attachedObjects[index].interactable.handFollowTransform)
645+
if (attachedObjects[index].interactable != null && attachedObjects[index].interactable.handFollowTransform && HasSkeleton())
641646
{
642647
skeleton.transform.localPosition = Vector3.zero;
643648
skeleton.transform.localRotation = Quaternion.identity;
@@ -1101,7 +1106,7 @@ protected virtual void HandFollowUpdate()
11011106
{
11021107
SteamVR_Skeleton_PoseSnapshot pose = null;
11031108

1104-
if (currentAttachedObjectInfo.Value.interactable.skeletonPoser != null)
1109+
if (currentAttachedObjectInfo.Value.interactable.skeletonPoser != null && HasSkeleton())
11051110
{
11061111
pose = currentAttachedObjectInfo.Value.interactable.skeletonPoser.GetBlendedPose(skeleton);
11071112
}
@@ -1224,7 +1229,7 @@ protected void UpdateAttachedVelocity(AttachedObject attachedObjectInfo)
12241229

12251230
protected Vector3 TargetItemPosition(AttachedObject attachedObject)
12261231
{
1227-
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null)
1232+
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null && HasSkeleton())
12281233
{
12291234
Vector3 tp = attachedObject.handAttachmentPointTransform.InverseTransformPoint(transform.TransformPoint(attachedObject.interactable.skeletonPoser.GetBlendedPose(skeleton).position));
12301235
//tp.x *= -1;
@@ -1238,7 +1243,7 @@ protected Vector3 TargetItemPosition(AttachedObject attachedObject)
12381243

12391244
protected Quaternion TargetItemRotation(AttachedObject attachedObject)
12401245
{
1241-
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null)
1246+
if (attachedObject.interactable != null && attachedObject.interactable.skeletonPoser != null && HasSkeleton())
12421247
{
12431248
Quaternion tr = Quaternion.Inverse(attachedObject.handAttachmentPointTransform.rotation) * (transform.rotation * attachedObject.interactable.skeletonPoser.GetBlendedPose(skeleton).rotation);
12441249
return currentAttachedObjectInfo.Value.handAttachmentPointTransform.rotation * tr;

Assets/SteamVR/InteractionSystem/Core/Scripts/RenderModel.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ protected void InitializeHand()
6161
SetHandVisibility(false);
6262

6363
handAnimator = handInstance.GetComponentInChildren<Animator>();
64+
65+
if (handSkeleton.skeletonAction.activeBinding == false)
66+
{
67+
Debug.LogWarning("Skeleton action: " + handSkeleton.skeletonAction.GetPath() + " is not bound. Your controller may not support SteamVR Skeleton Input.");
68+
DestroyHand();
69+
}
6470
}
6571
}
6672

@@ -352,7 +358,10 @@ public EVRSkeletalMotionRange GetSkeletonRangeOfMotion
352358
{
353359
get
354360
{
355-
return handSkeleton.rangeOfMotion;
361+
if (handSkeleton != null)
362+
return handSkeleton.rangeOfMotion;
363+
else
364+
return EVRSkeletalMotionRange.WithController;
356365
}
357366
}
358367

Assets/SteamVR/Scripts/SteamVR.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,13 @@ private static string GetManifestFile()
433433

434434
string fullPath = Path.Combine(currentPath, "unityProject.vrmanifest");
435435

436+
FileInfo fullManifestPath = new FileInfo(SteamVR_Settings.instance.actionsFilePath);
437+
436438
if (File.Exists(fullPath))
437439
{
438440
string jsonText = File.ReadAllText(fullPath);
439441
SteamVR_Input_ManifestFile existingFile = Valve.Newtonsoft.Json.JsonConvert.DeserializeObject<SteamVR_Input_ManifestFile>(jsonText);
442+
440443
if (existingFile != null && existingFile.applications != null && existingFile.applications.Count > 0 &&
441444
existingFile.applications[0].app_key != SteamVR_Settings.instance.editorAppKey)
442445
{
@@ -446,6 +449,18 @@ private static string GetManifestFile()
446449
existingInfo.IsReadOnly = false;
447450
existingInfo.Delete();
448451
}
452+
453+
if (existingFile != null && existingFile.applications != null && existingFile.applications.Count > 0 &&
454+
existingFile.applications[0].action_manifest_path != fullManifestPath.FullName)
455+
{
456+
Debug.Log("<b>[SteamVR]</b> Deleting existing VRManifest because it has a different action manifest path:" +
457+
"\nExisting:" + existingFile.applications[0].action_manifest_path +
458+
"\nNew: " + fullManifestPath.FullName);
459+
FileInfo existingInfo = new FileInfo(fullPath);
460+
if (existingInfo.IsReadOnly)
461+
existingInfo.IsReadOnly = false;
462+
existingInfo.Delete();
463+
}
449464
}
450465

451466
if (File.Exists(fullPath) == false)
@@ -454,7 +469,7 @@ private static string GetManifestFile()
454469
manifestFile.source = "Unity";
455470
SteamVR_Input_ManifestFile_Application manifestApplication = new SteamVR_Input_ManifestFile_Application();
456471
manifestApplication.app_key = SteamVR_Settings.instance.editorAppKey;
457-
//manifestApplication.action_manifest_path = SteamVR_Settings.instance.actionsFilePath;
472+
manifestApplication.action_manifest_path = fullManifestPath.FullName;
458473
manifestApplication.launch_type = "url";
459474
//manifestApplication.binary_path_windows = SteamVR_Utils.ConvertToForwardSlashes(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
460475
//manifestApplication.binary_path_linux = SteamVR_Utils.ConvertToForwardSlashes(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
@@ -507,22 +522,19 @@ private static void IdentifyEditorApplication(bool showLogs = true)
507522
{
508523
bool isInstalled = OpenVR.Applications.IsApplicationInstalled(SteamVR_Settings.instance.editorAppKey);
509524

510-
if (isInstalled == false)
511-
{
512-
string manifestPath = GetManifestFile();
525+
string manifestPath = GetManifestFile();
513526

514-
var addManifestErr = OpenVR.Applications.AddApplicationManifest(manifestPath, true);
515-
if (addManifestErr != EVRApplicationError.None)
516-
Debug.LogError("<b>[SteamVR]</b> Error adding vr manifest file: " + addManifestErr.ToString());
517-
else
518-
{
519-
if (showLogs)
520-
Debug.Log("<b>[SteamVR]</b> Successfully added VR manifest to SteamVR");
521-
}
527+
EVRApplicationError addManifestErr = OpenVR.Applications.AddApplicationManifest(manifestPath, true);
528+
if (addManifestErr != EVRApplicationError.None)
529+
Debug.LogError("<b>[SteamVR]</b> Error adding vr manifest file: " + addManifestErr.ToString());
530+
else
531+
{
532+
if (showLogs)
533+
Debug.Log("<b>[SteamVR]</b> Successfully added VR manifest to SteamVR");
522534
}
523535

524536
int processId = System.Diagnostics.Process.GetCurrentProcess().Id;
525-
var applicationIdentifyErr = OpenVR.Applications.IdentifyApplication((uint)processId, SteamVR_Settings.instance.editorAppKey);
537+
EVRApplicationError applicationIdentifyErr = OpenVR.Applications.IdentifyApplication((uint)processId, SteamVR_Settings.instance.editorAppKey);
526538

527539
if (applicationIdentifyErr != EVRApplicationError.None)
528540
Debug.LogError("<b>[SteamVR]</b> Error identifying application: " + applicationIdentifyErr.ToString());

Assets/SteamVR/readme.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SteamVR Unity Plugin - v2.2RC4
1+
# SteamVR Unity Plugin - v2.2RC5
22

33
Copyright (c) Valve Corporation, All rights reserved.
44

@@ -33,13 +33,20 @@ Support:
3333
If you'd like to discuss features, post guides, and give general feedback please post on the steam forum here: https://steamcommunity.com/app/250820/discussions/7/
3434

3535

36+
Changes for v2.2RC5:
37+
38+
* Fix for controllers that don't support Skeleton Input yet (WinMR)
39+
40+
* Fixing issue where sometimes SteamVR would load legacy bindings for SteamVR Input projects while in the editor.
41+
42+
3643
Changes for v2.2RC4:
3744

3845
* Changed SteamVR_Input.isStartupFrame to return true for the couple frames around startup. This fixes some startup errors temporarily until we have a SteamVR API to determine startup state.
3946

4047
* Fixed an issue where builds would fail
4148

42-
* Significantly reduced asset package file size 50%. Some psds were replaced with pngs, some png res was lowered. The old assets are still on the github repo under old plugin versions.
49+
* Significantly reduced asset package file size (~50%). Some psds were replaced with pngs, some png res was lowered. The old assets are still on the github repo under old plugin versions.
4350

4451
* Made Unity 2018.1+ OpenVR package detection and installation more robust.
4552

0 commit comments

Comments
 (0)