38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
|
from lnx.logicnode.lnx_nodes import *
|
||
|
|
||
|
class SwitchActionMultiNode(LnxLogicTreeNode):
|
||
|
"""Switch between the given actions with interpolation."""
|
||
|
bl_idname = 'LNSwitchActionMultiNode'
|
||
|
bl_label = 'Switch Action Multi'
|
||
|
lnx_version = 1
|
||
|
min_inputs = 8
|
||
|
|
||
|
def __init__(self):
|
||
|
super(SwitchActionMultiNode, self).__init__()
|
||
|
array_nodes[self.get_id_str()] = self
|
||
|
|
||
|
def lnx_init(self, context):
|
||
|
self.add_input('LnxNodeSocketAction', 'Switch')
|
||
|
self.add_input('LnxIntSocket', 'Switch To', default_value = 1)
|
||
|
self.add_input('LnxNodeSocketObject', 'Object')
|
||
|
self.add_input('LnxBoolSocket', 'Restart', default_value = True)
|
||
|
self.add_input('LnxFloatSocket', 'Time', default_value = 1.0)
|
||
|
self.add_input('LnxIntSocket', 'Bone Group', default_value = -1)
|
||
|
self.add_input('LnxNodeSocketAnimTree', 'Action 0')
|
||
|
self.add_input('LnxNodeSocketAnimTree', 'Action 1')
|
||
|
|
||
|
self.add_output('LnxNodeSocketAction', 'Done')
|
||
|
self.add_output('LnxNodeSocketAnimTree', 'Result')
|
||
|
|
||
|
def draw_buttons(self, context, layout):
|
||
|
row = layout.row(align=True)
|
||
|
op = row.operator('lnx.node_add_input', text='New', icon='PLUS', emboss=True)
|
||
|
op.node_index = self.get_id_str()
|
||
|
op.socket_type = 'LnxNodeSocketAnimTree'
|
||
|
op.name_format = 'Action {0}'
|
||
|
op.index_name_offset = -6
|
||
|
column = row.column(align=True)
|
||
|
op = column.operator('lnx.node_remove_input', text='', icon='X', emboss=True)
|
||
|
op.node_index = self.get_id_str()
|
||
|
if len(self.inputs) == self.min_inputs:
|
||
|
column.enabled = False
|