Skip to content

Commit 9424d20

Browse files
committed
refactored pinned elements to use GraphElements and clean exposed parameter view
1 parent 114eb5d commit 9424d20

File tree

57 files changed

+2087
-496
lines changed

Some content is hidden

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

57 files changed

+2087
-496
lines changed

Assets/Examples/BasicExample.asset

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MonoBehaviour:
99
m_GameObject: {fileID: 0}
1010
m_Enabled: 1
1111
m_EditorHideFlags: 0
12+
m_GeneratorAsset: {fileID: 0}
1213
m_Script: {fileID: 11500000, guid: 31390c44c9f3a3d40b424bf6821999a2, type: 3}
1314
m_Name: BasicExample
1415
m_EditorClassIdentifier:
@@ -18,13 +19,13 @@ MonoBehaviour:
1819
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
1920
jsonDatas: '{"GUID":"3327402b-5ad1-4564-af17-2025a850d4bb","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":242.69566345214845,"y":107.39205932617188,"width":107.0,"height":117.0},"expanded":false,"debug":false,"output":4.0}'
2021
- type: MultiAddNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
21-
jsonDatas: '{"GUID":"9a1c513a-65bc-4906-83b7-4a7b66699064","computeOrder":3,"canProcess":true,"position":{"serializedVersion":"2","x":497.6956481933594,"y":164.2720489501953,"width":149.0,"height":97.0},"expanded":false,"debug":false,"output":16.0}'
22+
jsonDatas: '{"GUID":"9a1c513a-65bc-4906-83b7-4a7b66699064","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":497.6956481933594,"y":164.2720489501953,"width":149.0,"height":97.0},"expanded":false,"debug":false,"output":16.0}'
2223
- type: SubNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
23-
jsonDatas: '{"GUID":"95bce55f-47d9-4c5d-bdcd-1f5bbbf57d1b","computeOrder":5,"canProcess":true,"position":{"serializedVersion":"2","x":706.0,"y":204.40249633789063,"width":107.0,"height":121.0},"expanded":false,"debug":false,"inputA":16.0,"inputB":5.0,"output":11.0}'
24+
jsonDatas: '{"GUID":"95bce55f-47d9-4c5d-bdcd-1f5bbbf57d1b","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":706.0,"y":204.40249633789063,"width":107.0,"height":121.0},"expanded":false,"debug":false,"inputA":16.0,"inputB":5.0,"output":11.0}'
2425
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
25-
jsonDatas: '{"GUID":"42eb43b8-ac7e-4f38-b49b-26ba1bc42732","computeOrder":6,"canProcess":true,"position":{"serializedVersion":"2","x":879.1253051757813,"y":151.1937713623047,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
26+
jsonDatas: '{"GUID":"42eb43b8-ac7e-4f38-b49b-26ba1bc42732","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":879.1253051757813,"y":151.1937713623047,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
2627
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
27-
jsonDatas: '{"GUID":"6398414c-0e45-44d7-a62f-3267016dbca1","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":239.0,"y":-50.0374755859375,"width":183.0,"height":117.0},"expanded":false,"debug":false}'
28+
jsonDatas: '{"GUID":"6398414c-0e45-44d7-a62f-3267016dbca1","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":239.0,"y":-50.0374755859375,"width":183.0,"height":117.0},"expanded":false,"debug":false}'
2829
- type: PrefabNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
2930
jsonDatas: '{"GUID":"ffd2cf4b-87c3-42a6-9822-04bae7a5700b","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":440.43243408203127,"y":-176.6033172607422,"width":157.0,"height":101.0},"expanded":true,"debug":false,"output":{"instanceID":12146}}'
3031
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
@@ -33,7 +34,7 @@ MonoBehaviour:
3334
jsonDatas: '{"GUID":"ab7c80f0-51fd-401a-9d67-0b6543025f87","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":-94.2540283203125,"y":133.54473876953126,"width":107.0,"height":137.0},"expanded":false,"debug":false,"output":"Hello
3435
World"}'
3536
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
36-
jsonDatas: '{"GUID":"e277d5c6-386e-4f6b-bd63-af2353f3e4d8","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":68.76971435546875,"y":94.11068725585938,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
37+
jsonDatas: '{"GUID":"e277d5c6-386e-4f6b-bd63-af2353f3e4d8","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":68.76971435546875,"y":94.11068725585938,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
3738
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
3839
jsonDatas: '{"GUID":"34e17a0c-9187-47eb-a21c-d105ee6ed911","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":506.0,"y":309.04254150390627,"width":107.0,"height":117.0},"expanded":true,"debug":false,"output":5.0}'
3940
edges:
@@ -86,11 +87,11 @@ MonoBehaviour:
8687
editorType:
8788
serializedType: GraphProcessor.ProcessorView, Assembly-CSharp-Editor, Version=0.0.0.0,
8889
Culture=neutral, PublicKeyToken=null
89-
- position: {x: 0, y: 0}
90+
- position: {x: -0, y: 287}
9091
opened: 1
9192
editorType:
9293
serializedType: GraphProcessor.ProcessorView, com.alelievr.NodeGraphProcessor,
9394
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
9495
exposedParameters: []
95-
position: {x: -149, y: 313, z: 0}
96+
position: {x: 273, y: -116, z: 0}
9697
scale: {x: 1, y: 1, z: 1}

