2007年04月04日

選択されているオブジェクトの親を選択する

//[MEL] 選択されているオブジェクトの親を選択する
{
 string $sels[] = `ls -sl`;
 string $parents[];
 
 select -cl;
 
 for( $s in $sels ){
  $parent = `listRelatives -p $s`;
  select -add $parent[0];
 }
}

posted by toka at 23:55| Comment(0) | TrackBack(1) | MEL | このブログの読者になる | 更新情報をチェックする

UV列挙サンプル

//[MEL] UV列挙サンプル
proc getTexturingCoords( string $mesh )
{
 // get number of uvs on the mesh
 int $uvCount[] = `polyEvaluate -uv $mesh`;

 // write the number of UV coords
 print( "numTexCoords=" + $uvCount[0] + "\n" );

 // add each uv coord to the string also
 for( $i=0;$i<$uvCount[0];$i++)
 {
  // get the uv coord
  float $uvs[] = `getAttr ($mesh + ".uv[" +$i+"]")`;

  // print it's value
  print( $uvs[0] + " " + $uvs[1] + "\n" );
  
  if( 1.0 < $uvs[0] || 0.0 > $uvs[0] || 1.0 < $uvs[1] || 0.0 > $uvs[1] ){
   select -r ($mesh + ".map[" + $i + "]");
  }
 }
}
string $tmp[] = `ls -sl`;
select -clear;
getTexturingCoords($tmp[0]);

posted by toka at 23:44| Comment(0) | TrackBack(0) | MEL | このブログの読者になる | 更新情報をチェックする

メッシュ頂点の位置を列挙するサンプル

// [MEL] メッシュ頂点の位置を列挙するサンプル
{
 string $selected[] = `ls -sl`;
 string $obj = $selected[0];

 float $pos[];
 int $nVerts[] = `polyEvaluate -v $obj`;
 int $nVert = $nVerts[0];
 int $i, $j;

 for( $i=0; $i<$nVert; $i++){
  $pos = `pointPosition -local ($obj + ".vtx[" + $i + "]")`;
  print ("< " + $pos[0] + ", " + $pos[1] + ", " + $pos[2] + " >\n");
 }


 int $nFaces[] = `polyEvaluate -f $obj`;
 int $nFace = $nFaces[0];
 string $face[];
 string $buf[];

 for( $i=0; $i<$nFace; $i++){
  $face =  `polyInfo -fv ($obj + ".f[" + $i + "]")`;
  $face[0] = `substitute "\n$" $face[0] ""`;
  tokenize $face[0] " " $buf;
  for( $j=2; $j<size($buf); $j++){
   print ($buf[$j] + " ");
  }
  print "\n";
 }
}

 

posted by toka at 23:43| Comment(0) | TrackBack(0) | MEL | このブログの読者になる | 更新情報をチェックする

広告


この広告は60日以上更新がないブログに表示がされております。

以下のいずれかの方法で非表示にすることが可能です。

・記事の投稿、編集をおこなう
・マイブログの【設定】 > 【広告設定】 より、「60日間更新が無い場合」 の 「広告を表示しない」にチェックを入れて保存する。


×

この広告は90日以上新しい記事の投稿がないブログに表示されております。