forked from LeenkxTeam/LNXSDK
Repe [T3DU] and Moises Jpelaez updates
This commit is contained in:
@ -14,6 +14,8 @@ import iron.data.Armature;
|
||||
import iron.data.Data;
|
||||
import iron.math.Ray;
|
||||
|
||||
import StringTools;
|
||||
|
||||
class BoneAnimation extends Animation {
|
||||
|
||||
public static var skinMaxBones = 128;
|
||||
@ -84,6 +86,15 @@ class BoneAnimation extends Animation {
|
||||
}
|
||||
}
|
||||
|
||||
override function get_action(): String {
|
||||
var an: String = action; // an -> action name
|
||||
if (an != "" && object != null && object.filename != "") {
|
||||
var sufix = "_" + object.filename;
|
||||
if (an.indexOf(sufix) != -1) an = StringTools.replace(an, sufix, "");
|
||||
}
|
||||
return an;
|
||||
}
|
||||
|
||||
public function initMatsEmpty(): Array<Mat4> {
|
||||
|
||||
var mats = [];
|
||||
@ -135,7 +146,16 @@ class BoneAnimation extends Animation {
|
||||
if (ar != null) ar.remove(o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getName(n: String): String {
|
||||
var fn: String = n; // fn -> final name
|
||||
if (fn != "" && object != null && object.filename != "") {
|
||||
var sufix = "_" + object.filename;
|
||||
if (fn.indexOf(sufix) == -1) fn += sufix;
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
|
||||
@:access(iron.object.Transform)
|
||||
function updateBoneChildren(bone: TObj, bm: Mat4) {
|
||||
var ar = boneChildren.get(bone.name);
|
||||
@ -232,10 +252,11 @@ class BoneAnimation extends Animation {
|
||||
}
|
||||
|
||||
override public function play(action = "", onComplete: Void->Void = null, blendTime = 0.2, speed = 1.0, loop = true) {
|
||||
if (action != "") {
|
||||
setAction(action);
|
||||
super.play(action, onComplete, blendTime, speed, loop);
|
||||
var tempAnimParam = new ActionSampler(action);
|
||||
var actionName: String = getName(action);
|
||||
if (actionName != "") {
|
||||
setAction(actionName);
|
||||
super.play(actionName, onComplete, blendTime, speed, loop);
|
||||
var tempAnimParam = new ActionSampler(actionName);
|
||||
registerAction("tempAction", tempAnimParam);
|
||||
updateAnimation = function(mats){
|
||||
sampleAction(tempAnimParam, mats);
|
||||
|
||||
Reference in New Issue
Block a user