Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component now uses XRIT at v1.0.0-pre.2 TRNG-1463 #89

Merged
merged 1 commit into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ExportedObj/
*.booproj
*.svd

# Creator generated files
*[XR_Setup_Simulator]*

# Unity3D generated meta files
*.pidb.meta
Expand Down
12 changes: 1 addition & 11 deletions Editor/Innoactive.CreatorEditor.XRInteraction.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,10 @@
"XR_INTERACTION_TOOLKIT"
],
"versionDefines": [
{
"name": "com.unity.xr.interaction.toolkit",
"expression": "",
"define": "XR_INTERACTION_TOOLKIT"
},
{
"name": "com.unity.xr.interaction.toolkit",
"expression": "0.10.0-preview",
"define": "XRIT_0_10_OR_NEWER"
},
{
"name": "com.unity.xr.interaction.toolkit",
"expression": "1.0.0-pre.2",
"define": "XRIT_1_0_OR_NEWER"
"define": "XR_INTERACTION_TOOLKIT"
}
],
"noEngineReferences": false
Expand Down
31 changes: 0 additions & 31 deletions Editor/Interaction/DirectInteractorEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ private void OnEnable()
precisionGrab = serializedObject.FindProperty("precisionGrab");
hideControllerOnSelect = serializedObject.FindProperty("m_HideControllerOnSelect");

#if XRIT_0_10_OR_NEWER
playAudioClipOnSelectEntered = serializedObject.FindProperty("m_PlayAudioClipOnSelectEntered");
audioClipForOnSelectEntered = serializedObject.FindProperty("m_AudioClipForOnSelectEntered");
playAudioClipOnSelectExited = serializedObject.FindProperty("m_PlayAudioClipOnSelectExited");
Expand All @@ -121,32 +120,6 @@ private void OnEnable()
onSelectExit = serializedObject.FindProperty("m_OnSelectExited");
onHoverEnter = serializedObject.FindProperty("m_OnHoverEntered");
onHoverExit = serializedObject.FindProperty("m_OnHoverExited");
#else
playAudioClipOnSelectEntered = serializedObject.FindProperty("m_PlayAudioClipOnSelectEnter");
audioClipForOnSelectEntered = serializedObject.FindProperty("m_AudioClipForOnSelectEnter");
playAudioClipOnSelectExited = serializedObject.FindProperty("m_PlayAudioClipOnSelectExit");
audioClipForOnSelectExited = serializedObject.FindProperty("m_AudioClipForOnSelectExit");
playAudioClipOnHoverEntered = serializedObject.FindProperty("m_PlayAudioClipOnHoverEnter");
audioClipForOnHoverEntered = serializedObject.FindProperty("m_AudioClipForOnHoverEnter");
playAudioClipOnHoverExited = serializedObject.FindProperty("m_PlayAudioClipOnHoverExit");
audioClipForOnHoverExited = serializedObject.FindProperty("m_AudioClipForOnHoverExit");
playHapticsOnSelectEntered = serializedObject.FindProperty("m_PlayHapticsOnSelectEnter");
hapticSelectEnterIntensity = serializedObject.FindProperty("m_HapticSelectEnterIntensity");
hapticSelectEnterDuration = serializedObject.FindProperty("m_HapticSelectEnterDuration");
playHapticsOnHoverEntered = serializedObject.FindProperty("m_PlayHapticsOnHoverEnter");
hapticHoverEnterIntensity = serializedObject.FindProperty("m_HapticHoverEnterIntensity");
hapticHoverEnterDuration = serializedObject.FindProperty("m_HapticHoverEnterDuration");
playHapticsOnSelectExited = serializedObject.FindProperty("m_PlayHapticsOnSelectExit");
hapticSelectExitIntensity = serializedObject.FindProperty("m_HapticSelectExitIntensity");
hapticSelectExitDuration = serializedObject.FindProperty("m_HapticSelectExitDuration");
playHapticsOnHoverExited = serializedObject.FindProperty("m_PlayHapticsOnHoverExit");
hapticHoverExitIntensity = serializedObject.FindProperty("m_HapticHoverExitIntensity");
hapticHoverExitDuration = serializedObject.FindProperty("m_HapticHoverExitDuration");
onSelectEnter = serializedObject.FindProperty("m_OnSelectEnter");
onSelectExit = serializedObject.FindProperty("m_OnSelectExit");
onHoverEnter = serializedObject.FindProperty("m_OnHoverEnter");
onHoverExit = serializedObject.FindProperty("m_OnHoverExit");
#endif
}

public override void OnInspectorGUI()
Expand All @@ -161,11 +134,7 @@ public override void OnInspectorGUI()
{
DirectInteractor interactor = (DirectInteractor)targetObject;

#if XRIT_0_10_OR_NEWER
if (interactor.GetComponent<XRController>() == null && interactor.GetComponent<ActionBasedController>() == null)
#else
if (interactor.GetComponent<XRController>() == null)
#endif
{
EditorGUILayout.HelpBox(Tooltips.MissingRequiredController, MessageType.Warning, true);
break;
Expand Down
30 changes: 0 additions & 30 deletions Editor/Interaction/InteractableObjectEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,16 @@ internal class InteractableObjectEditor : Editor
private SerializedProperty throwAngularVelocityScaleProperty;
private SerializedProperty gravityOnDetachProperty;
private SerializedProperty retainTransformParentProperty;

#if XRIT_1_0_OR_NEWER
private SerializedProperty customReticle;
#endif

private SerializedProperty onFirstHoverEntered;
private SerializedProperty onHoverEntered;
private SerializedProperty onHoverExited;
private SerializedProperty onLastHoverExited;
private SerializedProperty onSelectEntered;
private SerializedProperty onSelectExited;
#if XRIT_0_10_OR_NEWER
private SerializedProperty onSelectCanceled;
#endif
private SerializedProperty onActivateProperty;
private SerializedProperty onDeactivateProperty;

private SerializedProperty interactionManager;
private SerializedProperty collidersProperty;
private SerializedProperty interactionLayerMaskProperty;
Expand Down Expand Up @@ -82,10 +75,7 @@ private static class Tooltips
public static readonly GUIContent IsGrabbable = new GUIContent("Is Grabbable", "Determines if this Interactable Object can be grabbed.");
public static readonly GUIContent IsUsable = new GUIContent("Is Usable", "Determines if this Interactable Object can be used.");
public static readonly GUIContent HighlightOptions = new GUIContent("Enable Highlighting", "Adds an InteractableHighlighter component to this Interactable.");

#if XRIT_1_0_OR_NEWER
public static readonly GUIContent CustomReticle = EditorGUIUtility.TrTextContent("Custom Reticle", "The reticle that will appear at the end of the line when it is valid.");
#endif
}

private void OnEnable()
Expand All @@ -111,30 +101,15 @@ private void OnEnable()
throwAngularVelocityScaleProperty = serializedObject.FindProperty("m_ThrowAngularVelocityScale");
retainTransformParentProperty = serializedObject.FindProperty("m_RetainTransformParent");
interactionManager = serializedObject.FindProperty("m_InteractionManager");

#if XRIT_1_0_OR_NEWER
gravityOnDetachProperty = serializedObject.FindProperty("m_ForceGravityOnDetach");
customReticle = serializedObject.FindProperty("m_CustomReticle");
#else
gravityOnDetachProperty = serializedObject.FindProperty("m_GravityOnDetach");
#endif

#if XRIT_0_10_OR_NEWER
onFirstHoverEntered = serializedObject.FindProperty("m_OnFirstHoverEntered");
onHoverEntered = serializedObject.FindProperty("m_OnHoverEntered");
onHoverExited = serializedObject.FindProperty("m_OnHoverExited");
onLastHoverExited = serializedObject.FindProperty("m_OnLastHoverExited");
onSelectEntered = serializedObject.FindProperty("m_OnSelectEntered");
onSelectExited = serializedObject.FindProperty("m_OnSelectExited");
onSelectCanceled = serializedObject.FindProperty("m_OnSelectCanceled");
#else
onFirstHoverEntered = serializedObject.FindProperty("m_OnFirstHoverEnter");
onHoverEntered = serializedObject.FindProperty("m_OnHoverEnter");
onHoverExited = serializedObject.FindProperty("m_OnHoverExit");
onLastHoverExited = serializedObject.FindProperty("m_OnLastHoverExit");
onSelectEntered = serializedObject.FindProperty("m_OnSelectEnter");
onSelectExited = serializedObject.FindProperty("m_OnSelectExit");
#endif
onActivateProperty = serializedObject.FindProperty("m_OnActivate");
onDeactivateProperty = serializedObject.FindProperty("m_OnDeactivate");
collidersProperty = serializedObject.FindProperty("m_Colliders");
Expand Down Expand Up @@ -168,10 +143,7 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(interactionManager, Tooltips.InteractionManager);
EditorGUILayout.PropertyField(interactionLayerMaskProperty, Tooltips.InteractionLayerMask);
EditorGUILayout.PropertyField(collidersProperty, Tooltips.Colliders, true);

#if XRIT_1_0_OR_NEWER
EditorGUILayout.PropertyField(customReticle, Tooltips.CustomReticle);
#endif

EditorGUILayout.Space();

Expand Down Expand Up @@ -241,9 +213,7 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(onLastHoverExited);
EditorGUILayout.PropertyField(onSelectEntered);
EditorGUILayout.PropertyField(onSelectExited);
#if XRIT_0_10_OR_NEWER
EditorGUILayout.PropertyField(onSelectCanceled);
#endif
EditorGUILayout.PropertyField(onActivateProperty);
EditorGUILayout.PropertyField(onDeactivateProperty);
}
Expand Down
44 changes: 1 addition & 43 deletions Editor/Interaction/RayInteractorEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,11 @@ internal class RayInteractorEditor : Editor
private SerializedProperty onSelectEntered;
private SerializedProperty onSelectExited;

#if XRIT_0_10_OR_NEWER
private SerializedProperty keepSelectedTargetValid;
private SerializedProperty allowAnchorControl;
private SerializedProperty useForceGrab;
private SerializedProperty anchorRotateSpeed;
private SerializedProperty anchorTranslateSpeed;
#endif

// private bool showInteractorEvents;
// private bool showSoundEvents = false;
// private bool showHapticEvents = false;

private static class Tooltips
{
Expand Down Expand Up @@ -169,7 +163,6 @@ private void OnEnable()
acceleration = serializedObject.FindProperty("m_Acceleration");
additionalFlightTime = serializedObject.FindProperty("m_AdditionalFlightTime");

#if XRIT_0_10_OR_NEWER
keepSelectedTargetValid = serializedObject.FindProperty("m_KeepSelectedTargetValid");
allowAnchorControl = serializedObject.FindProperty("m_AllowAnchorControl");
useForceGrab = serializedObject.FindProperty("m_UseForceGrab");
Expand Down Expand Up @@ -202,34 +195,6 @@ private void OnEnable()
onHoverExited = serializedObject.FindProperty("m_OnHoverExited");
onSelectEntered = serializedObject.FindProperty("m_OnSelectEntered");
onSelectExited = serializedObject.FindProperty("m_OnSelectExited");
#else
playAudioClipOnSelectEntered = serializedObject.FindProperty("m_PlayAudioClipOnSelectEnter");
audioClipForOnSelectEntered = serializedObject.FindProperty("m_AudioClipForOnSelectEnter");
playAudioClipOnSelectExited = serializedObject.FindProperty("m_PlayAudioClipOnSelectExit");
audioClipForOnSelectExited = serializedObject.FindProperty("m_AudioClipForOnSelectExit");
playAudioClipOnHoverEntered = serializedObject.FindProperty("m_PlayAudioClipOnHoverEnter");
audioClipForOnHoverEntered = serializedObject.FindProperty("m_AudioClipForOnHoverEnter");
playAudioClipOnHoverExited = serializedObject.FindProperty("m_PlayAudioClipOnHoverExit");
audioClipForOnHoverExited = serializedObject.FindProperty("m_AudioClipForOnHoverExit");
playHapticsOnSelectEntered = serializedObject.FindProperty("m_PlayHapticsOnSelectEnter");

hapticSelectEnterIntensity = serializedObject.FindProperty("m_HapticSelectEnterIntensity");
hapticSelectEnterDuration = serializedObject.FindProperty("m_HapticSelectEnterDuration");
playHapticsOnHoverEntered = serializedObject.FindProperty("m_PlayHapticsOnHoverEnter");
hapticHoverEnterIntensity = serializedObject.FindProperty("m_HapticHoverEnterIntensity");
hapticHoverEnterDuration = serializedObject.FindProperty("m_HapticHoverEnterDuration");
playHapticsOnSelectExited = serializedObject.FindProperty("m_PlayHapticsOnSelectExit");
hapticSelectExitIntensity = serializedObject.FindProperty("m_HapticSelectExitIntensity");
hapticSelectExitDuration = serializedObject.FindProperty("m_HapticSelectExitDuration");
playHapticsOnHoverExited = serializedObject.FindProperty("m_PlayHapticsOnHoverExit");
hapticHoverExitIntensity = serializedObject.FindProperty("m_HapticHoverExitIntensity");
hapticHoverExitDuration = serializedObject.FindProperty("m_HapticHoverExitDuration");

onHoverEntered = serializedObject.FindProperty("m_OnHoverEnter");
onHoverExited = serializedObject.FindProperty("m_OnHoverExit");
onSelectEntered = serializedObject.FindProperty("m_OnSelectEnter");
onSelectExited = serializedObject.FindProperty("m_OnSelectExit");
#endif
}

public override void OnInspectorGUI()
Expand All @@ -243,11 +208,8 @@ public override void OnInspectorGUI()
foreach (Object targetObject in serializedObject.targetObjects)
{
RayInteractor interactor = (RayInteractor)targetObject;
#if XRIT_0_10_OR_NEWER
if (interactor.GetComponent<XRController>() == null && interactor.GetComponent<ActionBasedController>() == null)
#else
if (interactor.GetComponent<XRController>() == null)
#endif
{
EditorGUILayout.HelpBox(Tooltips.MissingRequiredController, MessageType.Warning, true);
break;
Expand All @@ -261,7 +223,6 @@ public override void OnInspectorGUI()

EditorGUILayout.PropertyField(enableUIInteraction, Tooltips.EnableUIInteraction);

#if XRIT_0_10_OR_NEWER
EditorGUILayout.PropertyField(useForceGrab, Tooltips.ForceGrab);
EditorGUILayout.PropertyField(allowAnchorControl, Tooltips.AllowAnchorControl);

Expand All @@ -272,7 +233,6 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(anchorTranslateSpeed, Tooltips.AnchorTranslateSpeed);
EditorGUI.indentLevel--;
}
#endif

EditorGUILayout.PropertyField(attachTransform, Tooltips.AttachTransform);

Expand Down Expand Up @@ -338,9 +298,7 @@ public override void OnInspectorGUI()
EditorGUILayout.HelpBox(Tooltips.StartingInteractableWarning, MessageType.Warning, true);
}

#if XRIT_0_10_OR_NEWER
EditorGUILayout.PropertyField(keepSelectedTargetValid, Tooltips.KeepSelectedTargetValid);
#endif
EditorGUILayout.PropertyField(hideControllerOnSelect, Tooltips.HideControllerOnSelect);
EditorGUILayout.PropertyField(hoverToSelect, Tooltips.HoverToSelect);

Expand Down
7 changes: 0 additions & 7 deletions Editor/Interaction/SnapZoneEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,10 @@ private void OnEnable()

interactableHoverMeshMaterial = serializedObject.FindProperty("validationMaterial");

