`
DragonXin
  • 浏览: 6924 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
最近访客 更多访客>>
社区版块
存档分类
最新评论

Mirror shave mel

    博客分类:
  • Maya
阅读更多
/*
*
*   Problem:mirrored shave shorter than original
*
*
*   Create: Dec 22 2009
*   Last Modify:
*
*/


proc shaveMirrorWin()

    if(`window -exists mainWindow` == true)
        deleteUI mainWindow;
    window
            -sizeable true
            -minimizeButton true
            -maximizeButton false
            -menuBarVisible false
            -widthHeight 200 300
            -title "Mirror Shave"
            mainWindow;

    string $coLayout1 = `columnLayout -columnAttach "both" 5 -rowSpacing 5 -columnWidth 250`;

            textScrollList -height 40 -width 150 textScroll_01;
           
            string $rowLayout1 = `rowLayout -numberOfColumns 2 -columnWidth2 120 120 -columnAlign 1 "center" -columnAlign 2 "center"-columnAttach 1 "both" 0 -columnAttach 2 "both" 0`;

                    string $loadButton = `button -height 28 -label "Load Shave" -width 120 -c "listShave" `;
                   
                    string $convertButton = `button -height 28 -label "ConvertCurve" -width 120 -c "convertCurve" `;

            setParent..;

            string $sep1 = `separator -height 10 -style "in"`;

            string $coLayout2 = `columnLayout -columnAttach "both" 3 -rowSpacing 3 -columnWidth 240`;
                  
                    intSliderGrp
                            -label "CombNum"
                            -field true
                            -cw3 58 22 40
                            -minValue 0 -maxValue 10
                            -fieldMinValue 0 -fieldMaxValue 10
                            -value 0
                            -cl3 "center" "center" "center"
                            reduce_Percentum;

                    string $reduceButton = `button -height 28 -label "Reduce" -width 150 -c "combNumReduce"`;

            setParent..;

            string $sep2 = `separator -height 10 -style "in"`;

            string $coLayout3 = `columnLayout -columnAttach "both" 5 -rowSpacing 5 -columnWidth 240`;

                    radioButtonGrp
                            -numberOfRadioButtons 3
                            -cw 1 90
                            -cw 2 90
                            -cw 3 60
                            -labelArray3 "+X" "+Y" "+Z"
                            -select 1
                            mirrorAxisRadioButton;

                    $mirButton = `button -height 28 -label "Mirror" -width 150 -c mirrorShave`;

            setParent..;

showWindow;
}


proc listShave()
{

    string $selObj[] = `ls -sl -fl`;
    textScrollList -e -ra textScroll_01;
    textScrollList -e -a $selObj[0] textScroll_01;

}

proc convertCurve()
{
    string $shaveList[] = `textScrollList -q -si textScroll_01`;  
    select $shaveList;
    shaveCreateCurvesFromHairs;
}

proc combNumReduce()
{
    int $percentumNum = `intSliderGrp -q -value reduce_Percentum`;

    $shaveCrvGrp1 = `ls -sl`;

    for($i=0; $i<$percentumNum; $i++)
    {
        string $sel[] = `filterExpand -sm 9`;   
        for($k=0; $k<size($sel); $k++)   
        {
            if($k%2 == 0)
            {
                delete $sel[$k];
            }
        }
    }

}

proc mirrorShave()
{
    string $selFaces[] = `filterExpand -sm 34`;
    if(size($selFaces) == 0)
        error "You Must Select Faces First!"; 

    string $shaveList[] = `textScrollList -q -si textScroll_01`;
    select $shaveList[0];     
    string $shaveShpNod[] = `ls -sl -dag -s`;   

    select $selFaces;
    shaveCreateHairCopy($shaveShpNod[0]);

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

    int $r = `radioButtonGrp -q -select mirrorAxisRadioButton`;

    string $mirrorDirection;
    switch($r)
    {
        case 1:
            $mirrorDirection = "shaveCurveGroup1.scaleX";
            break;
        case 2:
            $mirrorDirection = "shaveCurveGroup1.scaleY";
            break;        
        case 3:
            $mirrorDirection = "shaveCurveGroup1.scaleZ";
            break;
    } 
  
    string $scalComd = "setAttr " + $mirrorDirection + " -1";
    eval($scalComd);
    select shaveCurveGroup1;
    FreezeTransformations;
   
    select $newShav[0] shaveCurveGroup1;
    shaveCombFromCurves;
    select shaveCurveGroup1;
    delete;
}

shaveMirrorWin;

  • 大小: 9.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics