I'm currently writing a Java parser for reading FBX binary files and rendering them in
OpenGL using the
LWJGL (Light-Weight Java Games Library). I have pretty much managed to parse everything thanks to a couple of blog posts by the Blender Foundation, but there is one more challenge remaining. I thought I'd try posting here given that the Blender guys are the only ones who have tried to outline the format in full.
As, hopefully, you already know, the file consists of a series of nodes which are in turn comprised of nested nodes. These nested nodes (you guessed it), also can contain nested nodes.
My question is how do I detected when a nested node belongs to the node above, and isn't a separate nested node? For example:
Node: Objects<br> Nested Node: Model<br> Nested Node: Properties60<br> Nested Node: Property<br> [Series of data types]<br> Nested Node: Property<br> [Series of data types]<br> Nested Node: [NULL]<br> Nested Node: [NULL]<br> End of Objects
In this situation, Model contains within itself another nested node called
Properties60, which in turn contains several nested nodes, one for each property. You then have two
null Nested Nodes representing the end of that particular node (like a closing bracket I guess).
My question is how do I detect the
"opening" bracket? So I know by looking at the above that each
"Property" nested node belongs to
Properties60 and not to Model, but only because it makes sense to me as a human. How do I automatically detect that? I've tried examining each
unicode value for each byte and cannot find a consistent character that is used to denote a change in scope. I've also checked and there doesn't appear to be an end offset value for nested nodes to tell you how big it is like you have with Nodes.
Have I missed something? I would much appreciate any help you can offer as it's the last piece of the puzzle for me :) Without it, I can't reliably tell when, for example, one model definition ends and another begins.