LNXSDK/leenkx/blender/lnx/logicnode/draw/LN_draw_circle.py
2025-01-22 16:18:30 +01:00

38 lines
1.7 KiB
Python

from lnx.logicnode.lnx_nodes import *
class DrawCircleNode(LnxLogicTreeNode):
"""Draws a circle.
@input Draw: Activate to draw the circle on this frame. The input must
be (indirectly) called from an `On Render2D` node.
@input Color: The color of the circle.
@input Filled: Whether the circle is filled or only the outline is drawn.
@input Strength: The line strength if the circle is not filled.
@input Segments: How many line segments should be used to draw the
circle. 0 (default) = automatic.
@input Center X/Y: The position of the circle's center, in pixels from the top left corner.
@input Radius: The radius of the circle in pixels.
@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 = 'LNDrawCircleNode'
bl_label = 'Draw Circle'
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')
self.add_output('LnxNodeSocketAction', 'Out')