Update leenkx/Sources/leenkx/logicnode/SetBoneTransformNode.hx
This commit is contained in:
		@ -1,38 +1,37 @@
 | 
			
		||||
package leenkx.logicnode;
 | 
			
		||||
 | 
			
		||||
import iron.object.Object;
 | 
			
		||||
#if lnx_skin
 | 
			
		||||
import iron.object.BoneAnimation;
 | 
			
		||||
#end
 | 
			
		||||
import iron.math.Mat4;
 | 
			
		||||
 | 
			
		||||
class SetBoneTransformNode extends LogicNode {
 | 
			
		||||
 | 
			
		||||
	public function new(tree: LogicTree) {
 | 
			
		||||
		super(tree);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	override function run(from: Int) {
 | 
			
		||||
		#if lnx_skin
 | 
			
		||||
 | 
			
		||||
		var object: Object = inputs[1].get();
 | 
			
		||||
		if (object == null) return;
 | 
			
		||||
                var transform = inputs[3].get();
 | 
			
		||||
                if (transform == null) return;
 | 
			
		||||
                var boneName: String = inputs[2].get();
 | 
			
		||||
 | 
			
		||||
		var anim = object.animation != null ? cast(object.animation, BoneAnimation) : null;
 | 
			
		||||
		if (anim == null) anim = object.getBoneAnimation(object.uid);
 | 
			
		||||
 | 
			
		||||
		// Get bone in armature
 | 
			
		||||
		var bone = anim.getBone(boneName);
 | 
			
		||||
 | 
			
		||||
		anim.setBoneMatFromWorldMat(anim.skeletonMats, transform, bone);
 | 
			
		||||
                //return anim.getAbsMat(bone).clone().multmat(object.transform.world);
 | 
			
		||||
 | 
			
		||||
		runOutput(0);
 | 
			
		||||
 | 
			
		||||
                #end
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
package leenkx.logicnode;
 | 
			
		||||
 | 
			
		||||
import iron.object.Object;
 | 
			
		||||
#if lnx_skin
 | 
			
		||||
import iron.object.BoneAnimation;
 | 
			
		||||
#end
 | 
			
		||||
import iron.math.Mat4;
 | 
			
		||||
 | 
			
		||||
class SetBoneTransformNode extends LogicNode {
 | 
			
		||||
 | 
			
		||||
	public function new(tree: LogicTree) {
 | 
			
		||||
		super(tree);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	override function run(from: Int) {
 | 
			
		||||
		#if lnx_skin
 | 
			
		||||
 | 
			
		||||
		var object: Object = inputs[1].get();
 | 
			
		||||
		if (object == null) return;
 | 
			
		||||
                var transform = inputs[3].get();
 | 
			
		||||
                if (transform == null) return;
 | 
			
		||||
                var boneName: String = inputs[2].get();
 | 
			
		||||
 | 
			
		||||
		var anim = object.animation != null ? cast(object.animation, BoneAnimation) : null;
 | 
			
		||||
		if (anim == null) anim = object.getBoneAnimation(object.uid);
 | 
			
		||||
 | 
			
		||||
		// Get bone in armature
 | 
			
		||||
		var bone = anim.getBone(boneName);
 | 
			
		||||
 | 
			
		||||
		anim.setBoneMatFromWorldMat(anim.skeletonMats, transform, bone);
 | 
			
		||||
 | 
			
		||||
		runOutput(0);
 | 
			
		||||
 | 
			
		||||
        #end
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user