Skip to content
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

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

pierrebai-adsk
Copy link
Collaborator

We must create the pop-up menu explicitly, otherwise the menu fails to show in some circumstances.

We must create the pop-up menu explicitly, otherwise the menu fails to show in some circumstances.
@pierrebai-adsk pierrebai-adsk added bug Something isn't working adsk Related to Autodesk plugin labels Oct 20, 2023
@@ -105,6 +105,9 @@ global proc USDMenuProc(string $parent, string $obj)
{
$obj = expandToSelection($obj);

popupMenu -e -dai $parent;
setParent -menu $parent;

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

@seando-adsk seando-adsk Oct 23, 2023

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.
@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Oct 24, 2023
@seando-adsk seando-adsk merged commit de187e8 into dev Oct 24, 2023
11 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-715/missing-context-menu branch October 24, 2023 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin bug Something isn't working ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants