armory/blender/arm/logicnode/transform/LN_look_at.py
2021-07-03 19:45:05 +02:00

29 lines
893 B
Python

from arm.logicnode.arm_nodes import *
class LookAtNode(ArmLogicTreeNode):
"""Converts the two given coordinates to a quaternion rotation."""
bl_idname = 'LNLookAtNode'
bl_label = 'Look At'
arm_section = 'rotation'
arm_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('X', ' X', 'X'),
('-X', '-X', '-X'),
('Y', ' Y', 'Y'),
('-Y', '-Y', '-Y'),
('Z', ' Z', 'Z'),
('-Z', '-Z', '-Z')],
name='With', default='Z')
def init(self, context):
super(LookAtNode, self).init(context)
self.add_input('NodeSocketVector', 'From Location')
self.add_input('NodeSocketVector', 'To Location')
self.add_output('NodeSocketVector', 'Rotation')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')