PYTHON

I started teaching myself Python a couple years ago on a friend's suggestion. I got a few pointers and lessons from some Python-veteran co-workers. It has been a little tough, but here a a few scripts I have come up with. They are intended to be used within Maya.

replace_paths_fileNode.py

I wrote this little snippet for a Texturing colleague. He asked for a way to replace all the urls from the file nodes for just a universal url. This way he could place all texture files into a single folder.


paint_itBlack.py

This was partly a lesson/test from one of my Python veteran coworkers; he asked me to change the color input attribute on all shaders in the file into black. Tricky part is not all shaders shade the same input naming. It also had to respect other nodes like transparency.


prefix-2-renderLayer.py

Another lesson/test the same Python veteran buddy; he asked me to isolate an asset base on a prefix, move all the assets into a new layer, replace the shaders with a black hole matte while keeping the prefixed asset keep its shader.