Skip to content

Commit 118429a

Browse files
committed
Fix delete operation on vertical nodes
1 parent 871e853 commit 118429a

File tree

2 files changed

+115
-5
lines changed

2 files changed

+115
-5
lines changed

Assets/Examples/Vertical.asset

Lines changed: 109 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ MonoBehaviour:
1818
- id: 1
1919
- id: 2
2020
- id: 3
21+
- id: 4
22+
- id: 5
23+
- id: 6
24+
- id: 7
2125
edges:
2226
- GUID: 6fc14a9b-739f-41b2-93d6-0c31954c30d8
2327
owner: {fileID: 11400000}
@@ -35,22 +39,54 @@ MonoBehaviour:
3539
outputFieldName: output3
3640
inputPortIdentifier:
3741
outputPortIdentifier:
38-
- GUID: 09116d37-391e-4899-97f2-4d784215b8dd
42+
- GUID: 570cd2d3-3522-4c78-8364-5c194eac9c1c
3943
owner: {fileID: 11400000}
4044
inputNodeGUID: db7bed3e-aa7e-4099-b072-2546adce6efb
4145
outputNodeGUID: b5503582-4b12-4ccc-950f-a4ea7d7fa3ec
4246
inputFieldName: input
4347
outputFieldName: output3
4448
inputPortIdentifier:
4549
outputPortIdentifier:
50+
- GUID: 654938fb-2e48-45f0-818a-0af8dcad896d
51+
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
61+
outputNodeGUID: 89b7d0e2-ae3f-4cd7-92b8-1191b253cba4
62+
inputFieldName: input2
63+
outputFieldName: output
64+
inputPortIdentifier:
65+
outputPortIdentifier:
66+
- GUID: b8f0a337-841e-431e-b9e2-f610c4860963
67+
owner: {fileID: 11400000}
68+
inputNodeGUID: b8fca29c-c5dc-4aa7-8eae-06f8e1454bab
69+
outputNodeGUID: 3e8c2ea0-deb9-404b-a704-9916aad94a77
70+
inputFieldName: input
71+
outputFieldName: output
72+
inputPortIdentifier:
73+
outputPortIdentifier:
74+
- GUID: d34b7b03-dee1-4036-ac84-2a617b1fd6be
75+
owner: {fileID: 11400000}
76+
inputNodeGUID: 8435f2e1-a798-47f4-8eb7-cfd8b8d81afe
77+
outputNodeGUID: 3e8c2ea0-deb9-404b-a704-9916aad94a77
78+
inputFieldName: input
79+
outputFieldName: output2
80+
inputPortIdentifier:
81+
outputPortIdentifier:
4682
groups: []
4783
stackNodes: []
4884
pinnedElements: []
4985
exposedParameters: []
5086
serializedParameterList: []
5187
stickyNotes: []
52-
position: {x: -582, y: -263, z: 0}
53-
scale: {x: 2, y: 2, z: 1}
88+
position: {x: -163, y: -205, z: 0}
89+
scale: {x: 1.3225, y: 1.3225, z: 1}
5490
references:
5591
version: 1
5692
00000000:
@@ -114,14 +150,82 @@ MonoBehaviour:
114150
computeOrder: 3
115151
position:
116152
serializedVersion: 2
117-
x: 590
153+
x: 614
118154
y: 416
119155
width: 90
120-
height: 71
156+
height: 54
121157
expanded: 1
122158
debug: 0
123159
nodeLock: 0
124160
input: 0
125161
output: 0
126162
output2: 0
127163
output3: 0
164+
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:
183+
type: {class: FloatNode, ns: , asm: Assembly-CSharp}
184+
data:
185+
GUID: 89b7d0e2-ae3f-4cd7-92b8-1191b253cba4
186+
computeOrder: 4
187+
position:
188+
serializedVersion: 2
189+
x: 378.21738
190+
y: 518.5
191+
width: 102
192+
height: 99
193+
expanded: 0
194+
debug: 0
195+
nodeLock: 0
196+
output: 0
197+
input: 0
198+
00000006:
199+
type: {class: VerticalNode, ns: , asm: Assembly-CSharp}
200+
data:
201+
GUID: b8fca29c-c5dc-4aa7-8eae-06f8e1454bab
202+
computeOrder: 6
203+
position:
204+
serializedVersion: 2
205+
x: 645
206+
y: 744
207+
width: 90
208+
height: 54
209+
expanded: 1
210+
debug: 0
211+
nodeLock: 0
212+
input: 0
213+
output: 0
214+
output2: 0
215+
output3: 0
216+
00000007:
217+
type: {class: FloatNode, ns: , asm: Assembly-CSharp}
218+
data:
219+
GUID: 8435f2e1-a798-47f4-8eb7-cfd8b8d81afe
220+
computeOrder: 7
221+
position:
222+
serializedVersion: 2
223+
x: 812.3043
224+
y: 645
225+
width: 102
226+
height: 99
227+
expanded: 0
228+
debug: 0
229+
nodeLock: 0
230+
output: 0
231+
input: 0

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,12 @@ int GetPriority(GraphElement e)
329329
Disconnect(edge);
330330
return true;
331331
case BaseNodeView nodeView:
332+
// For vertical nodes, we need to delete them ourselves as it's not handled by GraphView
333+
foreach (var pv in nodeView.inputPortViews.Concat(nodeView.outputPortViews))
334+
if (pv.orientation == Orientation.Vertical)
335+
foreach (var edge in pv.GetEdges().ToList())
336+
Disconnect(edge);
337+
332338
nodeInspector.NodeViewRemoved(nodeView);
333339
ExceptionToLog.Call(() => nodeView.OnRemoved());
334340
graph.RemoveNode(nodeView.nodeTarget);

0 commit comments

Comments
 (0)