-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EMSUSD-715 fix context menu in viewport #3404
Conversation
We must create the pop-up menu explicitly, otherwise the menu fails to show in some circumstances.
@@ -105,6 +105,9 @@ global proc USDMenuProc(string $parent, string $obj) | |||
{ | |||
$obj = expandToSelection($obj); | |||
|
|||
popupMenu -e -dai $parent; | |||
setParent -menu $parent; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code also had setParent -menu ..;
Note: this doesn't actually create the menu - it is created by Maya. What this is doing is clearing out the menu and then setting it for subsequent menuItem
calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A! Well, the bug was in Maya, buildNonMayaContextMenu calls MEL command that fail because there are no menu active. So something in those two lines does the trick. I wrote those because they were in here before my previous change to use the UFE context menu, so I thought they were needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you got the right line, we can commit it with "suggested code changes" in this review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually confused why the previous code also had setParent -menu ..
- the line above set the menu parent and then this one would make it move up one level.
Can you do a test and print out what the original parent is and what the calls to the two different setParent
would be?
Note: this menu is actually called from two different places in Maya, so make sure to test both of those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem being fixed here is that as reported sometimes the parent is not a menu and does not have a popup menu. The version without the popuMenu call would only work by a happy accident most of the time. I'll check what were the parent when it work and did not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he parent being passed in is for example "MainPane|viewPanes|modelPanel4|modelPanel4|modelPanel4|modelPanel4ObjectPop". What is needed is to set it as the parent to be used by the menu being created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking. I wonder if we should leave in the popupMenu -e -dai $parent;
which would clear the menu of all items (in case it has any) as we are going to populate it with MayaUsd menu items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll put it back then.
Only need to set the parent as the menu parent.
We must create the pop-up menu explicitly, otherwise the menu fails to show in some circumstances.