20 lines
		
	
	
		
			655 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			655 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from lnx.logicnode.lnx_nodes import *
 | |
| 
 | |
| class ArrayIndexNode(LnxLogicTreeNode):
 | |
|     """Returns the array index of the given value."""
 | |
|     bl_idname = 'LNArrayIndexNode'
 | |
|     bl_label = 'Array Index'
 | |
|     lnx_version = 2
 | |
| 
 | |
|     def lnx_init(self, context):
 | |
|         self.add_input('LnxNodeSocketArray', 'Array')
 | |
|         self.add_input('LnxDynamicSocket', 'Value')
 | |
|         self.add_input('LnxIntSocket', 'From')
 | |
| 
 | |
|         self.add_output('LnxIntSocket', 'Index')
 | |
| 
 | |
|     def get_replacement_node(self, node_tree: bpy.types.NodeTree):
 | |
|         if self.lnx_version not in (0, 1):
 | |
|             raise LookupError()
 | |
|             
 | |
|         return NodeReplacement.Identity(self) |