hamish-milne / fbxwriter Goto Github PK
View Code? Open in Web Editor NEWAn FBX reader and writer for .NET
An FBX reader and writer for .NET
I'm not sure that the currently logic for the number of null bytes between the footer code and version (footerZeroes1
) is correct. I have a number of FBX files of different versions, and each version seems to have its own number of zeroes here. Some examples I've found:
FbxBinary current value: 20 (which version was this checked against?)
FBX 7500: 14
FBX 7400: 19
FBX 7300: 6
I haven't conducted a very exhaustive search of FBX files besides opening a handful and checking by hand, so I'm not sure yet if the number is dependent on the FBX version number, the exporter used, or something else.
I've also noticed that writing out any number of zeroes in a version 7500 file doesn't impede Autodesk FBX Review or Unity from opening the files.
Can't seem to find a way to get the channels from .fbx. I also converted the entire fbx document to json and can't seem to find any channel list to get the animation data.
The take section shows the 3 take properties but I assume the channels just show up as null.
When displaying in readable ASCII form.
FBX is a 7.4 binary made in blender 2.7.9. test.zip
I am currently updating your library (minor refactoring + almost at stage where it reads in mesh data) I thought id ping you a message to see if you would be interested in updated code once my updates are done?
Hi,
I'd love to make use of your code. (Got a little game engine project, and have run into the wall of: How do I get an actually useful format into the thing?)
What license is this codebase under? Would you be willing to consider putting e.g. an MIT/BSD license on it?
As it stands, I don't think GitHub repositories have licenses by default, so I don't think anyone can legally make use of or modify then redistribute your work, open or closed source.
Thanks in advance,
leafi
I am trying to dump unity mesh as fbx binary.
I successfully managed to dump the mesh as fbxascii using code from https://github.com/KellanHiggins/UnityFBXExporter
then I executed this code:
string ascii = UnityFBXExporter.FBXExporter.MeshToString(gameObject,"");
var reader = new FbxAsciiReader(ascii.ToStream());
FbxDocument doc = reader.Read();
FbxIO.WriteBinary(doc, path)
Stream ToStream(this string val) => new MemoryStream(Encoding.UTF8.GetBytes(val))
I got this error
FbxException: Invalid property type System.Byte, at Month/CreationTimeStamp/FBXHeaderExtension[0]
at Fbx.FbxBinaryWriter.WriteProperty (System.Object obj, Int32 id) [0x00027] in \FbxUtil\FbxWriter\FbxBinaryWriter.cs:155
at Fbx.FbxBinaryWriter.WriteNode (Fbx.FbxDocument document, Fbx.FbxNode node) [0x001a9] in \FbxUtil\FbxWriter\FbxBinaryWriter.cs:212
at Fbx.FbxBinaryWriter.WriteNode (Fbx.FbxDocument document, Fbx.FbxNode node) [0x0028a] in \FbxUtil\FbxWriter\FbxBinaryWriter.cs:229
at Fbx.FbxBinaryWriter.WriteNode (Fbx.FbxDocument document, Fbx.FbxNode node) [0x0028a] in \FbxUtil\FbxWriter\FbxBinaryWriter.cs:229
at Fbx.FbxBinaryWriter.Write (Fbx.FbxDocument document) [0x0005a] in \FbxUtil\FbxWriter\FbxBinaryWriter.cs:259
at Fbx.FbxIO.WriteBinary (Fbx.FbxDocument document, System.String path) [0x00024] in \FbxUtil\FbxWriter\FbxIO.cs:57
...
the writer does not handle byte
:
https://github.com/Ploaj/IONET/blob/ca42ce6c9cadaf73312cc3cbe73f94e7feed509c/IONET/Fbx/IO/FbxBinaryWriter.cs#L54
but the reader does read as byte
:
https://github.com/Ploaj/IONET/blob/ca42ce6c9cadaf73312cc3cbe73f94e7feed509c/IONET/Fbx/IO/FbxAsciiReader.cs#L229
So this is problem number 1. writer does not handle byte produced by reader.
I looked at the code that generates the ascii code and I found this (which matches the error message):
// Creationg Date Stamp
System.DateTime currentDate = System.DateTime.Now;
sb.AppendLine("\tCreationTimeStamp: {");
sb.AppendLine("\t\tVersion: 1000");
sb.AppendLine("\t\tYear: " + currentDate.Year);
sb.AppendLine("\t\tMonth: " + currentDate.Month); // <----!!!!!!! type of Month is int !!!!!!!!!
sb.AppendLine("\t\tDay: " + currentDate.Day);
sb.AppendLine("\t\tHour: " + currentDate.Hour);
sb.AppendLine("\t\tMinute: " + currentDate.Minute);
sb.AppendLine("\t\tSecond: " + currentDate.Second);
sb.AppendLine("\t\tMillisecond: " + currentDate.Millisecond);
sb.AppendLine("\t}");
if the written type is int then why the time that is read is byte? i guess because the data was small?
So I think the solution would be that the reader should treat byte as int?
{ typeof(byte), new WriterInfo('I', (sw, obj) => sw.Write((int)(byte)obj)) }, // write as int
{ typeof(int), new WriterInfo('I', (sw, obj) => sw.Write((int)obj)) },
or should I write is as byte?
{ typeof(byte), new WriterInfo('B', (sw, obj) => sw.Write((byte)obj)) }, // write as bye
{ typeof(int), new WriterInfo('I', (sw, obj) => sw.Write((int)obj)) },
Please fix this issue.
i want to use this demo in u3d.when runtime import fbx object
Hi, i want to know how to integrate FbxWriter with Unity.
Can you give me some advice?
How does the unity runtime get mesh info ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.