Custom Maya Material GUI

Introduction

My idea was to create a Maya GUI that would prompt the user to select a material and decide between procedural and using texture files. There would be a scroll bar with the material's attributes that the user can select to determine which ones would have an OSL script assigned to it. The GUI would then run my Python script that assigns the selected attributes to the shape nodes of the selected objects, create the selected material, input the OSL code and make all the correct connections in the HyperShade. The goal is to manipulate material attributes on individual objects with the same material without affecting the look of the other objects. This will ultimately optimize scene files with large amounts of objects in them.

How to Use

1. Download .zip file
2. Unzip and save 'Custom_OSL_Shader_Amanda_Rabade' in '/Users/<username>/Library/Preferences/Autodesk/maya/scripts'
3. In Maya, copy and paste in a new Python tab in the script editor and run:

import sys

sys.path.append('C:/Users/<username>/Documents/maya/scripts/Custom_OSL_Shader_Amanda_Rabade')  < Windows
import sys
sys.path.append('~/Library/Preferences/Autodesk/maya/<version>/scripts/Custom_OSL_Shader_Amanda_Rabade') 
< MAC
 

4. Open 'main.py' in the script editor and run

5. Pick material from drop down and select either 'Procedural' or 'Texture Files' then select geometry. (Can select geometry first, order doesn't matter)

6. Click 'Create'

If 'Texture Files' is selected:

  1. A window will appear and prompt you to compile the OSL node in the HyperShade. The rest of the code will not run until this task is complete!

  2. Click 'Done' to finish the process

Current Features

1. Works with aiStandardSurface and aiToon
2. Procedurally and with Texture Files
3. If done procedurally, can work on any and all objects, regardless of UVs
4. If done with texture files, the objects selected must have the same UVs

Future Features

1. Will work with any material in Maya
2. User will be able to select desired attributes
3. User will be able to use the browse button to search for desired texture files and they will be automatically added to the script and make the correct connections instead of the user manually making the connection after running the script
4. OSL will have fresnel along with color correct when done with texture files
5. Will have error messages to help guide the user to make the appropriate selections

Ideation Process

Possible Errors

no_module_error.JPG

If you receive this error, go back to How to Use and make sure you did steps 1-4