How to make maya still know parameters in maya python after restarting maya?

I write a script to save control and bone’s transform matrix in a list, i would like to maya still has this list data even i restart maya.

I have read a stackover flow topic about using maya scriptnode, but it seems not quite elegant and easy to do this.

Anyone could give me a hint?

Not sure how to do it being redistributable but if its only testing/personal usage, you can just use the pickle module.

Save the data somewhere in the drive and retrieve it as needed.

1 Like

There’s all kinds of ways.

  • You could add a matrix attribute to your bone, and use setattr (This is my favorite)

  • You could just add 16 float attributes on your bone

  • You could just make a fourByFourMatrix node. Then you would connect its message plug to the bone. That connection is only there so you know which fourByFourMatrix node goes with which bone or control.

  • You could make a string attribute on your bone and just write the data to that string. (Our rig builder does this using the python json module. You could also use pickle as bentraje said)

  • You could just make a transform node and use the xform command to set its local matrix. Then maybe make that a child of your bone.


first method is great