瀏覽代碼

fixes for UV anim

ncannasse 11 年之前
父節點
當前提交
a54cd14a46
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 0 1
      h3d/anim/LinearAnimation.hx
  2. 7 4
      h3d/fbx/Library.hx

+ 0 - 1
h3d/anim/LinearAnimation.hx

@@ -117,7 +117,6 @@ class LinearAnimation extends Animation {
 				}
 				mat.uvDelta.x = o.uvs[frame1 << 1] * k1 + o.uvs[frame2 << 1] * k2;
 				mat.uvDelta.y = o.uvs[(frame1 << 1) | 1] * k1 + o.uvs[(frame2 << 1) | 1] * k2;
-				trace(frame1, mat.uvDelta);
 				continue;
 			}
 			var f1 = o.frames[frame1], f2 = o.frames[frame2];

+ 7 - 4
h3d/fbx/Library.hx

@@ -300,8 +300,10 @@ class Library {
 				break;
 			}
 		if( animNode == null ) {
-			if( animName == null ) return null;
-			throw "Animation not found " + animName;
+			if( animName != null )
+				throw "Animation not found " + animName;
+			if( uvAnims == null )
+				return null;
 		}
 
 		var curves = new Map();
@@ -309,7 +311,8 @@ class Library {
 		var P1 = new Point(1, 1, 1);
 		var F = Math.PI / 180;
 		var allTimes = new Map();
-		for( cn in getChilds(animNode, "AnimationCurveNode") ) {
+		
+		if( animNode != null ) for( cn in getChilds(animNode, "AnimationCurveNode") ) {
 			var model = getParent(cn, "Model");
 			var c = getObjectCurve(curves, model, cn.getName(), animName);
 			if( c == null ) continue;
@@ -528,7 +531,7 @@ class Library {
 				var alpha = c.a == null ? null : new haxe.ds.Vector(numFrames);
 				var uvs = c.uv == null ? null : new haxe.ds.Vector(numFrames * 2);
 				// skip empty curves
-				if( frames == null && alpha == null )
+				if( frames == null && alpha == null && uvs == null )
 					continue;
 				var ctx = c.t == null ? null : c.t.x;
 				var cty = c.t == null ? null : c.t.y;