ソースを参照

added fbx BaseLibrary fileName

ncannasse 7 年 前
コミット
b61304f9f5
4 ファイル変更10 行追加7 行削除
  1. 5 2
      hxd/fmt/fbx/BaseLibrary.hx
  2. 1 1
      hxd/fmt/hmd/Dump.hx
  3. 1 1
      hxd/fs/Convert.hx
  4. 3 3
      tools/fbx/Viewer.hx

+ 5 - 2
hxd/fmt/fbx/BaseLibrary.hx

@@ -92,6 +92,8 @@ class BaseLibrary {
 	var defaultModelMatrixes : Map<String,DefaultMatrixes>;
 	var uvAnims : Map<String, Array<{ t : Float, u : Float, v : Float }>>;
 	var animationEvents : Array<{ frame : Int, data : String }>;
+	
+	public var fileName : String;
 
 	/**
 		The FBX version that was decoded
@@ -125,7 +127,8 @@ class BaseLibrary {
 
 	public var allowVertexColor : Bool = true;
 
-	public function new() {
+	public function new( fileName ) {
+		this.fileName = fileName;
 		root = { name : "Root", props : [], childs : [] };
 		keepJoints = new Map();
 		skipObjects = new Map();
@@ -609,7 +612,7 @@ class BaseLibrary {
 			return lib.loadAnimation(animName);
 		}
 		if( root != null ) {
-			var l = new BaseLibrary();
+			var l = new BaseLibrary(fileName);
 			l.load(root);
 			if( leftHand ) l.leftHandConvert();
 			l.defaultModelMatrixes = defaultModelMatrixes;

+ 1 - 1
hxd/fmt/hmd/Dump.hx

@@ -230,7 +230,7 @@ class Dump {
 		if( file == null ) throw "Missing file argument";
 		var bytes;
 		if( file.split(".").pop().toLowerCase() == "fbx" ) {
-			var l = new hxd.fmt.fbx.HMDOut();
+			var l = new hxd.fmt.fbx.HMDOut(file);
 			l.loadTextFile(sys.io.File.getContent(file));
 			var hmd = l.toHMD(null, !StringTools.startsWith(file.split("\\").join("/").split("/").pop(), "Anim_"));
 			var out = new haxe.io.BytesOutput();

+ 1 - 1
hxd/fs/Convert.hx

@@ -45,7 +45,7 @@ class ConvertFBX2HMD extends Convert {
 
 	override function convert() {
 		var fbx = try hxd.fmt.fbx.Parser.parse(srcBytes.toString()) catch( e : Dynamic ) throw Std.string(e) + " in " + srcPath;
-		var hmdout = new hxd.fmt.fbx.HMDOut();
+		var hmdout = new hxd.fmt.fbx.HMDOut(srcPath);
 		hmdout.load(fbx);
 		var isAnim = StringTools.startsWith(srcFilename, "Anim_") || srcFilename.toLowerCase().indexOf("_anim_") > 0;
 		var hmd = hmdout.toHMD(null, !isAnim);

+ 3 - 3
tools/fbx/Viewer.hx

@@ -329,7 +329,7 @@ class Viewer extends hxd.App {
 					if( props.convertHMD || bytes.get(0) == 'H'.code ) {
 						ahmd = fbxToHmd(bytes, false).toModel().toHmd();
 					} else {
-						alib = new hxd.fmt.fbx.Library();
+						alib = new hxd.fmt.fbx.Library(sel.fileName);
 						var fbx = hxd.fmt.fbx.Parser.parse(bytes.toString());
 						alib.load(fbx);
 						if( !rightHand )
@@ -355,7 +355,7 @@ class Viewer extends hxd.App {
 		if( data.get(0) == 'H'.code )
 			return hxd.res.Any.fromBytes("model.hmd", data);
 
-		var hmdOut = new hxd.fmt.fbx.HMDOut();
+		var hmdOut = new hxd.fmt.fbx.HMDOut("");
 		hmdOut.absoluteTexturePath = true;
 		hmdOut.loadTextFile(data.toString());
 		var hmd = hmdOut.toHMD(null, includeGeometry);
@@ -392,7 +392,7 @@ class Viewer extends hxd.App {
 
 		} else {
 
-			curFbx = new hxd.fmt.fbx.Library();
+			curFbx = new hxd.fmt.fbx.Library("");
 			curFbx.unskinnedJointsAsObjects = true;
 			var fbx = hxd.fmt.fbx.Parser.parse(data.toString());
 			curFbx.load(fbx);