<?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: Add Assignment in aiSetParameter through MEL/Python in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/add-assignment-in-aisetparameter-through-mel-python/m-p/12462468#M581</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11712848"&gt;@Kahylan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the quick response.&lt;/P&gt;&lt;P&gt;I really appreciate your help in resolving the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and Happy holiday's&lt;/P&gt;</description>
    <pubDate>Tue, 26 Dec 2023 11:18:59 GMT</pubDate>
    <dc:creator>pravin0056</dc:creator>
    <dc:date>2023-12-26T11:18:59Z</dc:date>
    <item>
      <title>Add Assignment in aiSetParameter through MEL/Python</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/add-assignment-in-aisetparameter-through-mel-python/m-p/12457260#M579</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to add new assignment in aiSetParameter node through script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pravin0056_0-1703216282758.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1307288i84C8A087BFB3687E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pravin0056_0-1703216282758.png" alt="pravin0056_0-1703216282758.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add shader through Python but I am not getting any output in script editor while doing the manual process so that I can refer the same and create script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be great if anyone guide me to achieve the required step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2023 03:44:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/add-assignment-in-aisetparameter-through-mel-python/m-p/12457260#M579</guid>
      <dc:creator>pravin0056</dc:creator>
      <dc:date>2023-12-22T03:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Add Assignment in aiSetParameter through MEL/Python</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/add-assignment-in-aisetparameter-through-mel-python/m-p/12460226#M580</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not gonna lie, this node is a pain to work with. appearently the message attriubtes have a preassignet japanese string, no idea why. It doesn't allow to for multiple assignements of the same type, etc.&lt;BR /&gt;&lt;BR /&gt;But I think I figured out a way to do what you want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import maya.cmds as mc


def addAssignement(type = "", attribute = "", aiSetParameterNode = ""):
    
    i = 0
    message = "="
    lenType= len(type)
    
    while "=" in message:
        message = mc.getAttr("{0}.assignment[{1}]".format(aiSetParameterNode,i))
        i= i + 1
        if message[:lenType] == type:
            break
        
    
    mc.setAttr("{0}.assignment[{1}]".format(aiSetParameterNode,i-1), "{0}='{1}'".format(type, attribute), type = "string")
    
addAssignement(type = "shader", attribute = "lambert2", aiSetParameterNode = "aiSetParameter1")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the type variable takes the left part of the assignmetn (eg. shader or displacement) and the attribute variable right part of the assignment. (name of shader, type of curve, etc)&lt;BR /&gt;the aiSetParameterNode variable takes the name of the Node you want to add the assignment to.&lt;BR /&gt;&lt;BR /&gt;I hope it helps, and happy holidays!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2023 10:15:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/add-assignment-in-aisetparameter-through-mel-python/m-p/12460226#M580</guid>
      <dc:creator>Kahylan</dc:creator>
      <dc:date>2023-12-24T10:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add Assignment in aiSetParameter through MEL/Python</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/add-assignment-in-aisetparameter-through-mel-python/m-p/12462468#M581</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11712848"&gt;@Kahylan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the quick response.&lt;/P&gt;&lt;P&gt;I really appreciate your help in resolving the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and Happy holiday's&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 11:18:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/add-assignment-in-aisetparameter-through-mel-python/m-p/12462468#M581</guid>
      <dc:creator>pravin0056</dc:creator>
      <dc:date>2023-12-26T11:18:59Z</dc:date>
    </item>
  </channel>
</rss>

