Is there a common property in a Maya scene that one could use as an identifier? the UUID property we get through cmds.fileInfo('UUID', q=True)
gets renewed on every scene save, while the cutIdentifier is the same for every scene (per Maya version?).
I’m looking for some sticky attribute that stays the same on a scene no matter what. Can always just rely on the attribute of some sticky node in the scene, of course, but wanted to double check first
Bob White Yesterday at 5:24 AM
I don’t think there is a built in id like that, you can easily insert a UUID into fileInfo
and then it would always be there
7 replies
Can’t believe I’ve missed that you can create attributes as well with it thanks a lot Bob! Really appreciate it.
I was about to go the custom node with data in the scene route, but since it’s only needed to store a json string + an int, felt like there must be a simpler way.
One thing to watch out for with fileInfo
is that it escapes "
with a backslash.
So least painful way to store something in there is to get your string, and then run it through base64
and toss that into the fileInfo
, and then when pulling it back out, you can safely just run that back through base64
to get the original
1
Thanks for the heads up! super useful to know
Yeah, I’m not sure if its still in there, but I added some code for just handling the quote escaping to the pymel version of fileInfo
, but it only does quote escaping, if there are other characters that get escaped I don’t know how nicely it plays with that. The base64
method is way more universal because none of the resulting characters need escapes
1
ahem \discourse post
ahem
1
actually in this case, cut-and-paste since it’s a thread