forked from LeenkxTeam/LNXSDK
53 lines
2.3 KiB
Python
53 lines
2.3 KiB
Python
|
|
from lnx.logicnode.lnx_nodes import *
|
||
|
|
|
||
|
|
class SetCurveMeshNode(LnxLogicTreeNode):
|
||
|
|
"""Sets curve mesh."""
|
||
|
|
bl_idname = 'LNSetCurveMeshNode'
|
||
|
|
bl_label = 'Set Curve Mesh'
|
||
|
|
lnx_section = 'set'
|
||
|
|
lnx_version = 1
|
||
|
|
|
||
|
|
def update_sockets(self, context):
|
||
|
|
while len(self.inputs) > 2:
|
||
|
|
self.inputs.remove(self.inputs[-1])
|
||
|
|
if self.property0 == 'Extrude':
|
||
|
|
self.add_input('LnxFloatSocket', 'Width', default_value = 0.1)
|
||
|
|
self.add_input('LnxFloatSocket', 'Thickness')
|
||
|
|
self.add_input('LnxFloatSocket', 'Start')
|
||
|
|
self.add_input('LnxFloatSocket', 'End', default_value = 1.0)
|
||
|
|
self.add_input('LnxBoolSocket', 'Fill Caps')
|
||
|
|
elif self.property0 == 'Bevel':
|
||
|
|
self.add_input('LnxFloatSocket', 'Depth', default_value = 0.1)
|
||
|
|
self.add_input('LnxIntSocket', 'Resolution')
|
||
|
|
self.add_input('LnxFloatSocket', 'Start')
|
||
|
|
self.add_input('LnxFloatSocket', 'End', default_value = 1.0)
|
||
|
|
self.add_input('LnxBoolSocket', 'Fill Caps')
|
||
|
|
else:
|
||
|
|
self.add_input('LnxNodeSocketObject', 'Object')
|
||
|
|
self.add_input('LnxStringSocket', 'Forward Axis', default_value = 'X')
|
||
|
|
self.add_input('LnxIntSocket', 'Repetitions', default_value = 1)
|
||
|
|
self.add_input('LnxFloatSocket', 'Start')
|
||
|
|
self.add_input('LnxFloatSocket', 'End', default_value = 1.0)
|
||
|
|
|
||
|
|
property0: HaxeEnumProperty(
|
||
|
|
'property0',
|
||
|
|
items = [('Extrude', 'Extrude', 'Extrude'),
|
||
|
|
('Bevel', 'Bevel', 'Bevel'),
|
||
|
|
('Deform', 'Deform', 'Deform')],
|
||
|
|
name='', default='Extrude', update=update_sockets)
|
||
|
|
|
||
|
|
def lnx_init(self, context):
|
||
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
||
|
|
self.add_input('LnxNodeSocketObject', 'Curve')
|
||
|
|
self.add_input('LnxFloatSocket', 'Width', default_value = 0.1)
|
||
|
|
self.add_input('LnxFloatSocket', 'Thickness')
|
||
|
|
self.add_input('LnxFloatSocket', 'Start')
|
||
|
|
self.add_input('LnxFloatSocket', 'End', default_value = 1.0)
|
||
|
|
self.add_input('LnxBoolSocket', 'Fill Caps')
|
||
|
|
|
||
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
||
|
|
self.add_output('LnxNodeSocketObject', 'Curve Mesh')
|
||
|
|
|
||
|
|
def draw_buttons(self, context, layout):
|
||
|
|
layout.prop(self, 'property0')
|