2018-02-22 13:25:06 +01:00
|
|
|
package armory.logicnode;
|
|
|
|
|
|
|
|
import iron.object.Object;
|
|
|
|
|
|
|
|
class SetParentBoneNode extends LogicNode {
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
public function new(tree: LogicTree) {
|
2018-02-22 13:25:06 +01:00
|
|
|
super(tree);
|
|
|
|
}
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
override function run(from: Int) {
|
2018-11-16 14:01:41 +01:00
|
|
|
#if arm_skin
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
var object: Object = inputs[1].get();
|
|
|
|
var parent: Object = inputs[2].get();
|
|
|
|
var bone: String = inputs[3].get();
|
|
|
|
|
2018-02-22 13:25:06 +01:00
|
|
|
if (object == null || parent == null) return;
|
|
|
|
|
|
|
|
if (object.parent != parent) {
|
|
|
|
object.parent.removeChild(object, false); // keepTransform
|
2018-02-22 15:27:27 +01:00
|
|
|
parent.addChild(object, false); // applyInverse
|
2018-02-22 13:25:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var banim = object.getParentArmature(object.parent.name);
|
|
|
|
banim.addBoneChild(bone, object);
|
|
|
|
|
2018-10-22 10:10:33 +02:00
|
|
|
runOutput(0);
|
2018-11-16 14:01:41 +01:00
|
|
|
|
|
|
|
#end
|
2018-02-22 13:25:06 +01:00
|
|
|
}
|
|
|
|
}
|