<?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: Outline Editor Contextual Menu On Custom Node in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/outline-editor-contextual-menu-on-custom-node/m-p/13394083#M906</link>
    <description>&lt;P&gt;I've found the only way is to adda callback:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;def myCallbackFunction(arg1):
    cmds.menuItem(divider=True, insertAfter="")
    cmds.menuItem("myCallbackFunction", enableCommandRepeat=False, label="My Command", command="cmds.polySphere()")

cmds.callbacks(addCallback=myCallbackFunction, hook='addItemsToOutlinerNodePopupMenu', owner='myPlugin')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Mar 2025 13:37:28 GMT</pubDate>
    <dc:creator>joeleveson</dc:creator>
    <dc:date>2025-03-27T13:37:28Z</dc:date>
    <item>
      <title>Outline Editor Contextual Menu On Custom Node</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/outline-editor-contextual-menu-on-custom-node/m-p/12131000#M904</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have created a custom node based on an OpenMayaMPx.MPxLocatorNode. The node is created and registered in Python (I used this example as a starting point: &lt;A href="https://help.autodesk.com/view/MAYAUL/2023/ENU/?guid=MAYA_API_REF_py_ref_python_2api1_2py1_rocking_transform_8py_example_html" target="_blank"&gt;https://help.autodesk.com/view/MAYAUL/2023/ENU/?guid=MAYA_API_REF_py_ref_python_2api1_2py1_rocking_transform_8py_example_html&lt;/A&gt;). So far it works, and when I add the node to the scene, it appears in the outline editor as expected. I now want to add some menu items to the context menu that appears when a node is hovered and right-clicked in the outline editor. I want these menu items to perform custom actions for the selected node and be visible only on nodes of that custom type. I have not yet found a solution that works for this case. Can anyone help me with this issue?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 14:14:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/outline-editor-contextual-menu-on-custom-node/m-p/12131000#M904</guid>
      <dc:creator>Philipp99_N</dc:creator>
      <dc:date>2023-07-27T14:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Outline Editor Contextual Menu On Custom Node</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/outline-editor-contextual-menu-on-custom-node/m-p/12133109#M905</link>
      <description>&lt;P&gt;The only way (afaik) to custom modify the Outliner RMB-popup menu is to provide a MEL script named:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;outlinerEdMenuUserCallback.mel&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This is sourced (reloaded and executed) automatically every time you right-click in the outliner.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, save this code into a file with the exact name above, and save it into your &lt;STRONG&gt;documents\maya\scripts\&lt;/STRONG&gt; folder (or somewhere on your Maya scripts path):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;menuItem -sm 1 -l "My Custom SubMenu";
	menuItem -l "do something";
setParent -m "..";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(you'll need to restart Maya or "rehash"). But now, when you do, right clicking in the Outliner should show something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FirespriteNate_0-1690536127552.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1246342i1B179B936AC15283/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FirespriteNate_0-1690536127552.png" alt="FirespriteNate_0-1690536127552.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this MEL callback doesn't provide any arguments, so you have no idea what the user &lt;EM&gt;clicked on&lt;/EM&gt;, so the only thing you can query/rely on is what is &lt;EM&gt;currently selected&lt;/EM&gt;. If, for example you wanted this menu to only appear when you had a specific node type selected, you'd have to check and handle that yourself.&lt;/P&gt;&lt;P&gt;Also, if you're working in Python, you probably don't want to do this in MEL, so you might want to write your custom menu functionality in python and just use &lt;STRONG&gt;outlinerEdMenuUserCallback.mel&amp;nbsp;&lt;/STRONG&gt;to call your Python code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you wanted to insert your new custom menu somewhere else in the outliner popup (i.e. not at the bottom) you will need to know the names of the other menu items in it, which you can find out by browsing the MEL file that creates it: &lt;STRONG&gt;OutlinerEdMenu.mel&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this is enough to get you started.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 09:28:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/outline-editor-contextual-menu-on-custom-node/m-p/12133109#M905</guid>
      <dc:creator>FirespriteNate</dc:creator>
      <dc:date>2023-07-28T09:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Outline Editor Contextual Menu On Custom Node</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/outline-editor-contextual-menu-on-custom-node/m-p/13394083#M906</link>
      <description>&lt;P&gt;I've found the only way is to adda callback:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;def myCallbackFunction(arg1):
    cmds.menuItem(divider=True, insertAfter="")
    cmds.menuItem("myCallbackFunction", enableCommandRepeat=False, label="My Command", command="cmds.polySphere()")

cmds.callbacks(addCallback=myCallbackFunction, hook='addItemsToOutlinerNodePopupMenu', owner='myPlugin')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 13:37:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/outline-editor-contextual-menu-on-custom-node/m-p/13394083#M906</guid>
      <dc:creator>joeleveson</dc:creator>
      <dc:date>2025-03-27T13:37:28Z</dc:date>
    </item>
  </channel>
</rss>

