Home Technical Talk

Mel scripting help

i don't know much about mel scripting and i'm trying to figure it out. i have a few custom buttons but what i want to do now is create a button that essentially checks to see if a material named "Xray" exists and if it does to apply it to the currently selected object. even nicer would be if i hit the same button and it sees that "Xray" is already applied to apply a solid gray lambert type material named "GrayModel" or something. so that way it would switch back and forth between the two. does anyone here know anything about mel scripting to help me out?

Replies

  • Denny
    Options
    Offline / Send Message
    Denny polycounter lvl 14
    While I can't answer your question directly you might have luck with this wiki.
    http://mayamel.tiddlyspot.com/
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Heres some simple code to toggle xray, it's not want you wanted but does the same job (unless you wanted transparency thats on 50$). Let me know if you want me to explain it but it should be relatively straight forward. Ill post the code for the material switching later on or probably tomorrow.
     string $sel[] =`ls -sl`;    
        for ($thisObj in $sel){ 
            int $xraylevel[] = `displaySurface -q -xRay $thisObj`;
            if ($xraylevel[0] == 1) 
            {
                //Go to 0
                displaySurface -xRay false $thisObj;
            }
            if ($xraylevel[0] == 0) 
            {
                //Go to 1
                displaySurface -xRay true $thisObj;
            }
            
        }
    
Sign In or Register to comment.