ncannasse 12 سال پیش
والد
کامیت
f56a60b8d0
3فایلهای تغییر یافته به همراه8 افزوده شده و 5 حذف شده
  1. 1 0
      engine.hxml
  2. 1 1
      engine.hxproj
  3. 6 4
      h3d/fbx/Skin.hx

+ 1 - 0
engine.hxml

@@ -6,3 +6,4 @@
 -main Test
 -lib format
 --macro include('h3d')
+--macro include('h2d')

+ 1 - 1
engine.hxproj

@@ -23,7 +23,7 @@
     <option flashStrict="True" />
     <option mainClass="Test" />
     <option enabledebug="False" />
-    <option additional="-lib format&#xA;--macro include('h3d')" />
+    <option additional="-lib format&#xA;--macro include('h3d')&#xA;--macro include('h2d')" />
   </build>
   <!-- haxelib libraries -->
   <haxelib>

+ 6 - 4
h3d/fbx/Skin.hx

@@ -144,9 +144,10 @@ class Skin extends h3d.prim.Skin {
 		var meshObj = lib.getParents(meshGeom,"Model")[0];
 
 		// assume that the mesh in on the stage (common ancestor = stage)
-		if( lib.getParents(meshObj).length > 0 )
-			throw "Mesh has parents";
-
+		var parents = lib.getParents(meshObj);
+		if( parents.length > 0 )
+			throw "Mesh has parent [" + Lambda.map(parents, function(p) return try p.getName() catch( e : Dynamic ) p.name)+"]";
+		
 		// get the skin root
 		var skinRoot = lib.getParents(this.rootJoints[0].model, "Model")[0];
 
@@ -160,12 +161,13 @@ class Skin extends h3d.prim.Skin {
 		meshPos.invert();
 		preTransform.multiply(preTransform, meshPos);
 			
-		// apply geometric translation as a post transform matrix
+		// apply geometric translation as a pre AND post transform matrix
 		var geomTrans = null;
 		for( p in meshObj.getAll("Properties70.P") )
 			switch( p.props[0].toString() ) {
 			case "GeometricTranslation":
 				geomTrans = new h3d.Point(p.props[4].toFloat(), p.props[5].toFloat(), p.props[6].toFloat());
+				preTransform.translate(geomTrans.x, geomTrans.y, geomTrans.z);
 			default:
 			}
 		if( geomTrans != null ) {