I'm taking a Mel and Python scripting class for Maya and I've run into a pickle.
I'm just trying to change the color of a blinn for all the blocks in my project, but I keep getting these two errors with the script below:
# Warning: Cannot add the following items to the set since the set has restrictions on membership: blinn1 #
# Warning: None of the items can be added to the set #
cmds.select( 'all=True' )
cmds.shadingNode('blinn', asShader=True)
cmds.sets( renderable=True, noSurfaceShader=True, empty=True, name='blinn1SG' )
cmds.connectAttr( 'blinn1.outColor', 'blinn1SG.surfaceShader' )
cmds.sets( e=True, forceElement='blinn1SG' )
cmds.setAttr( 'blinn1.color', 0.927, 0.38007, 0.863191, type='double3' )
What did I do wrong and how can I fix it?
Thank you!
Replies
Sometimes if you don't force a set operation it won't complete.
However it also looks like you might be trying to put the Blinn itself into the blinn1SG shading group (since your first command is Select All, but then you create a new node which usually means that the new node gets selected - you can use "skipSelect" I think to avoid this).
What you should really do is add some debug prints to make sure all the variables and selections are what you expect them to be at each stage.
For example, before you do the forceElement operation, check to see what the current selection is (just dump the current selection into a new array and print the array).
That way it should become pretty obvious where stuff is going wrong.
and now i want to see monty python scripts =[