44 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			44 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
|  | from lnx.logicnode.lnx_nodes import * | ||
|  | 
 | ||
|  | 
 | ||
|  | class DrawArcNode(LnxLogicTreeNode): | ||
|  |     """Draws an arc (part of a circle).
 | ||
|  | 
 | ||
|  |     @input Draw: Activate to draw the arc on this frame. The input must | ||
|  |         be (indirectly) called from an `On Render2D` node. | ||
|  |     @input Color: The color of the arc. | ||
|  |     @input Filled: Whether the arc is filled or only the outline is drawn. | ||
|  |     @input Strength: The line strength if the arc is not filled. | ||
|  |     @input Segments: How many line segments should be used to draw the | ||
|  |         arc. 0 (default) = automatic. | ||
|  |     @input Center X/Y: The position of the arc's center, in pixels from the top left corner. | ||
|  |     @input Radius: The radius of the arc in pixels. | ||
|  |     @input Start Angle/End Angle: The angles in radians where the | ||
|  |         arc starts/ends, starting right of the arc's center. | ||
|  |     @input Exterior Angle: Whether the angles describe an Exterior angle. | ||
|  | 
 | ||
|  |     @output Out: Activated after the arc has been drawn. | ||
|  | 
 | ||
|  |     @see [`kha.graphics2.GraphicsExtension.drawArc()`](http://kha.tech/api/kha/graphics2/GraphicsExtension.html#drawArc). | ||
|  |     @see [`kha.graphics2.GraphicsExtension.fillArc()`](http://kha.tech/api/kha/graphics2/GraphicsExtension.html#fillArc). | ||
|  |     """
 | ||
|  |     bl_idname = 'LNDrawArcNode' | ||
|  |     bl_label = 'Draw Arc' | ||
|  |     lnx_section = 'draw' | ||
|  |     lnx_version = 1 | ||
|  | 
 | ||
|  |     def lnx_init(self, context): | ||
|  |         self.add_input('LnxNodeSocketAction', 'Draw') | ||
|  |         self.add_input('LnxColorSocket', 'Color', default_value=[1.0, 1.0, 1.0, 1.0]) | ||
|  |         self.add_input('LnxBoolSocket', 'Filled', default_value=False) | ||
|  |         self.add_input('LnxFloatSocket', 'Strength', default_value=1.0) | ||
|  |         self.add_input('LnxIntSocket', 'Segments') | ||
|  |         self.add_input('LnxFloatSocket', 'Center X') | ||
|  |         self.add_input('LnxFloatSocket', 'Center Y') | ||
|  |         self.add_input('LnxFloatSocket', 'Radius', default_value=20.0) | ||
|  |         self.add_input('LnxFloatSocket', 'Start Angle') | ||
|  |         self.add_input('LnxFloatSocket', 'End Angle') | ||
|  |         self.add_input('LnxBoolSocket', 'Exterior Angle', default_value=False) | ||
|  | 
 | ||
|  |         self.add_output('LnxNodeSocketAction', 'Out') |