armory/blender/arm/logicnode/action_rotate_object_around_axis.py
niacdoial 17daabeb29 Improved quaternion and angle handling in logic nodes (+2bugfixes)
- Made so all nodes outputting a quaternion object also output it as a XYZ (vector) + W (float) combination
- Modernized the interface of the "Action/Rotate Object" node, to align on the newer "Action/Set Rotation" node interface  ("Action/Rotate Object Along Axis" is now depreciated, but still usable)
- Fixed a blender-side-only bug with the "Logic/Switch" node (...which technically could have lead to a compile-time problem if exploited the right way)
- Fixed a bug on the "Action/Set Rotation" node: now, quaternion input is automatically normalized in order to avoid accidental scaling
- Added a "Value/Separate Quaternion" node
- Made so the names of some sockets change in the "Set Rotation" and "Rotate Object" nodes, so they adapt to those nodes' input types.
  (Same thing with "Value/Vector From Transform"'s output type)
2020-08-30 15:50:06 +02:00

26 lines
975 B
Python

import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class RotateObjectAroundAxisNode(Node, ArmLogicTreeNode):
'''Rotate object around axis node'''
bl_idname = 'LNRotateObjectAroundAxisNode'
bl_label = 'Rotate Object Around Axis'
bl_description = 'Rotate Object Around Axis (Depreciated: use "Rotate Object")'
bl_icon = 'ERROR'
def init(self, context):
self.inputs.new('ArmNodeSocketAction', 'In')
self.inputs.new('ArmNodeSocketObject', 'Object')
self.inputs.new('NodeSocketVector', 'Axis')
self.inputs[-1].default_value = [0, 0, 1]
self.inputs.new('NodeSocketFloat', 'Angle')
self.outputs.new('ArmNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
row = layout.row(align=True)
row.label(text='Depreciated. Consider using "Rotate Object"')
add_node(RotateObjectAroundAxisNode, category='Action')