Home Coding, Scripting, Shaders

Maya Window Compress #MEL

polycounter lvl 5
Offline / Send Message
Pinned
jayantbhatt007 polycounter lvl 5
Hi guys as you can see in the screen shot when I closed the options and constraint and other options too  in the script (flowLayout menu ) is not compressing  my main window. Its like window is stuck anybody know how can I fix it?


Hi I added add script please tell me where is the problem?





Replies

  • jayantbhatt007
    Options
    Offline / Send Message
    jayantbhatt007 polycounter lvl 5

        //AUTHOR : Jayant bhatt.


    //works with maya 2017 and 2018

    //special thanks to autosk and polycount forum

    //for materials thanks to Bodizz

    //PP

    if ( `window -exists "nameWindow"` ) {

    deleteUI "nameWindow";

    }

    // create a window with a menu bar

    window -title "3DGhost" -menuBar true -w 220 -h 200 "nameWindow";

    // two frame layouts will be laid out in a columna

    columnLayout;

    {

    if ( `window -exists CgGhost` ) {

    deleteUI CgGhost;

    }

    // create a tearOff menu

    menu -label "File" -tearOff true;

    // add the menu items

    menuItem -label "New" -command "NewScene";

    menuItem -label "Open" -command "OpenScene";

    menuItem -label "Save" -command "SaveScene";

    menuItem -divider true ;

    menuItem -label "Quit" -command "quit";

    // add a help menu

    menu -label "Credit" -helpMenu true;

    menuItem -label "Jayant bhatt";

    menuItem -label "Virbhadra Gupta";

    // add a help menu

    menu -label "Windows" -helpMenu true;

    menuItem -label "Outliner" -command "OutlinerWindow";

    menuItem -label "Preferences" -command "PreferencesWindow";

    menuItem -label "Hotkey Editr " -command "HotkeyPreferencesWindow";

    menuItem -label "PluginManagr" -command "PluginManager;";

    // add a help menu

    menu -label "Display" -helpMenu true;

    menuItem -label "HideSelected" -command "HideSelectedObjects";

    menuItem -label "ShowAll" -command "ShowAll";

    menuItem -label "Polycount" -command "TogglePolyCount";

    menuItem -divider true -dividerLabel "Rigging";

    menuItem -label "Joint Size" -command "jdsWin";

    menuItem -label "Ik/Fk Js" -command "ikfkjdsWin";

    menuItem -label "Ik Handle Size" -command "ikHdsWin";

    // create a collapsible frame layout

    frameLayout -collapsable true -label "Shapes";

    // add the other controls

    flowLayout -columnSpacing 1 -w 220 -h 30;

    // create six symbol buttons with related mel command

    symbolButton -image "cube.xpm" -command "polyCube";

    symbolButton -image "sphere.xpm" -command "CreatePolygonSphere";

    symbolButton -image "plane.xpm" -command "CreatePolygonPlane";

    symbolButton -image "cylinder.xpm" -command "CreatePolygonCylinder";

    symbolButton -image "circle.xpm" -command "CreateNURBSCircle";

    symbolButton -image "text.xpm" -command "CreatePolygonType";

    setParent ..;

    columnLayout;

    // create some text

    text -label " cube sphre Plne Cylndr Circle Text ";

    setParent ..;

    setParent ..;

    // create a collapsible frame layout

    frameLayout -collapsable true -label "Lights";

    // add the other controls

    flowLayout -columnSpacing 7 -w 20 -h 25;

    // create six symbol buttons with related mel command

    symbolButton -w 30 -h 30 -image "ambientlight.png" -command "CreateAmbientLight";

    symbolButton -w 30 -h 30 -image "directionallight.png" -command "CreateDirectionalLight";

    symbolButton -w 30 -h 30 -image "pointlight.png" -command "CreatePointLight";

    symbolButton -w 30 -h 30 -image "spotlight.png" -command "CreateSpotLight";

    symbolButton -w 30 -h 30 -image "arealight.png" -command "CreateAreaLight";

    symbolButton -w 30 -h 30 -image "volumelight.png" -command "CreateVolumeLight";

    setParent ..;

    columnLayout;

    // create some text

    text -label " Amb Dir Point spot Area Vol ";

    setParent ..;

    setParent ..;

    // three frame layouts will be laid out in a column

    columnLayout;

    // create a collapsible frame layout

    frameLayout -collapsable true -label "Options";

    // define the layout of controls added

    // to the window.

    columnLayout;

    // add the other controls

    flowLayout -columnSpacing 1 -w 220 -h 33;

    // create a couple of buttons

    symbolButton -w 35 -h 35 -image "buttonManip.svg" -command "CenterPivot";

    symbolButton -image "multiCut_NEX32.png" -command "dR_multiCutTool";

    symbolButton -image "detach.png" -command "DetachComponent";

    symbolButton -w 35 -h 35 -image "GateMask.png" -command "PolyCircularize";

    symbolButton -w 35 -h 35 -image "addCreateGeneric_100.png" -command "CombinePolygons";

    symbolButton -w 35 -h 35 -image "mergeConnections.png" -command "SeparatePolygon";

    setParent ..;

    columnLayout;

    // create some text

    text -label " CPvt MCtol Dattch Circ Comb Sept ";

    setParent ..;

    setParent ..;

    flowLayout -columnSpacing 1 -w 220 -h 30;

    // create a couple of buttons

    symbolButton -w 35 -h 35 -image "bridge_NEX32.png" -command "performBridgeOrFill";

    symbolButton -w 35 -h 35 -image "bevel.png" -command "BevelPolygon";

    symbolButton -w 35 -h 35 -image "bezCorner.png" -command "SoftPolyEdgeElements 0";

    symbolButton -w 35 -h 35 -image "bezNormalSelect.png" -command "SoftPolyEdgeElements 1";

    symbolButton -w 35 -h 35 -image "reverseSurface.png" -command "ReversePolygonNormals";

    symbolButton -w 35 -h 35 -image "UV.png" -command "TextureViewWindow";

    setParent ..;

    columnLayout;

    // create some text

    text -label " Brdge Bvl HEd SEd Nrevse UV ";

    setParent ..;

    setParent ..;

    setParent ..;

    // create a collapsible frame layout

    frameLayout -collapsable true -label "Constraint";

    // add the other controls

    flowLayout -columnSpacing 10 -w 224 -h 32;

    symbolButton -w 30 -h 30 -image "edges_NEX.png" -command "toolPropertyWindow";

    symbolButton -w 30 -h 30 -image "hyper_s_ON.png" -command "manipMoveSetXformConstraint edge";

    symbolButton -w 30 -h 30 -image "hyper_s_OFF.png" -command "manipMoveSetXformConstraint none";

    setParent ..;

    setParent ..;

    // create a collapsible frame layout

    frameLayout -collapsable true -label "Materials";

    // add the other controls

    flowLayout -columnSpacing 4 -w 224 -h 53;

    columnLayout;

    // create some text

    text -label " Blinn Lmbrt Phong HypShd MatA ";



    //create a blinn material

    proc createBlinn(){

    string $sel[] = `ls -sl`;

    string $myBlinn = `shadingNode -asShader blinn`;

    select -r $sel;

    hyperShade -assign $myBlinn;

    }

    flowLayout -columnSpacing 4 -w 220 -h 40;

    symbolButton -w 40 -h 40 -image "blinn.svg" -c "createBlinn()" ;

    //create a Lambert material



    proc createLambert(){

    string $sel[] = `ls -sl`;

    string $lambert = `shadingNode -asShader lambert`;

    select -r $sel;

    hyperShade -assign $lambert;

    }

    flowLayout -columnSpacing 4 -w 220 -h 40;

    symbolButton -w 40 -h 40 -image "lambert.svg" -c "createLambert()" ;

    //create a Phong material

    proc createPhong(){

    string $sel[] = `ls -sl`;

    string $phong = `shadingNode -asShader phong`;

    select -r $sel;

    hyperShade -assign $phong;

    }

    flowLayout -columnSpacing 4 -w 220 -h 40;

    symbolButton -w 40 -h 40 -image "phong.svg" -c "createPhong()" ;

    //Material attribute

    flowLayout -columnSpacing 3 -w 220 -h 40;

    symbolButton -w 38 -h 38 -image "Hypershade.png" -command "HypershadeWindow";

    //take you to the material attribut

    symbolButton -w 40 -h 40 -image "samplerInfo.svg" -c "showShadingGroupAttrEditor" ;

    setParent ..;

    columnLayout;

    setParent ..;

    setParent ..;

    showWindow;

    }

  • tsungyuw
    Options
    Offline / Send Message
    tsungyuw polycounter lvl 8
    from my memory, window do not resize automatically. you may meed to run another line when  frameLayout  collapse, resize window height  ,
    of cause each 
    frameLayout will have different height, there are a bit of calculation. 
  • jayantbhatt007
    Options
    Offline / Send Message
    jayantbhatt007 polycounter lvl 5
    tsungyuw said:
    from my memory, window do not resize automatically. you may meed to run another line when  frameLayout  collapse, resize window height  ,
    of cause each frameLayout will have different height, there are a bit of calculation. 
    https://forums.autodesk.com/t5/maya-programming/window-compress-mel/m-p/8982297#M10284

    Already someone helped thank you
Sign In or Register to comment.