LNXSDK/leenkx/blender/lnx/logicnode/animation/LN_simple_foot_ik.py
2025-01-22 16:18:30 +01:00

54 lines
2.6 KiB
Python

from lnx.logicnode.lnx_nodes import *
class SimpleFootIKNode(LnxLogicTreeNode):
"""Performs inverse kinematics on the selected armature with specified bone.
@input Object: Armature on which IK should be performed.
@input Bone: Effector or tip bone for the inverse kinematics
@input Goal Position: Position in world coordinates the effector bone will track to
@input Enable Pole: Bend IK solution towards pole location
@input Pole Position: Location of the pole in world coordinates
@input Chain Length: Number of bones to include in the IK solver including the effector. If set to 0, all bones from effector to the root bone of the armature will be considered.
@input Max Iterations: Maximum allowed FABRIK iterations to solve for IK. For longer chains, more iterations are needed.
@input Precision: Presition of IK to stop at. It is described as a tolerence in length. Typically 0.01 is a good value.
@input Roll Angle: Roll the bones along their local axis with specified radians. set 0 for no extra roll.
"""
bl_idname = 'LNSimpleFootIKNode'
bl_label = 'Foot IK Node'
lnx_version = 1
lnx_section = 'armature'
property0: HaxeStringProperty('property0', name = '', default = '')
property1: HaxeStringProperty('property1', name = '', default = '')
def draw_buttons(self, context, layout):
layout.label(text='Left Foot Name:')
layout.prop(self, 'property0')
layout.label(text='Right Foot Name:')
layout.prop(self, 'property1')
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxNodeSocketAnimTree', 'Action')
self.add_input('LnxFloatSocket', 'Scan Height', default_value = 1.0)
self.add_input('LnxFloatSocket', 'Scan Depth', default_value = 1.0)
self.add_input('LnxIntSocket', 'Collision Mask', default_value = 1)
self.add_input('LnxFloatSocket', 'Height Offset', default_value = 0.0)
self.add_input('LnxFloatSocket', 'Foot Offset', default_value = 0.0)
self.add_input('LnxFloatSocket', 'Offset Threshold', default_value = 1.0)
self.add_input('LnxFloatSocket', 'Interp Speed', default_value = 0.1)
self.add_input('LnxIntSocket', 'Bone Group', default_value = -1)
self.add_input('LnxFloatSocket', 'Influence', default_value = 1.0)
self.add_input('LnxBoolSocket', 'Use Pole Targets', default_value = False)
self.add_input('LnxBoolSocket', 'Rotate Foot', default_value = False)
self.add_input('LnxNodeSocketArray', 'Pole And Direction Array')
self.add_output('LnxNodeSocketAnimTree', 'Result')