Assets/Examples/CustomOutputExample.asset

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MonoBehaviour:
99
m_GameObject: {fileID: 0}
1010
m_Enabled: 1
1111
m_EditorHideFlags: 0
12+
m_GeneratorAsset: {fileID: 0}
1213
m_Script: {fileID: 11500000, guid: 31390c44c9f3a3d40b424bf6821999a2, type: 3}
1314
m_Name: CustomOutputExample
1415
m_EditorClassIdentifier:
@@ -18,7 +19,7 @@ MonoBehaviour:
1819
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
1920
jsonDatas: '{"GUID":"4ddedc62-453d-4d18-81bb-0b8cdb80556d","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":60.839111328125,"y":292.5489501953125,"width":107.0,"height":117.0},"expanded":false,"debug":false,"output":2.0}'
2021
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
21-
jsonDatas: '{"GUID":"54814e54-d849-427c-bd54-4f84921ddb9a","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":102.66525268554688,"y":54.35247802734375,"width":107.0,"height":117.0},"expanded":false,"debug":false,"output":5.0}'
22+
jsonDatas: '{"GUID":"54814e54-d849-427c-bd54-4f84921ddb9a","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":125.0,"y":68.35999298095703,"width":73.0,"height":101.0},"expanded":false,"debug":false,"output":5.0}'
2223
- type: CustomPortsNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
2324
jsonDatas: '{"GUID":"3042d8e2-86c8-46bd-8773-a23db56c259d","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":340.0,"y":207.0,"width":134.0,"height":97.0},"expanded":false,"debug":false}'
2425
edges:
@@ -41,7 +42,12 @@ MonoBehaviour:
4142
inputFieldName: inputs
4243
outputFieldName: output
4344
commentBlocks: []
44-
pinnedWindows: []
45+
pinnedWindows:
46+
- position: {x: 0, y: 0}
47+
opened: 1
48+
editorType:
49+
serializedType: GraphProcessor.ProcessorView, com.alelievr.NodeGraphProcessor,
50+
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
4551
exposedParameters: []
46-
position: {x: -2, y: 93, z: 0}
52+
position: {x: 139, y: -11, z: 0}
4753
scale: {x: 1, y: 1, z: 1}

