Skip to content

Commit b593c2e

Browse files
authored
Merge pull request #114 from alelievr/refactor-serialization-system
Use [SerializeReference] instead of JSON serialization for nodes a parameters
2 parents 9cb17d5 + 33fb976 commit b593c2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3257
-359
lines changed

.vsconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Workload.ManagedGame"
5+
]
6+
}

Assets/Examples/BasicExample.asset

Lines changed: 553 additions & 71 deletions
Large diffs are not rendered by default.

Assets/Examples/DefaultNodes/Nodes/CustomPortDataNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class CustomPortData : BaseNode
1010
[Input(name = "In Values", allowMultiple = true)]
1111
public IEnumerable< object > inputs = null;
1212

13-
PortData[] portDatas = new PortData[] {
13+
static PortData[] portDatas = new PortData[] {
1414
new PortData{displayName = "0", displayType = typeof(float), identifier = "0"},
1515
new PortData{displayName = "1", displayType = typeof(int), identifier = "1"},
1616
new PortData{displayName = "2", displayType = typeof(GameObject), identifier = "2"},
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using GraphProcessor;
5+
using System.Linq;
6+
7+
[System.Serializable, NodeMenuItem("Custom/FieldTestNode")]
8+
public class FieldTestNode : BaseNode
9+
{
10+
public string s;
11+
public int i;
12+
public float f;
13+
public Vector2 v2;
14+
public Vector3 v3;
15+
public Vector4 v4;
16+
public LayerMask layer;
17+
public Color color;
18+
public Bounds bounds;
19+
public Rect rect;
20+
public CameraClearFlags flags = CameraClearFlags.Color;
21+
public bool toggle;
22+
public Gradient gradient;
23+
public AnimationCurve curve;
24+
25+
public override string name => "FieldTestNode";
26+
27+
protected override void Process() { }
28+
}

Assets/Examples/DefaultNodes/Nodes/FieldTestNode.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using UnityEngine.UIElements;
4+
5+
[CustomEditor(typeof(GraphBehaviour))]
6+
public class GraphBehaviourEditor : Editor
7+
{
8+
Editor graphEditor;
9+
GraphBehaviour behaviour => target as GraphBehaviour;
10+
11+
void OnEnable()
12+
{
13+
graphEditor = Editor.CreateEditor(behaviour.graph);
14+
}
15+
16+
void OnDisable()
17+
{
18+
DestroyImmediate(graphEditor);
19+
}
20+
21+
public override VisualElement CreateInspectorGUI()
22+
{
23+
var root = new VisualElement();
24+
var graphContainer = graphEditor != null ? graphEditor.CreateInspectorGUI().Q("ExposedParameters") : null;
25+
26+
root.Add(new Button(() => EditorWindow.GetWindow<AllGraphWindow>().InitializeGraph(behaviour.graph))
27+
{
28+
text = "Open"
29+
});
30+
31+
root.Add(graphContainer);
32+
33+
return root;
34+
}
35+
}

Assets/Examples/Editor/GraphBehaviourEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)