https://gist.github.com/achayan/e8f14f6b88a34e731351
On Fri, Aug 14, 2015 at 8:58 AM, f.michal <f.mic...@gmail.com> wrote: > Pardon MEL, but that's what I have now :) > > global proc mfNewShaderForSL() > { > string $sl[]= `ls -sl -l`; > for($o in $sl) > { > string $SG = `sets -renderable true -noSurfaceShader true -empty`; > string $shader = `shadingNode -asShader lambert`; > connectAttr -f ($shader + ".outColor") ($SG + ".surfaceShader"); > select $o; > //this is what you need ! > sets -e -forceElement $SG; > } > } > > W dniu 2015-08-14 o 17:55, Kate Sendall pisze: > > Hi! I'm trying to assign a material to an object in the script editor > using python. I've managed to assign the object to maya_material_x, but > can't seem to find a way to make it one of the presets! Help would be > greatly appreciated. :) > > def applyMaterial(): > myShader = mc.shadingNode('mia_material_x', asShader=True) > mc.select('myStep*') > mc.hyperShade(assign = myShader) > > > Simple really, don't know why I can't figure it out. XD > > Kate > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to python_inside_maya+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/25b05c27-2e35-4bec-abc5-f4c19dc2a40b%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/25b05c27-2e35-4bec-abc5-f4c19dc2a40b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to python_inside_maya+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/55CE1018.8090001%40gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/55CE1018.8090001%40gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- --:: Kurian ::-- -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANEMyhNG%2BgYr3ATxJuniNN3dzf%3DPeevG-k-VJw7Ea1bnrvgebQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.