Skip to content

Commit a3b0020

Browse files
authored
Merge pull request #146 from alelievr/fixes
Fixes
2 parents 2322667 + 499a5e9 commit a3b0020

File tree

7 files changed

+173
-50
lines changed

7 files changed

+173
-50
lines changed

Assets/Examples/Vertical.asset

Lines changed: 124 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ MonoBehaviour:
2222
- id: 5
2323
- id: 6
2424
- id: 7
25+
- id: 8
26+
- id: 9
27+
- id: 10
2528
edges:
2629
- GUID: 6fc14a9b-739f-41b2-93d6-0c31954c30d8
2730
owner: {fileID: 11400000}
@@ -47,46 +50,56 @@ MonoBehaviour:
4750
outputFieldName: output3
4851
inputPortIdentifier:
4952
outputPortIdentifier:
50-
- GUID: 654938fb-2e48-45f0-818a-0af8dcad896d
53+
- GUID: 108a0c57-b6c8-43da-b42f-8d2833457748
5154
owner: {fileID: 11400000}
52-
inputNodeGUID: 3e8c2ea0-deb9-404b-a704-9916aad94a77
53-
outputNodeGUID: dfa1573e-5d96-4dfb-8843-82332c02cea9
54-
inputFieldName: input
55-
outputFieldName: output2
56-
inputPortIdentifier:
57-
outputPortIdentifier:
58-
- GUID: 440f93d6-913a-4aa9-b452-66cd4b3f1e0e
59-
owner: {fileID: 11400000}
60-
inputNodeGUID: 3e8c2ea0-deb9-404b-a704-9916aad94a77
55+
inputNodeGUID: 2ed50666-7d0c-4d9a-9c6d-b457ff3bc095
6156
outputNodeGUID: 89b7d0e2-ae3f-4cd7-92b8-1191b253cba4
6257
inputFieldName: input2
6358
outputFieldName: output
6459
inputPortIdentifier:
6560
outputPortIdentifier:
66-
- GUID: b8f0a337-841e-431e-b9e2-f610c4860963
61+
- GUID: abee5fb4-90dd-48c8-a74f-b9529c00f32f
6762
owner: {fileID: 11400000}
68-
inputNodeGUID: b8fca29c-c5dc-4aa7-8eae-06f8e1454bab
69-
outputNodeGUID: 3e8c2ea0-deb9-404b-a704-9916aad94a77
63+
inputNodeGUID: 8435f2e1-a798-47f4-8eb7-cfd8b8d81afe
64+
outputNodeGUID: 2ed50666-7d0c-4d9a-9c6d-b457ff3bc095
7065
inputFieldName: input
71-
outputFieldName: output
66+
outputFieldName: output2
7267
inputPortIdentifier:
7368
outputPortIdentifier:
74-
- GUID: d34b7b03-dee1-4036-ac84-2a617b1fd6be
69+
- GUID: 510676ca-204b-4b50-86d7-5816ce384506
7570
owner: {fileID: 11400000}
76-
inputNodeGUID: 8435f2e1-a798-47f4-8eb7-cfd8b8d81afe
77-
outputNodeGUID: 3e8c2ea0-deb9-404b-a704-9916aad94a77
71+
inputNodeGUID: 2ed50666-7d0c-4d9a-9c6d-b457ff3bc095
72+
outputNodeGUID: db7bed3e-aa7e-4099-b072-2546adce6efb
7873
inputFieldName: input
7974
outputFieldName: output2
8075
inputPortIdentifier:
8176
outputPortIdentifier:
77+
- GUID: 106dd16c-3fe8-48e2-9d64-9d77ca758f24
78+
owner: {fileID: 11400000}
79+
inputNodeGUID: b8fca29c-c5dc-4aa7-8eae-06f8e1454bab
80+
outputNodeGUID: 2ed50666-7d0c-4d9a-9c6d-b457ff3bc095
81+
inputFieldName: input
82+
outputFieldName: output
83+
inputPortIdentifier:
84+
outputPortIdentifier:
8285
groups: []
8386
stackNodes: []
84-
pinnedElements: []
87+
pinnedElements:
88+
- position:
89+
serializedVersion: 2
90+
x: 0
91+
y: 151
92+
width: 150
93+
height: 200
94+
opened: 0
95+
editorType:
96+
serializedType: GraphProcessor.ProcessorView, com.alelievr.NodeGraphProcessor.Editor,
97+
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
8598
exposedParameters: []
8699
serializedParameterList: []
87100
stickyNotes: []
88-
position: {x: -163, y: -205, z: 0}
89-
scale: {x: 1.3225, y: 1.3225, z: 1}
101+
position: {x: -48, y: -358, z: 0}
102+
scale: {x: 1.15, y: 1.15, z: 1}
90103
references:
91104
version: 1
92105
00000000:
@@ -162,58 +175,41 @@ MonoBehaviour:
162175
output2: 0
163176
output3: 0
164177
00000004:
165-
type: {class: VerticalNode2, ns: , asm: Assembly-CSharp}
166-
data:
167-
GUID: 3e8c2ea0-deb9-404b-a704-9916aad94a77
168-
computeOrder: 5
169-
position:
170-
serializedVersion: 2
171-
x: 555
172-
y: 568
173-
width: 149
174-
height: 87
175-
expanded: 1
176-
debug: 0
177-
nodeLock: 0
178-
input: 0
179-
input2: 0
180-
output: 0
181-
output2: 0
182-
00000005:
183178
type: {class: FloatNode, ns: , asm: Assembly-CSharp}
184179
data:
185180
GUID: 89b7d0e2-ae3f-4cd7-92b8-1191b253cba4
186181
computeOrder: 4
187182
position:
188183
serializedVersion: 2
189-
x: 378.21738
190-
y: 518.5
184+
x: 377.24387
185+
y: 519
191186
width: 102
192187
height: 99
193188
expanded: 0
194189
debug: 0
195190
nodeLock: 0
196191
output: 0
197192
input: 0
198-
00000006:
193+
input2: 0
194+
00000005:
199195
type: {class: VerticalNode, ns: , asm: Assembly-CSharp}
200196
data:
201197
GUID: b8fca29c-c5dc-4aa7-8eae-06f8e1454bab
202198
computeOrder: 6
203199
position:
204200
serializedVersion: 2
205-
x: 645
201+
x: 590
206202
y: 744
207203
width: 90
208204
height: 54
209-
expanded: 1
205+
expanded: 0
210206
debug: 0
211207
nodeLock: 0
212208
input: 0
213209
output: 0
214210
output2: 0
215211
output3: 0
216-
00000007:
212+
00000006:
217213
type: {class: FloatNode, ns: , asm: Assembly-CSharp}
218214
data:
219215
GUID: 8435f2e1-a798-47f4-8eb7-cfd8b8d81afe
@@ -229,3 +225,87 @@ MonoBehaviour:
229225
nodeLock: 0
230226
output: 0
231227
input: 0
228+
input2: 0
229+
00000007:
230+
type: {class: VerticalNode2, ns: , asm: Assembly-CSharp}
231+
data:
232+
GUID: 2ed50666-7d0c-4d9a-9c6d-b457ff3bc095
233+
computeOrder: 5
234+
position:
235+
serializedVersion: 2
236+
x: 555
237+
y: 546.5
238+
width: 149
239+
height: 87
240+
expanded: 0
241+
debug: 0
242+
nodeLock: 0
243+
input: 0
244+
input2: 0
245+
output: 0
246+
output2: 0
247+
00000008:
248+
type: {class: ColorNode, ns: , asm: Assembly-CSharp}
249+
data:
250+
GUID: f27e1b25-7714-4a7c-831a-2c804013d6e8
251+
computeOrder: 8
252+
position:
253+
serializedVersion: 2
254+
x: 940.5341
255+
y: 495.13834
256+
width: 100
257+
height: 100
258+
expanded: 0
259+
debug: 0
260+
nodeLock: 0
261+
color: {r: 0, g: 0, b: 0, a: 0}
262+
00000009:
263+
type: {class: DrawerFieldTestNode, ns: , asm: Assembly-CSharp}
264+
data:
265+
GUID: 1c230694-52c9-4f71-93d4-e6823a9850f2
266+
computeOrder: 9
267+
position:
268+
serializedVersion: 2
269+
x: 972.43475
270+
y: 744
271+
width: 146
272+
height: 339
273+
expanded: 0
274+
debug: 0
275+
nodeLock: 0
276+
vector4: {x: 0, y: 0, z: 0, w: 0}
277+
vector3: {x: 0, y: 0, z: 0}
278+
vector2: {x: 0, y: 0}
279+
floatInput: 0
280+
intInput: 0
281+
intInput2: 0
282+
stringInput:
283+
color: {r: 0, g: 0, b: 0, a: 0}
284+
gameObject: {fileID: 0}
285+
animationCurve:
286+
serializedVersion: 2
287+
m_Curve: []
288+
m_PreInfinity: 2
289+
m_PostInfinity: 2
290+
m_RotationOrder: 4
291+
rigidbody: {fileID: 0}
292+
layerMask:
293+
serializedVersion: 2
294+
m_Bits: 0
295+
0000000A:
296+
type: {class: FloatNode, ns: , asm: Assembly-CSharp}
297+
data:
298+
GUID: 3f6f6a7f-6835-40a7-9e64-2897c73730ec
299+
computeOrder: 10
300+
position:
301+
serializedVersion: 2
302+
x: 1309.6409
303+
y: 782.6087
304+
width: 100
305+
height: 100
306+
expanded: 0
307+
debug: 0
308+
nodeLock: 0
309+
output: 0
310+
input: 0
311+
input2: 0

