forked from wonderworks-software/PyFlow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
no_ui.py
42 lines (31 loc) · 1.01 KB
/
no_ui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from PyFlow.Core.AbstractGraph import *
# class TestGraph(Core.AbstractGraph.Graph):
# def __init__(self, name):
# super(TestGraph, self).__init__(name)
G = Graph("TestGraph")
class AddNode(NodeBase):
def __init__(self, name, graph):
super(AddNode, self).__init__(name, graph)
self.a = self.addInputPin("A", DataTypes.Float, 2.0)
self.b = self.addInputPin("B", DataTypes.Float, 2.0)
self.out = self.addOutputPin("Out", DataTypes.Float)
pinAffects(self.a, self.out)
pinAffects(self.b, self.out)
@staticmethod
def pinTypeHints():
return {'inputs': [DataTypes.Float], 'outputs': [DataTypes.Float]}
@staticmethod
def category():
return 'Utils'
@staticmethod
def keywords():
return []
@staticmethod
def description():
return 'None'
def compute(self):
a = self.a.getData()
b = self.b.getData()
self.out.setData(a + b)
addition = AddNode("add", G)
print(addition.out.getData())