forked from LeenkxTeam/LNXSDK
		
	
		
			
	
	
		
			44 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			44 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
|  | from lnx.logicnode.lnx_nodes import * | ||
|  | 
 | ||
|  | 
 | ||
|  | class DrawSubImageNode(LnxLogicTreeNode): | ||
|  |     """Draws an image.
 | ||
|  |     @input Draw: Activate to draw the image on this frame. The input must | ||
|  |         be (indirectly) called from an `On Render2D` node. | ||
|  |     @input Image: The filename of the image. | ||
|  |     @input Color: The color that the image's pixels are multiplied with. | ||
|  |     @input Left/Center/Right: Horizontal anchor point of the image. | ||
|  |         0 = Left, 1 = Center, 2 = Right | ||
|  |     @input Top/Middle/Bottom: Vertical anchor point of the image. | ||
|  |         0 = Top, 1 = Middle, 2 = Bottom | ||
|  |     @input X/Y: Position of the anchor point in pixels. | ||
|  |     @input Width/Height: Size of the sub image in pixels. | ||
|  |     @input sX/Y: Position of the sub anchor point in pixels. | ||
|  |     @input sWidth/Height: Size of the image in pixels. | ||
|  |     @input Angle: Rotation angle in radians. Image will be rotated cloclwiswe | ||
|  |         at the anchor point. | ||
|  |     @output Out: Activated after the image has been drawn. | ||
|  |     @see [`kha.graphics2.Graphics.drawImage()`](http://kha.tech/api/kha/graphics2/Graphics.html#drawImage). | ||
|  |     """
 | ||
|  |     bl_idname = 'LNDrawSubImageNode' | ||
|  |     bl_label = 'Draw Sub Image' | ||
|  |     lnx_section = 'draw' | ||
|  |     lnx_version = 1 | ||
|  | 
 | ||
|  |     def lnx_init(self, context): | ||
|  |         self.add_input('LnxNodeSocketAction', 'Draw') | ||
|  |         self.add_input('LnxStringSocket', 'Image File') | ||
|  |         self.add_input('LnxColorSocket', 'Color', default_value=[1.0, 1.0, 1.0, 1.0]) | ||
|  |         self.add_input('LnxIntSocket', '0/1/2 = Left/Center/Right', default_value=0) | ||
|  |         self.add_input('LnxIntSocket', '0/1/2 = Top/Middle/Bottom', default_value=0) | ||
|  |         self.add_input('LnxFloatSocket', 'X') | ||
|  |         self.add_input('LnxFloatSocket', 'Y') | ||
|  |         self.add_input('LnxFloatSocket', 'Width') | ||
|  |         self.add_input('LnxFloatSocket', 'Height') | ||
|  |         self.add_input('LnxFloatSocket', 'sX') | ||
|  |         self.add_input('LnxFloatSocket', 'sY') | ||
|  |         self.add_input('LnxFloatSocket', 'sWidth') | ||
|  |         self.add_input('LnxFloatSocket', 'sHeight') | ||
|  |         self.add_input('LnxFloatSocket', 'Angle') | ||
|  | 
 | ||
|  |         self.add_output('LnxNodeSocketAction', 'Out')  |