Assets/Examples/CustomPushExample.asset

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ MonoBehaviour:
99
m_GameObject: {fileID: 0}
1010
m_Enabled: 1
1111
m_EditorHideFlags: 0
12+
m_GeneratorAsset: {fileID: 0}
1213
m_Script: {fileID: 11500000, guid: 31390c44c9f3a3d40b424bf6821999a2, type: 3}
1314
m_Name: CustomPushExample
1415
m_EditorClassIdentifier:
1516
serializedNodes:
1617
- type: CircleRadians, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
17-
jsonDatas: '{"GUID":"7078860c-f7cb-4534-befd-da3c678d17ee","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":160.0,"y":151.0,"width":120.0,"height":117.0},"expanded":false,"debug":false,"outputRadians":[0.0,1.2566370964050294,2.5132741928100588,3.769911289215088,5.026548385620117]}'
18+
jsonDatas: '{"GUID":"7078860c-f7cb-4534-befd-da3c678d17ee","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":162.0,"y":148.0,"width":120.0,"height":167.0},"expanded":false,"debug":false,"outputRadians":[0.0,1.2566370964050294,2.5132741928100588,3.769911289215088,5.026548385620117]}'
1819
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
19-
jsonDatas: '{"GUID":"0d8cd048-486b-4cce-9bd3-616bd2255d45","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":495.63519287109377,"y":13.4459867477417,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
20+
jsonDatas: '{"GUID":"0d8cd048-486b-4cce-9bd3-616bd2255d45","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":496.0,"y":-3.399993896484375,"width":71.0,"height":95.0},"expanded":false,"debug":false}'
2021
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
21-
jsonDatas: '{"GUID":"e2203ce1-49be-41ea-814a-465faf267adb","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":382.7353515625,"y":107.50852966308594,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
22+
jsonDatas: '{"GUID":"e2203ce1-49be-41ea-814a-465faf267adb","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":382.7353515625,"y":107.50852966308594,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
2223
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
23-
jsonDatas: '{"GUID":"3b193543-3bd6-44d6-9664-115ecc6f2502","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":382.8052978515625,"y":239.9835205078125,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
24+
jsonDatas: '{"GUID":"3b193543-3bd6-44d6-9664-115ecc6f2502","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":382.8052978515625,"y":239.9835205078125,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
2425
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
25-
jsonDatas: '{"GUID":"e3318e7b-5469-424c-ab54-9524e62907a8","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":498.0,"y":273.0,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
26+
jsonDatas: '{"GUID":"e3318e7b-5469-424c-ab54-9524e62907a8","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":498.0,"y":273.0,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
2627
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
27-
jsonDatas: '{"GUID":"83c994d8-6442-4e61-82e1-e83537229fda","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":499.0,"y":144.0,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
28+
jsonDatas: '{"GUID":"83c994d8-6442-4e61-82e1-e83537229fda","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":499.0,"y":144.0,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
2829
edges:
2930
- GUID: 035ee169-e916-40b5-aecc-831d072ea9ab
3031
owner: {fileID: 11400000}
@@ -63,5 +64,6 @@ MonoBehaviour:
6364
editorType:
6465
serializedType: GraphProcessor.ProcessorView, com.alelievr.NodeGraphProcessor,
6566
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
66-
position: {x: 74, y: 48, z: 0}
67+
exposedParameters: []
68+
position: {x: 35, y: 21.320023, z: 0}
6769
scale: {x: 1, y: 1, z: 1}

Assets/Examples/DefaultNodes/Editor/CircleRadiansView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44
using UnityEditor;
5-
using UnityEditor.Experimental.UIElements;
6-
using UnityEditor.Experimental.UIElements.GraphView;
7-
using UnityEngine.Experimental.UIElements;
5+
using UnityEditor.UIElements;
6+
using UnityEditor.Experimental.GraphView;
7+
using UnityEngine.UIElements;
88
using GraphProcessor;
99

1010
[NodeCustomEditor(typeof(CircleRadians))]

Assets/Examples/DefaultNodes/Editor/FloatNodeView.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44
using UnityEditor;
5-
using UnityEditor.Experimental.UIElements;
6-
using UnityEditor.Experimental.UIElements.GraphView;
7-
using UnityEngine.Experimental.UIElements;
5+
using UnityEditor.UIElements;
6+
using UnityEditor.Experimental.GraphView;
7+
using UnityEngine.UIElements;
88
using GraphProcessor;
99

1010
[NodeCustomEditor(typeof(FloatNode))]
@@ -19,7 +19,7 @@ public override void Enable()
1919
value = floatNode.output
2020
};
2121

