By golly, that does actually work!
from maya_scenefile_parser import MayaBinaryParser
fname = "C:/Users/marcus/Desktop/temp.mb"
def on_file_info(self, key, value):
print("%s = %s" % (key, value))
with open(fname, "rb") as f:
parser = Parser(f)
mykey = myvalue
application = maya
product = Maya 2015
version = 2015
cutIdentifier = 201503261530-955654
osv = Microsoft Windows 8 Enterprise Edition, 64-bit (Build 9200)\n
Where mykey = myvalue was added via cmds.fileInfo("myvalue", "mykey")
before saving the mb file. Tested on a file saved with Maya 2015.
Nice one, Alok!
On 12 February 2018 at 10:39, Alok Gandhi <alok.gandhi2...@gmail.com> wrote:
> Why not use the fileInfo() to store the data?
> Can be read outside maya as well by parsing the ma/mb
> Sent from my iPhone
> > On 12-Feb-2018, at 00:10, Juan Cristóbal Quesada <
> juan.cristobal...@gmail.com> wrote:
> > following your attempts at using cPickle in mb files which seems
> interesting to me... Cant you just append a binary datablock with your data
> at the end of the .mb file and just preprocess the file reading and
> deleting that appended block of data before opening the file in Maya? If
> you do it right you should leave de postprocessed file as the original one
> exactly with same size. Using a fixed sized datablock big enough to hold
> your metadata should be easier. As a drawback you should code your own
> "file open.."
> >> El 11/02/2018 a las 15:38, fruityfr...@gmail.com escribió:
> >> I'd be curious to find something as well ! I had a quick look at it
> ages ago, and couldn't find anything robust. If you're on Unix, you can
> attach infos against a file (including a .mb), but that doesn't seem to
> exist on windows. And I'd like to find something cross-platform
> >> You can also write notes in maya, but then, as you said, you need to
> open the file, and even in standalone mode, it can take some time..
> >> However, I think the safest option would be to deal with separated
> config files. As you say, one can 'break' the pipeline by moving the config
> file away from its scene file, but I'd say it is acceptable... I mean if an
> animator removes everything in the outliner, he can't complain the rig is
> broken ; if someone starts messing around with files he doesn't know,
> pipeline can't be responsible for that.
> >> Still, by curiosity, I'd be curious to know if there is a way of
> storing infos against an .mb file
> >> Le vendredi 9 février 2018 18:08:05 UTC-5, AK Eric a écrit :
> >>> It would be of great use if I could (somehow) tag mb files with
> metadata that could be read at system level, never having to open the mb
> itself in Maya.
> >>> I already have a solution that will save out a json/xml next to the
> file whenever the users saves, with queryable info. But this is lossy, can
> decouple from the file if it's ever moved, etc.
> >>> Being able to tag an actual mb with data would be great (in the same
> way you can say, check exif data on an image).
> >>> I've tried some examples doing this in Python with pickle, on both ma
> & mb files, but... it corrupts the files. Ironically, I can store and
> retrieve metadata, it just wrecks everything else in the file :P
> >>> Maybe not possible. But I thought I'd see if someone actually had a
> more elegant solution for this.
> >>> 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 python_inside_maya+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/
> > For more options, visit https://groups.google.com/d/optout.
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> For more options, visit https://groups.google.com/d/optout.
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 view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.