Mercurial > code > home > repos > light9
annotate flax/Node.py @ 110:490843093506
all of this stuff is super rough and not well thought out yet.
all of this stuff is super rough and not well thought out yet.
i'm just checking in so we have some stuff to work with for the
sprint tonight.
author | dmcc |
---|---|
date | Tue, 10 Jun 2003 10:31:57 +0000 |
parents | 45b12307c695 |
children | 7ccf1d10804b |
rev | line source |
---|---|
0 | 1 # super rough code |
2 | |
3 # The magic value | |
4 NoChange = "NoChange" | |
5 | |
6 class NodeType: | |
7 def __init__(self, iports=None, oports=None): | |
8 make_attributes_from_args('iports', 'oports') | |
110
490843093506
all of this stuff is super rough and not well thought out yet.
dmcc
parents:
0
diff
changeset
|
9 def process(self): |
0 | 10 pass |
11 # TODO: handle NoChange stuff | |
12 | |
13 class AddNode(NodeType): | |
14 """Adds two nodes together""" | |
15 def __init__(self): | |
16 NodeType.__init__(self, iports={'in1' : Port, 'in2' : Port}, | |
17 oports={'out1' : Port}) | |
18 def process(self, ports): | |
19 ports.out1 = ports.in1 + ports.in2 | |
20 | |
21 class SumNode(NodeType): | |
22 """Adds any number of nodes together""" | |
23 def __init__(self, empty_val=0): | |
24 NodeType.__init__(self, iports={'in1' : MultiPort}, | |
25 oports={'out1' : Port}) | |
26 self.empty_val = 0 | |
27 def process(self, ports): | |
28 val = self.empty_val | |
29 for p in ports.in1: | |
30 val += p | |
31 | |
32 ports.out1 = val | |
33 | |
34 class FadeNode(NodeType): | |
35 """Provides a UI scaler to let you fade a value""" | |
36 def __init__(self): | |
110
490843093506
all of this stuff is super rough and not well thought out yet.
dmcc
parents:
0
diff
changeset
|
37 NodeType.__init__(self, iports={'in1' : Port, |
490843093506
all of this stuff is super rough and not well thought out yet.
dmcc
parents:
0
diff
changeset
|
38 'scale1' : Port}, |
490843093506
all of this stuff is super rough and not well thought out yet.
dmcc
parents:
0
diff
changeset
|
39 oports={'out1' : Port}, |
490843093506
all of this stuff is super rough and not well thought out yet.
dmcc
parents:
0
diff
changeset
|
40 def process(self, ports): |
0 | 41 ports.out1 = ports.in1 * ports.scale1 |
42 | |
43 class FadeConstellation(Constellation): | |
44 """This somehow describes the following: | |
45 | |
46 [ ] [ UI.Scale ] | |
47 | | | |
48 | in | scale | |
49 | ____ / | |
50 | | | |
51 [ FadeNode ] | |
52 | | |
53 | out | |
54 | | |
55 [ ] | |
56 | |
57 Maybe this is a group (I like this more): | |
58 | |
59 | | |
60 | in | |
61 | FadeGroup | |
62 - - - - - - - - - - - - -- - - | |
63 | | | | |
64 | [ UI.Scale ] | |
65 | | | | | |
66 | in | scale | |
67 | | ____ / | | |
68 | | | |
69 | [ FadeNode ] | | |
70 | | |
71 | | out | | |
72 | | |
73 \ - - - - - - - - - - - -- - - / | |
74 | | |
75 | out | |
76 | | |
77 """ |