作っているようで作っていなかった移動回転スケールの値を量子化するMEL
/*
SYNOPSIS
選択したノードのsrt値を量子化する
I quantize the value of the selected node
INPUTS
Nothing
RETURNS
Nothing
Quantizing
*/
global proc float yjp_DPoint(float $val,float $k)
{
$val *= 1 / $k;
$val = floor($val + 0.5);
$val *= $k;
return $val;
}
global proc doSRT_Quantize()
{
string $sel[] = `ls -sl`;
if(`size$sel` < 1)
{
warning("no ");
return ;
}
int $n;
float $new[];
for ($n=0;$n<size($sel);$n++)
{
float $T = `floatField -q -v SRT_QThresholdField`;
if(`checkBox -q -v SRT_QtranslateBox`)
{
$new[0] = yjp_DPoint(`getAttr($sel[$n] +".tx")` , $T);
$new[1] = yjp_DPoint(`getAttr($sel[$n] +".ty")` , $T);
$new[2] = yjp_DPoint(`getAttr($sel[$n] +".tz")` , $T);
setAttr($sel[$n]+".t") $new[0] $new[1] $new[2];
}
if(`checkBox -q -v SRT_QrotateBox`)
{
$new[0] = yjp_DPoint(`getAttr($sel[$n] +".rx")` , $T);
$new[1] = yjp_DPoint(`getAttr($sel[$n] +".ry")` , $T);
$new[2] = yjp_DPoint(`getAttr($sel[$n] +".rz")` , $T);
setAttr($sel[$n]+".r") $new[0] $new[1] $new[2];
}
if(`checkBox -q -v SRT_QscaleBox`)
{
$new[0] = yjp_DPoint(`getAttr($sel[$n] +".sx")` , $T);
$new[1] = yjp_DPoint(`getAttr($sel[$n] +".sy")` , $T);
$new[2] = yjp_DPoint(`getAttr($sel[$n] +".sz")` , $T);
setAttr($sel[$n]+".s") $new[0] $new[1] $new[2];
}
}
return ;
}
global proc yjp_SRT_Quantize()
{
if(`window -q -ex yjp_SRT_QuantizeWindow`)
{
deleteUI yjp_SRT_QuantizeWindow;
}
window -wh 100 100 -s 1 -t "yjp_SRT_Quantize 1.0" yjp_SRT_QuantizeWindow;
columnLayout -adjustableColumn true;
floatField -w 95 -h 22 -v 0.001 SRT_QThresholdField;
checkBox -l "translate"-v 1 SRT_QtranslateBox;
checkBox -l "rotate"-v 1 SRT_QrotateBox;
checkBox -l "scale"-v 0 SRT_QscaleBox;
button -h 25 -w 100 -l "Quantize" -c "doSRT_Quantize";
setParent ..;
window -e -wh 100 100 yjp_SRT_QuantizeWindow;
showWindow yjp_SRT_QuantizeWindow;
}
0 件のコメント:
コメントを投稿