20 lines
		
	
	
		
			766 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			766 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from lnx.logicnode.lnx_nodes import *
 | |
| 
 | |
| 
 | |
| class SeparateColorHSVNode(LnxLogicTreeNode):
 | |
|     """Splits the given color into its HSVA components (hue, saturation, value, and alpha).
 | |
|     If the input color is `null`, the outputs are each set to `0.0`.
 | |
|     formula from: https://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c
 | |
|     """
 | |
|     bl_idname = 'LNSeparateColorHSVNode'
 | |
|     bl_label = 'Separate HSVA'
 | |
|     lnx_section = 'color'
 | |
|     lnx_version = 1
 | |
| 
 | |
|     def lnx_init(self, context):
 | |
|         self.add_input('LnxColorSocket', 'Color', default_value=[1.0, 1.0, 1.0, 1.0])
 | |
| 
 | |
|         self.add_output('LnxFloatSocket', 'H')
 | |
|         self.add_output('LnxFloatSocket', 'S')
 | |
|         self.add_output('LnxFloatSocket', 'V')
 | |
|         self.add_output('LnxFloatSocket', 'A') |