I don't have much experience trying to parse maya binary files, and cgkit
doesn't give any indication really of how to handle the groups and chunks
beyond it just giving them to you in the callbacks... But a quick google
search turned up this mayatools python package:
https://mayatools.readthedocs.org/en/latest/binary.html

Pretty easy to grab and install. And it seemed to easily hand you the chunk
and data objects in at least a meaningful way for dealing with the fileinfo
portion.

$ git clone https://github.com/westernx/mayatools.git
$ cd mayatools
$ python setup.py install

$ python
>>> from mayatools.binary import Parser

>>> f = open("sphere.mb")
>>> p = Parser(f)
>>> p.parse_all()

>>> p.pprint()
# Maya group (FOR4); 64336 bytes for 31 children:
#    HEAD group (FOR4); 344 bytes for 16 children:
#        VERS; 4 bytes as string(s)
#            0020: 32303133                    '2013'
# ... snip ...
# Produces a huge dump of the file structure,
# indicating that the tag we are interested in
# is the first group, called "HEAD"

>>> head = p.find_one('HEAD')

>>> head.pprint()
# HEAD group (FOR4); 344 bytes for 16 children:
#     VERS; 4 bytes as string(s)
#         0020: 32303133                        '2013'
#     UVER; 5 bytes as string(s)
#         002c: 756e6465 66                     'undef'

# Then just deal with the child chunks?
>>> head.children
>>> head.find(...)

Not sure if that was what you are after.




On Wed, Oct 23, 2013 at 5:36 AM, <[email protected]> wrote:

> I need a standalone script that reads fileInfo data from binary scenes.
> I tried using cgKit mayabinary class  but I'm not sure how to parse bin
> data chunks.
> Any tips ?
>
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/a2e99d69-95fc-4091-887d-cb9a48b3f366%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3kiZM4cv6Y2S%2BkQay8Bf4Rf4ZFaMPmRio1qE4ma1%3DCKA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to