<?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: Python API 2.0 MPlug attributes in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6703129#M12515</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, You are correct. there is no "setLocked()" API in OpenMaya Python 2.0. Instead we have to use "isLocked()" method for both setting the lock as well as checking the lock. Below is the actual documentation of isLocked() method. &amp;nbsp;It has both Read and Write access.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="memitem"&gt;
&lt;DIV class="memproto"&gt;
&lt;TABLE class="mlabels"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="mlabels-left"&gt;
&lt;TABLE class="memname"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="memname"&gt;OpenMaya.MPlug.isLocked&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/TD&gt;
&lt;TD class="mlabels-right"&gt;&lt;SPAN class="mlabels"&gt;&lt;SPAN class="mlabel"&gt;static&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;DIV class="memdoc"&gt;
&lt;PRE class="fragment"&gt; True if plug is locked against changes.&lt;/PRE&gt;
&lt;TABLE border="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;STRONG&gt;Name:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;isLocked&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;STRONG&gt;Type:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;bool&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Access:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;&lt;FONT color="#FF0000"&gt;RW&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;STRONG&gt;Description:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;True if plug is locked against changes.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Vijaya Prakash.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2016 17:19:21 GMT</pubDate>
    <dc:creator>vijaya.prakash</dc:creator>
    <dc:date>2016-11-22T17:19:21Z</dc:date>
    <item>
      <title>Python API 2.0 MPlug attributes</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6700850#M12511</link>
      <description>&lt;P&gt;I am trying to use the Python API 2.0 and MPlug in particular. &amp;nbsp;I can't find a way to lock the attribute. &amp;nbsp;There is a "isLocked" which gives a boolean result. &amp;nbsp;But how do you set the locked state? &amp;nbsp;The API 2.0 discussion says that the attributes should be available to be set directly. &amp;nbsp;But there is an error when trying MPlug.locked = True. &amp;nbsp;What am I missing?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 19:40:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6700850#M12511</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-21T19:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python API 2.0 MPlug attributes</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6701726#M12512</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In C++, you can use MPlug.setLocked(True) but in Python, you should use MPlug.setAttribute() with "lock" parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Vijaya Prakash.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 07:34:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6701726#M12512</guid>
      <dc:creator>vijaya.prakash</dc:creator>
      <dc:date>2016-11-22T07:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python API 2.0 MPlug attributes</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6701886#M12513</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the below python code to set the lock attribute, there is no specific API in Python 2.0 API in OpenMaya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;import maya.cmds as cmds&lt;/P&gt;
&lt;P&gt;cmds.sphere( n="sphere" )&lt;BR /&gt;cmds.setAttr( 'sphere.translateX', 5 )&lt;BR /&gt;cmds.setAttr( 'sphere.translateX', lock=True )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Vijaya Prakash.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 09:19:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6701886#M12513</guid>
      <dc:creator>vijaya.prakash</dc:creator>
      <dc:date>2016-11-22T09:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Python API 2.0 MPlug attributes</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6703074#M12514</link>
      <description>&lt;P&gt;You are incorrect in your information. &amp;nbsp;API 2.0 does provide this functionality. &amp;nbsp;I assumed "isLocked" was read only. &amp;nbsp;It actually can be set as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MPlug.isLocked = True&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 16:58:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6703074#M12514</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-22T16:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python API 2.0 MPlug attributes</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6703129#M12515</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, You are correct. there is no "setLocked()" API in OpenMaya Python 2.0. Instead we have to use "isLocked()" method for both setting the lock as well as checking the lock. Below is the actual documentation of isLocked() method. &amp;nbsp;It has both Read and Write access.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="memitem"&gt;
&lt;DIV class="memproto"&gt;
&lt;TABLE class="mlabels"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="mlabels-left"&gt;
&lt;TABLE class="memname"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="memname"&gt;OpenMaya.MPlug.isLocked&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/TD&gt;
&lt;TD class="mlabels-right"&gt;&lt;SPAN class="mlabels"&gt;&lt;SPAN class="mlabel"&gt;static&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;DIV class="memdoc"&gt;
&lt;PRE class="fragment"&gt; True if plug is locked against changes.&lt;/PRE&gt;
&lt;TABLE border="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;STRONG&gt;Name:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;isLocked&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;STRONG&gt;Type:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;bool&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Access:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;&lt;FONT color="#FF0000"&gt;RW&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD align="right" valign="top"&gt;&lt;STRONG&gt;Description:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD valign="top"&gt;True if plug is locked against changes.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Vijaya Prakash.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 17:19:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-api-2-0-mplug-attributes/m-p/6703129#M12515</guid>
      <dc:creator>vijaya.prakash</dc:creator>
      <dc:date>2016-11-22T17:19:21Z</dc:date>
    </item>
  </channel>
</rss>

