27 lines
		
	
	
		
			875 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			875 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from lnx.logicnode.lnx_nodes import *
 | |
| 
 | |
| 
 | |
| class RandomOutputNode(LnxLogicTreeNode):
 | |
|     """Activate a random output when the input is activated."""
 | |
|     bl_idname = 'LNRandomOutputNode'
 | |
|     bl_label = 'Random Output'
 | |
|     lnx_section = 'logic'
 | |
|     lnx_version = 1
 | |
| 
 | |
|     def __init__(self, *args, **kwargs):
 | |
|         super(RandomOutputNode, self).__init__(*args, **kwargs)
 | |
|         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))
 |