armory/blender/arm/logicnode/math/LN_mix.py

47 lines
1.6 KiB
Python
Raw Normal View History

2018-04-19 16:29:15 +02:00
from arm.logicnode.arm_nodes import *
class MixNode(ArmLogicTreeNode):
2020-10-05 19:55:56 +02:00
"""Interpolates between the two given values."""
2018-04-19 16:29:15 +02:00
bl_idname = 'LNMixNode'
2020-09-25 00:49:21 +02:00
bl_label = 'Mix'
arm_version = 1
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'),
2020-10-28 15:16:14 +01:00
('Bounce', 'Bounce', 'Bounce'),
('Elastic', 'Elastic', 'Elastic'),
2018-04-19 16:29:15 +02:00
],
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):
super(MixNode, self).init(context)
2020-09-08 21:49:02 +02:00
self.add_input('NodeSocketFloat', 'Factor', default_value=0.0)
2020-09-20 20:10:01 +02:00
self.add_input('NodeSocketFloat', 'Value 1', default_value=0.0)
self.add_input('NodeSocketFloat', 'Value 2', default_value=1.0)
2020-11-17 16:01:15 +01:00
2020-09-20 20:10:01 +02:00
self.add_output('NodeSocketFloat', 'Result')
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')