移動ツールの対称機能を使っている
頂点移動調整なら移動ツールの方がUVが崩れず、頂点番号も変わらない。
そこで左右の頂点の位置が少しずれていると気持ちわるくなって来たので
左右をそろえるMELでも作ろうかと思う。
さらにUVも対称になるようにしたい。
テキトウに作った。なんか短くできそうだけどしんどい。
今後はセンターは頂点選択して取得したい。
ほとんど0.0で問題なさそうだけど。
UVもあとで考えよう。
global proc yjp_doVertexSymmetryMove(int $dir)
{
string $vetx[] = `ls -sl -fl`;
if(size($vetx) != 2 )return;
if(`gmatch $vetx[0] "*.vtx*"` && `gmatch $vetx[1] "*.vtx*"`)
{
float $center[];
string $VertexPlus = $vetx[0];
string $VertexMinus = $vetx[1];
float $VertexValueA[] = `pointPosition $vetx[0]`;
float $VertexValueB[] = `pointPosition $vetx[1]`;
$center[0] = `floatFieldGrp -q -value1 vsVertexCenterField`;
$center[1] = `floatFieldGrp -q -value2 vsVertexCenterField`;
$center[2] = `floatFieldGrp -q -value3 vsVertexCenterField`;
float $newx,$newy,$newz;
string $targetVertex;
if ($dir == 0 || $dir == 1)
{
if($VertexValueA[0] < $VertexValueB[0])
{
$VertexPlus = $vetx[1]; $VertexMinus = $vetx[0];
$VertexValueA = `pointPosition $vetx[1]`;
$VertexValueB = `pointPosition $vetx[0]`;
}
if ($dir == 0)
{
$newx = $center[0] - ($VertexValueA[0] - $center[0]);
$newy = $VertexValueA[1];
$newz = $VertexValueA[2];
$targetVertex = $VertexMinus;
}
else
{
$newx = $center[0] - ($VertexValueB[0] - $center[0]);
$newy = $VertexValueB[1];
$newz = $VertexValueB[2];
$targetVertex = $VertexPlus;
}
}
else if ($dir == 2 || $dir == 3)
{
if($VertexValueA[1] < $VertexValueB[1])
{
$VertexPlus = $vetx[1]; $VertexMinus = $vetx[0];
$VertexValueA = `pointPosition $vetx[1]`;
$VertexValueB = `pointPosition $vetx[0]`;
}
if ($dir == 2)
{
$newx = $VertexValueA[0];
$newy = $center[1] - ($VertexValueA[1] - $center[1]);
$newz = $VertexValueA[2];
$targetVertex = $VertexMinus;
}
else
{
$newx = $VertexValueB[0];
$newy = $center[1] - ($VertexValueB[1] - $center[1]);
$newz = $VertexValueB[2];
$targetVertex = $VertexPlus;
}
}
else if ($dir == 4 || $dir == 5)
{
if($VertexValueA[2] < $VertexValueB[2])
{
$VertexPlus = $vetx[1]; $VertexMinus = $vetx[0];
$VertexValueA = `pointPosition $vetx[1]`;
$VertexValueB = `pointPosition $vetx[0]`;
}
if ($dir == 4)
{
$newx = $VertexValueA[0];
$newy = $VertexValueA[1];
$newz = $center[2] - ($VertexValueA[2] - $center[2]);
$targetVertex = $VertexMinus;
}
else
{
$newx = $VertexValueB[0];
$newy = $VertexValueB[1];
$newz = $center[2] - ($VertexValueB[2] - $center[2]);
$targetVertex = $VertexPlus;
}
}
move -ws $newx $newy $newz $targetVertex;
}
}
global proc yjp_VertexSymmetryMove()
{
if(`window -q -ex yjp_VertexSymmetryMoveWindow`)
{
deleteUI yjp_VertexSymmetryMoveWindow ;
}
window -tb 1 -tlb 0 -t "VertexSymmetry" yjp_VertexSymmetryMoveWindow ;
columnLayout ;
floatFieldGrp -numberOfFields 3
-label "center"
-cw4 50 70 70 70
-value1 0.0 -value2 0.0 -value3 0.0 vsVertexCenterField;
rowColumnLayout -nc 6 -cw 1 50 -cw 2 50 -cw 3 50 -cw 4 50 -cw 5 50 -cw 6 50 ;
button -w 50 -h 25 -l "+X to -X" -c "yjp_doVertexSymmetryMove 0";
button -w 50 -h 25 -l "-X to +X" -c "yjp_doVertexSymmetryMove 1";
button -w 50 -h 25 -l "+Y to -Y" -c "yjp_doVertexSymmetryMove 2";
button -w 50 -h 25 -l "-Y to +Y" -c "yjp_doVertexSymmetryMove 3";
button -w 50 -h 25 -l "+Z to -Z" -c "yjp_doVertexSymmetryMove 4";
button -w 50 -h 25 -l "-Z to +Z" -c "yjp_doVertexSymmetryMove 5";
setParent..;
button -w 130 -h 25 -l "Close" -c ("deleteUI -window yjp_VertexSymmetryMoveWindow") ;
setParent..;
showWindow yjp_VertexSymmetryMoveWindow ;
window -e -wh 320 80 yjp_VertexSymmetryMoveWindow ;
}
0 件のコメント:
コメントを投稿