I have hundreds of materials in my scene and rightclicking then going to arnold and shimmying down to AIsurface takes too long. Is there a faster way?
Many thanks
Solved! Go to Solution.
Solved by Kahylan. Go to Solution.
Hi!
I'm not quite sure, are we talking about new materials or existing materials?
if it is just a question of creating new materials, you can use a script like this one to do so:
import maya.cmds as mc
sel = mc.ls(sl = True)
for s in sel:
mat = mc.createNode("aiStandardSurface", n = "{0}_material".format(s))
sg = mc.createNode("shadingEngine", n="{0}_SG".format(s))
mc.connectAttr("{0}.outColor".format(mat), "{0}.surfaceShader".format(sg))
shape = mc.listRelatives(s, s= True)[0]
attr = mc.listConnections("{0}.instObjGroups[0]".format(shape), p = True)[0]
mc.disconnectAttr("{0}.instObjGroups[0]".format(shape),attr)
mc.connectAttr("{0}.instObjGroups[0]".format(shape),"{0}.dagSetMembers[0]".format(sg))
If you need to connect the right existing materials with their geometric counterparts, it is going to be harder, because you would need very strict consistent naming conventions to write a script that does that.
I hope this helps!
Thank you! I'm not sure what that does, does in make control or s the hotkey? What about just a new AIstandard surface?
I agree with Kahylan, your question is hard to understand Jackson. Maybe you can gives a better description.
I only usually create ai standard surface, but I have to click 3 times and find it in a long list every time, when I would prefer to just default to having an ai standard surface on my materials. I've searched for this for quite a while and not so cut and dry
If that is what you want then I understood you correctly, you can just create a hotkey that runs the script that I posted above using the hotkey editor. This should give you the result you want.
Here's a tutorial on creating and assigning custom hotkeys
Can't find what you're looking for? Ask the community or share your knowledge.