21 lines
		
	
	
		
			795 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			21 lines
		
	
	
		
			795 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								from lnx.logicnode.lnx_nodes import *
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class CombineColorNode(LnxLogicTreeNode):
							 | 
						||
| 
								 | 
							
								    """Combines the given HSVA() components to a color value.
							 | 
						||
| 
								 | 
							
								    If any input is `null`, the respective channel of the output color is set to `0.0`.
							 | 
						||
| 
								 | 
							
								    formula from // https://stackoverflow.com/a/17243070
							 | 
						||
| 
								 | 
							
								    """
							 | 
						||
| 
								 | 
							
								    bl_idname = 'LNCombineColorHSVNode'
							 | 
						||
| 
								 | 
							
								    bl_label = 'Combine HSVA'
							 | 
						||
| 
								 | 
							
								    lnx_section = 'color'
							 | 
						||
| 
								 | 
							
								    lnx_version = 1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def lnx_init(self, context):
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxFloatSocket', 'H', default_value=0.0)
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxFloatSocket', 'S', default_value=0.0)
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxFloatSocket', 'V', default_value=0.0)
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxFloatSocket', 'A', default_value=1.0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxColorSocket', 'Color', default_value=[1.0, 1.0, 1.0, 1.0])
							 |