forked from LeenkxTeam/LNXSDK
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
|
|
from lnx.logicnode.lnx_nodes import *
|
||
|
|
|
||
|
|
class SetCurveDataNode(LnxLogicTreeNode):
|
||
|
|
"""Sets curve data."""
|
||
|
|
bl_idname = 'LNSetCurveDataNode'
|
||
|
|
bl_label = 'Set Curve Data'
|
||
|
|
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 == 'Equidistant Samples':
|
||
|
|
self.add_input('LnxIntSocket', 'Equidistant Samples')
|
||
|
|
elif self.property0 == 'Strength':
|
||
|
|
self.add_input('LnxFloatSocket', 'Strength')
|
||
|
|
elif self.property0 == 'Color':
|
||
|
|
self.add_input('LnxColorSocket', 'Color')
|
||
|
|
else:
|
||
|
|
self.add_input('LnxIntSocket', 'Resolution', default_value = 12)
|
||
|
|
|
||
|
|
property0: HaxeEnumProperty(
|
||
|
|
'property0',
|
||
|
|
items = [('Equidistant Samples', 'Equidistant Samples', 'Equidistant Samples'),
|
||
|
|
('Resolution', 'Resolution', 'Resolution'),
|
||
|
|
('Strength', 'Strength', 'Strength'),
|
||
|
|
('Color', 'Color', 'Color')],
|
||
|
|
name='', default='Equidistant Samples', update=update_sockets)
|
||
|
|
|
||
|
|
def lnx_init(self, context):
|
||
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
||
|
|
self.add_input('LnxNodeSocketObject', 'Curve')
|
||
|
|
self.add_input('LnxIntSocket', 'Equidistant Samples')
|
||
|
|
|
||
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
||
|
|
|
||
|
|
def draw_buttons(self, context, layout):
|
||
|
|
layout.prop(self, 'property0')
|