2017-04-08 00:34:45 +02:00
|
|
|
package armory.logicnode;
|
|
|
|
|
2017-11-20 15:16:52 +01:00
|
|
|
import iron.object.Object;
|
2017-04-08 00:34:45 +02:00
|
|
|
|
2017-04-08 20:05:35 +02:00
|
|
|
class AnimationStateNode extends LogicNode {
|
2017-04-08 00:34:45 +02:00
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
public function new(tree: LogicTree) {
|
2017-04-08 00:34:45 +02:00
|
|
|
super(tree);
|
|
|
|
}
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
override function get(from: Int): Dynamic {
|
|
|
|
var object: Object = inputs[0].get();
|
2017-04-08 00:34:45 +02:00
|
|
|
|
2017-09-20 14:27:45 +02:00
|
|
|
if (object == null) return null;
|
2020-10-14 15:03:47 +02:00
|
|
|
|
2018-03-02 14:50:58 +01:00
|
|
|
var animation = object.animation;
|
2020-10-14 15:03:47 +02:00
|
|
|
|
2018-03-02 14:50:58 +01:00
|
|
|
if (animation == null) animation = object.getParentArmature(object.name);
|
2017-04-08 00:34:45 +02:00
|
|
|
|
2020-10-14 15:03:47 +02:00
|
|
|
return switch (from) {
|
2020-10-14 15:05:31 +02:00
|
|
|
case 0: animation.action;
|
|
|
|
case 1: animation.currentFrame();
|
|
|
|
case 2: animation.paused;
|
|
|
|
default: null;
|
2020-10-14 15:03:47 +02:00
|
|
|
}
|
2017-04-08 00:34:45 +02:00
|
|
|
}
|
|
|
|
}
|