Assets/com.alelievr.NodeGraphProcessor/Editor/BaseGraphWindow.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ public void InitializeGraph(BaseGraph graph)
9595
AssetDatabase.SaveAssets();
9696
// Unload the graph
9797
graphUnloaded?.Invoke(this.graph);
98-
99-
if (!this.graph.IsLinkedToScene())
100-
Resources.UnloadAsset(this.graph);
10198
}
10299

103100
graphLoaded?.Invoke(graph);

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,17 @@ ParameterNodeView #controls EnumField > VisualElement > VisualElement {
231231
#BottomPortContainer
232232
{
233233
margin-top: -1px;
234+
}
235+
236+
#title-button-container
237+
{
238+
align-items: center;
239+
align-content: center;
240+
}
241+
242+
#collapse-button:
243+
{
244+
width: 16px;
245+
height: 16px;
246+
margin: 4px;
234247
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,17 @@ string SerializeGraphElementsCallback(IEnumerable<GraphElement> elements)
179179
var data = new CopyPasteHelper();
180180

181181
foreach (BaseNodeView nodeView in elements.Where(e => e is BaseNodeView))
182+
{
182183
data.copiedNodes.Add(JsonSerializer.SerializeNode(nodeView.nodeTarget));
184+
foreach (var port in nodeView.nodeTarget.GetAllPorts())
185+
{
186+
if (port.portData.vertical)
187+
{
188+
foreach (var edge in port.GetEdges())
189+
data.copiedEdges.Add(JsonSerializer.Serialize(edge));
190+
}
191+
}
192+
}
183193

184194
foreach (GroupView groupView in elements.Where(e => e is GroupView))
185195
data.copiedGroups.Add(JsonSerializer.Serialize(groupView.group));

Assets/com.alelievr.NodeGraphProcessor/Runtime/Elements/BaseNode.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,29 @@ public NodePort GetPort(string fieldName, string identifier)
715715
});
716716
}
717717

