armory/blender/arm/logicnode/math/LN_math.py
2020-09-09 00:28:41 +02:00

52 lines
1.9 KiB
Python

from arm.logicnode.arm_nodes import *
class MathNode(ArmLogicTreeNode):
"""Math node"""
bl_idname = 'LNMathNode'
bl_label = 'Math'
property0: EnumProperty(
items = [('Add', 'Add', 'Add'),
('Multiply', 'Multiply', 'Multiply'),
('Sine', 'Sine', 'Sine'),
('Cosine', 'Cosine', 'Cosine'),
('Max', 'Maximum', 'Max'),
('Min', 'Minimum', 'Min'),
('Abs', 'Absolute', 'Abs'),
('Subtract', 'Subtract', 'Subtract'),
('Divide', 'Divide', 'Divide'),
('Tangent', 'Tangent', 'Tangent'),
('Arcsine', 'Arcsine', 'Arcsine'),
('Arccosine', 'Arccosine', 'Arccosine'),
('Arctangent', 'Arctangent', 'Arctangent'),
('Power', 'Power', 'Power'),
('Logarithm', 'Logarithm', 'Logarithm'),
('Round', 'Round', 'Round'),
('Less Than', 'Less Than', 'Less Than'),
('Greater Than', 'Greater Than', 'Greater Than'),
('Modulo', 'Modulo', 'Modulo'),
('Arctan2', 'Arctan2', 'Arctan2'),
('Floor', 'Floor', 'Floor'),
('Ceil', 'Ceil', 'Ceil'),
('Fract', 'Fract', 'Fract'),
('Square Root', 'Square Root', 'Square Root'),
],
name='', default='Add')
@property
def property1(self):
return 'true' if self.property1_ else 'false'
property1_: BoolProperty(name='Clamp', default=False)
def init(self, context):
self.add_input('NodeSocketFloat', 'Value', default_value=0.5)
self.add_input('NodeSocketFloat', 'Value', default_value=0.5)
self.add_output('NodeSocketFloat', 'Value')
def draw_buttons(self, context, layout):
layout.prop(self, 'property1_')
layout.prop(self, 'property0')
add_node(MathNode, category=MODULE_AS_CATEGORY)