完成したyjp_pMatchSwapArrayを使って、VertexSnapを改造
ターゲット頂点群と移動させる頂点群を指定するので距離指定は消しました。
法線方向が似ている近い頂点同士がくっつきます。
法線チェックはオンオフできるようにした。
一定以上離れている頂点は無視しています。
ついでにスナップした頂点同士の法線をアベレージできるようにしました。
今後はスキンクラスタがあれば中間オブジェクトを編集するとか
ウエイトもコピーするとか考え中
global proc do_VertexSnap()
{
string $sel[] = `ls -sl -fl`;
if(size($sel)<2)
{
warning("オブジェクトや頂点を二つ選択してください ");
return ;
}
string $SingleData,$TotalVertex[],$VertexGroup[];
float $x,$y,$z;
//float $AverageValue = `floatField -q -v vsThresholdField`;
int $nmc = `checkBox -q -v vsNormalMatcheCheck`;
int $ntc = `checkBox -q -v vsNormalTuningCheck`;
if(!`gmatch $sel[0] "*.vtx*"`)
{
for($SingleData in $sel)
{
if(`checkBox -q -v vsBoEdgeCheck`)
{
select $SingleData;
polySelectConstraint -t 0x0001 -w 1 -bo 1 -m 3;
$VertexGroup = `ls -sl -fl`;
$TotalVertex = stringArrayCatenate ($TotalVertex,$VertexGroup);
}
else
{
$VertexGroup = `ls -fl ($SingleData + ".vtx[*]")`;
$TotalVertex = stringArrayCatenate ($TotalVertex,$VertexGroup);
}
}
resetPolySelectConstraint;
}
else
{
$TotalVertex = $sel;
}
string $buffer[],$Vertex[],$VertexGroupA[],$VertexGroupB[],$VertexGroupC[],$VertexGroupD[];
tokenize $TotalVertex[size($TotalVertex)-1] "." $buffer;
int $n;
float $v[],$t[];
for ($n=0;$n<size($TotalVertex);$n++)
{
//print ("TotalVertex " + $TotalVertex[$n] +"\n");
tokenize $TotalVertex[$n] "." $Vertex;
if($buffer[0] == $Vertex[0])
{
//print ("GroupA " + $TotalVertex[$n] +"\n");
$VertexGroupA[size($VertexGroupA)] = $TotalVertex[$n];
}
else
{
//print ("GroupB " + $TotalVertex[$n] +"\n");
$VertexGroupB[size($VertexGroupB)] = $TotalVertex[$n];
}
}
$VertexGroupC = `yjp_pMatchSwapArray $VertexGroupA $VertexGroupB 1 0 $nmc`;
for($n=0;$n<size($VertexGroupB);$n++)
{
if(!`objExists $VertexGroupC[$n]`)
{
continue;
}
//print ("GroupB " +$VertexGroupB[$n]);
$t = `pointPosition $VertexGroupB[$n]`;
//print (" " + $t[0] + $t[1] + $t[2] +"\n");
//print ("GroupC " +$VertexGroupC[$n]);
$v = `pointPosition $VertexGroupC[$n]`;
//print ("GroupC " + $v[0] + $v[1] + $v[2] +"\n");
$VertexGroupD[size($VertexGroupD)] = $VertexGroupB[$n];
$VertexGroupD[size($VertexGroupD)] = $VertexGroupC[$n];
if(`checkBox -q -v vsAverageCheck`)
{
$x = ($v[0] + $t[0]) / 2 ;
$y = ($v[1] + $t[1]) / 2 ;
$z = ($v[2] + $t[2]) / 2 ;
move -a -wd $x $y $z $VertexGroupB[$n];
move -a -wd $x $y $z $VertexGroupC[$n];
}
else
{
move -a -wd $v[0] $v[1] $v[2] $VertexGroupB[$n];
}
}
if($ntc)
{
select -r $VertexGroupD;
if(size(`ls -sl`)>0)
{
print ("NormalTuning" +"\n");
polyAverageNormal;
}
}
}
global proc yjp_VertexSnap()
{
if(`window -q -ex yjp_VertexSnapwin`)
{
deleteUI yjp_VertexSnapwin ;
}
window -wh 140 120 -tb 1 -tlb 0 -t "VertexSnap1.1" yjp_VertexSnapwin ;
columnLayout -w 130;
checkBox -l "NormalMatche" -ann "法線が似ている頂点をスナップ" -v 1 vsNormalMatcheCheck;
checkBox -l "SnapAverage" -ann "二点の中間でスナップ"-v 1 vsAverageCheck;
checkBox -l "BorderEdge" -ann "ボーダーエッジのみスナップ" -v 1 vsBoEdgeCheck;
checkBox -l "NormalTuning" -ann "スナップした法線の同調" -v 1 vsNormalTuningCheck;
//floatField -w 95 -h 22 -v 0.1 vsThresholdField;
button -w 130 -h 25 -l "Apply" -ann "最後に選択したオブジェクトや頂点にスナップ" -c do_VertexSnap ;
button -w 130 -h 25 -l "Close" -c ("deleteUI -window yjp_VertexSnapwin") ;
setParent..;
showWindow yjp_VertexSnapwin ;
window -e -wh 140 120 yjp_VertexSnapwin ;
}
2014年12月25日木曜日
2014年12月22日月曜日
頂点群と頂点群の配列を合わせる
やっといい感じになった。
頂点の距離が近い、法線が似ている頂点が取得できたと思う
配列順が同じなのでいろんなMELで使いやすい。
左右反転も考慮しています。
スナップやシンメトリに使えると思う。
しきい値入力の必要が無いのもいいかと。
//yjp_pMatchPointArray(Aメッシュの頂点配列,Bメッシュ頂点配列)
//Aメッシュの頂点リストとBメッシュの頂点リストを比べて
//Aメッシュの頂点リストと同じ座標の頂点をBメッシュから探して
//Aメッシュの頂点配列と同じ順にする
proc vector yjp_positionVector(string $node,int $Invers)
{
float $pos[];
int $i[];
if ($Invers == 0){$i[0] = -1;$i[1] = 1;$i[2] = 1;}
if ($Invers == 1){$i[0] = 1;$i[1] = 1;$i[2] = 1;}
if ($Invers == 2){$i[0] = 1;$i[1] = -1;$i[2] = 1;}
if ($Invers == 3){$i[0] = 1;$i[1] = 1;$i[2] = -1;}
$pos = `pointPosition $node`;
vector $vec = <<($pos[0] * $i[0]),($pos[1] * $i[1]),($pos[2] * $i[2])>>;
return $vec;
}
proc int yjp_pMatchSwapArrayAC(float $VecAngle , int $on)
{
int $c = 0;
if($on == 1)
{
if($VecAngle < 45)
{
$c = 1;
}
}
else if($on == 0)
{
$c = 1;
}
return $c;
}
global proc string[] yjp_pMatchSwapArray(string $PointGroupA[], string $PointGroupB[],int $x,int $Overlap,int $normal)
{
//$PointGroupAターゲット
//$PointGroupB処理させたい頂点
//$x 左右反転
//$Overlap 配列順を変える$PointGroupAがPointGroupBより多い場合頂点が重複してもOK
//
int $n,$m,$linknum, $index_n,$Inversindex;
string $Point[],$usePoint[];
vector $xyzA,$xyzB,$xyzC;
vector $PointGroupBVec;
vector $PointGroupAVec;
float $posA[3],$posB[3];
float $dis;
float $Length[],$Lengthsort[];
float $Average;
float $InversLength[],$InversLengthsort[];
float $VecAngle;
int $amount = 0;
float $startTime = `timerX`;
progressWindow
-t "Compare vertex ..."
-pr $amount
-st "Search: ..."
-ii 0;
//頂点と頂点が一番近い頂点の組み合わせ
////頂点が近い場合でも違う場合がある
////法線の角度が45度以内であれば似ている頂点とする
////
clear $Point;
clear $usePoint;
for ($n=0;$n<size($PointGroupB);$n++)
{
clear $Length;
clear $Lengthsort;
clear $InversLength;
clear $InversLengthsort;
//隣接する頂点の座標(未使用)
//$posAlink = `yjp_PointConnectedPosVector $PointGroupB[$n] $x`;
$xyzA = `yjp_positionVector $PointGroupB[$n] $x`;
//法線
$PointGroupBVec = `yjp_VertexAverageVector $PointGroupB[$n]`;
$PointGroupBVec = <<($PointGroupBVec.x*$x),($PointGroupBVec.y),($PointGroupBVec.z)>>;
//print ("PointGroupB " + $PointGroupB[$n] +"\n");
for ($m=0;$m<size($PointGroupA);$m++)
{
$xyzB = `yjp_positionVector $PointGroupA[$m] 1`;
$dis = abs(mag($xyzA-$xyzB));
$Length[$m] = $dis;
$Average += $Length[$m];
//print ($PointGroupA[$m] + " dis "+$dis +"\n");
}
$Average = $Average/size($PointGroupA)*1.5;
//print ("LengthAverage " + $Average +"\n");
//$PointGroupAの最小距離でソート
$Lengthsort = `sort $Length`;
//string $up;
//for($up in $Lengthsort){print ($up +"\n");}
int $num = size($Lengthsort);
if($num > 32)
{
$num = 8;
}
for ($m=0;$m<$num;$m++)
{
$index_n = `floatArrayFind $Lengthsort[$m] 0 $Length`;
$xyzB = `yjp_positionVector $PointGroupA[$index_n] 1`;
//print ("Length " + $Lengthsort[$m] + " " + $PointGroupA[$index_n] +"\n");
$PointGroupAVec = `yjp_VertexAverageVector $PointGroupA[$index_n]`;
$PointGroupAVec = <<($PointGroupAVec.x*$x),($PointGroupAVec.y),($PointGroupAVec.z)>>;
$VecAngle = rad_to_deg(`angle $PointGroupAVec $PointGroupBVec`);
//print ($PointGroupA[$index_n] + " Angle " + $VecAngle + "\n");
if(stringArrayCount($PointGroupA[$index_n],$usePoint) > 0 && $Overlap == 0)
{
$Point[$amount] = "none";
//print ("use " +$PointGroupA[$index_n] +"\n");
continue;
}
$dis = abs(mag($xyzA-$xyzB));
//print ("kyori " + $dis +"\n");
if($Average < $dis)
{
$Point[$amount] = "none";
//print ("Long " +$PointGroupA[$index_n] +"\n");
continue;
}
else if(`yjp_pMatchSwapArrayAC $VecAngle $normal`)
{
if($Overlap == 1)
{
$Point[$amount] = $PointGroupA[$index_n];
break;
}
//法線を比較して45度以内かチェック
for ($linknum=0;$linknum<size($PointGroupB);$linknum++)
{
$xyzC = `yjp_positionVector $PointGroupB[$linknum] $x`;
$dis = abs(mag($xyzB-$xyzC));
$InversLength[$linknum] = $dis;
}
$InversLengthsort = `sort $InversLength`;
$Inversindex = `floatArrayFind $InversLengthsort[0] 0 $InversLength`;
//print ("InversCheck " + $PointGroupB[$n] + " "+ $PointGroupB[$Inversindex] +"\n");
if($PointGroupB[$n] == $PointGroupB[$Inversindex])
{
//print ("OK " +"\n");
$Point[$amount] = $PointGroupA[$index_n];
$usePoint[size($usePoint)] = $PointGroupA[$index_n];
break;
}
else
{
$Point[$amount] ="none";
}
}
}
print ("PointGroupB " + $PointGroupB[$n] + " PointGroupA " + $Point[$amount] +"\n\n");
$amount += 1;
progressWindow -edit -max (size($PointGroupB)) -pr $amount -st ("Compare vertex: " + $PointGroupB[$n]);
}
progressWindow -ep;
float $totalTime = `timerX -startTime $startTime`;
print("Execution time: " + $totalTime + " seconds.\n");
clear $usePoint;
clear $Length;
clear $Lengthsort;
clear $InversLength;
clear $InversLengthsort;
return ($Point);
}
頂点の距離が近い、法線が似ている頂点が取得できたと思う
配列順が同じなのでいろんなMELで使いやすい。
左右反転も考慮しています。
スナップやシンメトリに使えると思う。
しきい値入力の必要が無いのもいいかと。
//yjp_pMatchPointArray(Aメッシュの頂点配列,Bメッシュ頂点配列)
//Aメッシュの頂点リストとBメッシュの頂点リストを比べて
//Aメッシュの頂点リストと同じ座標の頂点をBメッシュから探して
//Aメッシュの頂点配列と同じ順にする
proc vector yjp_positionVector(string $node,int $Invers)
{
float $pos[];
int $i[];
if ($Invers == 0){$i[0] = -1;$i[1] = 1;$i[2] = 1;}
if ($Invers == 1){$i[0] = 1;$i[1] = 1;$i[2] = 1;}
if ($Invers == 2){$i[0] = 1;$i[1] = -1;$i[2] = 1;}
if ($Invers == 3){$i[0] = 1;$i[1] = 1;$i[2] = -1;}
$pos = `pointPosition $node`;
vector $vec = <<($pos[0] * $i[0]),($pos[1] * $i[1]),($pos[2] * $i[2])>>;
return $vec;
}
proc int yjp_pMatchSwapArrayAC(float $VecAngle , int $on)
{
int $c = 0;
if($on == 1)
{
if($VecAngle < 45)
{
$c = 1;
}
}
else if($on == 0)
{
$c = 1;
}
return $c;
}
global proc string[] yjp_pMatchSwapArray(string $PointGroupA[], string $PointGroupB[],int $x,int $Overlap,int $normal)
{
//$PointGroupAターゲット
//$PointGroupB処理させたい頂点
//$x 左右反転
//$Overlap 配列順を変える$PointGroupAがPointGroupBより多い場合頂点が重複してもOK
//
int $n,$m,$linknum, $index_n,$Inversindex;
string $Point[],$usePoint[];
vector $xyzA,$xyzB,$xyzC;
vector $PointGroupBVec;
vector $PointGroupAVec;
float $posA[3],$posB[3];
float $dis;
float $Length[],$Lengthsort[];
float $Average;
float $InversLength[],$InversLengthsort[];
float $VecAngle;
int $amount = 0;
float $startTime = `timerX`;
progressWindow
-t "Compare vertex ..."
-pr $amount
-st "Search: ..."
-ii 0;
//頂点と頂点が一番近い頂点の組み合わせ
////頂点が近い場合でも違う場合がある
////法線の角度が45度以内であれば似ている頂点とする
////
clear $Point;
clear $usePoint;
for ($n=0;$n<size($PointGroupB);$n++)
{
clear $Length;
clear $Lengthsort;
clear $InversLength;
clear $InversLengthsort;
//隣接する頂点の座標(未使用)
//$posAlink = `yjp_PointConnectedPosVector $PointGroupB[$n] $x`;
$xyzA = `yjp_positionVector $PointGroupB[$n] $x`;
//法線
$PointGroupBVec = `yjp_VertexAverageVector $PointGroupB[$n]`;
$PointGroupBVec = <<($PointGroupBVec.x*$x),($PointGroupBVec.y),($PointGroupBVec.z)>>;
//print ("PointGroupB " + $PointGroupB[$n] +"\n");
for ($m=0;$m<size($PointGroupA);$m++)
{
$xyzB = `yjp_positionVector $PointGroupA[$m] 1`;
$dis = abs(mag($xyzA-$xyzB));
$Length[$m] = $dis;
$Average += $Length[$m];
//print ($PointGroupA[$m] + " dis "+$dis +"\n");
}
$Average = $Average/size($PointGroupA)*1.5;
//print ("LengthAverage " + $Average +"\n");
//$PointGroupAの最小距離でソート
$Lengthsort = `sort $Length`;
//string $up;
//for($up in $Lengthsort){print ($up +"\n");}
int $num = size($Lengthsort);
if($num > 32)
{
$num = 8;
}
for ($m=0;$m<$num;$m++)
{
$index_n = `floatArrayFind $Lengthsort[$m] 0 $Length`;
$xyzB = `yjp_positionVector $PointGroupA[$index_n] 1`;
//print ("Length " + $Lengthsort[$m] + " " + $PointGroupA[$index_n] +"\n");
$PointGroupAVec = `yjp_VertexAverageVector $PointGroupA[$index_n]`;
$PointGroupAVec = <<($PointGroupAVec.x*$x),($PointGroupAVec.y),($PointGroupAVec.z)>>;
$VecAngle = rad_to_deg(`angle $PointGroupAVec $PointGroupBVec`);
//print ($PointGroupA[$index_n] + " Angle " + $VecAngle + "\n");
if(stringArrayCount($PointGroupA[$index_n],$usePoint) > 0 && $Overlap == 0)
{
$Point[$amount] = "none";
//print ("use " +$PointGroupA[$index_n] +"\n");
continue;
}
$dis = abs(mag($xyzA-$xyzB));
//print ("kyori " + $dis +"\n");
if($Average < $dis)
{
$Point[$amount] = "none";
//print ("Long " +$PointGroupA[$index_n] +"\n");
continue;
}
else if(`yjp_pMatchSwapArrayAC $VecAngle $normal`)
{
if($Overlap == 1)
{
$Point[$amount] = $PointGroupA[$index_n];
break;
}
//法線を比較して45度以内かチェック
for ($linknum=0;$linknum<size($PointGroupB);$linknum++)
{
$xyzC = `yjp_positionVector $PointGroupB[$linknum] $x`;
$dis = abs(mag($xyzB-$xyzC));
$InversLength[$linknum] = $dis;
}
$InversLengthsort = `sort $InversLength`;
$Inversindex = `floatArrayFind $InversLengthsort[0] 0 $InversLength`;
//print ("InversCheck " + $PointGroupB[$n] + " "+ $PointGroupB[$Inversindex] +"\n");
if($PointGroupB[$n] == $PointGroupB[$Inversindex])
{
//print ("OK " +"\n");
$Point[$amount] = $PointGroupA[$index_n];
$usePoint[size($usePoint)] = $PointGroupA[$index_n];
break;
}
else
{
$Point[$amount] ="none";
}
}
}
print ("PointGroupB " + $PointGroupB[$n] + " PointGroupA " + $Point[$amount] +"\n\n");
$amount += 1;
progressWindow -edit -max (size($PointGroupB)) -pr $amount -st ("Compare vertex: " + $PointGroupB[$n]);
}
progressWindow -ep;
float $totalTime = `timerX -startTime $startTime`;
print("Execution time: " + $totalTime + " seconds.\n");
clear $usePoint;
clear $Length;
clear $Lengthsort;
clear $InversLength;
clear $InversLengthsort;
return ($Point);
}
2014年12月20日土曜日
polyCompare
ポリゴンのトポロジーを比較する処理ってどうすればいいのやらとググッてみた。
なにこの便利そうなコマンド
明日調べる。
残念。トポロジーがまったく同じものしかダメなのか。
polyCompare
2 つのポリゴン ジオメトリ オブジェクトを比較します
ってなにこの便利そうなコマンド
明日調べる。
残念。トポロジーがまったく同じものしかダメなのか。
2014年12月19日金曜日
次は何を作ろうか
頂点同士の関係が似ているものを探すMELに苦戦している。
他に何かあれば便利な事はないか。
今思いついてるのは3Dペイントが微妙なので
影だけ、ハイライトだけ、各要素を白黒ペイントだけして
フォトショップに持っていき、マスクにする手法を試みています。
UVを見ながらPSで描くよりは早い気がしている。
オブジェを複製して別マテリアルを適用し、ペイントできる準備をするMELとかどうだろう。
さらにマスクにペーストできるとイイのになー。
PSで描くのが効率悪い気がするので、3Dペイントソフトを探してみると
Substance Painterが安かったので早速購入。
2014年12月18日木曜日
メモ
昨日はAdSenseから除外されたと言う報告を受けた。
もう二度と参加できないんですね。
何もしてないのにね。
そんなにアクセスもないというのに
なんだか気分の悪いサービスですね。
でも普通に更新は続けようと思います。
AdSense広告はいったん消します。
もう二度と参加できないんですね。
何もしてないのにね。
そんなにアクセスもないというのに
なんだか気分の悪いサービスですね。
でも普通に更新は続けようと思います。
AdSense広告はいったん消します。
2014年12月13日土曜日
2014年12月11日木曜日
中間オブジェクトを編集するウインドウ
14/12/16更新
二重起動をしないようにしました。
アンドゥのしすぎてもウインドウが消せるようにしました。
14/12/15更新
メンバーセットが増え続ける状態だったので修正
バインドされたオブジェクトを微調整したいなーと。
中間オブジェクトをいじろうとして、重なって見にくいとか。
いろいろ面倒だったので作ってみた。
複数選択対応してます。
選択して実行すると右ウインドウに中間オブジェクト
左ウインドウはジョイントルートを移動させたメッシュが表示されます。
動きを見ながら頂点を調整する時に楽です。
閉じるボタンで中間オブジェクトが非表示になります。
global proc yjp_constructionHide()
{
global string $yjp_constructionSel[];
global string $yjp_constructionSellayer[];
global string $yjp_constructionPname;
global string $yjp_constructionPanel;
global float $yjp_constructionPposY;
global float $yjp_constructionTime;
currentTime $yjp_constructionTime;
int$n;
for ($n=0;$n<size($yjp_constructionSel);$n++)
{
select -r $yjp_constructionSel[$n];
print ($yjp_constructionSel[$n]+" " +$yjp_constructionSellayer[$n]+"\n");
editDisplayLayerMembers -noRecurse $yjp_constructionSellayer[$n] $yjp_constructionSel[$n];
HideIntermediateObjects;
}
isolateSelect -state 0 $yjp_constructionPanel;
if(`objExists "construction_layer"`)delete "construction_layer";
if(`objExists "tempview_layer"`)delete "tempview_layer";
if(`objExists "const_workcam"`)delete "const_workcam" ;
if(`objExists "const_viewcam"`)delete "const_viewcam";
setAttr ($yjp_constructionPname + ".ty") $yjp_constructionPposY;
clear $yjp_constructionSel;
clear $yjp_constructionSellayer;
}
global proc yjp_constructionPosChange()
{
global string $yjp_constructionPname;
global float $yjp_constructionPposY;
float $asf = `getAttr ($yjp_constructionPname + ".ty")`;
if($asf == $yjp_constructionPposY)
{
setAttr ($yjp_constructionPname + ".ty") 150;
}
else
{
setAttr ($yjp_constructionPname + ".ty") $yjp_constructionPposY;
}
}
global proc yjp_Construction()
{
global string $yjp_constructionSel[];
global string $yjp_constructionSellayer[];
global string $yjp_constructionPname;
global string $yjp_constructionPanel;
global float $yjp_constructionPposY;
global float $yjp_constructionTime;
if(size($yjp_constructionSel) != 0)
{
warning ;
print ("Constructionが起動しています"+ "\n") ;
return;
}
$yjp_constructionSel = `ls -sl`;
if (size($yjp_constructionSel) == 0)
{
warning ;
print ("バインドされたオブジェを選択してください"+ "\n") ;
return;
}
$yjp_constructionTime = `currentTime -q`;
if((`window -ex yjp_IntermediateEeditPanel`)==true)
{
yjp_constructionHide;
deleteUI yjp_IntermediateEeditPanel;
}
string $sel,$pobj[],$layer[],$io[];
//レイヤーチェック
int $n;
select -cl ;
createDisplayLayer -name "tempview_layer" -number 1 -nr;
setAttr "tempview_layer.displayType" 2;
for ($n=0;$n<size($yjp_constructionSel);$n++)
{
$io = stringArrayRemove(`listRelatives -s -ni $yjp_constructionSel`,`listRelatives -s $yjp_constructionSel`);
if(size($io) == 0)
{
stringArrayRemoveAtIndex($n, $yjp_constructionSel);
}
}
if(size($yjp_constructionSel) == 0)
{
print ("中間オブジェクトがあるオブジェクトを選択してください"+ "\n"); error;
}
for ($n=0;$n<size($yjp_constructionSel);$n++)
{
$sc = `findRelatedSkinCluster $yjp_constructionSel[$n]`;
if(size($sc) == 0)
{
stringArrayRemoveAtIndex($n, $yjp_constructionSel);
continue ;
}
$jointlistname = `listConnections -type "joint" ($sc +".matrix")`;
$yjp_constructionPname = `rootOf $jointlistname[0]`;
$layer = `listConnections -s on -t "displayLayer" $yjp_constructionSel[$n]`;
if(`objExists $layer[0]`)
{
$yjp_constructionSellayer[$n] = $layer[0];
}
else
{
$yjp_constructionSellayer[$n] = "defaultLayer";
}
editDisplayLayerMembers -noRecurse "tempview_layer" $yjp_constructionSel[$n];
}
$yjp_constructionPposY = `getAttr ($yjp_constructionPname + ".ty")`;
setAttr ($yjp_constructionPname + ".ty") 150;
duplicate -rr -n "const_workcam" persp;
duplicate -rr -n "const_viewcam" persp;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
window -w 840 -h 500 -t "construction" -tbm 0 yjp_IntermediateEeditPanel;
paneLayout -w 200 -h 200 -cn "quad" yjp_ConstPaneLayout;
string $viewPanel = `modelPanel -mbv 1 -cam "const_viewcam"`;
setParent ..;
string $yjp_constructionPanel = `modelPanel -cam "const_workcam"`;
setParent ..;
paneLayout -e -ps 2 50 98 -sp $yjp_constructionPanel 2 yjp_ConstPaneLayout;
paneLayout -e -ps 1 50 98 -sp $viewPanel 1 yjp_ConstPaneLayout;
modelEditor -e -parent yjp_ConstPaneLayout -da "smoothShaded" -displayTextures on-dl "none" -sel 0 -j 0 -m 0 -lc 0 -ha 0 $viewPanel;
modelEditor -e -parent yjp_ConstPaneLayout -da "smoothShaded" -displayTextures on-dl "none" $yjp_constructionPanel;
button -w 200 -h 30 -l "Position change" -c ("yjp_constructionPosChange;");
button -w 200 -h 30 -l "Close" -c ("yjp_constructionHide;deleteUI yjp_IntermediateEeditPanel;");
setParent ..;
showWindow;
select $yjp_constructionSel ;
viewFit "const_viewcam";
DisplayIntermediateObjects;
if(!`objExists construction_layer`)
{
createDisplayLayer -name "construction_layer" -number 1 -nr;
}
editDisplayLayerMembers -noRecurse construction_layer (`ls -sl`);
viewFit "const_workcam";
isolateSelect -state 1 $yjp_constructionPanel;
}
二重起動をしないようにしました。
アンドゥのしすぎてもウインドウが消せるようにしました。
14/12/15更新
メンバーセットが増え続ける状態だったので修正
バインドされたオブジェクトを微調整したいなーと。
中間オブジェクトをいじろうとして、重なって見にくいとか。
いろいろ面倒だったので作ってみた。
複数選択対応してます。
選択して実行すると右ウインドウに中間オブジェクト
左ウインドウはジョイントルートを移動させたメッシュが表示されます。
動きを見ながら頂点を調整する時に楽です。
閉じるボタンで中間オブジェクトが非表示になります。
global proc yjp_constructionHide()
{
global string $yjp_constructionSel[];
global string $yjp_constructionSellayer[];
global string $yjp_constructionPname;
global string $yjp_constructionPanel;
global float $yjp_constructionPposY;
global float $yjp_constructionTime;
currentTime $yjp_constructionTime;
int$n;
for ($n=0;$n<size($yjp_constructionSel);$n++)
{
select -r $yjp_constructionSel[$n];
print ($yjp_constructionSel[$n]+" " +$yjp_constructionSellayer[$n]+"\n");
editDisplayLayerMembers -noRecurse $yjp_constructionSellayer[$n] $yjp_constructionSel[$n];
HideIntermediateObjects;
}
isolateSelect -state 0 $yjp_constructionPanel;
if(`objExists "construction_layer"`)delete "construction_layer";
if(`objExists "tempview_layer"`)delete "tempview_layer";
if(`objExists "const_workcam"`)delete "const_workcam" ;
if(`objExists "const_viewcam"`)delete "const_viewcam";
setAttr ($yjp_constructionPname + ".ty") $yjp_constructionPposY;
clear $yjp_constructionSel;
clear $yjp_constructionSellayer;
}
global proc yjp_constructionPosChange()
{
global string $yjp_constructionPname;
global float $yjp_constructionPposY;
float $asf = `getAttr ($yjp_constructionPname + ".ty")`;
if($asf == $yjp_constructionPposY)
{
setAttr ($yjp_constructionPname + ".ty") 150;
}
else
{
setAttr ($yjp_constructionPname + ".ty") $yjp_constructionPposY;
}
}
global proc yjp_Construction()
{
global string $yjp_constructionSel[];
global string $yjp_constructionSellayer[];
global string $yjp_constructionPname;
global string $yjp_constructionPanel;
global float $yjp_constructionPposY;
global float $yjp_constructionTime;
if(size($yjp_constructionSel) != 0)
{
warning ;
print ("Constructionが起動しています"+ "\n") ;
return;
}
$yjp_constructionSel = `ls -sl`;
if (size($yjp_constructionSel) == 0)
{
warning ;
print ("バインドされたオブジェを選択してください"+ "\n") ;
return;
}
$yjp_constructionTime = `currentTime -q`;
if((`window -ex yjp_IntermediateEeditPanel`)==true)
{
yjp_constructionHide;
deleteUI yjp_IntermediateEeditPanel;
}
string $sel,$pobj[],$layer[],$io[];
//レイヤーチェック
int $n;
select -cl ;
createDisplayLayer -name "tempview_layer" -number 1 -nr;
setAttr "tempview_layer.displayType" 2;
for ($n=0;$n<size($yjp_constructionSel);$n++)
{
$io = stringArrayRemove(`listRelatives -s -ni $yjp_constructionSel`,`listRelatives -s $yjp_constructionSel`);
if(size($io) == 0)
{
stringArrayRemoveAtIndex($n, $yjp_constructionSel);
}
}
if(size($yjp_constructionSel) == 0)
{
print ("中間オブジェクトがあるオブジェクトを選択してください"+ "\n"); error;
}
for ($n=0;$n<size($yjp_constructionSel);$n++)
{
$sc = `findRelatedSkinCluster $yjp_constructionSel[$n]`;
if(size($sc) == 0)
{
stringArrayRemoveAtIndex($n, $yjp_constructionSel);
continue ;
}
$jointlistname = `listConnections -type "joint" ($sc +".matrix")`;
$yjp_constructionPname = `rootOf $jointlistname[0]`;
$layer = `listConnections -s on -t "displayLayer" $yjp_constructionSel[$n]`;
if(`objExists $layer[0]`)
{
$yjp_constructionSellayer[$n] = $layer[0];
}
else
{
$yjp_constructionSellayer[$n] = "defaultLayer";
}
editDisplayLayerMembers -noRecurse "tempview_layer" $yjp_constructionSel[$n];
}
$yjp_constructionPposY = `getAttr ($yjp_constructionPname + ".ty")`;
setAttr ($yjp_constructionPname + ".ty") 150;
duplicate -rr -n "const_workcam" persp;
duplicate -rr -n "const_viewcam" persp;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
window -w 840 -h 500 -t "construction" -tbm 0 yjp_IntermediateEeditPanel;
paneLayout -w 200 -h 200 -cn "quad" yjp_ConstPaneLayout;
string $viewPanel = `modelPanel -mbv 1 -cam "const_viewcam"`;
setParent ..;
string $yjp_constructionPanel = `modelPanel -cam "const_workcam"`;
setParent ..;
paneLayout -e -ps 2 50 98 -sp $yjp_constructionPanel 2 yjp_ConstPaneLayout;
paneLayout -e -ps 1 50 98 -sp $viewPanel 1 yjp_ConstPaneLayout;
modelEditor -e -parent yjp_ConstPaneLayout -da "smoothShaded" -displayTextures on-dl "none" -sel 0 -j 0 -m 0 -lc 0 -ha 0 $viewPanel;
modelEditor -e -parent yjp_ConstPaneLayout -da "smoothShaded" -displayTextures on-dl "none" $yjp_constructionPanel;
button -w 200 -h 30 -l "Position change" -c ("yjp_constructionPosChange;");
button -w 200 -h 30 -l "Close" -c ("yjp_constructionHide;deleteUI yjp_IntermediateEeditPanel;");
setParent ..;
showWindow;
select $yjp_constructionSel ;
viewFit "const_viewcam";
DisplayIntermediateObjects;
if(!`objExists construction_layer`)
{
createDisplayLayer -name "construction_layer" -number 1 -nr;
}
editDisplayLayerMembers -noRecurse construction_layer (`ls -sl`);
viewFit "const_workcam";
isolateSelect -state 1 $yjp_constructionPanel;
}
2014年12月10日水曜日
中間オブジェクトだけ表示するライトを使わないビュー
とりあえずメモ
もう少し改造します。
中間オブジェクトを別レイヤーにいれたり
デフォームメッシュは触れないようにしたり
重なって見えないのでデフォームのジョイントルートをずらしたり
編集が終わったら中間オブジェクトを非表示にして初期位置にもどしたり
考え中
window -w 500-h 500; paneLayout;
string $currentPanel = `modelPanel`;
showWindow;
modelEditor -edit -da "smoothShaded" -displayTextures on-dl "none" $currentPanel;
DisplayIntermediateObjects;
isolateSelect -state 1 $currentPanel;
もう少し改造します。
中間オブジェクトを別レイヤーにいれたり
デフォームメッシュは触れないようにしたり
重なって見えないのでデフォームのジョイントルートをずらしたり
編集が終わったら中間オブジェクトを非表示にして初期位置にもどしたり
考え中
window -w 500-h 500; paneLayout;
string $currentPanel = `modelPanel`;
showWindow;
modelEditor -edit -da "smoothShaded" -displayTextures on-dl "none" $currentPanel;
DisplayIntermediateObjects;
isolateSelect -state 1 $currentPanel;
登録:
コメント (Atom)