<?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 Bug Report: menuItem -dragMenuCommand does not work as advertised in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/bug-report-menuitem-dragmenucommand-does-not-work-as-advertised/m-p/13049515#M190</link>
    <description>&lt;P&gt;The &lt;STRONG&gt;menuItem&lt;/STRONG&gt; command has a flag &lt;STRONG&gt;-dragMenuCommand (-dmc)&lt;/STRONG&gt;, that the command docs describe as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;If the menu item is put on the shelf then this command will be invoked when the corresponding shelf object is clicked.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This suggests to me that if you don't want the regular -command contents to be put on the shelf button, then you can additionally specify this -dmc flag and it will put&amp;nbsp;&lt;EM&gt;THAT&lt;/EM&gt; code into the shelf button instead. This would be especially useful in Python where the &lt;STRONG&gt;-command&lt;/STRONG&gt; might be a function object, rather than a string, and you do not want that on your shelfButton.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, this does not seem to be the case (at least in the Maya versions I checked, 2022/23/24). If you use the -dmc flag, then the code you specify is executed IMMEDIATELY ON shelfButton creation (i.e. when you hold Shift/Ctrl and click the menuItem) and then the created shelfButton has an EMPTY command, so doesn't even take on the given -command OR -dragMenuCommand contents.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Additionally, the comparible &lt;STRONG&gt;-dragDoubleClickCommand&lt;/STRONG&gt;&amp;nbsp;flag does appear to work exactly as expected, even though it's doc explanation is essentially identical to &lt;STRONG&gt;-dragMenuCommand&lt;/STRONG&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there some trick to get this working? or is this indeed a bug?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2024 10:23:23 GMT</pubDate>
    <dc:creator>FirespriteNate</dc:creator>
    <dc:date>2024-09-27T10:23:23Z</dc:date>
    <item>
      <title>Bug Report: menuItem -dragMenuCommand does not work as advertised</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/bug-report-menuitem-dragmenucommand-does-not-work-as-advertised/m-p/13049515#M190</link>
      <description>&lt;P&gt;The &lt;STRONG&gt;menuItem&lt;/STRONG&gt; command has a flag &lt;STRONG&gt;-dragMenuCommand (-dmc)&lt;/STRONG&gt;, that the command docs describe as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;If the menu item is put on the shelf then this command will be invoked when the corresponding shelf object is clicked.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This suggests to me that if you don't want the regular -command contents to be put on the shelf button, then you can additionally specify this -dmc flag and it will put&amp;nbsp;&lt;EM&gt;THAT&lt;/EM&gt; code into the shelf button instead. This would be especially useful in Python where the &lt;STRONG&gt;-command&lt;/STRONG&gt; might be a function object, rather than a string, and you do not want that on your shelfButton.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, this does not seem to be the case (at least in the Maya versions I checked, 2022/23/24). If you use the -dmc flag, then the code you specify is executed IMMEDIATELY ON shelfButton creation (i.e. when you hold Shift/Ctrl and click the menuItem) and then the created shelfButton has an EMPTY command, so doesn't even take on the given -command OR -dragMenuCommand contents.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Additionally, the comparible &lt;STRONG&gt;-dragDoubleClickCommand&lt;/STRONG&gt;&amp;nbsp;flag does appear to work exactly as expected, even though it's doc explanation is essentially identical to &lt;STRONG&gt;-dragMenuCommand&lt;/STRONG&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there some trick to get this working? or is this indeed a bug?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 10:23:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/bug-report-menuitem-dragmenucommand-does-not-work-as-advertised/m-p/13049515#M190</guid>
      <dc:creator>FirespriteNate</dc:creator>
      <dc:date>2024-09-27T10:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report: menuItem -dragMenuCommand does not work as advertised</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/bug-report-menuitem-dragmenucommand-does-not-work-as-advertised/m-p/13054105#M191</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;The documentation appears to be incorrect.&lt;BR /&gt;&lt;BR /&gt;The &lt;STRONG&gt;dragMenuCommand&lt;/STRONG&gt; will be executed immediately and that command is expected to return a string containing the actual command that will be put on the shelf button.&lt;BR /&gt;&lt;BR /&gt;Searching through the Maya built-in scripts is a good way to figure out how commands are used.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;menuItem  
    -dmc "performPointConstraint 2"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Many Maya commands follow this pattern. There is a script called "&lt;STRONG&gt;performSomeCommand&lt;/STRONG&gt;" and it takes a single argument.&lt;BR /&gt;&lt;BR /&gt;- &lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;executes the command immediately&lt;BR /&gt;- &lt;STRONG&gt;1&lt;/STRONG&gt; brings up the command option box&amp;nbsp;&lt;BR /&gt;- &lt;STRONG&gt;2&lt;/STRONG&gt; returns the underlying command string&lt;BR /&gt;&lt;BR /&gt;So a menu item could call the same script passing &lt;STRONG&gt;0&lt;/STRONG&gt; for the &lt;STRONG&gt;command&lt;/STRONG&gt;, &lt;STRONG&gt;1&lt;/STRONG&gt; for the &lt;STRONG&gt;double-click&lt;/STRONG&gt; and &lt;STRONG&gt;2&lt;/STRONG&gt; for the &lt;STRONG&gt;drag&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;This explains why you are seeing different behaviour between the &lt;STRONG&gt;drag&lt;/STRONG&gt; and &lt;STRONG&gt;double-click&lt;/STRONG&gt; command. They do indeed act differently!&lt;BR /&gt;&lt;BR /&gt;I hope this clears things up and I will open an issue to update the menuItem command documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 08:17:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/bug-report-menuitem-dragmenucommand-does-not-work-as-advertised/m-p/13054105#M191</guid>
      <dc:creator>brentmc</dc:creator>
      <dc:date>2024-09-30T08:17:13Z</dc:date>
    </item>
  </channel>
</rss>

