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

34 lines
1.3 KiB
Python

from lnx.logicnode.lnx_nodes import *
class AnimationStateNode(LnxLogicTreeNode):
"""Returns the information about the current action of the given object."""
bl_idname = 'LNAnimationStateNode'
bl_label = 'Get Action State'
lnx_version = 2
property0: HaxeStringProperty('property0', name='', default='')
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxNodeSocketAction', 'On Complete')
self.add_output('LnxBoolSocket', 'Initialized')
self.add_output('LnxStringSocket', 'Action Name')
self.add_output('LnxIntSocket', 'Current Frame')
self.add_output('LnxBoolSocket', 'Is Paused')
self.add_output('LnxFloatSocket', 'Speed')
self.add_output('LnxIntSocket', 'Total Frames')
def draw_buttons(self, context, layout):
layout.label(text='Action ID:')
layout.prop(self, 'property0')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement(
'LNAnimationStateNode', self.lnx_version, 'LNAnimationStateNode', 2,
in_socket_mapping={}, out_socket_mapping={}
)