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)
|
||||
|
||||
Reference in New Issue
Block a user