Community
Maya Modeling
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya modeling topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hotkey for Assign material?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
JacksonLamme
1064 Views, 5 Replies

Hotkey for Assign material?

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

5 REPLIES 5
Message 2 of 6
Kahylan
in reply to: JacksonLamme

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!

Message 3 of 6
JacksonLamme
in reply to: Kahylan

Thank you! I'm not sure what that does, does in make control or s the hotkey?  What about just a new AIstandard surface?

Message 4 of 6
damaggio
in reply to: JacksonLamme

I agree with Kahylan,  your question is hard to understand Jackson. Maybe you can gives a better description.

Message 5 of 6
JacksonLamme
in reply to: damaggio

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

Message 6 of 6
Kahylan
in reply to: JacksonLamme

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

https://www.youtube.com/watch?v=3Xhnnao6AXY

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report