Skip to content

Commit b605a11

Browse files
author
Leandro Inocencio
committed
Load example from .nodes (.json)
1 parent e759b8f commit b605a11

File tree

2 files changed

+354
-32
lines changed

2 files changed

+354
-32
lines changed

example.nodes

Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
1+
{
2+
"nodes":{
3+
"0x150ad608":{
4+
"type_":"Math.MathFunctionsNode",
5+
"icon":null,
6+
"name":"Math Functions A",
7+
"color":[
8+
10,
9+
30,
10+
32
11+
],
12+
"border_color":[
13+
74,
14+
84,
15+
85,
16+
255
17+
],
18+
"text_color":[
19+
254,
20+
171,
21+
32
22+
],
23+
"disabled":false,
24+
"selected":true,
25+
"width":186.0,
26+
"height":103.0,
27+
"pos":[
28+
-247.0,
29+
103.0
30+
],
31+
"custom":{
32+
"funcs":"mul",
33+
"output":8.0,
34+
"x":3.2,
35+
"y":2.5
36+
}
37+
},
38+
"0x161e21c8":{
39+
"type_":"Math.MathFunctionsNode",
40+
"icon":null,
41+
"name":"Math Functions B",
42+
"color":[
43+
10,
44+
30,
45+
32
46+
],
47+
"border_color":[
48+
74,
49+
84,
50+
85,
51+
255
52+
],
53+
"text_color":[
54+
254,
55+
171,
56+
32
57+
],
58+
"disabled":false,
59+
"selected":true,
60+
"width":185.0,
61+
"height":103.0,
62+
"pos":[
63+
-256.0,
64+
-188.0
65+
],
66+
"custom":{
67+
"funcs":"add",
68+
"output":66.1415926535898,
69+
"x":63.0,
70+
"y":3.141592653589793
71+
}
72+
},
73+
"0x161e2b48":{
74+
"type_":"Math.MathFunctionsNode",
75+
"icon":null,
76+
"name":"Math Functions C",
77+
"color":[
78+
10,
79+
30,
80+
32
81+
],
82+
"border_color":[
83+
74,
84+
84,
85+
85,
86+
255
87+
],
88+
"text_color":[
89+
254,
90+
171,
91+
32
92+
],
93+
"disabled":false,
94+
"selected":true,
95+
"width":186.0,
96+
"height":103.0,
97+
"pos":[
98+
10.0,
99+
-56.0
100+
],
101+
"custom":{
102+
"funcs":"add",
103+
"output":74.1415926535898,
104+
"x":66.1415926535898,
105+
"y":8.0
106+
}
107+
},
108+
"0x161e8508":{
109+
"type_":"Inputs.DataInputNode",
110+
"icon":null,
111+
"name":"Input A",
112+
"color":[
113+
13,
114+
18,
115+
23,
116+
255
117+
],
118+
"border_color":[
119+
74,
120+
84,
121+
85,
122+
255
123+
],
124+
"text_color":[
125+
255,
126+
255,
127+
255,
128+
180
129+
],
130+
"disabled":false,
131+
"selected":true,
132+
"width":173.0,
133+
"height":91.0,
134+
"pos":[
135+
-500.0,
136+
44.0
137+
],
138+
"custom":{
139+
"out":"3.2"
140+
}
141+
},
142+
"0x161e8d48":{
143+
"type_":"Inputs.DataInputNode",
144+
"icon":null,
145+
"name":"Input B",
146+
"color":[
147+
13,
148+
18,
149+
23,
150+
255
151+
],
152+
"border_color":[
153+
74,
154+
84,
155+
85,
156+
255
157+
],
158+
"text_color":[
159+
255,
160+
255,
161+
255,
162+
180
163+
],
164+
"disabled":false,
165+
"selected":true,
166+
"width":173.0,
167+
"height":91.0,
168+
"pos":[
169+
-502.0,
170+
190.0
171+
],
172+
"custom":{
173+
"out":"2.5"
174+
}
175+
},
176+
"0x161ed4c8":{
177+
"type_":"Viewers.DataViewerNode",
178+
"icon":null,
179+
"name":"Output",
180+
"color":[
181+
13,
182+
18,
183+
23,
184+
255
185+
],
186+
"border_color":[
187+
74,
188+
84,
189+
85,
190+
255
191+
],
192+
"text_color":[
193+
255,
194+
255,
195+
255,
196+
180
197+
],
198+
"disabled":false,
199+
"selected":true,
200+
"width":170,
201+
"height":91.0,
202+
"pos":[
203+
290.0,
204+
-136.0
205+
],
206+
"custom":{
207+
"data":"74.1415926535898"
208+
}
209+
},
210+
"0x161f41c8":{
211+
"type_":"Inputs.TickTimeNode",
212+
"icon":null,
213+
"name":"Tick Time",
214+
"color":[
215+
13,
216+
18,
217+
23,
218+
255
219+
],
220+
"border_color":[
221+
74,
222+
84,
223+
85,
224+
255
225+
],
226+
"text_color":[
227+
255,
228+
255,
229+
255,
230+
180
231+
],
232+
"disabled":false,
233+
"selected":true,
234+
"width":173.0,
235+
"height":91.0,
236+
"pos":[
237+
-514.0,
238+
-246.0
239+
],
240+
"custom":{
241+
"out":"63"
242+
}
243+
},
244+
"0x1750b048":{
245+
"type_":"Math.MathFunctionsNode",
246+
"icon":null,
247+
"name":"Math Functions C 1",
248+
"color":[
249+
10,
250+
30,
251+
32
252+
],
253+
"border_color":[
254+
74,
255+
84,
256+
85,
257+
255
258+
],
259+
"text_color":[
260+
254,
261+
171,
262+
32
263+
],
264+
"disabled":false,
265+
"selected":true,
266+
"width":185.66666666666669,
267+
"height":103.0,
268+
"pos":[
269+
-528.8333333333335,
270+
-110.5
271+
],
272+
"custom":{
273+
"funcs":"pi",
274+
"output":3.141592653589793,
275+
"x":86.2,
276+
"y":5.7
277+
}
278+
}
279+
},
280+
"connections":[
281+
{
282+
"in":[
283+
"0x150ad608",
284+
"x"
285+
],
286+
"out":[
287+
"0x161e8508",
288+
"out"
289+
]
290+
},
291+
{
292+
"in":[
293+
"0x150ad608",
294+
"y"
295+
],
296+
"out":[
297+
"0x161e8d48",
298+
"out"
299+
]
300+
},
301+
{
302+
"out":[
303+
"0x150ad608",
304+
"output"
305+
],
306+
"in":[
307+
"0x161e2b48",
308+
"y"
309+
]
310+
},
311+
{
312+
"in":[
313+
"0x161e21c8",
314+
"x"
315+
],
316+
"out":[
317+
"0x161f41c8",
318+
"out"
319+
]
320+
},
321+
{
322+
"in":[
323+
"0x161e21c8",
324+
"y"
325+
],
326+
"out":[
327+
"0x1750b048",
328+
"output"
329+
]
330+
},
331+
{
332+
"out":[
333+
"0x161e21c8",
334+
"output"
335+
],
336+
"in":[
337+
"0x161e2b48",
338+
"x"
339+
]
340+
},
341+
{
342+
"out":[
343+
"0x161e2b48",
344+
"output"
345+
],
346+
"in":[
347+
"0x161ed4c8",
348+
"data"
349+
]
350+
}
351+
]
352+
}

