from lnx.logicnode.lnx_nodes import *

class AlternateNode(LnxLogicTreeNode):
    """Activates the outputs alternating every time it is active."""
    bl_idname = 'LNAlternateNode'
    bl_label = 'Alternate Output'
    lnx_section = 'flow'
    lnx_version = 2
    
    def __init__(self):
        super(AlternateNode, self).__init__()
        array_nodes[str(id(self))] = self

    def lnx_init(self, context):
        self.add_input('LnxNodeSocketAction', 'In')

    def draw_buttons(self, context, layout):
        row = layout.row(align=True)

        op = row.operator('lnx.node_add_output', text='New', icon='PLUS', emboss=True)
        op.node_index = str(id(self))
        op.socket_type = 'LnxNodeSocketAction'
        op2 = row.operator('lnx.node_remove_output', text='', icon='X', emboss=True)
        op2.node_index = str(id(self))