forked from LeenkxTeam/LNXSDK
Next patch
This commit is contained in:
@ -13,11 +13,15 @@ import iron.math.Vec2;
|
||||
import haxe.ds.Vector;
|
||||
import iron.object.Object;
|
||||
import iron.object.Animation;
|
||||
import iron.object.Animation.ActionSampler;
|
||||
#if lnx_skin
|
||||
import iron.object.BoneAnimation;
|
||||
#end
|
||||
import iron.object.ObjectAnimation;
|
||||
|
||||
class AnimationExtension {
|
||||
|
||||
#if lnx_skin
|
||||
public static function solveIKBlend(boneAnimation: BoneAnimation, actionMats: Array<Mat4>, effector: TObj, goal: Vec4, precision = 0.01, maxIterations = 100, chainLenght = 100, pole: Vec4 = null, rollAngle = 0.0, influence = 0.0, layerMask: Null<Int> = null, threshold: FastFloat = 0.1) {
|
||||
|
||||
var matsBlend = boneAnimation.initMatsEmpty();
|
||||
@ -31,7 +35,9 @@ class AnimationExtension {
|
||||
boneAnimation.solveIK(actionMats, effector, goal, precision, maxIterations, chainLenght, pole, rollAngle);
|
||||
boneAnimation.blendAction(matsBlend, actionMats, actionMats, influence, layerMask, threshold);
|
||||
}
|
||||
#end
|
||||
|
||||
#if lnx_skin
|
||||
public static function solveTwoBoneIKBlend(boneAnimation: BoneAnimation, actionMats: Array<Mat4>, effector: TObj, goal: Vec4, pole: Vec4 = null, rollAngle = 0.0, influence = 0.0, layerMask: Null<Int> = null, threshold: FastFloat = 0.1) {
|
||||
|
||||
var matsBlend = boneAnimation.initMatsEmpty();
|
||||
@ -45,6 +51,7 @@ class AnimationExtension {
|
||||
boneAnimation.solveTwoBoneIK(actionMats, effector, goal, pole, rollAngle);
|
||||
boneAnimation.blendAction(matsBlend, actionMats, actionMats, influence, layerMask, threshold);
|
||||
}
|
||||
#end
|
||||
|
||||
static inline function sortWeights(vecs: Array<Vec2>, sampleVec: Vec2): Map<Int, Vec2> {
|
||||
var weightIndex: Array<WeightIndex> = [];
|
||||
@ -113,7 +120,9 @@ class AnimationExtension {
|
||||
|
||||
class OneShotOperator {
|
||||
|
||||
#if lnx_skin
|
||||
var boneAnimation: BoneAnimation;
|
||||
#end
|
||||
var objectAnimation: ObjectAnimation;
|
||||
var isArmature: Bool;
|
||||
var oneShotAction: ActionSampler;
|
||||
@ -136,12 +145,15 @@ class OneShotOperator {
|
||||
|
||||
var animation = animation;
|
||||
this.oneShotAction = oneShotAction;
|
||||
#if lnx_skin
|
||||
if(Std.isOfType(animation, BoneAnimation)) {
|
||||
boneAnimation = cast animation;
|
||||
tempMatsBone = boneAnimation.initMatsEmpty();
|
||||
this.isArmature = true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
#end
|
||||
{
|
||||
objectAnimation = cast animation;
|
||||
tempMatsObject = objectAnimation.initTransformMap();
|
||||
this.isArmature = false;
|
||||
@ -150,10 +162,13 @@ class OneShotOperator {
|
||||
}
|
||||
|
||||
function initOneShot() {
|
||||
#if lnx_skin
|
||||
if(isArmature) {
|
||||
totalFrames = boneAnimation.getTotalFrames(oneShotAction) - 1;
|
||||
}
|
||||
else {
|
||||
else
|
||||
#end
|
||||
{
|
||||
totalFrames = objectAnimation.getTotalFrames(oneShotAction) - 1;
|
||||
}
|
||||
blendFactor = 0.0;
|
||||
@ -257,7 +272,9 @@ class OneShotOperator {
|
||||
|
||||
class SwitchActionOperator {
|
||||
|
||||
#if lnx_skin
|
||||
var boneAnimation: BoneAnimation;
|
||||
#end
|
||||
var objectAnimation: ObjectAnimation;
|
||||
var isArmature: Bool;
|
||||
var boneLayer: Null<Int>;
|
||||
@ -268,12 +285,14 @@ class SwitchActionOperator {
|
||||
var tween: TAnim = null;
|
||||
|
||||
public function new(animation: Animation) {
|
||||
|
||||
#if lnx_skin
|
||||
if(Std.isOfType(animation, BoneAnimation)) {
|
||||
boneAnimation = cast animation;
|
||||
this.isArmature = true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
#end
|
||||
{
|
||||
objectAnimation = cast animation;
|
||||
this.isArmature = false;
|
||||
}
|
||||
@ -338,6 +357,7 @@ class SwitchActionOperator {
|
||||
}
|
||||
}
|
||||
|
||||
#if lnx_skin
|
||||
class SimpleBiPedalIK {
|
||||
|
||||
var object: Object;
|
||||
@ -477,6 +497,7 @@ class SimpleBiPedalIK {
|
||||
}
|
||||
|
||||
}
|
||||
#end
|
||||
|
||||
@:enum abstract SelectAction(Int) from Int to Int {
|
||||
var action1 = 0;
|
||||
|
||||
Reference in New Issue
Block a user