Move third party assets to ThirdParty folder

This commit is contained in:
2024-08-08 11:26:28 +02:00
parent 386f303057
commit bd91af6f98
10340 changed files with 100 additions and 175 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 443be23ae50d17b409d3f638f6bab8ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 33b0413256240b44da62d52daed1e4cb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,101 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrValveIndexInputEditor.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using System.Linq;
using UltimateXR.Avatar;
using UltimateXR.Devices.Integrations.Valve;
using UltimateXR.Editor.Manipulation.HandPoses;
using UltimateXR.Extensions.System.Collections;
using UltimateXR.Extensions.Unity;
using UnityEditor;
using UnityEngine;
namespace UltimateXR.Editor.Devices.Integrations.Valve
{
/// <summary>
/// Custom Unity editor for the <see cref="UxrValveIndexInput" /> component.
/// </summary>
[CustomEditor(typeof(UxrValveIndexInput))]
public class UxrValveIndexInputEditor : UxrControllerInputEditor
{
#region Unity
/// <summary>
/// Caches the serialized properties.
/// </summary>
public void OnEnable()
{
_propertyOpenHandPoseName = serializedObject.FindProperty("_openHandPoseName");
_propertyIndexCurlAmount = serializedObject.FindProperty("_indexCurlAmount");
_propertyMiddleCurlAmount = serializedObject.FindProperty("_middleCurlAmount");
_propertyRingCurlAmount = serializedObject.FindProperty("_ringCurlAmount");
_propertyLittleCurlAmount = serializedObject.FindProperty("_littleCurlAmount");
_propertyThumbCurlAmount = serializedObject.FindProperty("_thumbCurlAmount");
_propertyThumbSpreadAmount = serializedObject.FindProperty("_thumbSpreadAmount");
}
/// <inheritdoc />
public override void OnInspectorGUI()
{
// Draw base GUI
base.OnInspectorGUI();
serializedObject.Update();
UxrAvatar avatar = (serializedObject.targetObject as UxrValveIndexInput)?.gameObject.SafeGetComponentInParent<UxrAvatar>();
IReadOnlyList<string> poseNames = UxrHandPoseEditorWindow.GetAvatarPoseNames(avatar);
if (poseNames.Count == 0 || _propertyOpenHandPoseName == null)
{
EditorGUILayout.HelpBox("Avatar has no hand poses available to set the open hand pose when grabbing the Index controllers", MessageType.Warning);
}
else
{
EditorGUILayout.Space();
EditorGUI.BeginChangeCheck();
int openPoseNameIndex = EditorGUILayout.Popup(ContentOpenHandPoseName, poseNames.IndexOf(_propertyOpenHandPoseName.stringValue), UxrEditorUtils.ToGUIContentArray(poseNames.ToArray()));
if (EditorGUI.EndChangeCheck())
{
_propertyOpenHandPoseName.stringValue = poseNames[openPoseNameIndex];
}
EditorGUILayout.Slider(_propertyIndexCurlAmount, 0.0f, 90.0f, ContentIndexCurlAmount);
EditorGUILayout.Slider(_propertyMiddleCurlAmount, 0.0f, 90.0f, ContentMiddleCurlAmount);
EditorGUILayout.Slider(_propertyRingCurlAmount, 0.0f, 90.0f, ContentRingCurlAmount);
EditorGUILayout.Slider(_propertyLittleCurlAmount, 0.0f, 90.0f, ContentLittleCurlAmount);
EditorGUILayout.Slider(_propertyThumbCurlAmount, 0.0f, 90.0f, ContentThumbCurlAmount);
EditorGUILayout.Slider(_propertyThumbSpreadAmount, 0.0f, 90.0f, ContentThumbSpreadAmount);
}
serializedObject.ApplyModifiedProperties();
EditorGUILayout.Space();
}
#endregion
#region Private Types & Data
private GUIContent ContentOpenHandPoseName { get; } = new GUIContent("Open Hand Pose", "Selects the hand pose that will be used as default when Index Controllers are enabled. Fingers will be curled using the tracking values starting from this pose.");
private GUIContent ContentIndexCurlAmount { get; } = new GUIContent("Index Curl Amount", "");
private GUIContent ContentMiddleCurlAmount { get; } = new GUIContent("Middle Curl Amount", "");
private GUIContent ContentRingCurlAmount { get; } = new GUIContent("Ring Curl Amount", "");
private GUIContent ContentLittleCurlAmount { get; } = new GUIContent("Little Curl Amount", "");
private GUIContent ContentThumbCurlAmount { get; } = new GUIContent("Thumb Curl Amount", "");
private GUIContent ContentThumbSpreadAmount { get; } = new GUIContent("Thumb Spread Amount", "");
private SerializedProperty _propertyOpenHandPoseName;
private SerializedProperty _propertyIndexCurlAmount;
private SerializedProperty _propertyMiddleCurlAmount;
private SerializedProperty _propertyRingCurlAmount;
private SerializedProperty _propertyLittleCurlAmount;
private SerializedProperty _propertyThumbCurlAmount;
private SerializedProperty _propertyThumbSpreadAmount;
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d21101798f95e764d8901e483b332c42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrController3DModelEditor.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Devices.Visualization;
using UnityEditor;
namespace UltimateXR.Editor.Devices
{
/// <summary>
/// Custom Unity editor for the <see cref="UxrController3DModel" /> component.
/// </summary>
[CustomEditor(typeof(UxrController3DModel))]
public class UxrController3DModelEditor : UnityEditor.Editor
{
#region Unity
/// <summary>
/// Caches the serialized properties.
/// </summary>
public void OnEnable()
{
_propertyNeedsBothHands = serializedObject.FindProperty("_needsBothHands");
_propertyHandSide = serializedObject.FindProperty("_handSide");
_propertyControllerHand = serializedObject.FindProperty("_controllerHand");
_propertyControllerHandLeft = serializedObject.FindProperty("_controllerHandLeft");
_propertyControllerHandRight = serializedObject.FindProperty("_controllerHandRight");
}
/// <inheritdoc />
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(_propertyNeedsBothHands);
if (_propertyNeedsBothHands.boolValue)
{
EditorGUILayout.PropertyField(_propertyControllerHandLeft);
EditorGUILayout.PropertyField(_propertyControllerHandRight);
}
else
{
EditorGUILayout.PropertyField(_propertyHandSide);
EditorGUILayout.PropertyField(_propertyControllerHand);
}
// Rest of inspector
DrawPropertiesExcluding(serializedObject, "m_Script", "_needsBothHands", "_handSide", "_controllerHand", "_controllerHandLeft", "_controllerHandRight");
// Apply modified properties if necessary
serializedObject.ApplyModifiedProperties();
}
#endregion
#region Private Types & Data
private SerializedProperty _propertyNeedsBothHands;
private SerializedProperty _propertyHandSide;
private SerializedProperty _propertyControllerHand;
private SerializedProperty _propertyControllerHandLeft;
private SerializedProperty _propertyControllerHandRight;
#endregion
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: ab4a46fd0a0ecc542993b5da82c4db48
timeCreated: 1516615188
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,193 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrController3DModelElementDrawer.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Devices.Visualization;
using UnityEditor;
using UnityEngine;
namespace UltimateXR.Editor.Devices
{
/// <summary>
/// Custom UI property drawer for the <see cref="UxrElement" /> type.
/// </summary>
[CustomPropertyDrawer(typeof(UxrElement))]
public class UxrController3DModelElementDrawer : PropertyDrawer
{
#region Public Overrides PropertyDrawer
/// <inheritdoc />
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
UxrController3DModel controller3DModel = property.serializedObject.targetObject as UxrController3DModel;
int enumIndex = property.FindPropertyRelative(PropertyElementType).enumValueIndex;
int lineCount = 1;
if (enumIndex == (int)UxrElementType.NotSet)
{
lineCount = 2;
}
else if (enumIndex == (int)UxrElementType.Button)
{
lineCount = 8;
}
else if (enumIndex == (int)UxrElementType.Input1DRotate)
{
lineCount = 8;
}
else if (enumIndex == (int)UxrElementType.Input1DPush)
{
lineCount = 8;
}
else if (enumIndex == (int)UxrElementType.Input2DJoystick)
{
lineCount = 9;
}
else if (enumIndex == (int)UxrElementType.Input2DTouch)
{
lineCount = 9;
}
else if (enumIndex == (int)UxrElementType.DPad)
{
lineCount = 11;
}
if (controller3DModel && !controller3DModel.NeedsBothHands && enumIndex != (int)UxrElementType.NotSet)
{
// Doesn't need hand parameter
lineCount -= 1;
}
return lineCount * EditorGUIUtility.singleLineHeight;
}
#endregion
#region Unity
/// <inheritdoc />
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
UxrController3DModel controller3DModel = property.serializedObject.targetObject as UxrController3DModel;
EditorGUI.BeginProperty(position, label, property);
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
EditorGUI.indentLevel += 1;
int posY = 1;
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyElementType), ContentElementType);
int enumIndex = property.FindPropertyRelative(PropertyElementType).enumValueIndex;
if (enumIndex != (int)UxrElementType.NotSet)
{
if (controller3DModel && controller3DModel.NeedsBothHands)
{
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyHand), ContentHand);
}
else
{
property.FindPropertyRelative(PropertyHand).enumValueIndex = (int)controller3DModel.HandSide;
}
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyElement), ContentElement);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyGameObject), ContentGameObject);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyFinger), ContentFinger);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyFingerContactPoint), ContentFingerContactPoint);
if (enumIndex == (int)UxrElementType.Button)
{
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyButtonPressedOffset), ContentButtonPressedOffset);
}
else if (enumIndex == (int)UxrElementType.Input1DRotate)
{
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyInput1DPressedOffsetAngle), ContentInput1DPressedOffsetAngle);
}
else if (enumIndex == (int)UxrElementType.Input1DPush)
{
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyInput1DPressedOffset), ContentInput1DPressedOffset);
}
else if (enumIndex == (int)UxrElementType.Input2DJoystick)
{
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyInput2DFirstAxisOffsetAngle), ContentInput2DFirstAxisOffsetAngle);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyInput2DSecondAxisOffsetAngle), ContentInput2DSecondAxisOffsetAngle);
}
else if (enumIndex == (int)UxrElementType.Input2DTouch)
{
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyInput2DFirstAxisOffset), ContentInput2DFirstAxisOffset);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyInput2DSecondAxisOffset), ContentInput2DSecondAxisOffset);
}
else if (enumIndex == (int)UxrElementType.DPad)
{
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyDpadFirstAxisOffset), ContentDpadFirstAxisOffset);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyDpadSecondAxisOffset), ContentDpadSecondAxisOffset);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyDpadFirstAxisOffsetAngle), ContentDpadFirstAxisOffsetAngle);
EditorGUI.PropertyField(GetRect(position, posY++), property.FindPropertyRelative(PropertyDpadSecondAxisOffsetAngle), ContentDpadSecondAxisOffsetAngle);
}
}
EditorGUI.indentLevel -= 1;
EditorGUI.EndProperty();
}
#endregion
#region Private Methods
/// <summary>
/// Helper method that returns the rect for a given line number.
/// </summary>
/// <param name="position"><see cref="OnGUI" /> position parameter</param>
/// <param name="line">Line number</param>
/// <returns>Rect to draw the given UI line</returns>
private Rect GetRect(Rect position, int line)
{
return new Rect(position.x, position.y + EditorGUIUtility.singleLineHeight * line, position.width, EditorGUIUtility.singleLineHeight);
}
#endregion
#region Private Types & Data
private GUIContent ContentElementType { get; } = new GUIContent("Type", "");
private GUIContent ContentHand { get; } = new GUIContent("Hand", "");
private GUIContent ContentElement { get; } = new GUIContent("Element", "");
private GUIContent ContentGameObject { get; } = new GUIContent("GameObject", "");
private GUIContent ContentFinger { get; } = new GUIContent("Finger Used", "");
private GUIContent ContentFingerContactPoint { get; } = new GUIContent("Finger Contact Pos", "");
private GUIContent ContentButtonPressedOffset { get; } = new GUIContent("Pressed Offset", "");
private GUIContent ContentInput1DPressedOffsetAngle { get; } = new GUIContent("Pressed Angle Offset", "");
private GUIContent ContentInput1DPressedOffset { get; } = new GUIContent("Pressed Offset", "");
private GUIContent ContentInput2DFirstAxisOffsetAngle { get; } = new GUIContent("1st Axis Angle Amplitude", "");
private GUIContent ContentInput2DSecondAxisOffsetAngle { get; } = new GUIContent("2nd Axis Angle Amplitude", "");
private GUIContent ContentInput2DFirstAxisOffset { get; } = new GUIContent("1st Axis Offset Amplitude", "");
private GUIContent ContentInput2DSecondAxisOffset { get; } = new GUIContent("2nd Axis Offset Amplitude", "");
private GUIContent ContentDpadFirstAxisOffsetAngle { get; } = new GUIContent("1st Axis Angle Amplitude", "");
private GUIContent ContentDpadSecondAxisOffsetAngle { get; } = new GUIContent("2nd Axis Angle Amplitude", "");
private GUIContent ContentDpadFirstAxisOffset { get; } = new GUIContent("1st Axis Offset Amplitude", "");
private GUIContent ContentDpadSecondAxisOffset { get; } = new GUIContent("2nd Axis Offset Amplitude", "");
private const string PropertyElementType = "_elementType";
private const string PropertyHand = "_hand";
private const string PropertyElement = "_element";
private const string PropertyGameObject = "_gameObject";
private const string PropertyFinger = "_finger";
private const string PropertyFingerContactPoint = "_fingerContactPoint";
private const string PropertyButtonPressedOffset = "_buttonPressedOffset";
private const string PropertyInput1DPressedOffsetAngle = "_input1DPressedOffsetAngle";
private const string PropertyInput1DPressedOffset = "_input1DPressedOffset";
private const string PropertyInput2DFirstAxisOffsetAngle = "_input2DFirstAxisOffsetAngle";
private const string PropertyInput2DSecondAxisOffsetAngle = "_input2DSecondAxisOffsetAngle";
private const string PropertyInput2DFirstAxisOffset = "_input2DFirstAxisOffset";
private const string PropertyInput2DSecondAxisOffset = "_input2DSecondAxisOffset";
private const string PropertyDpadFirstAxisOffsetAngle = "_dpadFirstAxisOffsetAngle";
private const string PropertyDpadSecondAxisOffsetAngle = "_dpadSecondAxisOffsetAngle";
private const string PropertyDpadFirstAxisOffset = "_dpadFirstAxisOffset";
private const string PropertyDpadSecondAxisOffset = "_dpadSecondAxisOffset";
#endregion
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5ab5b0aa93218ec408789d651c56ffed
timeCreated: 1505111962
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,76 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrControllerInputEditor.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Devices;
using UltimateXR.Editor.Core;
using UltimateXR.Editor.Sdks;
using UnityEditor;
using UnityEngine;
namespace UltimateXR.Editor.Devices
{
/// <summary>
/// Custom Unity editor for the device input components. Checks for SDK availability.
/// </summary>
[CustomEditor(typeof(UxrControllerInput), true)]
public class UxrControllerInputEditor : UnityEditor.Editor
{
#region Public Methods
/// <summary>
/// Draws the UI related to checking for the required SDK.
/// </summary>
/// <param name="controllerInput">The controller input component to draw the UI for</param>
public static void DrawSDKCheckInspectorGUI(UxrControllerInput controllerInput)
{
if (string.IsNullOrEmpty(controllerInput.SDKDependency) == false)
{
if (UxrSdkManager.IsAvailable(controllerInput.SDKDependency) == false)
{
EditorGUILayout.Space();
EditorGUILayout.HelpBox("In order to work properly this component needs the following SDK installed and active: " + controllerInput.SDKDependency, MessageType.Warning);
if (UxrEditorUtils.CenteredButton(new GUIContent("Check", "Go to the SDK Manager to check the SDK")))
{
UxrSdkManagerWindow.ShowWindow(UxrSdkLocator.SupportType.InputTracking);
}
EditorGUILayout.Space();
}
}
}
#endregion
#region Unity
/// <summary>
/// Checks if the given input component needs an SDK installed and available. Then draws the component itself.
/// </summary>
public override void OnInspectorGUI()
{
serializedObject.Update();
UxrControllerInput controllerInput = serializedObject.targetObject as UxrControllerInput;
DrawSDKCheckInspectorGUI(controllerInput);
if (controllerInput)
{
if (controllerInput.SetupType == UxrControllerSetupType.Single)
{
DrawPropertiesExcluding(serializedObject, "m_Script", "_leftController", "_rightController", "_enableObjectListLeft", "_enableObjectListRight");
}
else if (controllerInput.SetupType == UxrControllerSetupType.Dual)
{
DrawPropertiesExcluding(serializedObject, "m_Script", "_controller", "_enableObjectList");
}
}
serializedObject.ApplyModifiedProperties();
}
#endregion
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: ccf00dd74a1ea074080a3bcf7567fab0
timeCreated: 1521213978
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,108 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrHandTrackingEditor.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Core;
using UltimateXR.Devices;
using UnityEditor;
using UnityEngine;
namespace UltimateXR.Editor.Devices
{
/// <summary>
/// Custom Unity editor for hand tracking components.
/// </summary>
[CustomEditor(typeof(UxrHandTracking), true)]
public class UxrHandTrackingEditor : UnityEditor.Editor
{
#region Unity
/// <summary>
/// Caches the serialized properties.
/// </summary>
private void OnEnable()
{
_propertyCalibrationPose = serializedObject.FindProperty("_calibrationPose");
_propertyLeftCalibrationData = serializedObject.FindProperty("_leftCalibrationData");
_propertyRightCalibrationData = serializedObject.FindProperty("_rightCalibrationData");
}
/// <inheritdoc />
public override void OnInspectorGUI()
{
serializedObject.Update();
UxrHandTracking handTracking = serializedObject.targetObject as UxrHandTracking;
if (handTracking != null)
{
DrawPropertiesExcluding(serializedObject, "m_Script");
}
else
{
return;
}
if (!EditorApplication.isPlaying)
{
if (!handTracking.HasCalibrationData)
{
EditorGUILayout.HelpBox("Hand tracking can be calibrated for this avatar in play mode. Do not re-calibrate data if the avatar is already calibrated correctly or you don't know what you're doing", MessageType.Warning);
}
else
{
EditorGUILayout.HelpBox("Component contains calibration data. Calibration can be readjusted at runtime using this inspector.", MessageType.Info);
}
}
else
{
EditorGUILayout.HelpBox("Calibration for this avatar is performed by adopting, using your real hand, the same hand pose as the reference pose specified in the inspector, regardless of how the hand is currently being rendered. " +
"Once your real hand has roughly the same pose as the reference hand pose, click on the calibrate button.\n" +
"Calibration doesn't need to be performed per user or per session, only once at edit-time. The only goal is to correct the mismatch between the avatar's hand rigging and the tracking data for this device.",
MessageType.Info);
}
GUI.enabled = EditorApplication.isPlaying;
if (UxrEditorUtils.CenteredButton(ContentCalibrateLeft))
{
handTracking.CollectCalibrationData(UxrHandSide.Left);
}
if (UxrEditorUtils.CenteredButton(ContentCalibrateRight))
{
handTracking.CollectCalibrationData(UxrHandSide.Right);
}
serializedObject.ApplyModifiedProperties();
if (UxrEditorUtils.CenteredButton(ContentClearLeft))
{
handTracking.ClearCalibrationData(UxrHandSide.Left);
}
if (UxrEditorUtils.CenteredButton(ContentClearRight))
{
handTracking.ClearCalibrationData(UxrHandSide.Right);
}
GUI.enabled = true;
}
#endregion
#region Private Types & Data
private GUIContent ContentCalibrateLeft { get; } = new GUIContent("Calibrate Left Hand", "");
private GUIContent ContentCalibrateRight { get; } = new GUIContent("Calibrate Right Hand", "");
private GUIContent ContentClearLeft { get; } = new GUIContent("Clear Left Calibration", "");
private GUIContent ContentClearRight { get; } = new GUIContent("Clear Right Calibration", "");
private SerializedProperty _propertyCalibrationPose;
private SerializedProperty _propertyLeftCalibrationData;
private SerializedProperty _propertyRightCalibrationData;
#endregion
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: aaa7585db64ed7f4ca321c4bba74d62a
timeCreated: 1521213978
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,67 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrTrackingEditor.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Devices;
using UltimateXR.Editor.Core;
using UltimateXR.Editor.Sdks;
using UnityEditor;
using UnityEngine;
namespace UltimateXR.Editor.Devices
{
/// <summary>
/// Custom Unity editor for <see cref="UxrTrackingDevice" /> components. Checks for SDK availability.
/// </summary>
[CustomEditor(typeof(UxrTrackingDevice), true)]
public class UxrTrackingEditor : UnityEditor.Editor
{
#region Public Types & Data
public const string PropertyHideAvatarInPassthrough = "_hideAvatarInPassthrough";
#endregion
#region Unity
/// <summary>
/// Checks if the given tracking component needs an SDK installed and available. Then draws the component itself.
/// </summary>
public override void OnInspectorGUI()
{
serializedObject.Update();
UxrTrackingDevice tracking = serializedObject.targetObject as UxrTrackingDevice;
if (string.IsNullOrEmpty(tracking.SDKDependency) == false)
{
if (UxrSdkManager.IsAvailable(tracking.SDKDependency) == false)
{
EditorGUILayout.Space();
EditorGUILayout.HelpBox($"In order to work properly this component needs the following SDK installed and active: {tracking.SDKDependency}", MessageType.Warning);
if (UxrEditorUtils.CenteredButton(new GUIContent("Check", "Go to the SDK Manager to check the SDK")))
{
UxrSdkManagerWindow.ShowWindow();
}
EditorGUILayout.Space();
}
}
if (tracking.IsMixedRealityDevice)
{
DrawPropertiesExcluding(serializedObject, "m_Script");
}
else
{
DrawPropertiesExcluding(serializedObject, "m_Script", PropertyHideAvatarInPassthrough);
}
serializedObject.ApplyModifiedProperties();
}
#endregion
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 3e07525b06fd32e49bf5775a629f5b7e
timeCreated: 1521213978
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d4225a97895ebec45a939114a0f9d892
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,212 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrControllerHandEditor.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Avatar;
using UltimateXR.Avatar.Rig;
using UltimateXR.Core;
using UltimateXR.Devices.Visualization;
using UltimateXR.Extensions.Unity;
using UltimateXR.Manipulation.HandPoses;
using UnityEditor;
using UnityEngine;
namespace UltimateXR.Editor.Devices.Visualization
{
[CustomEditor(typeof(UxrControllerHand)), CanEditMultipleObjects]
public class UxrControllerHandEditor : UnityEditor.Editor
{
#region Unity
/// <summary>
/// Caches the properties.
/// </summary>
private void OnEnable()
{
_propertyHasAvatarSource = serializedObject.FindProperty("_hasAvatarSource");
_propertyAvatarPrefab = serializedObject.FindProperty("_avatarPrefab");
_propertyAvatarHandSide = serializedObject.FindProperty("_avatarHandSide");
_propertyHandPose = serializedObject.FindProperty("_handPose");
_propertyVariations = serializedObject.FindProperty("_variations");
_propertyHandRig = serializedObject.FindProperty("_hand");
_propertyThumb = serializedObject.FindProperty("_thumb");
_propertyIndex = serializedObject.FindProperty("_index");
_propertyMiddle = serializedObject.FindProperty("_middle");
_propertyRing = serializedObject.FindProperty("_ring");
_propertyLittle = serializedObject.FindProperty("_little");
}
/// <inheritdoc />
public override void OnInspectorGUI()
{
serializedObject.Update();
UxrControllerHand controllerHand = serializedObject.targetObject as UxrControllerHand;
UxrAvatar avatar = _propertyAvatarPrefab.objectReferenceValue as UxrAvatar;
UxrHandSide handSide = _propertyAvatarHandSide.enumValueIndex == (int)UxrHandSide.Left ? UxrHandSide.Left : UxrHandSide.Right;
_foldoutPoseBaking = UxrEditorUtils.FoldoutStylish("Pose Baking:", _foldoutPoseBaking);
if (_foldoutPoseBaking)
{
EditorGUILayout.PropertyField(_propertyHasAvatarSource, ContentHasAvatarSource);
if (_propertyHasAvatarSource.boolValue)
{
EditorGUILayout.PropertyField(_propertyAvatarPrefab, ContentAvatarPrefab);
if (avatar != null)
{
UxrEditorUtils.HandPoseDropdown(ContentHandPose, avatar, _propertyHandPose, out UxrHandPoseAsset selectedHandPose);
EditorGUILayout.PropertyField(_propertyAvatarHandSide, ContentAvatarHandSide);
GUI.enabled = avatar != null;
if (UxrEditorUtils.CenteredButton(ContentLoadRig))
{
UxrAvatarHand srcHand = avatar.GetHand(handSide);
if (srcHand.Wrist != null && _propertyHandRig.FindPropertyRelative("_wrist").objectReferenceValue == null)
{
_propertyHandRig.FindPropertyRelative("_wrist").objectReferenceValue = controllerHand.transform.FindRecursive(srcHand.Wrist.name);
}
GetFingerTransforms(_propertyHandRig, "_thumb", controllerHand, srcHand.Thumb);
GetFingerTransforms(_propertyHandRig, "_index", controllerHand, srcHand.Index);
GetFingerTransforms(_propertyHandRig, "_middle", controllerHand, srcHand.Middle);
GetFingerTransforms(_propertyHandRig, "_ring", controllerHand, srcHand.Ring);
GetFingerTransforms(_propertyHandRig, "_little", controllerHand, srcHand.Little);
}
GUI.enabled = true;
if (UxrEditorUtils.CenteredButton(ContentClearRig))
{
_propertyHandRig.FindPropertyRelative("_wrist").objectReferenceValue = null;
ClearFingerTransforms(_propertyHandRig, "_thumb");
ClearFingerTransforms(_propertyHandRig, "_index");
ClearFingerTransforms(_propertyHandRig, "_middle");
ClearFingerTransforms(_propertyHandRig, "_ring");
ClearFingerTransforms(_propertyHandRig, "_little");
}
GUI.enabled = selectedHandPose != null && controllerHand.Hand.HasFingerData();
if (UxrEditorUtils.CenteredButton(ContentBakePose))
{
UxrAvatarRig.UpdateHandUsingDescriptor(controllerHand.Hand,
selectedHandPose.GetHandDescriptor(handSide, selectedHandPose.PoseType, UxrBlendPoseType.OpenGrip),
avatar.AvatarRigInfo.GetArmInfo(handSide).HandUniversalLocalAxes,
avatar.AvatarRigInfo.GetArmInfo(handSide).FingerUniversalLocalAxes);
}
GUI.enabled = true;
}
}
}
_foldoutHand = UxrEditorUtils.FoldoutStylish("Hand information:", _foldoutHand);
if (_foldoutHand)
{
EditorGUILayout.PropertyField(_propertyVariations, ContentVariations, true);
if (avatar != null)
{
EditorGUILayout.PropertyField(_propertyHandRig, ContentHandRig, true);
}
EditorGUILayout.PropertyField(_propertyThumb, ContentThumb, true);
EditorGUILayout.PropertyField(_propertyIndex, ContentIndex, true);
EditorGUILayout.PropertyField(_propertyMiddle, ContentMiddle, true);
EditorGUILayout.PropertyField(_propertyRing, ContentRing, true);
EditorGUILayout.PropertyField(_propertyLittle, ContentLittle, true);
}
serializedObject.ApplyModifiedProperties();
}
#endregion
#region Private Methods
/// <summary>
/// Tries to solve the finger bone references using an avatar as source.
/// </summary>
/// <param name="propertyHandRig">The serialized property with the destination hand rig</param>
/// <param name="fingerField">The name of the finger field</param>
/// <param name="controllerHand">The controller hand</param>
/// <param name="srcFinger">The avatar finger with data that is already solved and that will be used as reference</param>
private void GetFingerTransforms(SerializedProperty propertyHandRig, string fingerField, UxrControllerHand controllerHand, UxrAvatarFinger srcFinger)
{
GetFingerTransform(controllerHand.transform, srcFinger.Metacarpal, propertyHandRig.FindPropertyRelative($"{fingerField}._metacarpal"));
GetFingerTransform(controllerHand.transform, srcFinger.Proximal, propertyHandRig.FindPropertyRelative($"{fingerField}._proximal"));
GetFingerTransform(controllerHand.transform, srcFinger.Intermediate, propertyHandRig.FindPropertyRelative($"{fingerField}._intermediate"));
GetFingerTransform(controllerHand.transform, srcFinger.Distal, propertyHandRig.FindPropertyRelative($"{fingerField}._distal"));
}
/// <summary>
/// Tries to solve a transform reference looking for a Transform that has the same name in an avatar as reference.
/// </summary>
/// <param name="root">Root of all the hand transforms in the <see cref="UxrControllerHand" /></param>
/// <param name="srcTransform">The transform that is used in the avatar and that will be used as reference</param>
/// <param name="dstPropertyTransform">The <see cref="SerializedProperty" /> of the transform that needs to be solved</param>
private void GetFingerTransform(Transform root, Transform srcTransform, SerializedProperty dstPropertyTransform)
{
if (srcTransform != null && dstPropertyTransform.objectReferenceValue == null)
{
dstPropertyTransform.objectReferenceValue = root.FindRecursive(srcTransform.name);
}
}
/// <summary>
/// Clears all the transforms in a finger.
/// </summary>
/// <param name="propertyHandRig">The serialized property with the hand rig</param>
/// <param name="fingerField">The name of the finger field</param>
private void ClearFingerTransforms(SerializedProperty propertyHandRig, string fingerField)
{
propertyHandRig.FindPropertyRelative($"{fingerField}._metacarpal").objectReferenceValue = null;
propertyHandRig.FindPropertyRelative($"{fingerField}._proximal").objectReferenceValue = null;
propertyHandRig.FindPropertyRelative($"{fingerField}._intermediate").objectReferenceValue = null;
propertyHandRig.FindPropertyRelative($"{fingerField}._distal").objectReferenceValue = null;
}
#endregion
#region Private Types & Data
private GUIContent ContentHasAvatarSource => new GUIContent("Has Avatar Source", "Allows to specify an avatar that uses the same rig as this hand. It allows to bake avatar hand poses for controllers into the hand");
private GUIContent ContentAvatarPrefab => new GUIContent("Avatar Prefab", "Source avatar prefab with the same hand rig");
private GUIContent ContentAvatarHandSide => new GUIContent("Hand Side", "Which hand side it is");
private GUIContent ContentHandPose => new GUIContent("Hand Pose", "The hand pose from the avatar to bake into this hand");
private GUIContent ContentVariations => new GUIContent("Hand Variations", "Registers the different available hands and materials if there are any");
private GUIContent ContentHandRig => new GUIContent("Hand Rig", "The hand transforms");
private GUIContent ContentLoadRig => new GUIContent("Load Rig Data", "Loads the rig data from the avatar into the component");
private GUIContent ContentClearRig => new GUIContent("Clear Rig Data", "Clears all the hand rig references");
private GUIContent ContentBakePose => new GUIContent("Bake Pose into Hand", "Bakes the selected pose into the hand");
private GUIContent ContentThumb => new GUIContent("Thumb", "Thumb finger information");
private GUIContent ContentIndex => new GUIContent("Index", "Index finger information");
private GUIContent ContentMiddle => new GUIContent("Middle", "Middle finger information");
private GUIContent ContentRing => new GUIContent("Ring", "Ring finger information");
private GUIContent ContentLittle => new GUIContent("Little", "Little finger information");
private SerializedProperty _propertyHasAvatarSource;
private SerializedProperty _propertyAvatarPrefab;
private SerializedProperty _propertyAvatarHandSide;
private SerializedProperty _propertyHandPose;
private SerializedProperty _propertyVariations;
private SerializedProperty _propertyHandRig;
private SerializedProperty _propertyThumb;
private SerializedProperty _propertyIndex;
private SerializedProperty _propertyMiddle;
private SerializedProperty _propertyRing;
private SerializedProperty _propertyLittle;
private bool _foldoutPoseBaking = true;
private bool _foldoutHand = true;
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bf72a82057d7772449297ebf6cabe376
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: