Page 1 of 4 123 ... LastLast
Results 1 to 10 of 38

Hybrid View

  1. #1
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    725

    Lightbulb Handy MEL scripts and plugins

    Hey mods / other 3DBuzz members,

    Wouldn't it be a good idea to make a sticky post with essential MEL scripts or plugins? For Maya.

    I myself, rely a lot on MEL scripts, it gives me functionality that I can't live without... It would be great if we can share it together.

    Everyone can post their own tips etc...

    Benny
    Last edited by bchew007; 04-27-2004 at 08:37 AM.

  2. #2
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    725
    Well let me start if off then.

    Essential MEL scripts for me on Modeling:

    Target Weld
    This functionality was inspired by Max I think. With this you can quickly merge vertices together. Just by clicking on one and on an other.

    Rage Merge Faces
    Merge faces: found in LW. Very handy script to reduce some polygons, or fix meshes.

    Togge SubDee
    Ever used Lightwave before? If so, than you must be familiar with the great TAB key that you can use in Modeler. This is a script to simulate that. I use it all the time!

    Seperate by edges
    I use this one if I have to 'operate' (like a doctor) on a model, moving parts around etc.
    Last edited by bchew007; 04-26-2004 at 10:57 AM.

  3. #3
    Join Date
    Mar 2002
    Location
    New Orleans
    Posts
    2,538
    Agree and moving to MEL forum.
    ___________________________

    That Old Russell
    AKA
    TOR

  4. #4
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    I've posted these in various places in the past but I'll post them here so they are locally accessed in a sticky in case someone wants to make use of them.

    Code:
    //ToggleOutliner:
    if ( `window -exists outlinerPanel1Window` ) 
    deleteUI -window outlinerPanel1Window; 
    else 
    tearOffPanel "Outliner" "outlinerPanel" false; 
    
    //ToggleGrid:
    string $currentPanel = `getPanel -underPointer`; 
    if ($currentPanel == "") 
        $currentPanel = `getPanel -withFocus`;  
    if (`modelEditor -q -ex $currentPanel`)
    {
        if(`modelEditor -q -grid $currentPanel`)
          modelEditor -e -grid 0 $currentPanel; 
        else
          modelEditor -e -grid 1 $currentPanel;
    }
    
    //Toggle Background Color:
    float $c[] = `displayRGBColor -q background`; 
    if ($c[0] > .6)
    displayRGBColor -c background .357 .357 .357; 
    else if ($c[0]==0) displayRGBColor -c background .672 .672 .672; 
    else displayRGBColor -c background 0 0 0; 
    
    //Toggle Viewport X-Ray:
    $currentPanel = `getPanel -withFocus`; 
    string $panelType = `getPanel -to $currentPanel`;
    if ($panelType == "modelPanel")
    { 
    modelEditor -e -xray ( !`modelEditor -q -xray $currentPanel` ) $currentPanel;
    } 
    
    //ToggleWireframe:
    $currentPanel = `getPanel -withFocus`; 
    string $panelType = `getPanel -to $currentPanel`;
    if ($panelType == "modelPanel")
    { 
    modelEditor -e -wos ( !`modelEditor -q -wos $currentPanel` ) $currentPanel;
    } 
    
    //Toggle Normals:
    string $all[] = `ls -sl`;
    toggle -normal $all
    
    //Toggle Walk Through Cameras:
    string $currentPanel = `getPanel -underPointer`; 
    if ($currentPanel == "") 
        $currentPanel = `getPanel -withFocus`;  
    if(`getPanel -to $currentPanel` == "modelPanel")
    {
    if(`modelPanel -q -cam $currentPanel` == "top")
    switchModelView front;
    else if(`modelPanel -q -cam $currentPanel` == "front")
    switchModelView side;
    else if(`modelPanel -q -cam $currentPanel` == "side")
    switchModelView Perspective;
    else if(`modelPanel -q -cam $currentPanel` == "persp")
    switchModelView top;
    }
    else
    error "I'm sorry, but that is not a valid camera panel.";
    
    
    //Look through selected:
    string $currentPanel = `getPanel -underPointer`; 
    if ($currentPanel == "") 
        $currentPanel = `getPanel -withFocus`;  
    if(`getPanel -to $currentPanel` == "modelPanel")
    {
    string $sel[] = `ls -sl`;
    lookThru $sel[0];
    }
    else
    error "That is not a camera panel.";
    
    
    //Camera home:
    string $currentPanel = `getPanel -underPointer`; 
    if ($currentPanel == "") 
        $currentPanel = `getPanel -withFocus`;  
    if(`getPanel -to $currentPanel` == "modelPanel")
    {
    string $camera = `modelEditor -q -camera $currentPanel`;
    viewSet -home $camera;
    }
    else
    error "I'm sorry, but that is not a valid camera panel.";
    
    
    //Toggle Walk Through Shelf Tabs:
    int $shelfQty = `shelfTabLayout -q -nch
        MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
    int $shelfNum = `tabLayout -q -sti
        MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
    
    if ($shelfNum < $shelfQty)
       {
        shelfTabLayout -edit -selectTabIndex ($shelfNum + 1)
        MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout;
        optionVar -iv selectedShelf `tabLayout -q -sti
        MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
        shelfTabChange;
       }
    
    else
       {
        shelfTabLayout -edit -selectTabIndex 1
        MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout;
        optionVar -iv selectedShelf `tabLayout -q -sti
        MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
        shelfTabChange;
       }
    
    string $shelfName = `shelfTabLayout -q -st MayaWindow|mayaMainWindowForm|formLayout2|formLayout14|formLayout15|formLayout49|ShelfLayout`;
    print ("New shelf is " + $shelfName);
    
    
    //Help window:
    string $myWindow = "cmdHelp";
    
        if (`window -ex $myWindow`)
    	   deleteUI $myWindow;
    
        window -rtf true -s false -title "Command Help" $myWindow;
    
        columnLayout;
    	    textFieldGrp -label "Command:" -cw 1 75 -cw 2 200 -cc cmdHelp cmd;
    	    button -w 275 -l "Find" -c "cmdHelp";
    	
        showWindow $myWindow;
    
    proc cmdHelp()
    {
         string $cmd = `textFieldGrp -q -tx cmd`;
         help -doc $cmd;
    }
    Due to funky word wrap you may need to fix some of the code on the shelf tab one.
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  5. #5
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    725

    Bridge

    polyBridge v1.0 (maya 5.0 only) v1.0

    Amazing command, the bridge tool, just found this script on Highend3D. It is credit of a person called t::REDs.

    Not sure if this link works:
    http://www.highend3d.com/files/dl.3d...p&file_id=2439

    If not go to Highend3d.com >> Maya >> Mel scripts
    search for bridge.

    UpDate: it work now .
    polyBridge creates a 'bridge' between polygonal faces.

    Notes:
    - It doesn't work on subd
    - It doesn't work on instanced geometry


    Have fun !

    t::REDs

  6. #6
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    I've found that when modeling you want to jump between the different modes for the transform tool. Here are 3 small scripts I wrote that will toggle back and forth between Object-World, Local-World, and Normal-World mode. Just map them to hotkeys like Alt + o, Alt + l, or Alt + n and you'll be set.

    //Object: Alt + o
    if (`manipMoveContext -q -mode Move` == 2)
    manipMoveContext -edit -mode 0 Move;

    else
    manipMoveContext -edit -mode 2 Move;

    //Local: Alt + l
    if (`manipMoveContext -q -mode Move` == 2)
    manipMoveContext -edit -mode 1 Move;

    else
    manipMoveContext -edit -mode 2 Move;

    //Normal: Alt + n
    if (`manipMoveContext -q -mode Move` == 2)
    manipMoveContext -edit -mode 3 Move;

    else
    manipMoveContext -edit -mode 2 Move;
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  7. #7
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    Here's a script for toggling the render view window.

    Code:
    if(`window -ex renderViewWindow`)
    deleteUI -window "renderViewWindow";
    else
    RenderViewWindow;
    Last edited by DezFX; 05-20-2004 at 09:59 AM.
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  8. #8
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    Here's one to toggle the Attribute Editor.

    Code:
    string $panel = `getPanel -withFocus`;
    if (`window -ex AEWindow`)
    deleteUI -window "AEWindow";
    else
    openAEWindow;
    setFocus $panel;
    Last edited by DezFX; 05-20-2004 at 10:05 AM.
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  9. #9
    Join Date
    Feb 2003
    Location
    UK
    Posts
    792
    Heres a short script that will show the frame number in the Heads up display that refreshes as time changes. It will also toggle on/off

    Code:
    -------------------------------------------

    if ( `headsUpDisplay -ex HUDCurrentTime`)
    headsUpDisplay -rem HUDCurrentTime;
    else
    {
    //create the HUD
    headsUpDisplay -section 2 -block 0
    -label "Frame: " -blockSize "small"
    -labelFontSize "small" -command "getCurrentTime()"
    -atr HUDCurrentTime;


    proc int getCurrentTime()
    {
    int $time = `currentTime -q`;
    return $time;
    }
    }

    ---------------------------------------------------------

  10. #10
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    This is an X-Ray command to toggle all viewports at the same time.

    Code:
    select -all;
    $sel = `ls -sl -dag -ap -typ surfaceShape`;
    for ($obj in $sel){
    $temp = `displaySurface -q -xRay $obj`;
    $value = $temp[0];
    if ($value == 1)
    displaySurface -xRay 0 $obj;
    else
    displaySurface -xRay 1 $obj;
    };
    select -cl;
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

Page 1 of 4 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •