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

52 lines
1.9 KiB
Python
Raw Normal View History

2017-03-21 03:06:38 +01:00
from arm.logicnode.arm_nodes import *
class MathNode(ArmLogicTreeNode):
2020-09-08 23:14:51 +02:00
"""Math node"""
2017-04-04 23:11:31 +02:00
bl_idname = 'LNMathNode'
2017-03-21 03:06:38 +01:00
bl_label = 'Math'
2018-12-18 23:48:38 +01:00
property0: EnumProperty(
2017-03-21 03:06:38 +01:00
items = [('Add', 'Add', 'Add'),
('Multiply', 'Multiply', 'Multiply'),
('Sine', 'Sine', 'Sine'),
2017-04-14 20:38:50 +02:00
('Cosine', 'Cosine', 'Cosine'),
2017-10-18 11:28:04 +02:00
('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'),
2018-08-15 19:11:47 +02:00
('Arctan2', 'Arctan2', 'Arctan2'),
('Floor', 'Floor', 'Floor'),
('Ceil', 'Ceil', 'Ceil'),
('Fract', 'Fract', 'Fract'),
('Square Root', 'Square Root', 'Square Root'),
2017-10-18 11:28:04 +02:00
],
2017-04-03 22:29:46 +02:00
name='', default='Add')
2017-10-18 11:28:04 +02:00
@property
def property1(self):
return 'true' if self.property1_ else 'false'
2018-12-18 23:48:38 +01:00
property1_: BoolProperty(name='Clamp', default=False)
2017-10-18 11:28:04 +02:00
2017-03-21 03:06:38 +01:00
def init(self, context):
2020-09-08 21:49:02 +02:00
self.add_input('NodeSocketFloat', 'Value', default_value=0.5)
self.add_input('NodeSocketFloat', 'Value', default_value=0.5)
self.add_output('NodeSocketFloat', 'Value')
2017-03-21 03:06:38 +01:00
def draw_buttons(self, context, layout):
2017-10-18 11:28:04 +02:00
layout.prop(self, 'property1_')
2017-04-03 22:29:46 +02:00
layout.prop(self, 'property0')
2017-03-21 03:06:38 +01:00
add_node(MathNode, category=MODULE_AS_CATEGORY)