Page MenuHome

FBX Export: add .blend file path to header
ClosedPublic

Authored by Richard Brenick (rBrenick) on Jan 10 2022, 1:07 PM.

Details

Summary

It's handy being able to track where fbx files originate from.

E.g. making a "Open source .blend file" tool for assets in game-engines.

When exporting .fbx files from Autodesk Maya, an extra ApplicationNativeFile property is stamped into the header. The property shows the local path of the .ma file it was exported from.

This change replicates that behaviour for the Blender FBX addon.

Example Maya ASCII FBX header below

; FBX 7.4.0 project file
; ----------------------------------------------------

FBXHeaderExtension:  {
	FBXHeaderVersion: 1003
	FBXVersion: 7400
	CreationTimeStamp:  {
		Version: 1000
		Year: 2021
		Month: 12
		Day: 2
		Hour: 16
		Minute: 28
		Second: 21
		Millisecond: 114
	}
	Creator: "FBX SDK/FBX Plugins version 2019.2"
	SceneInfo: "SceneInfo::GlobalInfo", "UserData" {
		Type: "UserData"
		Version: 100
		MetaData:  {
			Version: 100
			Title: ""
			Subject: ""
			Author: ""
			Keywords: ""
			Revision: ""
			Comment: ""
		}
		Properties70:  {
			P: "DocumentUrl", "KString", "Url", "", "C:\Users\richard.brenick\Desktop\test_ascii.fbx"
			P: "SrcDocumentUrl", "KString", "Url", "", "C:\Users\richard.brenick\Desktop\test_ascii.fbx"
			P: "Original", "Compound", "", ""
			P: "Original|ApplicationVendor", "KString", "", "", "Autodesk"
			P: "Original|ApplicationName", "KString", "", "", "Maya"
			P: "Original|ApplicationVersion", "KString", "", "", "201900"
			P: "Original|DateTime_GMT", "DateTime", "", "", "02/12/2021 15:28:21.110"
			P: "Original|FileName", "KString", "", "", "C:\Users\richard.brenick\Desktop\test_ascii.fbx"
			P: "LastSaved", "Compound", "", ""
			P: "LastSaved|ApplicationVendor", "KString", "", "", "Autodesk"
			P: "LastSaved|ApplicationName", "KString", "", "", "Maya"
			P: "LastSaved|ApplicationVersion", "KString", "", "", "201900"
			P: "LastSaved|DateTime_GMT", "DateTime", "", "", "02/12/2021 15:28:21.110"
			P: "Original|ApplicationActiveProject", "KString", "", "", "C:\Users\richard.brenick\Desktop"
			P: "Original|ApplicationNativeFile", "KString", "", "", "C:\Users\richard.brenick\Desktop\test_ascii_maya_file.ma"
		}
	}
}

After exporting an .fbx from Blender (and re-exporting it as an ASCII file using the FBX SDK) it will look something like this:

; FBX 7.7.0 project file
; ----------------------------------------------------

FBXHeaderExtension:  {
	FBXHeaderVersion: 1004
	FBXVersion: 7700
	CreationTimeStamp:  {
		Version: 1000
		Year: 2022
		Month: 1
		Day: 7
		Hour: 16
		Minute: 29
		Second: 44
		Millisecond: 82
	}
	Creator: "FBX SDK/FBX Plugins version 2020.0.1"
	OtherFlags:  {
		TCDefinition: 127
	}
	SceneInfo: "SceneInfo::GlobalInfo", "UserData" {
		Type: "UserData"
		Version: 100
		MetaData:  {
			Version: 100
			Title: ""
			Subject: ""
			Author: ""
			Keywords: ""
			Revision: ""
			Comment: ""
		}
		Properties70:  {
			P: "DocumentUrl", "KString", "Url", "", "C:\Users\richard.brenick\Desktop\test_blender_fbx_out.fbx"
			P: "SrcDocumentUrl", "KString", "Url", "", "C:\Users\richard.brenick\Desktop\test_blender_fbx_out.fbx"
			P: "Original", "Compound", "", ""
			P: "Original|ApplicationVendor", "KString", "", "", "Blender Foundation"
			P: "Original|ApplicationName", "KString", "", "", "Blender (stable FBX IO)"
			P: "Original|ApplicationVersion", "KString", "", "", "3.0.0"
			P: "Original|DateTime_GMT", "DateTime", "", "", "01/01/1970 00:00:00.000"
			P: "Original|FileName", "KString", "", "", "/foobar.fbx"
			P: "LastSaved", "Compound", "", ""
			P: "LastSaved|ApplicationVendor", "KString", "", "", "Blender Foundation"
			P: "LastSaved|ApplicationName", "KString", "", "", "Blender (stable FBX IO)"
			P: "LastSaved|ApplicationVersion", "KString", "", "", "3.0.0"
			P: "LastSaved|DateTime_GMT", "DateTime", "", "", "01/01/1970 00:00:00.000"
			P: "Original|ApplicationNativeFile", "KString", "", "", "C:\Users\richard.brenick\Desktop\test_ascii_blender_file.blend"
		}
	}
}

Diff Detail

Event Timeline

Richard Brenick (rBrenick) requested review of this revision.Jan 10 2022, 1:07 PM
Richard Brenick (rBrenick) created this revision.

LGTM, thanks.

For the future, please avoid citing any proprietary tool in patches.

This revision is now accepted and ready to land.Jan 10 2022, 4:29 PM

Awesome, thanks for committing it.

For sure, will keep in mind for future patches :)