Skip to content

Commit 26dce96

Browse files
author
Daniel Burgess
committed
Also use ShowAsDrawer attribute
1 parent eb09268 commit 26dce96

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

Assets/Examples/DefaultNodes/Nodes/DrawerFieldTestNode.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,46 @@
88
public class DrawerFieldTestNode : BaseNode
99
{
1010

11-
[Input(name = "Vector 4", showAsDrawer = true)]
11+
[Input(name = "Vector 4"), ShowAsDrawer]
1212
public Vector4 vector4;
1313

14-
[Input(name = "Vector 3", showAsDrawer = true)]
14+
[Input(name = "Vector 3"), ShowAsDrawer]
1515
public Vector3 vector3;
1616

17-
[Input(name = "Vector 2", showAsDrawer = true)]
17+
[Input(name = "Vector 2"), ShowAsDrawer]
1818
public Vector2 vector2;
1919

20-
[Input(name = "Float", showAsDrawer = true)]
20+
[Input(name = "Float"), ShowAsDrawer]
2121
public float floatInput;
2222

23-
[Input(name = "Vector 3 Int", showAsDrawer = true)]
23+
[Input(name = "Vector 3 Int"), ShowAsDrawer]
2424
public Vector3Int vector3Int;
2525

26-
[Input(name = "Vector 2 Int", showAsDrawer = true)]
26+
[Input(name = "Vector 2 Int"), ShowAsDrawer]
2727
public Vector2Int vector2Int;
2828

29-
[Input(name = "Int", showAsDrawer = true)]
29+
[Input(name = "Int"), ShowAsDrawer]
3030
public int intInput;
3131

3232
[Input(name = "Empty")]
3333
public int intInput2;
3434

35-
[Input(name = "String", showAsDrawer = true)]
35+
[Input(name = "String"), ShowAsDrawer]
3636
public string stringInput;
3737

38-
[Input(name = "Color", showAsDrawer = true)]
38+
[Input(name = "Color"), ShowAsDrawer]
3939
new public Color color;
4040

41-
[Input(name = "Game Object", showAsDrawer = true)]
41+
[Input(name = "Game Object"), ShowAsDrawer]
4242
public GameObject gameObject;
4343

44-
[Input(name = "Animation Curve", showAsDrawer = true)]
44+
[Input(name = "Animation Curve"), ShowAsDrawer]
4545
public AnimationCurve animationCurve;
4646

47-
[Input(name = "Rigidbody", showAsDrawer = true)]
47+
[Input(name = "Rigidbody"), ShowAsDrawer]
4848
public Rigidbody rigidbody;
4949

50-
[Input("Layer Mask", showAsDrawer = true)]
50+
[Input("Layer Mask"), ShowAsDrawer]
5151
public LayerMask layerMask;
5252

5353
public override string name => "Drawer Field Test";

Assets/Testing/SequenceData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class SequenceName : List<SequenceName.ConditionalName>
1515
[Serializable]
1616
public class ConditionalName : BaseIsConditional
1717
{
18-
[SerializeField, Input("Name", true)] string name;
18+
[SerializeField, Input("Name"), ShowAsDrawer] string name;
1919
public string Name => name;
2020
}
2121
}

Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ protected virtual void DrawField(List<FieldInfo> fieldInfoList, bool fromInspect
728728
InputAttribute inputAttribute = field.GetCustomAttribute<InputAttribute>();
729729
bool hasInputAttribute = inputAttribute != null;
730730
bool hasInputOrOutputAttribute = hasInputAttribute || field.HasCustomAttribute<OutputAttribute>();
731-
bool showAsDrawer = !fromInspector && hasInputAttribute && inputAttribute.showAsDrawer;
731+
bool showAsDrawer = !fromInspector && hasInputAttribute && (inputAttribute.showAsDrawer || field.HasCustomAttribute<ShowAsDrawer>());
732732
if ((!serializeField || isProxied) && hasInputOrOutputAttribute && !showAsDrawer)
733733
{
734734
AddEmptyField(field, fromInspector);
@@ -752,7 +752,7 @@ protected virtual void DrawField(List<FieldInfo> fieldInfoList, bool fromInspect
752752

753753

754754
var showInputDrawer = hasInputAttribute && serializeField;
755-
showInputDrawer |= hasInputAttribute && inputAttribute.showAsDrawer;
755+
showInputDrawer |= showAsDrawer;
756756
showInputDrawer &= !fromInspector; // We can't show a drawer in the inspector
757757
showInputDrawer &= !typeof(IList).IsAssignableFrom(field.FieldType);
758758

Assets/com.alelievr.NodeGraphProcessor/Runtime/Graph/Attributes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public ShowInInspector(bool showInNode = false)
227227
}
228228
}
229229

230-
[Obsolete("ShowAsDrawer attribute is deprecated. Please use the InputAttribute showAsDrawer field.")]
230+
// [Obsolete("ShowAsDrawer attribute is deprecated. Please use the InputAttribute showAsDrawer field.")]
231231

232232
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
233233
public class ShowAsDrawer : Attribute

0 commit comments

Comments
 (0)