79637110

Date: 2025-05-24 19:47:10
Score: 3
Natty:
Report link

In the end I did some analysis of the file, and looked at existing Maya parsers out there. Some of them are very comprehensive, but ultimately what I discovered is that the Maya binary files use the IFF format -- a series of chunks, some of which are data chunks and some of which are groups of other chunks. A chunk contains a tag, a size, and potentially child tags. I was able to parse a file and find the chunk with the tag 'FINF' in it - the File Info tag - and parse that out. I stop parsing the file as soon as I find the data I am looking for, making it very fast. There is some complexity to support 32 and 64 bit modes; the width of the tag and size change from 4 to 8 bytes but the sub-tag size does not. The user must correctly align the start of each chunk on a 4 or 8 byte boundary depending on 32 or 64 bit.

I wrote my solution in Python; it's about 500 lines long.

I know links can rot, but here is a collection of resources if you want to write your own parsers:

https://github.com/mottosso/maya-scenefile-parser

https://mayatools.readthedocs.io/

Reasons:
  • Blacklisted phrase (2): I am looking for
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Steven