PDA

View Full Version : xray view port toggle mel command(menu button)


MindShell
08-16-2003, 03:14 PM
i have a question about making a xray toggle button for current view pannel...

modelEditor -e -xray 0 modelPanel4;
// Result: modelPanel4 //
editMenuUpdate MayaWindow|mainEditMenu;

modelEditor -e -xray 1 modelPanel4;
// Result: modelPanel4 //
editMenuUpdate MayaWindow|mainEditMenu;

thoes are just the commands for the 4th pannel xray command... how would i go about making this command global... meaning for any view panel and make this able to toggle rather then having 2 buttons to preform half a task.

orgeeizm
08-17-2003, 01:49 AM
There should be a script somewhere around Highend3D. I found it before I forgot what it was called but I just copied and pasted the commands to hotkey editor then ditched the zip file so i forgot what it was called.

http://www.highend3d.com

Lookin mel scripts section.

nautilus
08-17-2003, 03:08 AM
I use this one for my markingmenu. It toggles to.

//MEL to toggle xray mode on/off

$currentPanel = `getPanel -withFocus`;
$state = `modelEditor -q -xray $currentPanel`;
modelEditor -edit -xray (!$state) $currentPanel;

dmcgrath
08-17-2003, 03:22 AM
I know you posted MEL command right into your headline, you really could have posted this into the MEL thread.

But here is a simple toggle, using if/else statements.

if ( `modelEditor -q -xray modelPanel1`== 0 )

{
modelEditor -e -xray 1 modelPanel1;
}
else
{
modelEditor -e -xray 0 modelPanel1;
}

if ( `modelEditor -q -xray modelPanel2`== 0 )

{
modelEditor -e -xray 1 modelPanel2;
}
else
{
modelEditor -e -xray 0 modelPanel2;
}

if ( `modelEditor -q -xray modelPanel3`== 0 )

{
modelEditor -e -xray 1 modelPanel3;
}

else
{
modelEditor -e -xray 0 modelPanel3;
}

if ( `modelEditor -q -xray modelPanel4`== 0 )

{
modelEditor -e -xray 1 modelPanel4;
}

else
{
modelEditor -e -xray 0 modelPanel4;
}

MindShell
08-18-2003, 03:43 AM
thnx

stallion151
08-18-2003, 08:09 AM
what nautilus said was right...
its not a good idea to use model panel ids what if you change to a camera or make a new persp you have to set it up again.

http://www.ewertb.com/maya/index.html

that site has what you NEED to know about MEL.

dmcgrath
08-18-2003, 05:37 PM
stallion151Well, nautilus does have good code, a bit more compact than what I use. But his is only for the current panel.

And to my knowledge, you never use more than four panels at any given time.

So using the modelEditor cmd the way I did is not bad. Try it out for yourself, make as many cameras as you want. If you can figure out how to make it fail, let me know. I've never had any problems.

You can use the same commands for making the wireframe appear on shaded objects, I also find that very useful.


-dan

anakinskywalker
08-19-2003, 10:00 AM
Mine is also very similar..works perfectly. I use for the marking menu.

$panel=`getPanel -wf`;
$xraystate=`modelEditor -q -xray $panel`;
if ($xraystate==1)
{
modelEditor -e -xray 0 $panel;
};


if ($xraystate==0)
{
modelEditor -e -xray 1 $panel;
};

stallion151
08-19-2003, 11:43 AM
$currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`;
if ($panelType == "modelPanel")
{
modelEditor -e -wos ( !`modelEditor -q -wos $currentPanel` ) $currentPanel;
}



thats what i use for my mel toggles.
dmcgrath, there is nothing wrong with your script, hell i don't know much about scripts. I got mine from that link....but if you use dmcgrath script you'll most likely go to hell for it...its evil
:buttrock:

dmcgrath
08-19-2003, 07:47 PM
....but if you use dmcgrath script you'll most likely go to hell for it...its evil
:buttrock:


http://www.spatiallight.net/challenge/puppy.jpg





lmao

stallion151
08-20-2003, 05:56 AM
i knew it....he's evil alright

poor puppy, don't try this at home :shame: ...unless its a cat. :rolleyes:

misterdi
08-20-2003, 07:37 AM
Yes, most of the time people are not using more than 4 panel at one time. But somebody with dual screen might have more floating window of the modeling view.

In this case you will have "modelPanel5" or more.

Best regards,

MindShell
08-21-2003, 09:20 PM
1st script didnt work in prespective view for some reason donno why... who well
the other mel scripts work more then well.

dmcgrath
08-28-2003, 06:35 AM
This is actually a better script, modified from my original post.




if ( `modelEditor -q -wos modelPanel1`== 0 )

{
modelEditor -e -wos 1 modelPanel1;
modelEditor -e -wos 1 modelPanel2;
modelEditor -e -wos 1 modelPanel3;
modelEditor -e -wos 1 modelPanel4;
}
else
{
modelEditor -e -wos 0 modelPanel1;
modelEditor -e -wos 0 modelPanel2;
modelEditor -e -wos 0 modelPanel3;
modelEditor -e -wos 0 modelPanel4;
}



I must concede that stallion151 was correct, my former coding was EVIL. Apologies to all.



except that mean, mean stallion151.....:)

MindShell
08-28-2003, 01:23 PM
does anyone know where i an get a good stitch tool script?

you can post it in my new post but was just wondering.

CGTalk Moderation
01-15-2006, 09:00 PM
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.