2018-10-21 20:43:28 +02:00
|
|
|
import bpy
|
|
|
|
from bpy.props import *
|
|
|
|
from bpy.types import Node, NodeSocket
|
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class TimerNode(ArmLogicTreeNode):
|
2018-10-21 20:43:28 +02:00
|
|
|
'''Timer node'''
|
|
|
|
bl_idname = 'LNTimerNode'
|
|
|
|
bl_label = 'Timer'
|
2020-08-07 18:58:19 +02:00
|
|
|
bl_icon = 'NONE'
|
2020-09-08 17:03:24 +02:00
|
|
|
|
2018-10-21 20:43:28 +02:00
|
|
|
def init(self, context):
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('ArmNodeSocketAction', 'Start')
|
|
|
|
self.add_input('ArmNodeSocketAction', 'Pause')
|
|
|
|
self.add_input('ArmNodeSocketAction', 'Stop')
|
|
|
|
self.add_input('NodeSocketFloat', 'Duration', default_value=1.0)
|
|
|
|
self.add_input('NodeSocketInt', 'Repeat', default_value=1)
|
2018-10-21 20:43:28 +02:00
|
|
|
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_output('ArmNodeSocketAction', 'Out')
|
|
|
|
self.add_output('ArmNodeSocketAction', 'Done')
|
|
|
|
self.add_output('NodeSocketBool', 'Running')
|
|
|
|
self.add_output('NodeSocketInt', 'Time Passed')
|
|
|
|
self.add_output('NodeSocketInt', 'Time Left')
|
|
|
|
self.add_output('NodeSocketFloat', 'Progress')
|
|
|
|
self.add_output('NodeSocketFloat', 'Repetitions')
|
2018-10-21 20:43:28 +02:00
|
|
|
|
2020-09-08 17:03:24 +02:00
|
|
|
add_node(TimerNode, category=MODULE_AS_CATEGORY)
|