forked from nortikin/sverchok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_FrameNode.py
36 lines (28 loc) · 1.24 KB
/
node_FrameNode.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
import bpy
from node_s import *
from util import *
class SvFrameInfoNode(Node, SverchCustomTreeNode):
''' Frame Info '''
bl_idname = 'SvFrameInfoNode'
bl_label = 'Frame Info'
bl_icon = 'OUTLINER_OB_EMPTY'
def init(self, context):
self.outputs.new('StringsSocket', "Current Frame", "Current Frame")
self.outputs.new('StringsSocket', "Start Frame", "Start Frame")
self.outputs.new('StringsSocket', "End Frame", "End Frame")
def update(self):
# outputs
if 'Current Frame' in self.outputs and self.outputs['Current Frame'].links:
SvSetSocketAnyType(self, 'Current Frame',[[bpy.context.scene.frame_current]])
if 'Start Frame' in self.outputs and self.outputs['Start Frame'].links:
SvSetSocketAnyType(self, 'Start Frame',[[bpy.context.scene.frame_start]])
if 'End Frame' in self.outputs and self.outputs['End Frame'].links:
SvSetSocketAnyType(self, 'End Frame',[[bpy.context.scene.frame_end]])
def update_socket(self, context):
self.update()
def register():
bpy.utils.register_class(SvFrameInfoNode)
def unregister():
bpy.utils.unregister_class(SvFrameInfoNode)
if __name__ == "__main__":
register()