From 0423a735fc0ed7fe4d8bc7a6b2b0173f413a74c0 Mon Sep 17 00:00:00 2001 From: LeenkxTeam Date: Tue, 24 Jun 2025 18:43:30 +0000 Subject: [PATCH] Update leenkx/Sources/leenkx/logicnode/PlayAnimationTreeNode.hx --- .../leenkx/logicnode/PlayAnimationTreeNode.hx | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/leenkx/Sources/leenkx/logicnode/PlayAnimationTreeNode.hx b/leenkx/Sources/leenkx/logicnode/PlayAnimationTreeNode.hx index 8a1d236..27c17e4 100644 --- a/leenkx/Sources/leenkx/logicnode/PlayAnimationTreeNode.hx +++ b/leenkx/Sources/leenkx/logicnode/PlayAnimationTreeNode.hx @@ -9,19 +9,38 @@ import iron.Scene; class PlayAnimationTreeNode extends LogicNode { + var object: Object; + var action: Dynamic; + var init: Bool = false; + public function new(tree: LogicTree) { super(tree); } override function run(from: Int) { - var object: Object = inputs[1].get(); - var action: Dynamic = inputs[2].get(); - + object = inputs[1].get(); + action = inputs[2].get(); assert(Error, object != null, "The object input not be null"); + init = true; + tree.notifyOnUpdate(playAnim); + // TO DO: Investigate AnimAction get and PlayAnimationTree notifiers + } + + function playAnim() { + if (init = false) return; + + init = false; + tree.removeUpdate(playAnim); + var animation = object.animation; if(animation == null) { #if lnx_skin animation = object.getBoneAnimation(object.uid); + if (animation == null) { + tree.notifyOnUpdate(playAnim); + init = true; + return; + } cast(animation, BoneAnimation).setAnimationLoop(function f(mats) { action(mats); }); @@ -32,7 +51,6 @@ class PlayAnimationTreeNode extends LogicNode { action(mats); }); } - runOutput(0); } }