Aligned structure to how Armory does things.

This commit is contained in:
Maxim Stewart 2018-10-06 00:14:16 -05:00
parent e7574b343d
commit a695f10759
4 changed files with 32 additions and 20 deletions

View File

@ -41,9 +41,9 @@ class EnhancedTransformNode extends LogicNode {
scale.z = object.transform.scale.z; scale.z = object.transform.scale.z;
} }
q.fromEuler(rot.x, rot.y, rot.z); q.fromEuler(rot.x, rot.y, rot.z);
value.compose(loc, q, scale); value.compose(loc, q, scale);
object.transform.setMatrix(value); object.transform.setMatrix(value);
#if arm_physics #if arm_physics
var rigidBody = object.getTrait(RigidBody); var rigidBody = object.getTrait(RigidBody);

View File

@ -1,24 +1,10 @@
from bpy.types import Node import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import * from arm.logicnode.arm_nodes import *
import arm.nodes_logic import arm.nodes_logic
from logicnode_definitions import *
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.outputs.new('ArmNodeSocketAction', 'Out')
def register(): def register():
# Add custom nodes
add_node(EnhancedTransformNode, category='Action')
# Register newly added nodes # Register newly added nodes
arm.nodes_logic.register_nodes() arm.nodes_logic.register_nodes()

View File

@ -0,0 +1,5 @@
# Import all nodes
from os.path import dirname, basename, isfile
import glob
modules = glob.glob(dirname(__file__)+"/*.py")
__all__ = [basename(f)[:-3] for f in modules if isfile(f)]

View File

@ -0,0 +1,21 @@
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
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.outputs.new('ArmNodeSocketAction', 'Out')
add_node(EnhancedTransformNode, category='Action')