Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 01-10-2014 , 03:20 PM
Registered User
Join Date: Oct 2014
Posts: 4

Edit RMB context menus

Hello Everyone!

I'm a new Maya 2015 User in the midst of customizing my hotkeys and user interface, and so far I'm happy with what I've managed to set up, with one exception - Maya's default context sensitive right click menus. Don't get me wrong, those are incredibly useful, it's only that I would like to customize them a bit - to cater to my personal needs and preferences. From what I've concluded however, reading dozens of Google-suggested threads on this subject, the only way of doing so is to modify Maya's core files in general and the dagMenuProc.mel in particular, by inserting a modified copy of it in the script folder, which in it self shouldn't be that big of a problem since I have a fair amount of coding experience, it's only that I don't know exactly where in those 2718 lines of code to do my edits.

For example, In the context sensitive edit polygons menu which appears when you right click a polygon object I would like switch places between the legacy bevel tool and the new and improved one, but nowhere in the dagMenuProc.mel can I find the bevel commands (performPolyBevel 0 and dR_DoCmd("bevelTool"))

Why is that, and where shall I search to find what I'm looking for? If some kind soul just could help me with the bevel tool example I'm confident that I'll find my way from there. Thanks in advance

/ Johan Wendesten

# 2 01-10-2014 , 03:50 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
It is frustrating that they don't make it as easy to modify those menus as the hotbox marking menus. Why not?

I do love that the file you reference was created 18 years ago...

I made a bit of progress on this one:

Apparently not all the marking menus are built in the dagMenuProc.mel (although many are).
Look at this page https://download.autodesk.com/us/maya...nds/uiRes.html and I used that to track down where the commands are actually sitting in the longer script files.
This is for an accompanying resource file that shows the text for commands used by the script.

The script that creates the marking menu seems to be ModelEdMenu, although the menu gets built dynamically, according to the documentation at the beginning.

That led me to searching in the Maya2015\scripts\others folder for "*context" and boom user added image, a ton of context menu scripts. Look in contextPolyToolsEdgeMM.mel. It seems to already have a specific menu item for the 2015 bevel tool. Remember to also look at the associated .res.mel file (e.g. contextPolyToolsEdgeMM.res.mel) as that seems to be where the displayed text shows up (presumably a separate file because of language translation).

Obviously be careful of modifying these, I don't completely understand how the different files are structured, so proceed with caution, make backups, don't come crying to me, etc. etc. user added image


Last edited by stwert; 01-10-2014 at 03:52 PM.
# 3 01-10-2014 , 04:15 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Just a bit more sleuthing. The default hotkey/context and the associated file (and .res.mel file)

Shift + RMB, nothing selected (poly creation MM) --> contextPolyToolsDefaultMM.mel

Shift + RMB over poly object --> contextPolyToolsObjectMM.mel

Shift + RMB over poly vertex mode --> contextPolyToolsVertexMM.mel
Shift + RMB over poly edge mode --> contextPolyToolsEdgeMM.mel
Shift + RMB over poly face mode --> contextPolyToolsFaceMM.mel
Shift + RMB over poly UV mode --> (no default, but can create a User one, see below)


Ctrl + RMB with poly selected (conversion) --> polyConvertMM.mel


I've further noticed that there generally seems to be an if statement like so:
Code:
if (`exists contextPolyToolsObjectUserMM`)
				contextPolyToolsObjectUserMM $parent;

			return 1;
		}
And documentation that says:
// allow user to define a proc with additional menu items

So I would assume this would be better than modifying the original values, although I'm not sure if this "user MM" overwrites the original, or just adds stuff to the bottom. Worth experimenting with.

# 4 01-10-2014 , 05:06 PM
Registered User
Join Date: Oct 2014
Posts: 4

Success!

You sir, you're a scholar and a gentleman. Thank you so much for pointing me in the right direction! I agree with you that, by now, there should be an easier way of customizing and setting up your own context sensitive marking menus. I could just imagine how sweet it would be if you had that functionality for every single type of element - right click on a NURBS surface and access the most useful NURBS editing tool, right click a light and get the lights equivalent of that etc. I the meantime however, I have to settle for this more manual approach, and the different contextPoly files were just what I was looking for.

As far as safety goes, I've made backups of all files that I'm going to edit, and in addition to that I make no changes to the actual core files, instead I make copies of them which I edit and then place in the maya scripts folder. So hopefully I'll won't come crying to you, but you'll never know user added image

Since I've already have you here and you seem to know what you're talking about, I have two bonus questions which you might be able to answer for me:

1. What's the point of the .res files? It seems to be only for naming purposes and, since I don't want to rename any tool or command I don't need to make any changes to them, do I?

2. If I would like to create my own context sensitive menu, like the ones I talk about at the top of this post, do you think that it would be difficult? Any tips on how to go about doing that? The way I see it you could create for example a NURBS editing menu, using the already existing polygon menus as a template, and then in the dagMenuProc.mel tell Maya to display said menu if what you're clicking at is a NURBS surface, or even more detailed - displaying different menus depending on if you've selected a vertex point, isoparm or hull etc. What do you think, maybe I'm a bit to naive and it's really not that simple?

Anyway, thanks again for your help - much appreciated!

// Johan Wendesten

# 5 01-10-2014 , 05:50 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Hey, glad it's helpful.
1) I'm guessing the res files are so Maya can use a different version for different languages (english version, french, german, etc). If you add a new tool to the MM, you might have to add the relevent code pointing to the res file and add the tool there as well, because it points to a specific file for the specific MM, rather than having a master list of all english command names.

2) Not really sure, to be honest. If you do any experimentation, I'd be interested to see the results. The selection checking seems to be done with the filterExpand command (see contextPolyToolsMM and https://download.autodesk.com/us/maya...terExpand.html). Unfortunately lights and such don't seem to be in the list of selection filters. Maybe they have hidden values.

