Month: February 2019

PyMel Script – Create Shader from folder of textures.

This script was a request from Monica Cappiello. Setting up a shader network and all its connections can be tedious work. Especially when working with artists or students who are not following the correct prefix naming convention. What this script does is prompt you to select a folder of textures. Then if they are named correctly plug them into the correct connections on the shading group and apply the shader to the selected object. If they are not named correctly you are prompted for what channel it should be mapped to and applies the correct prefix to the filenames. After fixing the files it then does the same shader creation functionality. Currently it supports aiStandardSurface, Blinn, Phong, and Lambert.

To install:
1: Put instantShaderUI.py and instantShaderClass.py in your C:\Users\’user’\Documents\maya\scripts folder
2. Add new shelf item with the following script:
import instantShaderUI
iscWindow()
To use:
1. Select object to assign to if desired.
2. Select Shader from drop down and hit create.
3. Select folder of images for your shader (will be name of shader). Must be in ‘jpg’,’gif’,’png’,’tif’,’bmp’ formats.
4. If files are named with correct prefixes shader will be created.
If not you will be prompted to fix each prefix and then the shader will be created.
5. Your newly created shader will be selected, take a moment to verify settings and enjoy.

Download here:
instantShader.zip

UPDATE:
Added better UI.
instantShaderUI.zip

Posted by Charles in All posts, scripting, 7 comments

PyMel Script – Rotate Spherical and Cylindrical UV projections

This script was designed for Dustin Aber. In Maya there is the built in functionality to choose a projection plane for planer projections. However, when you select to do a spherical or cylindrical projection you cannot specify a starting projection direction and have to manually rotate it with manipulators every time. It is available in the attributes however. This script loads a ui exposing that functionality making it easier for artists to project UVs quickly on non-defaultly oriented objects.

rotProUI.py

To install:
Place rotProUI.py in your C:\Users\(your user)\Documents\maya\scripts folder or equivalent location in your PYTHONPATH.
Usage:
1. In script editor run (can be added to shelf):
import rotProUI
rotProUI()
2. Select Object or set of faces
3. Select projection type from the radio buttons
4. Select rotation type
5. Click project

Please let me know if you have any feedback in the comments section.

Posted by Charles in All posts, scripting, 1 comment