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

38 lines
1.3 KiB
Python

from lnx.logicnode.lnx_nodes import *
class GetTilesheetStateNode(LnxLogicTreeNode):
"""Returns the information about the current tilesheet of the given object.
@output Active Tilesheet: Current active tilesheet.
@output Active Action: Current action in the tilesheet.
@output Frame: Frame offset with 0 as the first frame of the active action.
@output Absolute Frame: Absolute frame index in this tilesheet.
@output Is Paused: Tilesheet action paused.
"""
bl_idname = 'LNGetTilesheetStateNode'
bl_label = 'Get Tilesheet State'
lnx_version = 2
lnx_section = 'tilesheet'
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxStringSocket', 'Active Tilesheet')
self.add_output('LnxStringSocket', 'Active Action')
self.add_output('LnxIntSocket', 'Frame')
self.add_output('LnxIntSocket', 'Absolute Frame')
self.add_output('LnxBoolSocket', 'Is Paused')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement(
'LNGetTilesheetStateNode', self.lnx_version, 'LNGetTilesheetStateNode', 2,
in_socket_mapping={}, out_socket_mapping={0:1, 1:3, 2:4}
)