forked from LeenkxTeam/LNXSDK
Repe [T3DU] Update - 31f26d171bba0355ce2a77031e3aad4c64dbc7e9
This commit is contained in:
@ -6,9 +6,16 @@ class GetTransformNode(LnxLogicTreeNode):
|
||||
rotation and scale."""
|
||||
bl_idname = 'LNGetTransformNode'
|
||||
bl_label = 'Get Object Transform'
|
||||
lnx_version = 1
|
||||
lnx_version = 2
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxBoolSocket', 'Parent Relative')
|
||||
|
||||
self.add_output('LnxDynamicSocket', 'Transform')
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
raise LookupError()
|
||||
|
||||
return NodeReplacement.Identity(self)
|
||||
|
||||
@ -51,12 +51,6 @@ class RotateObjectNode(LnxLogicTreeNode):
|
||||
name='', default='Local')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
raise LookupError()
|
||||
|
||||
@ -12,19 +12,22 @@ class SeparateRotationNode(LnxLogicTreeNode):
|
||||
|
||||
self.add_output('LnxVectorSocket', 'Euler Angles / Vector XYZ')
|
||||
self.add_output('LnxFloatSocket', 'Angle / W')
|
||||
|
||||
|
||||
self.outputs[1].hide = True
|
||||
|
||||
def on_property_update(self, context):
|
||||
"""called by the EnumProperty, used to update the node socket labels"""
|
||||
if self.property0 == 'Quaternion':
|
||||
self.outputs[0].name = "Quaternion XYZ"
|
||||
self.outputs[1].name = "Quaternion W"
|
||||
self.outputs[1].hide = False
|
||||
elif self.property0 == 'EulerAngles':
|
||||
self.outputs[0].name = "Euler Angles"
|
||||
self.outputs[1].name = "[unused for Euler output]"
|
||||
self.outputs[1].hide = True
|
||||
elif self.property0 == 'AxisAngle':
|
||||
self.outputs[0].name = "Axis"
|
||||
self.outputs[1].name = "Angle"
|
||||
self.outputs[1].hide = False
|
||||
else:
|
||||
raise ValueError('No nodesocket labels for current input mode: check self-consistancy of LN_separate_rotation.py')
|
||||
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class SetDimensionNode(LnxLogicTreeNode):
|
||||
"""Sets the dimension of the given object."""
|
||||
bl_idname = 'LNSetDimensionNode'
|
||||
bl_label = 'Set Object Dimension'
|
||||
lnx_section = 'dimension'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxVectorSocket', 'Dimension', default_value=[1.0, 1.0, 1.0])
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
@ -6,7 +6,7 @@ class SetRotationNode(LnxLogicTreeNode):
|
||||
bl_idname = 'LNSetRotationNode'
|
||||
bl_label = 'Set Object Rotation'
|
||||
lnx_section = 'rotation'
|
||||
lnx_version = 2
|
||||
lnx_version = 3
|
||||
|
||||
|
||||
def lnx_init(self, context):
|
||||
@ -16,15 +16,42 @@ class SetRotationNode(LnxLogicTreeNode):
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0_proxy')
|
||||
|
||||
def on_proxyproperty_update(self, context=None):
|
||||
self.property0 = self.property0_proxy
|
||||
print(self.property0)
|
||||
|
||||
property0_proxy: EnumProperty(
|
||||
items = [('Local', 'Local F.O.R.', 'Frame of reference oriented with the object'),
|
||||
('Global', 'Global/Parent F.O.R.',
|
||||
'Frame of reference oriented with the object\'s parent or the world')],
|
||||
name='', default='Local',
|
||||
update = on_proxyproperty_update
|
||||
)
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items=[('Euler Angles', 'NODE REPLACEMENT ONLY', ''),
|
||||
('Angle Axies (Radians)', 'NODE REPLACEMENT ONLY', ''),
|
||||
('Angle Axies (Degrees)', 'NODE REPLACEMENT ONLY', ''),
|
||||
('Quaternion', 'NODE REPLACEMENT ONLY', ''),
|
||||
('Local', 'Local F.O.R.', 'Frame of reference oriented with the object'),
|
||||
('Global', 'Global/Parent F.O.R.',
|
||||
'Frame of reference oriented with the object\'s parent or the world')
|
||||
],
|
||||
name='', default='Local')
|
||||
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
if self.lnx_version not in (0, 1, 2):
|
||||
raise LookupError()
|
||||
|
||||
if self.lnx_version == 2:
|
||||
return NodeReplacement.Identity(self)
|
||||
|
||||
# transition from version 1 to version 2: make rotations their own sockets
|
||||
# this transition is a mess, I know.
|
||||
|
||||
|
||||
newself = self.id_data.nodes.new('LNRotateObjectNode')
|
||||
inputnode = self.id_data.nodes.new('LNRotationNode')
|
||||
@ -66,11 +93,3 @@ class SetRotationNode(LnxLogicTreeNode):
|
||||
)
|
||||
newself.inputs[2].default_value_raw = quat
|
||||
return [newself, inputnode]
|
||||
|
||||
# note: this is unused, but kept here so that the 'property0' field can be read during node replacement
|
||||
property0: EnumProperty(
|
||||
items = [('Euler Angles', '',''),
|
||||
('Angle Axies (Radians)', '', ''),
|
||||
('Angle Axies (Degrees)', '', ''),
|
||||
('Quaternion', '', '')],
|
||||
name='', default='Euler Angles')
|
||||
|
||||
@ -1,13 +1,31 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
def update_node(self, context):
|
||||
if self.property0 == 'Invert':
|
||||
self.inputs[1].hide = True
|
||||
else:
|
||||
self.inputs[1].hide = False
|
||||
|
||||
class TransformMathNode(LnxLogicTreeNode):
|
||||
"""Operates the two given transform values."""
|
||||
"""Performs mathematical operations on transformation matrices."""
|
||||
bl_idname = 'LNTransformMathNode'
|
||||
bl_label = 'Transform Math'
|
||||
lnx_version = 1
|
||||
lnx_version = 2
|
||||
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items = [
|
||||
('Multiply', 'Multiply', 'Standard matrix multiplication combining position, rotation, and scale'),
|
||||
('Invert', 'Invert', 'Calculates the inverse matrix, reversing all transformations'),
|
||||
('Transform Math', 'Transform Math', 'Multiplies rotation and scale while directly adding translations')
|
||||
],
|
||||
name='', default='Multiply', update=update_node)
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxDynamicSocket', 'Transform 1')
|
||||
self.add_input('LnxDynamicSocket', 'Transform 2')
|
||||
|
||||
self.add_output('LnxDynamicSocket', 'Result')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
|
||||
Reference in New Issue
Block a user