Created-Armory-Nodes/blender.py

41 lines
1.3 KiB
Python
Raw Normal View History

2018-08-13 02:07:28 +00:00
from bpy.types import Node
from arm.logicnode.arm_nodes import *
import arm.nodes_logic
class EnhancedTransformNode(Node, ArmLogicTreeNode):
'''EnhancedTransformNode'''
bl_idname = 'LNEnhancedTransformNode'
bl_label = 'Enhanced Transform'
bl_icon = 'GAME'
def init(self, context):
self.inputs.new('ArmNodeSocketAction', 'In')
self.inputs.new('ArmNodeSocketObject', 'Object')
self.inputs.new('NodeSocketVector', 'Location')
self.inputs.new('NodeSocketVector', 'Rotation')
self.inputs.new('NodeSocketVector', 'Scale')
self.inputs[-1].default_value = [1.0, 1.0, 1.0]
self.outputs.new('ArmNodeSocketAction', 'Out')
class LookAtNode(Node, ArmLogicTreeNode):
'''LookAtNode'''
bl_idname = 'LNLookAtNode'
bl_label = 'Look At'
bl_icon = 'GAME'
def init(self, context):
self.inputs.new('ArmNodeSocketAction', 'In')
self.inputs.new('ArmNodeSocketObject', 'Object')
self.inputs.new('ArmNodeSocketObject', 'Object')
self.inputs.new('NodeSocketBool', '3D Track')
self.outputs.new('ArmNodeSocketAction', 'Out')
def register():
# Add custom nodes
add_node(EnhancedTransformNode, category='Action')
add_node(LookAtNode, category='Action')
# Register newly added nodes
arm.nodes_logic.register_nodes()