Re: [Maya-Python] Add menu to grapheditor/hypershape

2017-11-27 Thread Robert White
Yeah, there isn't an API call for when UI's are created, just destroyed.
http://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__cpp_ref_class_m_ui_message_html



On Sunday, November 26, 2017 at 7:13:17 PM UTC-6, Justin Israel wrote:
>
>
>
> On Sat, Nov 25, 2017 at 9:35 AM Pritish Dogra  > 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 
>  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  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 python_inside_maya+unsubscr...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/08d0a77a-a497-460e-8c69-9ef5e8231a7e%40googlegroups.com
>>  
>> 
>> .
>> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/63e232d6-cca3-4676-b6b8-b36a74487d70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Add menu to grapheditor/hypershape

2017-11-26 Thread Justin Israel
On Sat, Nov 25, 2017 at 9:35 AM Pritish Dogra 
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
 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  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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/08d0a77a-a497-460e-8c69-9ef5e8231a7e%40googlegroups.com
> 
> .
> 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 python_inside_maya+unsubscr...@googlegroups.com.
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.


[Maya-Python] Add menu to grapheditor/hypershape

2017-11-24 Thread Pritish Dogra
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? 

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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/08d0a77a-a497-460e-8c69-9ef5e8231a7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.