718+
/// <summary>
719+
/// Return all the ports of the node
720+
/// </summary>
721+
/// <returns></returns>
722+
public IEnumerable<NodePort> GetAllPorts()
723+
{
724+
foreach (var port in inputPorts)
725+
yield return port;
726+
foreach (var port in outputPorts)
727+
yield return port;
728+
}
729+
730+
/// <summary>
731+
/// Return all the connected edges of the node
732+
/// </summary>
733+
/// <returns></returns>
734+
public IEnumerable<SerializableEdge> GetAllEdges()
735+
{
736+
foreach (var port in GetAllPorts())
737+
foreach (var edge in port.GetEdges())
738+
yield return edge;
739+
}
740+
718741
/// <summary>
719742
/// Is the port an input
720743
/// </summary>

ProjectSettings/ProjectSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ PlayerSettings:
5151
m_MTRendering: 1
5252
mipStripping: 0
5353
numberOfMipsStripped: 0
54-
m_StackTraceTypes: 020000000200000002000000020000000200000001000000
54+
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
5555
iosShowActivityIndicatorOnLoading: -1
5656
androidShowActivityIndicatorOnLoading: -1
5757
iosUseCustomAppBackgroundBehavior: 0

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2020.2.0f1
2-
m_EditorVersionWithRevision: 2020.2.0f1 (3721df5a8b28)
1+
m_EditorVersion: 2020.2.1f1
2+
m_EditorVersionWithRevision: 2020.2.1f1 (270dd8c3da1c)

0 commit comments

Comments
 (0)