forked from LeenkxTeam/LNXSDK
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
from lnx.logicnode.lnx_nodes import *
 | 
						|
 | 
						|
 | 
						|
class DrawTriangleNode(LnxLogicTreeNode):
 | 
						|
    """Draws a triangle.
 | 
						|
 | 
						|
    @input Draw: Activate to draw the triangle on this frame. The input must
 | 
						|
        be (indirectly) called from an `On Render2D` node.
 | 
						|
    @input Color: The color of the triangle.
 | 
						|
    @input Filled: Whether the triangle is filled or only the outline is drawn.
 | 
						|
    @input Strength: The line strength if the triangle is not filled.
 | 
						|
    @input X/Y: Positions of the vertices of the triangle, in pixels from the top left corner.
 | 
						|
 | 
						|
    @output Out: Activated after the triangle has been drawn.
 | 
						|
 | 
						|
    @see [`kha.graphics2.Graphics.fillTriangle()`](http://kha.tech/api/kha/graphics2/Graphics.html#fillTriangle).
 | 
						|
    """
 | 
						|
    bl_idname = 'LNDrawTriangleNode'
 | 
						|
    bl_label = 'Draw Triangle'
 | 
						|
    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('LnxFloatSocket', 'X1')
 | 
						|
        self.add_input('LnxFloatSocket', 'Y1')
 | 
						|
        self.add_input('LnxFloatSocket', 'X2')
 | 
						|
        self.add_input('LnxFloatSocket', 'Y2')
 | 
						|
        self.add_input('LnxFloatSocket', 'X3')
 | 
						|
        self.add_input('LnxFloatSocket', 'Y3')
 | 
						|
 | 
						|
        self.add_output('LnxNodeSocketAction', 'Out')
 |