-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JointFollower data set with datum properties
- Loading branch information
1 parent
e9e949c
commit 6379889
Showing
14 changed files
with
179 additions
and
104 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using UnityEditor; | ||
using ubco.ovilab.HPUI.Tracking; | ||
using UnityEngine; | ||
|
||
namespace ubco.ovilab.HPUI.Editor | ||
{ | ||
[CustomPropertyDrawer(typeof(JointFollowerData))] | ||
public class JointFollowerDataPropertyDrawer : PropertyDrawer | ||
{ | ||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
{ | ||
EditorGUI.BeginProperty(position, label, property); | ||
|
||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); | ||
|
||
EditorGUI.indentLevel++; | ||
|
||
EditorGUILayout.PropertyField(property.FindPropertyRelative("handedness")); | ||
EditorGUILayout.PropertyField(property.FindPropertyRelative("jointID")); | ||
SerializedProperty useSecondJointIDProp = property.FindPropertyRelative("useSecondJointID"); | ||
EditorGUILayout.PropertyField(useSecondJointIDProp); | ||
bool guiEnabled = GUI.enabled; | ||
GUI.enabled = useSecondJointIDProp.boolValue; | ||
EditorGUILayout.PropertyField(property.FindPropertyRelative("secondJointID")); | ||
GUI.enabled = guiEnabled; | ||
EditorGUILayout.PropertyField(property.FindPropertyRelative("defaultJointRadius")); | ||
EditorGUILayout.PropertyField(property.FindPropertyRelative("offsetAngle")); | ||
EditorGUILayout.PropertyField(property.FindPropertyRelative("offsetAsRatioToRadius")); | ||
EditorGUILayout.PropertyField(property.FindPropertyRelative("longitudinalOffset")); | ||
|
||
EditorGUI.indentLevel--; | ||
EditorGUI.EndProperty(); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...e/utils/ConditionalFieldAttribute.cs.meta → ...r/JointFollowerDataPropertyDrawer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using UnityEditor; | ||
using Unity.XR.CoreUtils.Datums.Editor; | ||
using ubco.ovilab.HPUI.Tracking; | ||
|
||
namespace ubco.ovilab.HPUI.Editor | ||
{ | ||
[CustomPropertyDrawer(typeof(JointFollowerDatumProperty))] | ||
public class JointFollowerDatumPropertyDrawer : DatumPropertyDrawer | ||
{ | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...r/ConditionalFieldAttributeDrawer.cs.meta → .../JointFollowerDatumPropertyDrawer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using UnityEngine; | ||
using UnityEngine.XR.Hands; | ||
|
||
namespace ubco.ovilab.HPUI.Tracking | ||
{ | ||
/// <summary> | ||
/// Represents the joint follower data to be used. | ||
/// </summary> | ||
[Serializable] | ||
public class JointFollowerData | ||
{ | ||
[Tooltip("The handedness of the joint to follow")] | ||
public Handedness handedness; | ||
[Tooltip("The joint to follow.")] | ||
public XRHandJointID jointID; | ||
[Tooltip("Should a second joint be used. If `useSecondJointID` is true, offsetAlongJoint behaves differently.")] | ||
public bool useSecondJointID; | ||
[Tooltip("Second joint to use as reference. If `useSecondJointID` is true, offsetAlongJoint behaves differently.")] | ||
public XRHandJointID secondJointID; | ||
[Tooltip("Default joint radius to use when joint radius is not provided by XR Hands. In unity units.")] | ||
public float defaultJointRadius = 0.01f; | ||
|
||
[Tooltip("The offset angle.")][SerializeField] | ||
public float offsetAngle = 0f; | ||
[Tooltip("The offset as a ratio of the joint radius.")][SerializeField] | ||
public float offsetAsRatioToRadius = 1f; | ||
[Tooltip("The offset along joint (the joint's up) if no secondJoint is set. Otherwise, the position along joint as a ratio to the distance between jointID and secondJointID. In unity units.")] | ||
[SerializeField] | ||
public float longitudinalOffset = 0f; | ||
|
||
public JointFollowerData() | ||
{} | ||
|
||
public JointFollowerData(Handedness handedness, XRHandJointID jointID, float offsetAngle, float offsetAsRationToRadius, float longitudinalOffset) | ||
{ | ||
this.handedness = handedness; | ||
this.jointID = jointID; | ||
this.offsetAngle = offsetAngle; | ||
this.offsetAsRatioToRadius = offsetAsRationToRadius; | ||
this.longitudinalOffset = longitudinalOffset; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using UnityEngine; | ||
using Unity.XR.CoreUtils.Datums; | ||
|
||
namespace ubco.ovilab.HPUI.Tracking | ||
{ | ||
/// <summary> | ||
/// <see cref="ScriptableObject"/> container class that holds a <see cref="JointFollowerData"/> value. | ||
/// </summary> | ||
[CreateAssetMenu(fileName = "JointFollowerData", menuName = "HPUI/JointFollowerData", order = 1)] | ||
public class JointFollowerDatum: Datum<JointFollowerData> | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Serializable container class that holds a JointFollower data value or container asset reference. | ||
/// </summary> | ||
/// <seealso cref="JointFollowerData"/> | ||
[Serializable] | ||
public class JointFollowerDatumProperty: DatumProperty<JointFollowerData, JointFollowerDatum> | ||
{ | ||
/// <inheritdoc/> | ||
public JointFollowerDatumProperty(JointFollowerData value) : base(value) | ||
{ | ||
} | ||
|
||
/// <inheritdoc/> | ||
public JointFollowerDatumProperty(JointFollowerDatum datum) : base(datum) | ||
{ | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.