Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 39ba0c6

Browse files
committed
Added SerializedReferenceUI as a dependency.
1 parent 314c079 commit 39ba0c6

17 files changed

+41
-23
lines changed

Naelstrof.PenetrationTech.asmdef

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "Naelstrof.PenetrationTech",
33
"rootNamespace": "",
4-
"references": [],
4+
"references": [
5+
"GUID:73106583b323919458c1e05166706ce3"
6+
],
57
"includePlatforms": [],
68
"excludePlatforms": [],
79
"allowUnsafeCode": true,

Scripts/Penetrable.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace PenetrationTech {
1515
[CanEditMultipleObjects]
1616
[CustomEditor(typeof(Penetrable))]
1717
public class PenetrableEditor : Editor {
18-
static IEnumerable<PenetrableListenerAttribute> GetPenetrableListenerAttributes() {
18+
/*static IEnumerable<PenetrableListenerAttribute> GetPenetrableListenerAttributes() {
1919
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
2020
foreach (Type type in assembly.GetTypes()) {
2121
var attributes =
@@ -26,7 +26,7 @@ static IEnumerable<PenetrableListenerAttribute> GetPenetrableListenerAttributes(
2626
}
2727
}
2828
}
29-
}
29+
}*/
3030
public override void OnInspectorGUI() {
3131
string lastError = ((Penetrable)target).GetLastError();
3232
if (!string.IsNullOrEmpty(lastError)) {
@@ -35,7 +35,7 @@ public override void OnInspectorGUI() {
3535

3636
DrawDefaultInspector();
3737

38-
if (!EditorGUILayout.DropdownButton(new GUIContent("Add listener"), FocusType.Passive)) {
38+
/*if (!EditorGUILayout.DropdownButton(new GUIContent("Add listener"), FocusType.Passive)) {
3939
return;
4040
}
4141
@@ -54,7 +54,7 @@ public override void OnInspectorGUI() {
5454
}
5555
});
5656
}
57-
menu.ShowAsContext();
57+
menu.ShowAsContext();*/
5858
}
5959
}
6060
#endif
@@ -69,7 +69,7 @@ public class Penetrable : CatmullDisplay {
6969
[SerializeField, Range(0f,1f)] private float splineTension = 0.5f;
7070
private List<Vector3> worldPoints;
7171
// Keep this on the bottom, so it lines up with the custom inspector.
72-
[SerializeReference]
72+
[SerializeReference,SerializeReferenceButton]
7373
public List<PenetrableListener> listeners;
7474

7575
private GameObject colliderEntrance;
@@ -242,6 +242,9 @@ void OnValidate() {
242242
valid = false;
243243
reinitialize = true;
244244
foreach(PenetrableListener listener in listeners) {
245+
if (listener == null) {
246+
continue;
247+
}
245248
listener.OnValidate(this);
246249
}
247250
}

Scripts/PenetrableListener.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
using System;
12
using System.Collections;
23
using System.Collections.Generic;
34
using System.Linq;
45
using UnityEngine;
56

67
namespace PenetrationTech {
8+
9+
[Obsolete("Currently this feature has been replaced by https://github.com/TextusGames/UnitySerializedReferenceUI with its handy SerializedReferenceButton attribute.")]
710
public class PenetrableListenerAttribute : System.Attribute {
811
public System.Type type;
912
public string name;

Scripts/PenetrableListeners/BoneTransformListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace PenetrationTech {
88
[System.Serializable]
9-
[PenetrableListener(typeof(BoneTransformListener), "Simple Bone Offset Correction Listener")]
9+
//[PenetrableListener(typeof(BoneTransformListener), "Simple Bone Offset Correction Listener")]
1010
public class BoneTransformListener : PenetrableListener {
1111
[FormerlySerializedAs("targetBone")] [SerializeField]
1212
protected Transform offsetCorrectionBone;

Scripts/PenetrableListeners/ClipListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace PenetrationTech {
77
[System.Serializable]
8-
[PenetrableListener(typeof(ClipListener), "Clip range listener")]
8+
//[PenetrableListener(typeof(ClipListener), "Clip range listener")]
99
public class ClipListener : PenetrableListener {
1010
[SerializeField]
1111
private bool allowForAllTheWayThrough = true;

Scripts/PenetrableListeners/LengthwiseBlendshapeListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace PenetrationTech {
88
[System.Serializable]
9-
[PenetrableListener(typeof(LengthwiseBlendshapeListener), "Lengthwise Blendshape Listener (depth rather than girth)")]
9+
//[PenetrableListener(typeof(LengthwiseBlendshapeListener), "Lengthwise Blendshape Listener (depth rather than girth)")]
1010
public class LengthwiseBlendshapeListener : PenetrableListener {
1111
[SerializeField]
1212
SkinnedMeshBlendshapePair[] targets;

Scripts/PenetrableListeners/LengthwiseBoneDepthPenetrableListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace PenetrationTech {
77
[System.Serializable]
8-
[PenetrableListener(typeof(LengthwiseBoneDepthPenetrableListener), "Lengthwise Bone Depth Penetrable")]
8+
//[PenetrableListener(typeof(LengthwiseBoneDepthPenetrableListener), "Lengthwise Bone Depth Penetrable")]
99
public class LengthwiseBoneDepthPenetrableListener : PenetrableListener {
1010
[SerializeField]
1111
private Transform targetTransform;

Scripts/PenetrableListeners/PushPullExpandBlendshapeListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace PenetrationTech {
1010
[System.Serializable]
11-
[PenetrableListener(typeof(PushPullExpandBlendshapeListener), "Push Pull Expand Blendshape Listener")]
11+
//[PenetrableListener(typeof(PushPullExpandBlendshapeListener), "Push Pull Expand Blendshape Listener")]
1212
public class PushPullExpandBlendshapeListener : BoneTransformListener {
1313
[SerializeField]
1414
private SkinnedMeshBlendshapePushPullExpandSet[] targets;

Scripts/PenetrableListeners/SimpleBlendshapeListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace PenetrationTech {
88
[System.Serializable]
9-
[PenetrableListener(typeof(SimpleBlendshapeListener), "Simple Blendshape Listener")]
9+
//[PenetrableListener(typeof(SimpleBlendshapeListener), "Simple Blendshape Listener")]
1010
public class SimpleBlendshapeListener : BoneTransformListener {
1111
[SerializeField]
1212
SkinnedMeshBlendshapePair[] targets;

Scripts/Penetrator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace PenetrationTech {
1515
[CanEditMultipleObjects]
1616
[CustomEditor(typeof(Penetrator))]
1717
public class PenetratorEditor : Editor {
18-
static IEnumerable<PenetratorListenerAttribute> GetPenetratorListenerAttributes() {
18+
/*static IEnumerable<PenetratorListenerAttribute> GetPenetratorListenerAttributes() {
1919
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
2020
foreach (Type type in assembly.GetTypes()) {
2121
var attributes =
@@ -26,7 +26,7 @@ static IEnumerable<PenetratorListenerAttribute> GetPenetratorListenerAttributes(
2626
}
2727
}
2828
}
29-
}
29+
}*/
3030
public override void OnInspectorGUI() {
3131
string lastError = ((Penetrator)target).GetLastError();
3232
if (!string.IsNullOrEmpty(lastError)) {
@@ -38,7 +38,7 @@ public override void OnInspectorGUI() {
3838
}
3939

4040
DrawDefaultInspector();
41-
41+
/*
4242
if (!EditorGUILayout.DropdownButton(new GUIContent("Add listener"), FocusType.Passive)) {
4343
return;
4444
}
@@ -59,7 +59,7 @@ public override void OnInspectorGUI() {
5959
}
6060
});
6161
}
62-
menu.ShowAsContext();
62+
menu.ShowAsContext();*/
6363
}
6464
}
6565
#endif
@@ -87,7 +87,7 @@ [SerializeField] [Range(0.001f,5f)] [Tooltip("How lenient we are with penetrator
8787
private float penetrationMarginOfError = 0.5f;
8888
[SerializeField] [Tooltip("Automate discovery of penetrables, and automatically penetrate with them if some basic conditions are met (roughly the right angle, and distance). Also decouple automatically if basic conditions are met (penetrator is certain distance away).")]
8989
private AutoPenetrateMode autoPenetrate = AutoPenetrateMode.AutoSeek | AutoPenetrateMode.AutoDecouple;
90-
[SerializeReference] [Tooltip("Programmable listeners, they can respond to penetrations in a variety of ways. Great for triggering audio and such.")]
90+
[SerializeReference,SerializeReferenceButton] [Tooltip("Programmable listeners, they can respond to penetrations in a variety of ways. Great for triggering audio and such.")]
9191
public List<PenetratorListener> listeners;
9292

9393

0 commit comments

Comments
 (0)