View Full Version : Newbie question
greynite1 07-31-2003, 10:49 PM Forgive me but I have to ask a silly mel question
Which command controls the Shading of the Viewports.
for instance I want to make a button which will put the Perspective viewport into wireframe mode. I can't seem to find the command in the mel script command reference or maybe I'm just not recognizing the issue can someone give me a hint as to which commands allow me to change a view ports Display from Wireframe to Smooth shading to Hard ware texturing to Textures and Lights? Any help would be appreciated. thank you very much.
|
|
mark_wilkins
07-31-2003, 11:14 PM
It's not silly at all.
To find the answer for this, I turned on "Echo All Commands" in the script editor and switched back and forth a few times.
Turns out that when you go to wireframe mode, Maya runs an undocumented built-in command called DisplayWireframe that then itself runs a MEL script that checks for whether you're dealing with a paint effects pane and handles that differently.
When switching to Smooth Shaded mode, though, Maya just uses the modelEditor -edit command.
For most panes, you can get away with using these commands to switch display modes to wireframe:
string $thePanel = `getPanel -withFocus`;
modelEditor -edit -displayAppearance wireframe -activeOnly false $thePanel;
there are a bunch of choices you can put in place of wireframe with the -displayAppearance flag... these are listed on the manual page for modelEditor in the MEL command reference.
However, DisplayWireframe tests to see whether you're switching to wireframe for a paint effects panel and uses a different command for that, so if you're likely to be using this in a paint effects context you may want to use DisplayWireframe to go that direction and something like the above with smoothShaded as the displayAppearance to go the other way.
-- Mark
loked
07-31-2003, 11:22 PM
modelEditor is the command you'll wanna use.
So for example if you wanted to turn on wireframe on shaded in modelPanel3, you type: modelEditor -e -wos 1 modelPanel3;
Check out the documentation for more info.
You'll also probably want to first check what modelPanel you are in and then save it to a variable and then use that, so you can use the script on any panel as apossed to just the ones specified at the end of the command.
Good Luck :thumbsup:
later:wavey:
loked
greynite1
07-31-2003, 11:32 PM
PERFECT You are a God JEEZ I forgot about Echo commands well i guess thats why i'm a newbie. Thank you very much for your help. This is exactly what I needed.
CGTalk Moderation
01-15-2006, 06: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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.