2018-04-19 16:29:15 +02:00
|
|
|
import bpy
|
|
|
|
from bpy.props import *
|
|
|
|
from bpy.types import Node, NodeSocket
|
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
|
|
|
class MixNode(Node, ArmLogicTreeNode):
|
|
|
|
'''Mix node'''
|
|
|
|
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):
|
|
|
|
self.inputs.new('NodeSocketFloat', 'Factor')
|
|
|
|
self.inputs[-1].default_value = 0.0
|
|
|
|
self.inputs.new('NodeSocketFloat', 'Value1')
|
|
|
|
self.inputs[-1].default_value = 0.0
|
|
|
|
self.inputs.new('NodeSocketFloat', 'Value2')
|
|
|
|
self.inputs[-1].default_value = 1.0
|
|
|
|
self.outputs.new('NodeSocketFloat', 'Value')
|
|
|
|
|
|
|
|
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)
|