Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 選択したキーの内、変化の無いキーだけを選択維持する
- シーン内のアニメーションカーブを全選択
- select `ls -typ animCurve`;
- size `ls -sl`;
- */
- proc SelectStaticKey_Exec(){
- // 選択したキーフレームのアニメーションカーブ名まずは配列で取得
- string $animCrvNames[] = `keyframe -q -name`;
- int $deleteAnimCrvCount = `size($animCrvNames)`;
- for( $animCrvName in $animCrvNames ){
- // カーブ内のすべてのキーフレームの値を配列で取得し・・・
- float $keys[] = `keyframe -q -valueChange $animCrvName`;
- // 比較して、値に変化があるアニメーションカーブを選択解除
- // キーが1つしか無いものも変化の無いキーと言えますね
- for( $key in $keys ){
- if( $keys[0] != $key){
- selectKey -rm $animCrvName;
- $deleteAnimCrvCount--;
- break;
- }
- }
- }
- print ($deleteAnimCrvCount + " / " + `size($animCrvNames)` + " 個の AnimCurve は値に変化がありません");
- }
- proc SelectStaticKey(){
- string $window = "SelectStaticKey";
- if(`window -exists $window`) deleteUI $window;
- window -title $window -width 300 -toolbox true $window;
- columnLayout -columnAttach "both" 5 -rowSpacing 10 -columnWidth 250;
- frameLayout -label "使い方" -cl true -cll true -bgc 0 0 0;
- text -l "グラフエディタで多くのキーを選択して実行。";
- text -l "キーの値の変化がないカーブだけが選択される。";
- text -l "これは、不要なキーを削減するのに役立つ。";
- setParent ..;
- //floatSliderGrp -l "しきい値" -field true -adj 1 -min 0 -max 0.1 -precision 3 -value 0.01 "ReductKeySample";
- button -l "Select ( ^ _ ^ )" -command "SelectStaticKey_Exec" -ann "選択したキーの内、変化の無いキーだけを選択維持する";
- showWindow $window;
- }
- SelectStaticKey();
Add Comment
Please, Sign In to add comment