Nice challenge 
You're definitely on the right track there.
Dont know if you've got Maya 8.5+ but this little python script I've knocked up changes the transparency for the currently selected object's material.
To test it just create a new scene, add a sphere or similar, open the script editor and copy the following code in and run it:
Code:
def toggleTrans():
# import and alias the relevant python libraries (only needed once in userSetup.py)
# python libraries
import maya.cmds as mc
# get the currently selected object
curSel = mc.ls(selection=True, dagObjects=True)
# get the selections shading engine node
curShader = mc.listConnections(curSel, source=True, type='shadingEngine')
# get the current material node attached to it - note, this may not work on complex shaders and would need to be tested
curMaterial = mc.listConnections(curShader, source=True, destination=False)
# go through the returned nodes
for item in curMaterial:
# discard the transform node
if mc.nodeType(item) != 'transform':
# get the current transparency setting (quick hack here is just the red channel)
curVal = mc.getAttr(item+'.transparency')
# if its greater than zero then set it to zero (remove transparency)
if curVal[0][0] > 0.0:
mc.setAttr(item+'.transparency', 0.0, 0.0, 0.0, type='double3')
# if its already zero then add some transparency
else:
mc.setAttr(item+'.transparency', 0.5, 0.5, 0.5, type='double3')
Now whenever you run the following command in the script editor it will change the transparency for the selected objects material:
You can also run it through Mel like so:
Code:
python("toggleTrans()");
I dont know how to add shelf items yet but if I can find some example code or something then I'll set it up 
Oh and it might be helpful to convert it to Mel so that you can play with it (or in case you cant run python).
Last edited by t1ck135; 24-09-2007 at 01:19 AM.