Skip to content

Commit d8b14b6

Browse files
authored
Merge pull request #17 from alelievr/NodeSettings
Node settings
2 parents e5ed5ca + 7785b9b commit d8b14b6

File tree

12 files changed

+311
-9
lines changed

12 files changed

+311
-9
lines changed

Assets/Examples/BasicExample.asset

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,31 @@ MonoBehaviour:
1818
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
1919
jsonDatas: '{"GUID":"3327402b-5ad1-4564-af17-2025a850d4bb","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":242.0,"y":101.0,"width":73.0,"height":101.0},"expanded":false,"debug":false,"output":4.0}'
2020
- type: MultiAddNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
21-
jsonDatas: '{"GUID":"9a1c513a-65bc-4906-83b7-4a7b66699064","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":406.64605712890627,"y":244.3121337890625,"width":125.0,"height":101.0},"expanded":false,"debug":false,"output":0.0}'
21+
jsonDatas: '{"GUID":"9a1c513a-65bc-4906-83b7-4a7b66699064","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":406.64605712890627,"y":244.3121337890625,"width":125.0,"height":101.0},"expanded":false,"debug":false,"output":4.0}'
2222
- type: SubNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
23-
jsonDatas: '{"GUID":"95bce55f-47d9-4c5d-bdcd-1f5bbbf57d1b","computeOrder":4,"canProcess":true,"position":{"serializedVersion":"2","x":709.6460571289063,"y":322.3121337890625,"width":98.0,"height":101.0},"expanded":false,"debug":false,"inputA":0.0,"inputB":8.0,"output":-8.0}'
23+
jsonDatas: '{"GUID":"95bce55f-47d9-4c5d-bdcd-1f5bbbf57d1b","computeOrder":4,"canProcess":true,"position":{"serializedVersion":"2","x":709.6460571289063,"y":322.3121337890625,"width":98.0,"height":101.0},"expanded":false,"debug":false,"inputA":4.0,"inputB":8.0,"output":-4.0}'
2424
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
2525
jsonDatas: '{"GUID":"42eb43b8-ac7e-4f38-b49b-26ba1bc42732","computeOrder":5,"canProcess":true,"position":{"serializedVersion":"2","x":879.1253051757813,"y":151.1937713623047,"width":107.0,"height":117.0},"expanded":false,"debug":false}'
2626
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
2727
jsonDatas: '{"GUID":"6398414c-0e45-44d7-a62f-3267016dbca1","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":236.43923950195313,"y":-42.947715759277347,"width":99.0,"height":115.0},"expanded":false,"debug":false}'
2828
- type: PrefabNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
2929
jsonDatas: '{"GUID":"ffd2cf4b-87c3-42a6-9822-04bae7a5700b","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":478.04730224609377,"y":-235.4877471923828,"width":136.0,"height":223.00001525878907},"expanded":true,"debug":false,"output":{"instanceID":0}}'
3030
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
31-
jsonDatas: '{"GUID":"e99da4fb-6a11-4b19-8594-f37f55d96114","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":245.83782958984376,"y":237.15869140625,"width":107.0,"height":117.0},"expanded":false,"debug":false,"output":12.0}'
31+
jsonDatas: '{"GUID":"e99da4fb-6a11-4b19-8594-f37f55d96114","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":245.83782958984376,"y":237.15869140625,"width":107.0,"height":117.0},"expanded":true,"debug":false,"output":12.0}'
3232
- type: TextNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
33-
jsonDatas: '{"GUID":"ab7c80f0-51fd-401a-9d67-0b6543025f87","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":-104.5,"y":125.5,"width":73.0,"height":113.0},"expanded":false,"debug":false,"output":"Hello
33+
jsonDatas: '{"GUID":"ab7c80f0-51fd-401a-9d67-0b6543025f87","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":-42.00001525878906,"y":219.0,"width":77.0,"height":115.0},"expanded":false,"debug":false,"output":"Hello
3434
World"}'
3535
- 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}'
36+
jsonDatas: '{"GUID":"e277d5c6-386e-4f6b-bd63-af2353f3e4d8","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":96.99998474121094,"y":135.0,"width":71.0,"height":95.0},"expanded":false,"debug":false}'
3737
- type: FloatNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
3838
jsonDatas: '{"GUID":"34e17a0c-9187-47eb-a21c-d105ee6ed911","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":505.64605712890627,"y":431.3121337890625,"width":73.0,"height":101.0},"expanded":true,"debug":false,"output":8.0}'
3939
- type: ParameterNode, com.alelievr.NodeGraphProcessor, Version=0.0.0.0, Culture=neutral,
4040
PublicKeyToken=null
4141
jsonDatas: '{"GUID":"eb62aec1-6b04-49a1-89c4-27d66f83289d","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":631.0,"y":6.160011291503906,"width":88.0,"height":77.0},"expanded":false,"debug":false,"parameterGUID":"4f5bc9d8-e5d3-4935-8d09-5cf903694414"}'
42+
- type: SettingsNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
43+
jsonDatas: '{"GUID":"b14b2e69-b835-4b73-ae8e-6f7f986575bb","computeOrder":1,"canProcess":true,"position":{"serializedVersion":"2","x":33.0,"y":426.0,"width":136.0,"height":95.0},"expanded":true,"debug":false,"setting":0,"input":0.0,"output":0.0}'
44+
- type: PrintNode, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
45+
jsonDatas: '{"GUID":"42bd42f7-7c33-4d6c-8cff-24e051b0e644","computeOrder":2,"canProcess":true,"position":{"serializedVersion":"2","x":87.99998474121094,"y":281.0,"width":71.0,"height":95.0},"expanded":false,"debug":false}'
4246
edges:
4347
- GUID: 04cee6c7-b233-40e1-b41a-31f6093f1482
4448
owner: {fileID: 11400000}
@@ -88,6 +92,14 @@ MonoBehaviour:
8892
outputFieldName: output
8993
inputPortIdentifier:
9094
outputPortIdentifier:
95+
- GUID: 9c14b0f4-095d-4d7b-9aa4-0cc4436ea5f1
96+
owner: {fileID: 11400000}
97+
inputNodeGUID: 42bd42f7-7c33-4d6c-8cff-24e051b0e644
98+
outputNodeGUID: ab7c80f0-51fd-401a-9d67-0b6543025f87
99+
inputFieldName: obj
100+
outputFieldName: output
101+
inputPortIdentifier:
102+
outputPortIdentifier:
91103
commentBlocks:
92104
- title: New Comment Block
93105
color: {r: 0, g: 0, b: 0, a: 0}
@@ -102,6 +114,19 @@ MonoBehaviour:
102114
- 9a1c513a-65bc-4906-83b7-4a7b66699064
103115
- 95bce55f-47d9-4c5d-bdcd-1f5bbbf57d1b
104116
- 34e17a0c-9187-47eb-a21c-d105ee6ed911
117+
- title: Print
118+
color: {r: 0.4627451, g: 0.14901963, b: 0.20610665, a: 1}
119+
position:
120+
serializedVersion: 2
121+
x: -67.000015
122+
y: 53.999996
123+
width: 260
124+
height: 346.99997
125+
size: {x: 300, y: 100}
126+
innerNodeGUIDs:
127+
- ab7c80f0-51fd-401a-9d67-0b6543025f87
128+
- 42bd42f7-7c33-4d6c-8cff-24e051b0e644
129+
- e277d5c6-386e-4f6b-bd63-af2353f3e4d8
105130
pinnedElements:
106131
- position:
107132
serializedVersion: 2
@@ -132,5 +157,5 @@ MonoBehaviour:
132157
serializedName:
133158
serializedValue: 0
134159
input: 1
135-
position: {x: 421, y: 215, z: 0}
136-
scale: {x: 0.65751624, y: 0.65751624, z: 1}
160+
position: {x: 197.5, y: -605.5, z: 0}
161+
scale: {x: 2, y: 2, z: 1}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor;
5+
using UnityEditor.UIElements;
6+
using UnityEditor.Experimental.GraphView;
7+
using UnityEngine.UIElements;
8+
using GraphProcessor;
9+
10+
[NodeCustomEditor(typeof(SettingsNode))]
11+
public class SettingsNodeView : BaseNodeView
12+
{
13+
protected override bool hasSettings => true;
14+
15+
SettingsNode settingsNode;
16+
17+
public override void Enable()
18+
{
19+
settingsNode = nodeTarget as SettingsNode;
20+
21+
controlsContainer.Add(new Label("Hello World !"));
22+
}
23+
24+
protected override VisualElement CreateSettingsView()
25+
{
26+
var settings = new VisualElement();
27+
28+
settings.Add(new EnumField("S", settingsNode.setting));
29+
30+
return settings;
31+
}
32+
}

