forked from LeenkxTeam/LNXSDK
Repe [T3DU] Update - 31f26d171bba0355ce2a77031e3aad4c64dbc7e9
This commit is contained in:
@ -16,53 +16,22 @@ class DrawCameraNode(LnxLogicTreeNode):
|
||||
bl_idname = 'LNDrawCameraNode'
|
||||
bl_label = 'Draw Camera'
|
||||
lnx_section = 'draw'
|
||||
lnx_version = 2
|
||||
min_inputs = 7
|
||||
lnx_version = 4
|
||||
|
||||
num_choices: IntProperty(default=0, min=0)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DrawCameraNode, self).__init__(*args, **kwargs)
|
||||
array_nodes[str(id(self))] = self
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'Start')
|
||||
self.add_input('LnxNodeSocketAction', 'Stop')
|
||||
self.add_sockets()
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'On Start')
|
||||
self.add_output('LnxNodeSocketAction', 'On Stop')
|
||||
|
||||
def add_sockets(self):
|
||||
self.num_choices += 1
|
||||
self.add_input('LnxNodeSocketObject', 'Camera ' + str(self.num_choices))
|
||||
self.add_input('LnxIntSocket', 'X')
|
||||
self.add_input('LnxIntSocket', 'Y')
|
||||
self.add_input('LnxIntSocket', 'Width')
|
||||
self.add_input('LnxIntSocket', 'Height')
|
||||
self.add_input('LnxBoolSocket', 'Paused')
|
||||
|
||||
def remove_sockets(self):
|
||||
if self.num_choices > 1:
|
||||
for _ in range(5):
|
||||
self.inputs.remove(self.inputs.values()[-1])
|
||||
self.num_choices -= 1
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
row = layout.row(align=True)
|
||||
|
||||
op = row.operator('lnx.node_call_func', text='Add Camera', icon='PLUS', emboss=True)
|
||||
op.node_index = str(id(self))
|
||||
op.callback_name = 'add_sockets'
|
||||
|
||||
column = row.column(align=True)
|
||||
op = column.operator('lnx.node_call_func', text='', icon='X', emboss=True)
|
||||
op.node_index = str(id(self))
|
||||
op.callback_name = 'remove_sockets'
|
||||
if len(self.inputs) == self.min_inputs:
|
||||
column.enabled = False
|
||||
self.add_output('LnxNodeSocketAction', 'On Start')
|
||||
self.add_output('LnxNodeSocketAction', 'On Stop')
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
raise LookupError()
|
||||
|
||||
return NodeReplacement.Identity(self)
|
||||
|
||||
49
leenkx/blender/lnx/logicnode/draw/LN_draw_gif.py
Normal file
49
leenkx/blender/lnx/logicnode/draw/LN_draw_gif.py
Normal file
@ -0,0 +1,49 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class DrawGifNode(LnxLogicTreeNode):
|
||||
"""Draws an image.
|
||||
|
||||
@input Draw: Activate to draw the image on this frame. The input must
|
||||
@input In:
|
||||
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 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 = 'LNDrawGifNode'
|
||||
bl_label = 'Draw Gif'
|
||||
lnx_section = 'draw'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'Draw')
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
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', 'Angle')
|
||||
self.add_input('LnxIntSocket', 'Start Index')
|
||||
self.add_input('LnxIntSocket', 'End Index', default_value=-1)
|
||||
self.add_input('LnxFloatSocket', 'Frame Duration', default_value=1.0)
|
||||
self.add_input('LnxBoolSocket', 'Loop', default_value=True)
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxIntSocket', 'Total Frames')
|
||||
self.add_output('LnxIntSocket', 'Index')
|
||||
@ -50,5 +50,6 @@ class DrawImageRenderNode(LnxLogicTreeNode):
|
||||
self.add_input('LnxFloatSocket', 'sHeight')
|
||||
self.add_input('LnxFloatSocket', 'Angle')
|
||||
self.add_input('LnxBoolSocket', 'Render2D')
|
||||
self.add_input('LnxBoolSocket', 'Continuous')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
@ -27,6 +27,20 @@ class DrawStringNode(LnxLogicTreeNode):
|
||||
lnx_section = 'draw'
|
||||
lnx_version = 3
|
||||
|
||||
property1: HaxeEnumProperty(
|
||||
'property1',
|
||||
items = [('TextLeft', 'Hor. Align. Left', 'Hor. Align. Left'),
|
||||
('TextCenter', 'Hor. Align. Center', 'Hor. Align. Center'),
|
||||
('TextRight', 'Hor. Align. Right', 'Hor. Align. Right'),],
|
||||
name='', default='TextLeft')
|
||||
|
||||
property2: HaxeEnumProperty(
|
||||
'property2',
|
||||
items = [('TextTop', 'Ver. Align. Top', 'Ver. Align. Top'),
|
||||
('TextMiddle', 'Ver. Align. Middle', 'Ver. Align. Middle'),
|
||||
('TextBottom', 'Ver. Align. Bottom', 'Ver. Align. Bottom'),],
|
||||
name='', default='TextTop')
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'Draw')
|
||||
self.add_input('LnxStringSocket', 'String')
|
||||
@ -41,6 +55,10 @@ class DrawStringNode(LnxLogicTreeNode):
|
||||
self.add_output('LnxFloatSocket', 'Width')
|
||||
self.add_output('LnxFloatSocket', 'Height')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property1')
|
||||
layout.prop(self, 'property2')
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1, 2):
|
||||
raise LookupError()
|
||||
|
||||
17
leenkx/blender/lnx/logicnode/draw/LN_reorder_render2D.py
Normal file
17
leenkx/blender/lnx/logicnode/draw/LN_reorder_render2D.py
Normal file
@ -0,0 +1,17 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class ReorderRender2DNode(LnxLogicTreeNode):
|
||||
|
||||
bl_idname = 'LNReorderRender2DNode'
|
||||
bl_label = 'Reorder Render2D'
|
||||
lnx_section = 'draw'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxDynamicSocket', 'Render2D')
|
||||
self.add_input('LnxIntSocket', 'Index')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxIntSocket', 'Index')
|
||||
Reference in New Issue
Block a user