# 6 21-10-2014 , 07:25 AM
Registered User
Join Date: Jan 2006
Posts: 2

Trying to locate the .mel file for this menu. See pic.

Trying to locate the .mel file for this menu. See attached pic. If for reason you can't see the pic its the menu that opens on the screen with nothing selected and pressing the RMB.

Already tried in the folder \Programs\Maya2014\scripts\others Doesn't appear to be in any of the context*.mel files.


Any help would be appreciated. Thanks in advance.

Attached Thumbnails
# 7 21-10-2014 , 11:02 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
Actually the code for that menu is found in the file bolded in the original message, dagMenuProc.mel. When in question, turn on History>Echo All Commands so you can see the read out when performing the tasks. Run a "whatIs" on the command and it will tell you where the file containing the code is found.

Example:

Code:
whatIs performPolyBevel;


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 8 22-10-2014 , 08:00 PM
Registered User
Join Date: Jan 2006
Posts: 2
Thank you very much for replying to my question. The additional info. you added (using the "whatIs" command) is a big help. Have a great day!

# 9 28-11-2014 , 04:26 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Okay, now I'm stuck on this one. In the UV texture editor, you have some UVs selected, then Shift+RMB and you have a beautifully useful marking menu. Where is the mel file that builds that marking menu? Simply can't find it.

If I try the whatIs trick, I simply get: Command.

# 10 28-11-2014 , 08:30 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
With echo all commands on, I'm getting this read out when shift+right clicking selected UVs in the UV Editor...

Code:
textureWindowCreatePopupContextMenu "polyTexturePlacementPanel1popupMenusShift";

If I run..

Code:
whatIs textureWindowCreatePopupContextMenu
...it says the proc is in the texturePanel.mel file found in the Maya installation "/scripts/others" folder.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 11 28-11-2014 , 08:36 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Aha, I was whatIs'ing the wrong command. Thanks!
I also ran a "findstr" using command line in all of the mel files for a layoutUV command, and it did find the texturePanel.mel file, but in the context of the result, I didn't think the code was what I was looking for.
Thanks Gen.

# 12 22-09-2015 , 07:54 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374

2. If I would like to create my own context sensitive menu, like the ones I talk about at the top of this post, do you think that it would be difficult? Any tips on how to go about doing that? The way I see it you could create for example a NURBS editing menu, using the already existing polygon menus as a template, and then in the dagMenuProc.mel tell Maya to display said menu if what you're clicking at is a NURBS surface, or even more detailed - displaying different menus depending on if you've selected a vertex point, isoparm or hull etc.

I was just revisiting this idea today, and I made some progress with this script and the idea of the filterExpand command (https://download.autodesk.com/us/maya...rExpand.html):

Code:
string $selection[] = `ls -long -selection`;
for ($i = 0; $i<100; $i++){
    string $selectionList[] = `filterExpand -expand false -selectionMask $i $selection`;
    if (0 != `size($selectionList)`)
		{   
		    print ("Selection Mask: " + $i + "\n");
		}
}
If you select something and run the script, it will tell you what kind of thing (the mask number) you have selected. That way you can make custom shift+RMB marking menus. Unfortunately lights still don't seem to have any selection mask, but nParticles show up as 15, and they're not listed in the table of types. Might be useful for someone.

Joints are 3. Cameras don't appear to have a mask.


Last edited by stwert; 22-09-2015 at 08:08 PM.
# 13 28-04-2016 , 03:11 PM
Registered User
Join Date: Jun 2006
Posts: 7

hi!

nice info here thank you guys for sharing it,

i am a new to coding but i would love to change this RMB context marking many and rearrange them.

i found the object mode but all the other ones edge vertices face multi etc i dont see them.

could someone just give me a little bit of info so i could move on i am kinda stuck.

thank you.

# 14 28-04-2016 , 04:06 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
I believe what you are looking for is in the dagMenuProc.mel around line 500

Code:
switch ($nt) {
...
case "mesh":
			$maskList[0] = "edge";
			$maskList[1] = "vertex";
			$maskList[2] = "facet";
			$maskList[3] = "puv";
			$maskList[4] = "pvf";
			$maskList[5] = "meshComponents";
			break;
...
I am guessing that the array order defines the radial position, so 1 is West, 2 is South etc.
Make sure to make a copy of the file before you mess around with anything. Also best to put the "override" script in your own scripts folder.

# 15 29-04-2016 , 10:45 AM
Registered User
Join Date: Jun 2006
Posts: 7
thanks a lot stwert your the man right in the spot user added image, i am having some complications in this i changed the code for something like this;

case "mesh":
$maskList[0] = "vertex";
$maskList[1] = "edge";
$maskList[3] = "facet";
$maskList[6] = "meshComponents";
$maskList[7] = "puv";
break;

but the other ones that i removed show an empty box in the MM and if i leave them there they will just duplicate other actions.

i tried to put object mode on South but no lucky i used this part o the cod.

if ($hasComponents) {
menuItem -label (uiRes("m_dagMenuProc.kObjectMode"))
-ecr false
-c ("maintainActiveChangeSelectMode " + $item + ";")
-rp "S";

but i failed

as you said, i found it in the cod.

setParent -menu $parent;
$radialPosition[0] = "N";
$radialPosition[1] = "W";
$radialPosition[2] = "S";
$radialPosition[3] = "E";
$radialPosition[4] = "SW";
$radialPosition[5] = "SE";
$radialPosition[6] = "NW";
$radialPosition[7] = "NE";

is it possible to change the actual command to these edge vertex face MM without messing all up.

thanks user added image

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads