Guest User

Untitled

a guest
Jun 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. /*
  2. 選択したキーの内、変化の無いキーだけを選択維持する
  3. シーン内のアニメーションカーブを全選択
  4. select `ls -typ animCurve`;
  5. size `ls -sl`;
  6. */
  7.  
  8.  
  9. proc SelectStaticKey_Exec(){
  10.  
  11. // 選択したキーフレームのアニメーションカーブ名まずは配列で取得
  12. string $animCrvNames[] = `keyframe -q -name`;
  13.  
  14.  
  15. int $deleteAnimCrvCount = `size($animCrvNames)`;
  16.  
  17.  
  18. for( $animCrvName in $animCrvNames ){
  19. // カーブ内のすべてのキーフレームの値を配列で取得し・・・
  20. float $keys[] = `keyframe -q -valueChange $animCrvName`;
  21.  
  22. // 比較して、値に変化があるアニメーションカーブを選択解除
  23. // キーが1つしか無いものも変化の無いキーと言えますね
  24. for( $key in $keys ){
  25.  
  26. if( $keys[0] != $key){
  27. selectKey -rm $animCrvName;
  28. $deleteAnimCrvCount--;
  29. break;
  30. }
  31. }
  32. }
  33.  
  34. print ($deleteAnimCrvCount + " / " + `size($animCrvNames)` + " 個の AnimCurve は値に変化がありません");
  35.  
  36. }
  37.  
  38. proc SelectStaticKey(){
  39. string $window = "SelectStaticKey";
  40.  
  41. if(`window -exists $window`) deleteUI $window;
  42.  
  43. window -title $window -width 300 -toolbox true $window;
  44.  
  45. columnLayout -columnAttach "both" 5 -rowSpacing 10 -columnWidth 250;
  46.  
  47. frameLayout -label "使い方" -cl true -cll true -bgc 0 0 0;
  48. text -l "グラフエディタで多くのキーを選択して実行。";
  49. text -l "キーの値の変化がないカーブだけが選択される。";
  50. text -l "これは、不要なキーを削減するのに役立つ。";
  51. setParent ..;
  52.  
  53. //floatSliderGrp -l "しきい値" -field true -adj 1 -min 0 -max 0.1 -precision 3 -value 0.01 "ReductKeySample";
  54. button -l "Select ( ^ _ ^ )" -command "SelectStaticKey_Exec" -ann "選択したキーの内、変化の無いキーだけを選択維持する";
  55.  
  56.  
  57. showWindow $window;
  58. }
  59.  
  60.  
  61. SelectStaticKey();
Add Comment
Please, Sign In to add comment