On Sat, Nov 25, 2017 at 9:35 AM Pritish Dogra <[email protected]>
wrote:

> I can add the menu through the following code
>
> import pymel.core as pm
> parent_object = pm.getPanel(sty="graphEditor")[0]
> pm.menu("test_menu", parent=parent_object, label="Test Menu", tearOff=True
>
> However as soon as I tear off the graph editor panel, I lose the menu. How
> can I make this permanent for the graph editor window or any other scripted
> panel?
>

I haven't been setting this stuff up in newer Maya releases (2016+) so my
information may be out of date. But ya it is a bit tricky to make custom
changes to Maya's interface and have them be persistent when the UI is
modified. This is happening because a tear-off is recreating the widget and
your injected modifications to the old widget are lost.

Some options you have to automatically introduce this change is to include
setting an event filter
<http://doc.qt.io/qt-4.8/eventsandfilters.html#event-filters> on one of the
parent objects that don't change. This could end up just being the main
window or the QApplication. The event filter would be watching for the
ChildAdded <http://doc.qt.io/qt-4.8/qevent.html#Type-enum> event, and if
its the expected type of widget you can apply your customization.

I don't recall the MMessage API offering any hooks for when arbitrary UI's
are created.


> Cheers
>
> Pritish
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/08d0a77a-a497-460e-8c69-9ef5e8231a7e%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/08d0a77a-a497-460e-8c69-9ef5e8231a7e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0MpO-A1hRFe04NOe_DQ2U%2BA-1%3Di14mXXc16k3qBSP2TQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to