Add ultimate xr
This commit is contained in:
8
Assets/UltimateXR/Editor/UI/Helpers.meta
Normal file
8
Assets/UltimateXR/Editor/UI/Helpers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe26366e2f1d6074d8bac9e0cd4d0b49
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/UltimateXR/Editor/UI/Helpers/Keyboard.meta
Normal file
8
Assets/UltimateXR/Editor/UI/Helpers/Keyboard.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9535326fc699b343aed9c06e078081f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,116 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrKeyboardKeyEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.UI.Helpers.Keyboard;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UltimateXR.Editor.UI.Helpers.Keyboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom inspector for <see cref="UxrKeyboardKeyEditor" />.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrKeyboardKeyUI))]
|
||||
[CanEditMultipleObjects]
|
||||
public class UxrKeyboardKeyEditor : UnityEditor.Editor
|
||||
{
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Caches the serialized properties.
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
_propertyKeyType = serializedObject.FindProperty("_keyType");
|
||||
_propertyLayout = serializedObject.FindProperty("_layout");
|
||||
_propertyPrintShift = serializedObject.FindProperty("_printShift");
|
||||
_propertyPrintNoShift = serializedObject.FindProperty("_printNoShift");
|
||||
_propertyPrintAltGr = serializedObject.FindProperty("_printAltGr");
|
||||
_propertyForceLabel = serializedObject.FindProperty("_forceLabel");
|
||||
_propertySingleLayoutValue = serializedObject.FindProperty("_singleLayoutValue");
|
||||
_propertyMultipleLayoutValueTopLeft = serializedObject.FindProperty("_multipleLayoutValueTopLeft");
|
||||
_propertyMultipleLayoutValueBottomLeft = serializedObject.FindProperty("_multipleLayoutValueBottomLeft");
|
||||
_propertyMultipleLayoutValueBottomRight = serializedObject.FindProperty("_multipleLayoutValueBottomRight");
|
||||
_propertyToggleSymbols = serializedObject.FindProperty("_toggleSymbols");
|
||||
_propertyNameDirty = serializedObject.FindProperty("_nameDirty");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the inspector and handles user input.
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyFieldWithChangeCheck(_propertyKeyType);
|
||||
|
||||
if (_propertyKeyType.enumValueIndex == (int)UxrKeyType.Printable)
|
||||
{
|
||||
PropertyFieldWithChangeCheck(_propertyLayout);
|
||||
PropertyFieldWithChangeCheck(_propertyPrintShift);
|
||||
PropertyFieldWithChangeCheck(_propertyPrintNoShift);
|
||||
PropertyFieldWithChangeCheck(_propertyPrintAltGr);
|
||||
}
|
||||
|
||||
PropertyFieldWithChangeCheck(_propertyForceLabel);
|
||||
|
||||
if (_propertyKeyType.enumValueIndex == (int)UxrKeyType.Printable)
|
||||
{
|
||||
PropertyFieldWithChangeCheck(_propertySingleLayoutValue);
|
||||
PropertyFieldWithChangeCheck(_propertyMultipleLayoutValueTopLeft);
|
||||
PropertyFieldWithChangeCheck(_propertyMultipleLayoutValueBottomLeft);
|
||||
PropertyFieldWithChangeCheck(_propertyMultipleLayoutValueBottomRight);
|
||||
}
|
||||
|
||||
if (_propertyKeyType.enumValueIndex == (int)UxrKeyType.ToggleSymbols)
|
||||
{
|
||||
PropertyFieldWithChangeCheck(_propertyToggleSymbols);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Draws the serialized property field and sets a dirty flag when the value changed. The dirty flag will tell the
|
||||
/// <see cref="UxrKeyboardKeyUI" /> component that it should check whether to update the GameObject's name based the
|
||||
/// function assigned to the key. This is because in order to handle the edition of many keys it comes in handy to
|
||||
/// handle the object naming automatically based on the key's function.
|
||||
/// </summary>
|
||||
/// <param name="serializedProperty">Serialized property to process</param>
|
||||
private void PropertyFieldWithChangeCheck(SerializedProperty serializedProperty)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(serializedProperty, true);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
_propertyNameDirty.boolValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private SerializedProperty _propertyKeyType;
|
||||
private SerializedProperty _propertyLayout;
|
||||
private SerializedProperty _propertyPrintShift;
|
||||
private SerializedProperty _propertyPrintNoShift;
|
||||
private SerializedProperty _propertyPrintAltGr;
|
||||
private SerializedProperty _propertyForceLabel;
|
||||
private SerializedProperty _propertySingleLayoutValue;
|
||||
private SerializedProperty _propertyMultipleLayoutValueTopLeft;
|
||||
private SerializedProperty _propertyMultipleLayoutValueBottomLeft;
|
||||
private SerializedProperty _propertyMultipleLayoutValueBottomRight;
|
||||
private SerializedProperty _propertyToggleSymbols;
|
||||
private SerializedProperty _propertyNameDirty;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3daa98234f962a740981af929f95ff73
|
||||
timeCreated: 1512393115
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/UltimateXR/Editor/UI/UnityInputModule.meta
Normal file
8
Assets/UltimateXR/Editor/UI/UnityInputModule.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: beb7a7b38ea317841a310594eb12eed5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7f094b068f7f7f458fdc6709ef403cd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrControlInputEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.UI.UnityInputModule.Controls;
|
||||
using UnityEditor;
|
||||
using UnityEditor.EventSystems;
|
||||
|
||||
namespace UltimateXR.Editor.UI.UnityInputModule.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom inspector for <see cref="UxrControlInput" />. Needs to inherit from <see cref="EventTriggerEditor" />
|
||||
/// because <see cref="UxrControlInput" /> is an EventTrigger-derived component.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrControlInput))]
|
||||
[CanEditMultipleObjects]
|
||||
public class UxrControlInputEditor : EventTriggerEditor
|
||||
{
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Caches the serialized properties.
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
_propertyPressAndHoldDuration = serializedObject.FindProperty("_pressAndHoldDuration");
|
||||
_propertyFeedbackOnDown = serializedObject.FindProperty("_feedbackOnPress");
|
||||
_propertyFeedbackOnUp = serializedObject.FindProperty("_feedbackOnRelease");
|
||||
_propertyFeedbackOnClick = serializedObject.FindProperty("_feedbackOnClick");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the custom inspector, including the one implemented in child classes.
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.PropertyField(_propertyPressAndHoldDuration);
|
||||
EditorGUILayout.PropertyField(_propertyFeedbackOnDown, true);
|
||||
EditorGUILayout.PropertyField(_propertyFeedbackOnUp, true);
|
||||
EditorGUILayout.PropertyField(_propertyFeedbackOnClick, true);
|
||||
|
||||
// Child properties
|
||||
OnControlInputInspectorGUI();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Trigger Methods
|
||||
|
||||
/// <summary>
|
||||
/// Overridable method to draw child properties.
|
||||
/// </summary>
|
||||
protected virtual void OnControlInputInspectorGUI()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private SerializedProperty _propertyPressAndHoldDuration;
|
||||
private SerializedProperty _propertyFeedbackOnDown;
|
||||
private SerializedProperty _propertyFeedbackOnUp;
|
||||
private SerializedProperty _propertyFeedbackOnClick;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a21a128a44df5346945162cd1609436
|
||||
timeCreated: 1471503516
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrToggleControlInputEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.UI.UnityInputModule.Controls;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UltimateXR.Editor.UI.UnityInputModule.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom inspector for <see cref="UxrToggleControlInput" />. Needs to inherit from
|
||||
/// <see cref="UxrControlInputEditor" />.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrToggleControlInput))]
|
||||
[CanEditMultipleObjects]
|
||||
public class UxrToggleControlInputEditor : UxrControlInputEditor
|
||||
{
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Caches serialized properties.
|
||||
/// </summary>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
_propertyInitialState = serializedObject.FindProperty("_initialState");
|
||||
_propertyCanToggleOnlyOnce = serializedObject.FindProperty("_canToggleOnlyOnce");
|
||||
_propertyText = serializedObject.FindProperty("_text");
|
||||
_propertyEnableWhenSelected = serializedObject.FindProperty("_enableWhenSelected");
|
||||
_propertyEnableWhenNotSelected = serializedObject.FindProperty("_enableWhenNotSelected");
|
||||
_propertyTextColorChanges = serializedObject.FindProperty("_textColorChanges");
|
||||
_propertyAudioToggleOn = serializedObject.FindProperty("_audioToggleOn");
|
||||
_propertyAudioToggleOff = serializedObject.FindProperty("_audioToggleOff");
|
||||
_propertyAudioToggleOnVolume = serializedObject.FindProperty("_audioToggleOnVolume");
|
||||
_propertyAudioToggleOffVolume = serializedObject.FindProperty("_audioToggleOffVolume");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Trigger Methods
|
||||
|
||||
/// <summary>
|
||||
/// Draws the inspector for the child properties.
|
||||
/// </summary>
|
||||
protected override void OnControlInputInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyInitialState);
|
||||
EditorGUILayout.PropertyField(_propertyCanToggleOnlyOnce);
|
||||
EditorGUILayout.PropertyField(_propertyText);
|
||||
EditorGUILayout.PropertyField(_propertyEnableWhenSelected);
|
||||
EditorGUILayout.PropertyField(_propertyEnableWhenNotSelected);
|
||||
EditorGUILayout.PropertyField(_propertyTextColorChanges);
|
||||
EditorGUILayout.PropertyField(_propertyAudioToggleOn);
|
||||
EditorGUILayout.PropertyField(_propertyAudioToggleOff);
|
||||
EditorGUILayout.PropertyField(_propertyAudioToggleOnVolume);
|
||||
EditorGUILayout.PropertyField(_propertyAudioToggleOffVolume);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private SerializedProperty _propertyInitialState;
|
||||
private SerializedProperty _propertyCanToggleOnlyOnce;
|
||||
private SerializedProperty _propertyText;
|
||||
private SerializedProperty _propertyEnableWhenSelected;
|
||||
private SerializedProperty _propertyEnableWhenNotSelected;
|
||||
private SerializedProperty _propertyTextColorChanges;
|
||||
private SerializedProperty _propertyAudioToggleOn;
|
||||
private SerializedProperty _propertyAudioToggleOff;
|
||||
private SerializedProperty _propertyAudioToggleOnVolume;
|
||||
private SerializedProperty _propertyAudioToggleOffVolume;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80b9dd85d5e8ab9458846b02721a9c86
|
||||
timeCreated: 1471503516
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrCanvasEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.UI.UnityInputModule;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UltimateXR.Editor.UI.UnityInputModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom inspector for <see cref="UxrCanvas" />.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrCanvas))]
|
||||
public class UxrCanvasEditor : UnityEditor.Editor
|
||||
{
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Caches the serialized properties.
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
_propertyInteractionType = serializedObject.FindProperty("_interactionType");
|
||||
_propertyFingerTipMinHoverDistance = serializedObject.FindProperty("_fingerTipMinHoverDistance");
|
||||
_propertyAutoEnableLaserPointer = serializedObject.FindProperty("_autoEnableLaserPointer");
|
||||
_propertyAutoEnableDistance = serializedObject.FindProperty("_autoEnableDistance");
|
||||
_propertyAllowLeftHand = serializedObject.FindProperty("_allowLeftHand");
|
||||
_propertyAllowRightHand = serializedObject.FindProperty("_allowRightHand");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the custom inspector and handles input.
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.PropertyField(_propertyInteractionType);
|
||||
|
||||
if (_propertyInteractionType.enumNames[_propertyInteractionType.enumValueIndex] == UxrInteractionType.FingerTips.ToString())
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyFingerTipMinHoverDistance);
|
||||
}
|
||||
if (_propertyInteractionType.enumNames[_propertyInteractionType.enumValueIndex] == UxrInteractionType.LaserPointers.ToString())
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyAutoEnableLaserPointer);
|
||||
EditorGUILayout.PropertyField(_propertyAutoEnableDistance);
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(_propertyAllowLeftHand);
|
||||
EditorGUILayout.PropertyField(_propertyAllowRightHand);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private SerializedProperty _propertyInteractionType;
|
||||
private SerializedProperty _propertyFingerTipMinHoverDistance;
|
||||
private SerializedProperty _propertyAutoEnableLaserPointer;
|
||||
private SerializedProperty _propertyAutoEnableDistance;
|
||||
private SerializedProperty _propertyAllowLeftHand;
|
||||
private SerializedProperty _propertyAllowRightHand;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c8ae3ce172e6cc4abf198111709d0ef
|
||||
timeCreated: 1512388722
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/UltimateXR/Editor/UI/UxrCameraPointerEditor.cs
Normal file
56
Assets/UltimateXR/Editor/UI/UxrCameraPointerEditor.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrCameraPointerEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.UI;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UltimateXR.Editor.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialized property for <see cref="UxrCameraPointer" />.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrCameraPointer))]
|
||||
public class UxrCameraPointerEditor : UnityEditor.Editor
|
||||
{
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Caches the serialized properties.
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
_propertyRayLength = serializedObject.FindProperty("_rayLength");
|
||||
_propertyCrosshair = serializedObject.FindProperty("_crosshair");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the custom inspector and handles user input.
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(_propertyRayLength, ContentRayLength);
|
||||
EditorGUILayout.PropertyField(_propertyCrosshair, ContentCrosshair);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private GUIContent ContentRayLength { get; } = new GUIContent("Ray Length", "Length of the raycast in units");
|
||||
private GUIContent ContentCrosshair { get; } = new GUIContent("Crosshair", "Optional crosshair object. This will allow the component to disable its colliders if there are any.");
|
||||
|
||||
private SerializedProperty _propertyRayLength;
|
||||
private SerializedProperty _propertyCrosshair;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
13
Assets/UltimateXR/Editor/UI/UxrCameraPointerEditor.cs.meta
Normal file
13
Assets/UltimateXR/Editor/UI/UxrCameraPointerEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 283fee6f9ad74284ea58489a7de867ed
|
||||
timeCreated: 1521403290
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
163
Assets/UltimateXR/Editor/UI/UxrLaserPointerEditor.cs
Normal file
163
Assets/UltimateXR/Editor/UI/UxrLaserPointerEditor.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrLaserPointerEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.Extensions.System.Math;
|
||||
using UltimateXR.UI;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UltimateXR.Editor.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom inspector for <see cref="UxrLaserPointer" />.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrLaserPointer))]
|
||||
[CanEditMultipleObjects]
|
||||
public class UxrLaserPointerEditor : UnityEditor.Editor
|
||||
{
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Caches the serialized properties.
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
// General parameters
|
||||
_propertyHandSide = serializedObject.FindProperty("_handSide");
|
||||
_propertyUseControllerForward = serializedObject.FindProperty("_useControllerForward");
|
||||
|
||||
// Interaction
|
||||
_propertyTargetTypes = serializedObject.FindProperty("_targetTypes");
|
||||
_propertyBlockingMask = serializedObject.FindProperty("_blockingMask");
|
||||
_propertyTriggerCollidersInteraction = serializedObject.FindProperty("_triggerCollidersInteraction");
|
||||
|
||||
// Input parameters
|
||||
_propertyClickInput = serializedObject.FindProperty("_clickInput");
|
||||
_propertyShowLaserInput = serializedObject.FindProperty("_showLaserInput");
|
||||
_propertyShowLaserButtonEvent = serializedObject.FindProperty("_showLaserButtonEvent");
|
||||
|
||||
// Laser appearance
|
||||
_propertyInvisible = serializedObject.FindProperty("_invisible");
|
||||
_propertyRayLength = serializedObject.FindProperty("_rayLength");
|
||||
_propertyRayWidth = serializedObject.FindProperty("_rayWidth");
|
||||
_propertyRayColorInteractive = serializedObject.FindProperty("_rayColorInteractive");
|
||||
_propertyRayColorNonInteractive = serializedObject.FindProperty("_rayColorNonInteractive");
|
||||
_propertyRayHitMaterial = serializedObject.FindProperty("_rayHitMaterial");
|
||||
_propertyRayHitSize = serializedObject.FindProperty("_rayHitSize");
|
||||
_propertyOptionalEnableWhenLaserOn = serializedObject.FindProperty("_optionalEnableWhenLaserOn");
|
||||
|
||||
if (_propertyRayHitMaterial.objectReferenceValue == null)
|
||||
{
|
||||
string laserDotMaterialAssetPath = AssetDatabase.GUIDToAssetPath(LaserDotMaterialGuid);
|
||||
|
||||
if (!string.IsNullOrEmpty(laserDotMaterialAssetPath))
|
||||
{
|
||||
Material dotMaterial = AssetDatabase.LoadAssetAtPath<Material>(laserDotMaterialAssetPath);
|
||||
_propertyRayHitMaterial.objectReferenceValue = dotMaterial;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the UI and gathers user input.
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
_foldoutGeneral = UxrEditorUtils.FoldoutStylish("General", _foldoutGeneral);
|
||||
|
||||
if (_foldoutGeneral)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyHandSide, new GUIContent("Hand", "Selects which controller will be used to control the laser"));
|
||||
EditorGUILayout.PropertyField(_propertyUseControllerForward, new GUIContent("Use Controller Forward", "When the avatar is rendered in controllers mode, whether to use the controller's forward vector instead of the GameObject's forward vector for the laser direction"));
|
||||
}
|
||||
|
||||
_foldoutInteraction = UxrEditorUtils.FoldoutStylish("Interaction", _foldoutInteraction);
|
||||
|
||||
if (_foldoutInteraction)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyTargetTypes, new GUIContent("Target Types", "Selects which target types the laser pointer will interact with"));
|
||||
|
||||
if (_propertyTargetTypes.intValue.HasFlags((int)UxrLaserPointerTargetTypes.Colliders3D))
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyTriggerCollidersInteraction, new GUIContent("Trigger Colliders Interaction", "Whether colliders with the trigger property set will interact with the laser pointer"));
|
||||
}
|
||||
|
||||
if (_propertyTargetTypes.intValue.HasFlags((int)UxrLaserPointerTargetTypes.Colliders2D) ||
|
||||
_propertyTargetTypes.intValue.HasFlags((int)UxrLaserPointerTargetTypes.Colliders3D))
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyBlockingMask, new GUIContent("Blocking Mask", "Which layers will block the laser pointer for 2D/3D GameObjects"));
|
||||
}
|
||||
}
|
||||
|
||||
_foldoutInput = UxrEditorUtils.FoldoutStylish("Input", _foldoutInput);
|
||||
|
||||
if (_foldoutInput)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyClickInput, new GUIContent("Click Input", "Tells which controller button will be used to perform clicks on UI elements"));
|
||||
EditorGUILayout.PropertyField(_propertyShowLaserInput, new GUIContent("Enable Laser Input", "Selects which controller button will be used to enable the laser"));
|
||||
EditorGUILayout.PropertyField(_propertyShowLaserButtonEvent, new GUIContent("Enable Laser Button Event", "Tells which controller button input event will be needed to enable the laser"));
|
||||
}
|
||||
|
||||
_foldoutAppearance = UxrEditorUtils.FoldoutStylish("Appearance", _foldoutAppearance);
|
||||
|
||||
if (_foldoutAppearance)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyInvisible, new GUIContent("Invisible", "Whether not to render the ray but still perform raycasts and interaction"));
|
||||
|
||||
if (_propertyInvisible.boolValue == false)
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyRayLength, new GUIContent("Ray Length", "Laser ray length"));
|
||||
EditorGUILayout.PropertyField(_propertyRayWidth, new GUIContent("Ray Width", "Laser ray width"));
|
||||
EditorGUILayout.PropertyField(_propertyRayColorInteractive, new GUIContent("Ray Color Interactive", "Laser color when hovering over interactive UI elements"));
|
||||
EditorGUILayout.PropertyField(_propertyRayColorNonInteractive, new GUIContent("Ray Color Non-Interactive", "Laser color when hovering over non-interactive UI elements"));
|
||||
EditorGUILayout.PropertyField(_propertyRayHitMaterial, new GUIContent("Ray Hit Material", "Material that will be used to render the quad representing the hit with the scenario or UI elements"));
|
||||
EditorGUILayout.PropertyField(_propertyRayHitSize, new GUIContent("Ray Hit Size", "Size of the quad representing the hit with the scenario or UI elements"));
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(_propertyOptionalEnableWhenLaserOn, new GUIContent("Optionally Enable Object", "Optional additional object that will be enabled/disabled at the same time the laser is enabled or disabled"));
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private const string LaserDotMaterialGuid = "5796fb89729c636469d8bd446231c1a0";
|
||||
|
||||
private SerializedProperty _propertyHandSide;
|
||||
private SerializedProperty _propertyUseControllerForward;
|
||||
|
||||
private SerializedProperty _propertyTargetTypes;
|
||||
private SerializedProperty _propertyBlockingMask;
|
||||
private SerializedProperty _propertyTriggerCollidersInteraction;
|
||||
|
||||
private SerializedProperty _propertyClickInput;
|
||||
private SerializedProperty _propertyShowLaserInput;
|
||||
private SerializedProperty _propertyShowLaserButtonEvent;
|
||||
|
||||
private SerializedProperty _propertyInvisible;
|
||||
private SerializedProperty _propertyRayLength;
|
||||
private SerializedProperty _propertyRayWidth;
|
||||
private SerializedProperty _propertyRayColorInteractive;
|
||||
private SerializedProperty _propertyRayColorNonInteractive;
|
||||
private SerializedProperty _propertyRayHitMaterial;
|
||||
private SerializedProperty _propertyRayHitSize;
|
||||
private SerializedProperty _propertyOptionalEnableWhenLaserOn;
|
||||
|
||||
private bool _foldoutGeneral = true;
|
||||
private bool _foldoutInteraction = true;
|
||||
private bool _foldoutInput = true;
|
||||
private bool _foldoutAppearance = true;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
13
Assets/UltimateXR/Editor/UI/UxrLaserPointerEditor.cs.meta
Normal file
13
Assets/UltimateXR/Editor/UI/UxrLaserPointerEditor.cs.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d442b3ab85ab085459856cd00195b343
|
||||
timeCreated: 1521403290
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
Assets/UltimateXR/Editor/UI/UxrPointerInputModuleEditor.cs
Normal file
73
Assets/UltimateXR/Editor/UI/UxrPointerInputModuleEditor.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrPointerInputModuleEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.UI.UnityInputModule;
|
||||
using UnityEditor;
|
||||
|
||||
namespace UltimateXR.Editor.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom editor for <see cref="UxrPointerInputModule" />.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrPointerInputModule))]
|
||||
public class UxrPointerInputModuleEditor : UnityEditor.Editor
|
||||
{
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Caches the serialized properties.
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
_propertyDisableOtherInputModules = serializedObject.FindProperty("_disableOtherInputModules");
|
||||
_propertyAutoEnableOnWorldCanvases = serializedObject.FindProperty("_autoEnableOnWorldCanvases");
|
||||
_propertyAutoAssignEventCamera = serializedObject.FindProperty("_autoAssignEventCamera");
|
||||
_propertyInteractionTypeOnAutoEnable = serializedObject.FindProperty("_interactionTypeOnAutoEnable");
|
||||
_propertyFingerTipMinHoverDistance = serializedObject.FindProperty("_fingerTipMinHoverDistance");
|
||||
_propertyDragThreshold = serializedObject.FindProperty("_dragThreshold");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the custom inspector to show additional help.
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.HelpBox("If Auto Enable World Canvases is enabled below, the input module will automatically enable VR interaction on world-space canvases that have not been manually set up by adding them a UxrCanvas component.\n\n" +
|
||||
"Two types of interaction are supported: finger tips, where the user will be able to interact with the elements by touching them with the hands, and laser pointers, where the user will be able to interact with the elements by pointing at them with a laser and pressing a controller button.",
|
||||
MessageType.Info);
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(_propertyDisableOtherInputModules);
|
||||
EditorGUILayout.PropertyField(_propertyAutoEnableOnWorldCanvases);
|
||||
EditorGUILayout.PropertyField(_propertyAutoAssignEventCamera);
|
||||
EditorGUILayout.PropertyField(_propertyInteractionTypeOnAutoEnable);
|
||||
|
||||
if (_propertyInteractionTypeOnAutoEnable.enumNames[_propertyInteractionTypeOnAutoEnable.enumValueIndex] == UxrInteractionType.FingerTips.ToString())
|
||||
{
|
||||
EditorGUILayout.PropertyField(_propertyFingerTipMinHoverDistance);
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(_propertyDragThreshold);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private SerializedProperty _propertyDisableOtherInputModules;
|
||||
private SerializedProperty _propertyAutoEnableOnWorldCanvases;
|
||||
private SerializedProperty _propertyAutoAssignEventCamera;
|
||||
private SerializedProperty _propertyInteractionTypeOnAutoEnable;
|
||||
private SerializedProperty _propertyFingerTipMinHoverDistance;
|
||||
private SerializedProperty _propertyDragThreshold;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da603cfe21b5bae429f1beeeb06b4c02
|
||||
timeCreated: 1505237288
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user