may I ask you a big favor?
If you have time, could you please write down the file format of the model files?
I've tried to figure out, and write a template in 010 Editor, but it drives me nuts. Sometimes it works,
sometimes the values are offset by an unknown value (the tables for example, it points to an address, there's no vertex number).
I don't know nothing about python scripting, so your importer is not a good starting point for me
I would really appreciate your help!
This is because there is no one format. There's 10 to 15 distinct vertex buffer formats. And they can have various sub blocks per format. so it's a very messy thing to decode. I have no real documentation, I figure a block format out in 010, then add it to the python script. then when I or someone else encounters another format, I add it to the script as well. The only real documentation is the python script. It's not hard to read really.
I have a library of data readers in the python script:
Code: Select all
def readcstr(): #Null Terminated text string
def BB(n): #unsigned Char
def Bb(n): # Signed Char
def BH(n): # Unsigned Short
def Bh(n): # Signed Short
def Bf(n): # Float
def BF(n): # HALF FLoat
def Bi(n): # Signed Long Int
def BI(n): # Unsigned Long Int
def Bd(n): # Double
def alignPosition(alignment): # align to given byte width (4/8/16 etc)
if you see BB(3) in the code, I read in 3 bytes, but didn't assign them to a variable, so I just skipped them
if you see new_var = BB(3), then 'new_var' is now an array of 3 bytes read in. new_var would be the first new_var would be the second etc.
if you see new_var = BB(1), then I immediately assigned the value read in to 'new_var' instead of assigning it as an array.
filehandle.seek(next_offset,0) # SEEK_SET
filehandle.seek(0,2) # SEEK_END
These all do exactly what they do in C, seek on the file stream either from the start (SET), the current position (CUR), or from the end (END).
The rest should be self explanatory.