Hey all, hope all is well.
I am trying to convert this python code into pymel code.
# Gears Material
metal = mc.shadingNode("blinn", asShader=True, name ="metalMat")
mc.setAttr(metal + ".color", 0.667,0.317,0.131)
mc.setAttr(metal + ".eccentricity", 0.421)
mc.setAttr(metal + ".specularRollOff", 0.972)
mc.setAttr(metal + ".specularColor", 0.703,0.703,0.703)
mc.setAttr(metal + ".reflectivity", 0.538)
mc.setAttr(metal + ".reflectedColor", 0.310,0.310,0.310)
# Assing Material
# Create Sureface Shader
mc.sets( renderable=True, noSurfaceShader=True, empty=True, name="gearShader" )
# Connect material to shader
mc.connectAttr("metalMat.outColor", "gearShader.surfaceShader")
# Assign shader to objects
mc.sets("smallGearGeo", edit=True, forceElement="gearShader")
mc.sets("largeGearGeo", edit=True, forceElement="gearShader")
This is what I have so far in pymel
# Gears Material
metal = shadingNode("blinn", asShader=True, name ="metalMat")
metal.color.set([0.667,0.317,0.131])
metal.eccentricity.set(0.421)
metal.specularRollOff.set(0.972)
metal.specularColor.set([0.703,0.703,0.703])
metal.reflectivity.set(0.538)
metal.reflectedColor.set([0.310,0.310,0.310])
# Assing Material
# Create Sureface Shader
gearShader = sets( renderable=True, noSurfaceShader=True, empty=True, name="gearSurfaceShader" )
# Connect material to shader
metal.outColor >> gearShader.surfaceShader
# Assign shader to objects
sets(smallGear, edit=True, forceElement="gearSurfaceShader")
sets(largeGear, edit=True, forceElement=gearShader)
The last two lines are where Iām having trouble, the two lines are different from each other as I was trying different methods to get it to work.
smallGear and largeGear refer to polyCylinder objects created earlier in the script.
largeGear = polyCylinder(radius=10, height=1, subdivisionsX=40,subdivisionsZ=0, name="largeGearGeo")[0]
smallGear = polyCylinder(radius=5, height=1, subdivisionsX=20,subdivisionsZ=0, name="smallGearGeo")[0]
Everytime I try to assign to run the last two lines of the pymel code to assign the materials to the two gears objects I get an error saying:
Error: RuntimeError: file C:\Program Files\Autodesk\Maya2011\Python\lib\site-packages\pymel-1.0.0-py2.6.egg\pymel\internal\pmcmds.py line 98: The argument provided is NOT a set
Its probably something really simple but I just cant see it, can anyone help me out.
Cheers.