浏览代码

fix when some skin was not found (root in particular)

ncannasse 10 年之前
父节点
当前提交
a50b58d2a4
共有 1 个文件被更改,包括 11 次插入6 次删除
  1. 11 6
      hxd/fmt/fbx/HMDOut.hx

+ 11 - 6
hxd/fmt/fbx/HMDOut.hx

@@ -245,18 +245,21 @@ class HMDOut extends BaseLibrary {
 	function addModels(includeGeometry) {
 
 		var root = buildHierarchy().root;
-		var objects = [], joints = [], skins = [];
+		var objects = [], joints = [], skins = [], foundSkin : Array<TmpObject> = null;
 		var uid = 0;
 		function indexRec( t : TmpObject ) {
 			if( t.isJoint ) {
 				joints.push(t);
 			} else {
 				var isSkin = false;
-				for( c in t.childs )
-					if( c.isJoint ) {
-						isSkin = true;
-						break;
-					}
+				if( foundSkin == null ) {
+					for( c in t.childs )
+						if( c.isJoint ) {
+							isSkin = true;
+							break;
+						}
+				} else
+					isSkin = Lambda.indexOf(foundSkin, t) >= 0;
 				if( isSkin ) {
 					skins.push(t);
 				} else
@@ -282,6 +285,7 @@ class HMDOut extends BaseLibrary {
 		}
 
 		// mark skin references
+		foundSkin = [];
 		for( o in skins ) {
 			function loopRec( o : TmpObject ) {
 				for( j in o.childs ) {
@@ -307,6 +311,7 @@ class HMDOut extends BaseLibrary {
 			var m = models[0];
 			for( o2 in objects )
 				if( o2.model == m ) {
+					foundSkin.push(o);
 					o2.skin = o;
 					ignoreMissingObject(m.getName()); // make sure we don't store animation for the model (only skin object has one)
 					// copy parent