armory/blender/arm/logicnode/transform/LN_look_at.py

28 lines
868 B
Python
Raw Normal View History

2018-06-14 15:24:28 +02:00
from arm.logicnode.arm_nodes import *
class LookAtNode(ArmLogicTreeNode):
2020-11-17 18:46:14 +01:00
"""Converts the two given coordinates to a quaternion rotation."""
2018-06-14 15:24:28 +02:00
bl_idname = 'LNLookAtNode'
bl_label = 'Look At'
2020-10-27 19:44:37 +01:00
arm_section = 'rotation'
arm_version = 1
2018-06-14 15:24:28 +02:00
property0: EnumProperty(
items = [('X', ' X', 'X'),
('-X', '-X', '-X'),
('Y', ' Y', 'Y'),
('-Y', '-Y', '-Y'),
('Z', ' Z', 'Z'),
('-Z', '-Z', '-Z')],
name='With', default='Z')
2018-06-14 15:24:28 +02:00
def init(self, context):
super(LookAtNode, self).init(context)
2020-09-08 21:49:02 +02:00
self.add_input('NodeSocketVector', 'From Location')
self.add_input('NodeSocketVector', 'To Location')
2020-11-17 16:01:15 +01:00
2020-09-08 21:49:02 +02:00
self.add_output('NodeSocketVector', 'Rotation')
2018-06-14 15:24:28 +02:00
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')