22-
floatField.OnValueChanged((v) => {
22+
floatField.RegisterValueChangedCallback((v) => {
2323
owner.RegisterCompleteObjectUndo("Updated floatNode output");
2424
floatNode.output = (float)v.newValue;
2525
});

Assets/Examples/DefaultNodes/Editor/PrefabNodeView.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44
using UnityEditor;
5-
using UnityEditor.Experimental.UIElements;
6-
using UnityEditor.Experimental.UIElements.GraphView;
7-
using UnityEngine.Experimental.UIElements;
5+
using UnityEditor.UIElements;
6+
using UnityEditor.Experimental.GraphView;
7+
using UnityEngine.UIElements;
88
using GraphProcessor;
99

1010
[NodeCustomEditor(typeof(PrefabNode))]
@@ -23,7 +23,7 @@ public override void Enable()
2323

2424
var preview = new Image();
2525

26-
objField.OnValueChanged(v => {
26+
objField.RegisterValueChangedCallback(v => {
2727
prefabNode.output = objField.value as GameObject;
2828
UpdatePreviewImage(preview, objField.value);
2929
});

Assets/Examples/DefaultNodes/Editor/PrintNodeView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44
using UnityEditor;
5-
using UnityEditor.Experimental.UIElements;
6-
using UnityEditor.Experimental.UIElements.GraphView;
7-
using UnityEngine.Experimental.UIElements;
5+
using UnityEditor.UIElements;
6+
using UnityEditor.Experimental.GraphView;
7+
using UnityEngine.UIElements;
88
using GraphProcessor;
99
using Unity.Jobs;
1010

Assets/Examples/DefaultNodes/Nodes/CustomPortsNode.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void PullInputs(List< SerializableEdge > inputEdges)
2828
values = inputEdges.Select(e => e.passThroughBuffer).ToList();
2929
}
3030

31+
[CustomPortOutput(nameof(output), typeof(float))]
3132
void PushOutputs(List< SerializableEdge > connectedEdges)
3233
{
3334
// Values length is supposed to match connected edges length

Assets/Examples/DefaultNodes/Nodes/ParameterNode.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using UnityEngine;
44
using GraphProcessor;
55
using System.Linq;
6+
using System;
67

78
[System.Serializable, NodeMenuItem("Custom/Parameter")]
89
public class ParameterNode : BaseNode
@@ -14,19 +15,26 @@ public class ParameterNode : BaseNode
1415

1516
public override string name => "Parameter";
1617

18+
[SerializeField]
19+
ExposedParameter parameter;
20+
1721
protected override void Enable()
1822
{
1923
UpdateOutput();
2024
}
2125

2226
void UpdateOutput()
2327
{
24-
Debug.Log("graph: " + graph);
25-
var param = graph.exposedParameters.FirstOrDefault(e => e.name == propertyName);
28+
parameter = graph.exposedParameters.FirstOrDefault(e => e.name == propertyName);
2629

27-
if (param == null)
30+
if (parameter == null)
2831
Debug.Log("Exposed property \"" + propertyName + "\" not found !");
2932
else
30-
output = param.value;
33+
output = parameter.value;
34+
}
35+
36+
protected override void Process()
37+
{
38+
UpdateOutput();
3139
}
3240
}

Assets/Examples/Editor/02_CustomContextMenu/CustomContextMenuGraphView.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using UnityEngine.Experimental.UIElements;
2-
using UnityEditor.Experimental.UIElements.GraphView;
1+
using UnityEngine.UIElements;
2+
using UnityEditor.Experimental.GraphView;
33
using UnityEngine;
44
using GraphProcessor;
55
using System;
@@ -9,16 +9,16 @@ public class CustomContextMenuGraphView : BaseGraphView
99
public override void BuildContextualMenu(ContextualMenuPopulateEvent evt)
1010
{
1111
evt.menu.AppendSeparator();
12-
12+
1313
foreach (var nodeMenuItem in NodeProvider.GetNodeMenuEntries())
1414
{
1515
Vector2 nodePosition = evt.mousePosition - (Vector2)viewTransform.position;
1616
evt.menu.AppendAction("Create/" + nodeMenuItem.Key,
1717
(e) => CreateNodeOfType(nodeMenuItem.Value, nodePosition),
18-
DropdownMenu.MenuAction.AlwaysEnabled
18+
DropdownMenuAction.AlwaysEnabled
1919
);
2020
}
21-
21+
2222
base.BuildContextualMenu(evt);
2323
}
2424

Assets/Examples/Editor/03_CustomToolbar/CustomToolbarGraphView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using UnityEngine.Experimental.UIElements;
2-
using UnityEditor.Experimental.UIElements.GraphView;
1+
using UnityEngine.UIElements;
2+
using UnityEditor.Experimental.GraphView;
33
using UnityEngine;
44
using GraphProcessor;
55
using System;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using UnityEngine;
5+
using GraphProcessor;
6+
7+
public class ExposedPropertiesGraph : BaseGraph
8+
{
9+
10+
}

Assets/NodeGraphProcessor/Editor/Views/BlackboardView.cs.meta renamed to Assets/Examples/Editor/04_ExposedProperties/ExposedPropertiesGraph.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Examples/Editor/04_ExposedProperties/ExposedPropertiesGraphView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using UnityEngine.Experimental.UIElements;
2-
using UnityEditor.Experimental.UIElements.GraphView;
1+
using UnityEngine.UIElements;
2+
using UnityEditor.Experimental.GraphView;
33
using UnityEngine;
44
using GraphProcessor;
55
using System;

Assets/Examples/Editor/04_ExposedProperties/ExposedPropertiesGraphWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ protected override void Initialize(BaseGraph graph)
2525

2626
rootView.Add(graphView);
2727

28-
graphView.Add(new ExposedParameterView(graphView));
28+
graphView.OpenPinned< ExposedParameterView >();
2929
}
3030
}

Assets/Examples/Editor/GraphAssetInspector.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,34 @@
33
using UnityEngine;
44
using UnityEditor;
55
using GraphProcessor;
6+
using UnityEngine.UIElements;
67

7-
[CustomEditor(typeof(BaseGraph))]
8-
public class GraphAssetInspector : Editor
8+
[CustomEditor(typeof(BaseGraph), true)]
9+
public class GraphAssetInspector : GraphInspector
910
{
10-
public override void OnInspectorGUI()
11+
// protected override void CreateInspector()
12+
// {
13+
// }
14+
15+
protected override void CreateInspector()
1116
{
12-
if (GUILayout.Button("Open base graph window"))
13-
DefaultGraphWindow.Open().InitializeGraph(target as BaseGraph);
14-
if (GUILayout.Button("Open custom context menu graph window"))
15-
CustomContextMenuGraphWindow.Open().InitializeGraph(target as BaseGraph);
16-
if (GUILayout.Button("Open custom toolbar graph window"))
17-
CustomToolbarGraphWindow.Open().InitializeGraph(target as BaseGraph);
18-
if (GUILayout.Button("Open exposed properties graph window"))
19-
ExposedPropertiesGraphWindow.Open().InitializeGraph(target as BaseGraph);
17+
base.CreateInspector();
18+
19+
root.Add(new Button(() => DefaultGraphWindow.Open().InitializeGraph(target as BaseGraph))
20+
{
21+
text = "Open base graph window"
22+
});
23+
root.Add(new Button(() => CustomContextMenuGraphWindow.Open().InitializeGraph(target as BaseGraph))
24+
{
25+
text = "Open custom context menu graph window"
26+
});
27+
root.Add(new Button(() => CustomToolbarGraphWindow.Open().InitializeGraph(target as BaseGraph))
28+
{
29+
text = "Open custom toolbar graph window"
30+
});
31+
root.Add(new Button(() => ExposedPropertiesGraphWindow.Open().InitializeGraph(target as BaseGraph))
32+
{
33+
text = "Open exposed properties graph window"
34+
});
2035
}
2136
}

Assets/Examples/ExposedPropertiesExample.asset

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MonoBehaviour:
99
m_GameObject: {fileID: 0}
1010
m_Enabled: 1
1111
m_EditorHideFlags: 0
12+
m_GeneratorAsset: {fileID: 0}
1213
m_Script: {fileID: 11500000, guid: 31390c44c9f3a3d40b424bf6821999a2, type: 3}
1314
m_Name: ExposedPropertiesExample
1415
m_EditorClassIdentifier:
@@ -66,5 +67,7 @@ MonoBehaviour:
6667
exposedParameters:
6768
- name: 'New Param #1'
6869
type: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
69-
position: {x: 46, y: 34, z: 0}
70-
scale: {x: 1, y: 1, z: 1}
70+
- name: 'New Param #1'
71+
type: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
72+
position: {x: 12.999985, y: 4.999995, z: 0}
73+
scale: {x: 1.15, y: 1.15, z: 1}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
.Port_Single {
2-
port-color: #2080FF;
2+
--port-color: #2080FF;
33
}
44

5-
65
.Port_Object {
7-
port-color: #80FF00;
6+
--port-color: #80FF00;
87
}
98

109
.Port_Color {
11-
port-color: #FF00FF;
10+
--port-color: #FF00FF;
1211
}
1312

1413
.Port_GameObject {
15-
port-color: #FF0000;
14+
--port-color: #FF0000;
1615
}

0 commit comments

Comments
 (0)