String attribute size limit when saving to maya ascii file?

String attribute size limit when saving to maya ascii file?

Anonymous
Not applicable
1,014 Views
3 Replies
Message 1 of 4

String attribute size limit when saving to maya ascii file?

Anonymous
Not applicable

I'm saving data from a maya session as a json string, in a node attribute.  It's a large-ish string (generally a few MB).  Setting and retrieving the value in a string attribute with the value is no problem.  But when I save the file in maya ascii format (which we want for production), maya crashes if the string is larger than about 2,750,000 bytes.  If I run this code and then try to save an ascii file, it reproduces the crash:

import maya.cmds as cmds
cmds.file(f=True, new=True)
node = cmds.createNode("transform")
cmds.addAttr(node, ln="strang", dt="string")
bigString = "$" * 3000000
cmds.setAttr(node+".strang", bigString, type="string")

Saving as maya binary works fine, as does splitting the string over multiple attributes.

Is this a known limitation?  Is there a better way to save a large python dictionary in a maya ascii file?

0 Likes
1,015 Views
3 Replies
Replies (3)
Message 2 of 4

viru.gupta8
Enthusiast
Enthusiast
Hey don't know about limit but have you try different attribute data type other then string ex: string array or something that will work in your case check below link for data type
http://download.autodesk.com/us/maya/2010help/Commands/setAttr.html
Hope this will help you.
0 Likes
Message 3 of 4

Anonymous
Not applicable

@viru.gupta8 wrote:
Hey don't know about limit but have you try different attribute data type other then string ex: string array or something that will work in your case check below link for data type
http://download.autodesk.com/us/maya/2010help/Commands/setAttr.html
Hope this will help you.

Thanks for the reply.  I haven't tried other data types.  I currently slice the string into 1.5MB chunks and create a string attribute for each chunk, then reassemble on the way back in.

0 Likes
Message 4 of 4

Anonymous
Not applicable

So... Nobody knows if this is a maya bug or if I'm doing something incorrectly?

0 Likes