42 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
|  | from lnx.logicnode.lnx_nodes import * | ||
|  | 
 | ||
|  | 
 | ||
|  | class DrawEllipseNode(LnxLogicTreeNode): | ||
|  |     """Draws an ellipse.
 | ||
|  | 
 | ||
|  |     @input Draw: Activate to draw the ellipse on this frame. The input must | ||
|  |         be (indirectly) called from an `On Render2D` node. | ||
|  |     @input Color: The color of the ellipse. | ||
|  |     @input Filled: Whether the ellipse is filled or only the outline is drawn. | ||
|  |     @input Strength: The line strength if the ellipse is not filled. | ||
|  |     @input Segments: How many line segments should be used to draw the | ||
|  |         ellipse. 0 (default) = automatic. | ||
|  |     @input Center X/Y: The position of the ellipse's center in pixels. | ||
|  |     @input Width: Width of the ellipse in pixels. | ||
|  |     @input Height: Height of the ellipse in pixels. | ||
|  |     @input Angle: Rotation angle in radians. Rotation is clockwise. | ||
|  | 
 | ||
|  |     @output Out: Activated after the circle has been drawn. | ||
|  | 
 | ||
|  |     @see [`kha.graphics2.GraphicsExtension.drawCircle()`](http://kha.tech/api/kha/graphics2/GraphicsExtension.html#drawCircle). | ||
|  |     @see [`kha.graphics2.GraphicsExtension.fillCircle()`](http://kha.tech/api/kha/graphics2/GraphicsExtension.html#fillCircle). | ||
|  |     """
 | ||
|  |     bl_idname = 'LNDrawEllipseNode' | ||
|  |     bl_label = 'Draw Ellipse' | ||
|  |     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', 'Width') | ||
|  |         self.add_input('LnxFloatSocket', 'Height') | ||
|  |         self.add_input('LnxFloatSocket', 'Angle') | ||
|  | 
 | ||
|  |         self.add_output('LnxNodeSocketAction', 'Out') |