33 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			33 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								from lnx.logicnode.lnx_nodes import *
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class AnimActionNode(LnxLogicTreeNode):
							 | 
						||
| 
								 | 
							
								    """Samples a given action."""
							 | 
						||
| 
								 | 
							
								    bl_idname = 'LNAnimActionNode'
							 | 
						||
| 
								 | 
							
								    bl_label = 'Action'
							 | 
						||
| 
								 | 
							
								    lnx_version = 2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    property0: HaxeStringProperty('property0', name = '', default = '')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def lnx_init(self, context):
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxNodeSocketObject', 'Object')
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxNodeSocketAnimAction', 'Action')
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxBoolSocket', 'Is Looped')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxNodeSocketAnimTree', 'Action')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def draw_buttons(self, context, layout):
							 | 
						||
| 
								 | 
							
								        layout.label(text='Action ID:')
							 | 
						||
| 
								 | 
							
								        layout.prop(self, 'property0')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def draw_label(self) -> str:
							 | 
						||
| 
								 | 
							
								        return f'{self.bl_label}: {self.property0}'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def get_replacement_node(self, node_tree: bpy.types.NodeTree):
							 | 
						||
| 
								 | 
							
								        if self.lnx_version not in (0, 1):
							 | 
						||
| 
								 | 
							
								            raise LookupError()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        return NodeReplacement(
							 | 
						||
| 
								 | 
							
								            'LNAnimActionNode', self.lnx_version, 'LNAnimActionNode', 2,
							 | 
						||
| 
								 | 
							
								            in_socket_mapping={}, out_socket_mapping={}
							 | 
						||
| 
								 | 
							
								        )
							 |