customizing marking menus - problem !


hi all,

i’m customizing my marking menus to contain more views, but the problem i’m facing is that each command i’d like to execute is always related to a specific viewport-panel :

for example :

viewSet -rs modelEditor -q -camera [b]modelPanel1;[/b]
editMenuUpdate MayaWindow|mainEditMenu;

switches viewport 1 into right view !

what i’d like to have is executing the command for the active viewport only, something like :

viewSet -rs modelEditor -q -camera [b]modelPanel*;[/b]
editMenuUpdate MayaWindow|mainEditMenu;

which give me a syntax error ! :eek:

so, does anyone know how to adress the active viewport in mel ?!



Yup, I did this just a while ago, and you can do it this way:

string $theNameOfTheCurrentPanel = `getPanel -wf`; // This assigns the name of the currently selected panel to the variable "$theNameOfTheCurrentPanel"

viewSet -rs `modelEditor -q -camera [b]$theNameOfTheCurrentPanel[/b]`; // And example on how to use the variable.

That should do it… oh damn I already miss my Maya days, solving simple problems with MEL was such a joy to me :hmm:


typed this :

viewSet -rs modelEditor -q -camera $theNameOfTheCurrentPanel;

unfortunately, this is what i got :

// Error: viewSet -rs modelEditor -q -camera $theNameOfTheCurrentPanel; //
// Error: “$theNameOfTheCurrentPanel” is an undeclared variable. //
editMenuUpdate MayaWindow|mainEditMenu;

what’s wrong ?! did i make a mistake ?


Well did you write the

string $theNameOfTheCurrentPanel = getPanel -wf;

line before that?
If not, then add that one and it should work.


ahhh, now it works ! :thumbsup:

for those who’re interested, this is the line to be added (in this case switch to ‘right side’) :

string $theNameOfTheCurrentPanel = getPanel -wf;
viewSet -rs modelEditor -q -camera $theNameOfTheCurrentPanel;

thanks a lot, man !


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.