Skip to content

Commit

Permalink
ci: release trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwim committed Feb 5, 2021
2 parents f733ec3 + 14c40d5 commit 4f2bc74
Show file tree
Hide file tree
Showing 69 changed files with 7,898 additions and 258 deletions.
5 changes: 5 additions & 0 deletions Editor/Innoactive.CreatorEditor.XRInteraction.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
"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"
}
],
"noEngineReferences": false
Expand Down
4 changes: 4 additions & 0 deletions Editor/Interaction/DirectInteractorEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ 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
21 changes: 20 additions & 1 deletion Editor/Interaction/InteractableObjectEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ internal class InteractableObjectEditor : Editor
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;
Expand Down Expand Up @@ -78,6 +82,10 @@ 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 @@ -101,9 +109,16 @@ private void OnEnable()
throwSmoothingCurveProperty = serializedObject.FindProperty("m_ThrowSmoothingCurve");
throwVelocityScaleProperty = serializedObject.FindProperty("m_ThrowVelocityScale");
throwAngularVelocityScaleProperty = serializedObject.FindProperty("m_ThrowAngularVelocityScale");
gravityOnDetachProperty = serializedObject.FindProperty("m_GravityOnDetach");
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");
Expand Down Expand Up @@ -154,6 +169,10 @@ public override void OnInspectorGUI()
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();

EditorGUILayout.PropertyField(movementTypeProperty, Tooltips.MovementType);
Expand Down
6 changes: 4 additions & 2 deletions Editor/Interaction/RayInteractorEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ 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 Down
26 changes: 0 additions & 26 deletions Editor/PackageDependencies/InputSystemChecker.cs

This file was deleted.

5 changes: 4 additions & 1 deletion Editor/PackageDependencies/XRInteractionPackageEnabler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
/// <summary>
/// Adds Unity's XR-Interaction-Toolkit package as a dependency and sets specified symbol for script compilation.
/// </summary>
public class XRInteractionPackageEnabler : Dependency
public class XRInteractionPackageEnabler : Dependency
{
/// <inheritdoc/>
public override string Package { get; } = "com.unity.xr.interaction.toolkit";

/// <inheritdoc/>
public override string[] Samples { get; } = { "Default Input Actions", "XR Device Simulator" };

/// <inheritdoc/>
public override int Priority { get; } = 4;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions Editor/SceneSetup/XRInteractionSceneSetup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using UnityEditor;
using UnityEngine;
using Innoactive.CreatorEditor.BasicInteraction;
using Innoactive.CreatorEditor.PackageManager.XRInteraction;

namespace Innoactive.CreatorEditor.XRInteraction
{
/// <summary>
/// Scene setup for XR-Interaction.
/// </summary>
public class XRInteractionSceneSetup : InteractionFrameworkSceneSetup
{
private const string Title = "Obsolete XR Ring detected";

/// <inheritdoc />
public override string Key { get; } = "XRInteractionSetup";

/// <inheritdoc />
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)
{
GameObject objectToDelete = GameObject.Find(objectName);

if (objectToDelete != null)
{
string message = $"Creator changed the XR Rig loading to a new dynamic system, you have a static {objectName} in the current scene, do you want to delete it?";

if (EditorUtility.DisplayDialog(Title, message, "Delete", "Skip"))
{
EditorUtility.SetDirty(objectToDelete);
Object.DestroyImmediate(objectToDelete);
}
}
}
}
}
File renamed without changes.
66 changes: 66 additions & 0 deletions Editor/SceneSetup/XRSimulatorImporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#if XRIT_1_0_OR_NEWER
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;

namespace Innoactive.CreatorEditor.PackageManager.XRInteraction
{
/// <summary>
/// Helper class to generate a new XR Simulator Rig out of the `[XR_Setup_Action_Based]` and the `XR Device Simulator` sample.
/// </summary>
internal class XRSimulatorImporter
{
public string SimulatorRigPath { get; } = null;

private const string SimulatorPathKey = "SimulatorRigPath";
private const string SamplePrefabName = "XR Device Simulator";
private const string ActionRigName = "[XR_Setup_Action_Based]";
private const string SimulatorPrefabName = "[XR_Setup_Simulator]";

public XRSimulatorImporter()
{
SimulatorRigPath = EditorPrefs.GetString(SimulatorPathKey);
}

/// <summary>
/// Imports a new `[XR_Setup_Simulator]` prefab based on the `[XR_Setup_Action_Based]` and the `XR Device Simulator` prefabs.
/// </summary>
/// <remarks>The generated prefab is imported into the `XR Interaction Component`’s `Resources` folder.</remarks>
public void ImportSimulatorRig()
{
GameObject simulator = LoadPrefab(SamplePrefabName, "Samples", out string simulatorRigPath);
GameObject actionRig = LoadPrefab(ActionRigName, "Innoactive", out string actionRigPath);

if (simulator == null || actionRig == null)
{
Debug.LogError($"{SimulatorPrefabName} could not be generated. {(simulator == null ? SamplePrefabName : ActionRigName)} is missing.");
return;
}

simulatorRigPath = $"{Path.GetDirectoryName(actionRigPath)}/{SimulatorPrefabName}.prefab";

simulator.transform.SetParent(actionRig.transform);
PrefabUtility.SaveAsPrefabAsset(actionRig, simulatorRigPath);

EditorPrefs.SetString(SimulatorPathKey, simulatorRigPath);
PrefabUtility.UnloadPrefabContents(simulator);
}

private GameObject LoadPrefab(string prefabName, string searchFolder, out string assetPath)
{
string filter = $"t:Prefab {prefabName}";
string prefabGUID = AssetDatabase.FindAssets(filter, new[] {$"Assets/{searchFolder}"}).FirstOrDefault();

if (string.IsNullOrEmpty(prefabGUID) == false)
{
assetPath = AssetDatabase.GUIDToAssetPath(prefabGUID);
return PrefabUtility.LoadPrefabContents(assetPath);
}

assetPath = string.Empty;
return null;
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions Editor/XRInteractionSceneSetup.cs

This file was deleted.

Loading

0 comments on commit 4f2bc74

Please sign in to comment.