ITeye博客

Mirror shave mel

DragonXin · 2010-11-20 08:08 · Maya · 非技术 · Markdown

/* *

  • 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 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;
        }
    }
}

}

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;      
string $shaveShpNod = `ls -sl -dag -s`;    

select $selFaces;
shaveCreateHairCopy($shaveShpNod);

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 shaveCurveGroup1;
shaveCombFromCurves;
select shaveCurveGroup1;
delete;

}

shaveMirrorWin;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。