Skip to content

Commit

Permalink
Merge pull request #25 from charles-river-analytics/release/v1.0.2
Browse files Browse the repository at this point in the history
Release/v1.0.2
  • Loading branch information
ddugganCRA committed Jan 22, 2020
2 parents 4a77f23 + bcbcdb3 commit bc8bea5
Show file tree
Hide file tree
Showing 81 changed files with 2,723 additions and 357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public override void OnInspectorGUI()
// do not draw the control variables
AdvancedGesture advTarget = (AdvancedGesture)target;
advTarget.gestureCooldown = EditorGUILayout.FloatField("Cooldown (seconds)", advTarget.gestureCooldown);
advTarget.allowedWhileHoldingObjects = EditorGUILayout.Toggle("Allow While Holding", advTarget.allowedWhileHoldingObjects);

foreach (AdvancedGestureState advState in advTarget.advancedGestureStateList)
{
Expand Down
56 changes: 56 additions & 0 deletions Assets/VIRTUOSO/Scripts/Editor/Editors/GrabOffsetEditor.cs
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 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.

3 changes: 3 additions & 0 deletions Assets/VIRTUOSO/Scripts/Editor/Editors/ReactorEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ public override void OnInspectorGUI()

reactionsPerEventDictionary.Add(eventNameArray[n], currentInfo);
}

// Since the dictionary has been changed, make sure it is updated
serializedObject.ApplyModifiedProperties();
}
// Otherwise, copy the one back from the target
else
Expand Down

0 comments on commit bc8bea5

Please sign in to comment.