View Single Post
# 9 01-10-2007 , 01:53 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
lol, thats a useful shortcut way of doing it funky user added image
Didnt even know it was there (as I'm still fairly new to Maya's programming capabilities).

I can easily add that in python like below:
Python:
Code:
# 1) open the script editor and copy the code below into it
def toggleXray():
    if mc.displaySurface(query=True, xRay=True) == [1]:
        mc.displaySurface(xRay=False)
    else:
        mc.displaySurface(xRay=True)


# 2) Now copy this into the script editor, highlight it and middle drag to your shelf.
# When asked what type of code it is choose Python. You should now have a toggle for xray on the selected objects
toggleXray()
N.B, If anyone wants to use it you'll need to add it to a file and include it to run it whenever you use maya.

How do you go about it in Mel?
I tried with the following code and variations but it doesnt seem to like using attribute values as variable comparisions?
Mel:
Code:
int $xRayVar = `displaySurface -q -xRay`;
if ($xRayVar) {
    displaySurface -xRay false;
} else {
    displaySurface -xRay true;
};
Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net

Last edited by t1ck135; 01-10-2007 at 01:55 AM.