forked from LeenkxTeam/LNXSDK
		
	
		
			
	
	
		
			26 lines
		
	
	
		
			860 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			26 lines
		
	
	
		
			860 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								from lnx.logicnode.lnx_nodes import *
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class SeparateColorNode(LnxLogicTreeNode):
							 | 
						||
| 
								 | 
							
								    """Splits the given color into its RGBA components (red, green, blue, and alpha).
							 | 
						||
| 
								 | 
							
								    If the input color is `null`, the outputs are each set to `0.0`.
							 | 
						||
| 
								 | 
							
								    """
							 | 
						||
| 
								 | 
							
								    bl_idname = 'LNSeparateColorNode'
							 | 
						||
| 
								 | 
							
								    bl_label = 'Separate RGBA'
							 | 
						||
| 
								 | 
							
								    lnx_section = 'color'
							 | 
						||
| 
								 | 
							
								    lnx_version = 2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def lnx_init(self, context):
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxColorSocket', 'Color', default_value=[1.0, 1.0, 1.0, 1.0])
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxFloatSocket', 'R')
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxFloatSocket', 'G')
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxFloatSocket', 'B')
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxFloatSocket', 'A')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def get_replacement_node(self, node_tree: bpy.types.NodeTree):
							 | 
						||
| 
								 | 
							
								        if self.lnx_version not in (0, 1):
							 | 
						||
| 
								 | 
							
								            raise LookupError()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        return NodeReplacement.Identity(self)
							 |