<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Hotkey for Assign material? in Maya Modeling Forum</title>
    <link>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11184171#M3295</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not quite sure, are we talking about new materials or existing materials?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if it is just a question of creating new materials, you can use a script like this one to do so:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;</description>
    <pubDate>Sat, 21 May 2022 12:08:50 GMT</pubDate>
    <dc:creator>Kahylan</dc:creator>
    <dc:date>2022-05-21T12:08:50Z</dc:date>
    <item>
      <title>Hotkey for Assign material?</title>
      <link>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11183024#M3294</link>
      <description>&lt;P&gt;I have hundreds of materials in my scene and rightclicking then going to arnold and shimmying down to AIsurface takes too long.&amp;nbsp; Is there a faster way?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 17:22:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11183024#M3294</guid>
      <dc:creator>JacksonLamme</dc:creator>
      <dc:date>2022-05-20T17:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Hotkey for Assign material?</title>
      <link>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11184171#M3295</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not quite sure, are we talking about new materials or existing materials?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if it is just a question of creating new materials, you can use a script like this one to do so:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 12:08:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11184171#M3295</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-05-21T12:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Hotkey for Assign material?</title>
      <link>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11194762#M3296</link>
      <description>&lt;P&gt;Thank you! I'm not sure what that does, does in make control or s the hotkey?&amp;nbsp; What about just a new AIstandard surface?&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 12:55:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11194762#M3296</guid>
      <dc:creator>JacksonLamme</dc:creator>
      <dc:date>2022-05-26T12:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Hotkey for Assign material?</title>
      <link>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11194866#M3297</link>
      <description>&lt;P&gt;I agree with Kahylan, &amp;nbsp;your question is hard to understand Jackson. Maybe you can gives a better description.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 13:32:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11194866#M3297</guid>
      <dc:creator>damaggio</dc:creator>
      <dc:date>2022-05-26T13:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Hotkey for Assign material?</title>
      <link>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11195865#M3298</link>
      <description>&lt;P&gt;I only usually create ai standard surface,&amp;nbsp; but I have to click 3 times and find it in a long list every time,&amp;nbsp; when I would prefer to just default to having an ai standard surface on my materials.&amp;nbsp; &amp;nbsp;I've searched for this for quite a while and not so cut and dry&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 19:51:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11195865#M3298</guid>
      <dc:creator>JacksonLamme</dc:creator>
      <dc:date>2022-05-26T19:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Hotkey for Assign material?</title>
      <link>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11197896#M3299</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a tutorial on creating and assigning custom hotkeys&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=3Xhnnao6AXY" target="_blank"&gt;https://www.youtube.com/watch?v=3Xhnnao6AXY&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 15:01:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-modeling-forum/hotkey-for-assign-material/m-p/11197896#M3299</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2022-05-27T15:01:10Z</dc:date>
    </item>
  </channel>
</rss>

