2018-04-19 16:29:15 +02:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class MixNode(ArmLogicTreeNode):
|
2020-09-08 23:14:51 +02:00
|
|
|
"""Mix node"""
|
2018-04-19 16:29:15 +02:00
|
|
|
bl_idname = 'LNMixNode'
|
2020-09-08 17:03:24 +02:00
|
|
|
bl_label = 'Interpolate'
|
2020-08-07 19:07:51 +02:00
|
|
|
bl_icon = 'NONE'
|
2018-12-18 23:48:38 +01:00
|
|
|
property0: EnumProperty(
|
2018-04-19 16:29:15 +02:00
|
|
|
items = [('Linear', 'Linear', 'Linear'),
|
|
|
|
('Sine', 'Sine', 'Sine'),
|
|
|
|
('Quad', 'Quad', 'Quad'),
|
|
|
|
('Cubic', 'Cubic', 'Cubic'),
|
|
|
|
('Quart', 'Quart', 'Quart'),
|
|
|
|
('Quint', 'Quint', 'Quint'),
|
|
|
|
('Expo', 'Expo', 'Expo'),
|
|
|
|
('Circ', 'Circ', 'Circ'),
|
|
|
|
('Back', 'Back', 'Back'),
|
|
|
|
],
|
|
|
|
name='', default='Linear')
|
2018-12-18 23:48:38 +01:00
|
|
|
property1: EnumProperty(
|
2018-04-19 16:29:15 +02:00
|
|
|
items = [('In', 'In', 'In'),
|
|
|
|
('Out', 'Out', 'Out'),
|
|
|
|
('InOut', 'InOut', 'InOut'),
|
|
|
|
],
|
|
|
|
name='', default='Out')
|
|
|
|
|
|
|
|
@property
|
|
|
|
def property2(self):
|
|
|
|
return 'true' if self.property2_ else 'false'
|
|
|
|
|
2018-12-18 23:48:38 +01:00
|
|
|
property2_: BoolProperty(name='Clamp', default=False)
|
2018-04-19 16:29:15 +02:00
|
|
|
|
|
|
|
def init(self, context):
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('NodeSocketFloat', 'Factor', default_value=0.0)
|
|
|
|
self.add_input('NodeSocketFloat', 'Value1', default_value=0.0)
|
|
|
|
self.add_input('NodeSocketFloat', 'Value2', default_value=1.0)
|
|
|
|
self.add_output('NodeSocketFloat', 'Value')
|
2018-04-19 16:29:15 +02:00
|
|
|
|
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
layout.prop(self, 'property2_')
|
|
|
|
layout.prop(self, 'property0')
|
|
|
|
layout.prop(self, 'property1')
|
|
|
|
|
2020-09-08 17:03:24 +02:00
|
|
|
add_node(MixNode, category=MODULE_AS_CATEGORY)
|