Assets/Examples/DefaultNodes/Editor/SettingsNodeView.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: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using GraphProcessor;
5+
using System.Linq;
6+
7+
public enum Setting
8+
{
9+
S1,
10+
S2,
11+
S3,
12+
}
13+
14+
[System.Serializable, NodeMenuItem("Custom/SettingsNode")]
15+
public class SettingsNode : BaseNode
16+
{
17+
public Setting setting;
18+
public override string name => "SettingsNode";
19+
20+
[Input]
21+
public float input;
22+
23+
[Output]
24+
public float output;
25+
26+
protected override void Process() {}
27+
}

Assets/Examples/DefaultNodes/Nodes/SettingsNode.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.

Assets/com.alelievr.NodeGraphProcessor/Editor/Resources/GraphProcessorStyles/BaseNodeView.uss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,26 @@
55
#controls {
66
background-color: rgba(63, 63, 63, 0.8);
77
}
8+
9+
#settings-button {
10+
align-self: center;
11+
border-width: 2px;
12+
width: 16px;
13+
height: 16px;
14+
}
15+
16+
#settings-button > #icon {
17+
background-image : resource("Icons/SettingsIcons");
18+
flex-grow: 1;
19+
}
20+
21+
#settings-button:hover > #icon {
22+
background-color: #2B2B2B;
23+
background-image : resource("Icons/SettingsIcons");
24+
}
25+
26+
#settings-button.clicked > #icon {
27+
background-color: #2B2B2B;
28+
background-image : resource("Icons/SettingsIcons");
29+
visibility: visible;
30+
}

Assets/com.alelievr.NodeGraphProcessor/Editor/Resources/Icons.meta

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

Assets/com.alelievr.NodeGraphProcessor/Editor/Resources/Icons/SettingsIcons.png.meta

Lines changed: 103 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)