-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from charles-river-analytics/release/v1.0.2
Release/v1.0.2
- Loading branch information
Showing
81 changed files
with
2,723 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Assets/VIRTUOSO/Scripts/Editor/Editors/GrabOffsetEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using CharlesRiverAnalytics.Virtuoso.Utilities; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using VRTK; | ||
|
||
namespace CharlesRiverAnalytics.Virtuoso.EditorScripts | ||
{ | ||
/// <summary> | ||
/// Custom Editor for the GrabOffset class. This editor helps display the available SDKs that VRTK/VIRTUOSO has available to it. | ||
/// | ||
/// Written by: Nicolas Herrera (nherrera@cra.com), 2019 | ||
/// </summary> | ||
[CustomEditor(typeof(GrabOffset))] | ||
public class GrabOffsetEditor : Editor | ||
{ | ||
#region PrivateVariables | ||
private SerializedProperty selectedSDK; | ||
private SerializedProperty positionOffset; | ||
private SerializedProperty rotationOffset; | ||
#endregion | ||
|
||
#region UnityFunctions | ||
private void Awake() | ||
{ | ||
selectedSDK = serializedObject.FindProperty("handOrControllerSDKName"); | ||
positionOffset = serializedObject.FindProperty("positionOffset"); | ||
rotationOffset = serializedObject.FindProperty("rotationOffset"); | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
serializedObject.Update(); | ||
|
||
DrawDefaultInspector(); | ||
|
||
Func<VRTK_SDKInfo, ReadOnlyCollection<VRTK_SDKInfo>, string> sdkNameSelector = (info, installedInfos) | ||
=> info.description.prettyName; | ||
List<string> availableControllerSDKNames = VRTK_SDKManager.AvailableControllerSDKInfos.Select(info => sdkNameSelector(info, VRTK_SDKManager.AvailableControllerSDKInfos)).ToList<string>(); | ||
List<string> availableHandSDKNames = VRTK_SDKManager.AvailableHandSDKInfos.Select(info => sdkNameSelector(info, VRTK_SDKManager.AvailableHandSDKInfos)).ToList<string>(); | ||
List<string> allAvailableDevices = availableControllerSDKNames.Concat(availableHandSDKNames).Distinct().ToList<string>(); | ||
|
||
int index = Mathf.Max(0, allAvailableDevices.IndexOf(selectedSDK.stringValue)); | ||
|
||
index = EditorGUILayout.Popup("SDK", index, allAvailableDevices.ToArray()); | ||
selectedSDK.stringValue = allAvailableDevices[index]; | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
#endregion | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/VIRTUOSO/Scripts/Editor/Editors/GrabOffsetEditor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.