pose.txtにsetAttrを記述しているのでMaya2つ起動してポーズのコピペができます。
ビジビリティUVアニメのキーもコピーできる。
//
//
//
//
//
//GetTextStringLineつかってます
global proc yjp_PosePaste()
{
string $PExportPath = `pwd`;
int $n;
string $cmd[] = `GetTextStringLine ($PExportPath + "/pose.txt")`;
for ($n=0;$n<size($cmd);$n++)
{
string $buffer[];
tokenize $cmd[$n] " ." $buffer;
if(`objExists $buffer[1]`)
{
eval $cmd[$n];
}
}
}
global proc yjp_PoseCopy(int $mode)
{
string $node[];
if(`radioButtonGrp -q -sl PoseCopyRBG` == 1)
{
$node =`ls -type "joint" -type "transform" -type "place2dTexture"`;
}
else
{
$node =`ls -type "joint" -type "transform" -type "place2dTexture" -sl`;
}
int $n;
string $script;
int $ti = `currentTime -q`;
for ($n=0;$n<size($node);$n++)
{
float $valt[],$valr[],$vals[],$valtv,$valtu;
int $valv;
if(`nodeType $node[$n]` == "joint")
{
$valt = `getAttr ($node[$n] + ".t")`;
$script += ("setAttr " + $node[$n] + ".t "+ $valt[0] + " "+$valt[1]+ " " +$valt[2] + "\;\n");
$valr = `getAttr ($node[$n] + ".r")`;
$script += ("setAttr " + $node[$n] + ".r "+ $valr[0] + " "+$valr[1]+ " " +$valr[2] + "\;\n");
$vals = `getAttr ($node[$n] + ".s")`;
$script += ("setAttr " + $node[$n] + ".s "+ $vals[0] + " "+$vals[1]+ " " +$vals[2] + "\;\n");
}
else if(`nodeType $node[$n]` == "transform" && `checkBox -q -v UseVisibilityCB`)
{
if(!`checkBox -q -v JointOnlyCB`)
{
$valt = `getAttr ($node[$n] + ".t")`;
$script += ("setAttr " + $node[$n] + ".t "+ $valt[0] + " "+$valt[1]+ " " +$valt[2] + "\;\n");
$valr = `getAttr ($node[$n] + ".r")`;
$script += ("setAttr " + $node[$n] + ".r "+ $valr[0] + " "+$valr[1]+ " " +$valr[2] + "\;\n");
$vals = `getAttr ($node[$n] + ".s")`;
$script += ("setAttr " + $node[$n] + ".s "+ $vals[0] + " "+$vals[1]+ " " +$vals[2] + "\;\n");
}
string $v[] = `listConnections -type animCurveTU $node[$n]`;
if(size($v) >0)
{
$valv = `getAttr ($node[$n] + ".v")`;
$script += ("setAttr " + $node[$n] + ".v "+ $valv + "\;\n");
}
}
else if(`nodeType $node[$n]` == "place2dTexture" && `checkBox -q -v UseUVanimCB`)
{
string $t[] = `listConnections -type animCurveTU $node[$n]`;
if(size($t) >0)
{
$valtv = `getAttr ($node[$n] + ".translateFrameV")`;
$script += ("setAttr " + $node[$n] + ".translateFrameV "+ $valtv + "\;\n");
$valtu = `getAttr ($node[$n] + ".translateFrameU")`;
$script += ("setAttr " + $node[$n] + ".translateFrameU "+ $valtu + "\;\n");
}
}
}
if($mode == 1)
{
textToShelf ($ti, $script);
}
if($mode == 0)
{
string $PExportPath = `pwd`;
int $PFile;
$PFile =`fopen ($PExportPath + "/pose.txt") "w"`;
fprint ($PFile, "//\r\n");
fprint ($PFile, $script);
fclose ($PFile);
}
return ;
}
global proc yjp_PoseCopyPaste()
{
if(`window -q -ex yjp_PoseCopyPaste`)
{
deleteUI yjp_PoseCopyPaste ;
}
window -wh 210 200 -tb 1 -tlb 0 -t "PoseCopyPaste" yjp_PoseCopyPaste ;
columnLayout -w 130;
radioButtonGrp
-nrb 2
-la2 "All" "Select"
-sl 1
-cw2 40 40 PoseCopyRBG;
rowColumnLayout -nc 3;
checkBox -label "JointOnly" -value true JointOnlyCB;
checkBox -label "Visibility" -value true UseVisibilityCB;
checkBox -label "UVanimation" -value true UseUVanimCB;
button -w 80 -h 25 -l "PoseCopyShelf" -c "yjp_PoseCopy 1" ;
button -w 60 -h 25 -l "PoseCopy" -c "yjp_PoseCopy 0";
button -w 60 -h 25 -l "PosePaste" -c "yjp_PosePaste" ;
setParent ..;
showWindow yjp_PoseCopyPaste ;
window -e -wh 230 70 yjp_PoseCopyPaste ;
}
0 件のコメント:
コメントを投稿