forked from nortikin/sverchok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_Float.py
41 lines (32 loc) · 1.18 KB
/
node_Float.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
import bpy
from node_s import *
from util import *
class FloatNode(Node, SverchCustomTreeNode):
''' Float '''
bl_idname = 'FloatNode'
bl_label = 'Float'
bl_icon = 'OUTLINER_OB_EMPTY'
float_ = bpy.props.FloatProperty(name = 'float_', description='float number', default=1.0, options={'ANIMATABLE'}, update=updateNode)
def init(self, context):
self.inputs.new('StringsSocket', "Float", "Float")
self.outputs.new('StringsSocket', "Float", "Float")
def draw_buttons(self, context, layout):
layout.prop(self, "float_", text="float")
def update(self):
# inputs
if 'Float' in self.inputs and self.inputs['Float'].links:
tmp = SvGetSocketAnyType(self,self.inputs['Float'])
Float = tmp[0][0]
else:
Float = self.float_
# outputs
if 'Float' in self.outputs and self.outputs['Float'].links:
SvSetSocketAnyType(self,'Float',[[Float]])
def update_socket(self, context):
self.update()
def register():
bpy.utils.register_class(FloatNode)
def unregister():
bpy.utils.unregister_class(FloatNode)
if __name__ == "__main__":
register()