example_math_nodes.py

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,7 @@ def show_nodes_list(node):
4040
graph.node_double_clicked.connect(show_nodes_list)
4141

4242
# registered nodes.
43-
for n in Nodes:
44-
graph.register_node(n)
45-
46-
mathNodeA = graph.create_node('Math.MathFunctionsNode',
47-
name='Math Functions A',
48-
color='#0a1e20',
49-
text_color='#feab20',
50-
pos=[-250, 70])
51-
52-
mathNodeB = graph.create_node('Math.MathFunctionsNode',
53-
name='Math Functions B',
54-
color='#0a1e20',
55-
text_color='#feab20',
56-
pos=[-250, -70])
57-
58-
mathNodeC = graph.create_node('Math.MathFunctionsNode',
59-
name='Math Functions C',
60-
color='#0a1e20',
61-
text_color='#feab20',
62-
pos=[0, 0])
63-
64-
inputANode = graph.create_node('Inputs.DataInputNode',
65-
name='Input A',
66-
pos=[-500, -50])
67-
68-
inputBNode = graph.create_node('Inputs.DataInputNode',
69-
name='Input B',
70-
pos=[-500, 50])
71-
72-
outputNode = graph.create_node('Viewers.DataViewerNode',
73-
name='Output',
74-
pos=[250, 0])
43+
[graph.register_node(n) for n in Nodes]
44+
graph.load_session('example.nodes')
7545

7646
app.exec_()

0 commit comments

Comments
 (0)