#if XRIT_0_10_OR_NEWER
onHoverEntered = serializedObject.FindProperty("m_OnHoverEntered");
onHoverExited = serializedObject.FindProperty("m_OnHoverExited");
onSelectEntered = serializedObject.FindProperty("m_OnSelectEntered");
onSelectExited = serializedObject.FindProperty("m_OnSelectExited");
#else
onHoverEntered = serializedObject.FindProperty("m_OnHoverEnter");
onHoverExited = serializedObject.FindProperty("m_OnHoverExit");
onSelectEntered = serializedObject.FindProperty("m_OnSelectEnter");
onSelectExited = serializedObject.FindProperty("m_OnSelectExit");
#endif
}

public override void OnInspectorGUI()
Expand Down
3 changes: 3 additions & 0 deletions Editor/PackageDependencies/XRInteractionPackageEnabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public class XRInteractionPackageEnabler : Dependency
{
/// <inheritdoc/>
public override string Package { get; } = "com.unity.xr.interaction.toolkit";

/// <inheritdoc/>
public override string Version { get; internal set; } = "1.0.0-pre.2";

/// <inheritdoc/>
public override string[] Samples { get; } = { "Default Input Actions", "XR Device Simulator" };
Expand Down
2 changes: 0 additions & 2 deletions Editor/SceneSetup/XRInteractionSceneSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ public override void Setup()
{
DeleteStaticObject("[XR_Setup]");

#if XRIT_1_0_OR_NEWER
XRSimulatorImporter simulatorImporter = new XRSimulatorImporter();

if (string.IsNullOrEmpty(simulatorImporter.SimulatorRigPath) || AssetDatabase.GetMainAssetTypeAtPath(simulatorImporter.SimulatorRigPath) == null)
{
simulatorImporter.ImportSimulatorRig();
}
#endif
}

private void DeleteStaticObject(string objectName)
Expand Down
4 changes: 1 addition & 3 deletions Editor/SceneSetup/XRSimulatorImporter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if XRIT_1_0_OR_NEWER
using System.IO;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -63,4 +62,3 @@ private GameObject LoadPrefab(string prefabName, string searchFolder, out string
}
}
}
#endif
4 changes: 0 additions & 4 deletions Editor/SnapZone/SnapZoneSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ public class SnapZoneSettings : SettingsObject<SnapZoneSettings>
/// </summary>
public void ApplySettingsToSnapZone(SnapZone snapZone)
{
#if XRIT_0_10_OR_NEWER
snapZone.interactionLayerMask = InteractionLayerMask;
#else
snapZone.InteractionLayerMask = InteractionLayerMask;
#endif
snapZone.ShownHighlightObjectColor = HighlightColor;
snapZone.ValidationMaterial = ValidationMaterial;
snapZone.InvalidMaterial = InvalidMaterial;
Expand Down
12 changes: 1 addition & 11 deletions Runtime/Innoactive.Creator.XRInteraction.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,10 @@
"XR_INTERACTION_TOOLKIT"
],
"versionDefines": [
{
"name": "com.unity.xr.interaction.toolkit",
"expression": "",
"define": "XR_INTERACTION_TOOLKIT"
},
{
"name": "com.unity.xr.interaction.toolkit",
"expression": "0.10.0-preview",
"define": "XRIT_0_10_OR_NEWER"
},
{
"name": "com.unity.xr.interaction.toolkit",
"expression": "1.0.0-pre.2",
"define": "XRIT_1_0_OR_NEWER"
"define": "XR_INTERACTION_TOOLKIT"
}
],
"noEngineReferences": false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if XRIT_0_10_OR_NEWER
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
Expand Down Expand Up @@ -786,5 +785,4 @@ private InputAction GetInputAction(InputActionReference actionReference)
return actionReference != null ? actionReference.action : null;
}
}
}
#endif
}
4 changes: 1 addition & 3 deletions Runtime/Interaction/Action-based/LocomotionSchemeManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if XRIT_0_10_OR_NEWER
using System;
using System;
using System.ComponentModel;
using System.Collections.Generic;
using UnityEngine;
Expand Down Expand Up @@ -546,4 +545,3 @@ private void ClearBindingMasks()
}
}
}
#endif
Loading