31 lines
		
	
	
		
			960 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			960 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from lnx.logicnode.lnx_nodes import *
 | |
| 
 | |
| class RetainValueNode(LnxLogicTreeNode):
 | |
|     """Retains the input value.
 | |
| 
 | |
|     @input Retain: Retains the value when exeuted.
 | |
|     @input Value: The value that should be retained.
 | |
|     """
 | |
|     bl_idname = 'LNRetainValueNode'
 | |
|     bl_label = 'Retain Value'
 | |
|     lnx_section = 'set'
 | |
|     lnx_version = 2
 | |
| 
 | |
|     def lnx_init(self, context):
 | |
|         self.add_input('LnxNodeSocketAction', 'Retain')
 | |
|         self.add_input('LnxDynamicSocket', 'Value', is_var=True)
 | |
| 
 | |
|         self.add_output('LnxNodeSocketAction', 'Out')
 | |
|         self.add_output('LnxDynamicSocket', 'Value')
 | |
| 
 | |
|     def get_replacement_node(self, node_tree: bpy.types.NodeTree):
 | |
|         if self.lnx_version not in (0, 1):
 | |
|             raise LookupError()
 | |
| 
 | |
|         return NodeReplacement(
 | |
|             "LNRetainValueNode", self.lnx_version,
 | |
|             "LNRetainValueNode", 2,
 | |
|             in_socket_mapping={0: 0, 1: 1},
 | |
|             out_socket_mapping={0: 1, 1: 0},
 | |
|         )
 |