global proc redundantKeys() { string $curves[] = `keyframe -q -name -sl` ; // get all selected animCurve Nodes string $crv ; int $idxDelete[]; string $crvDelete[]; // for each curve for ($crv in $curves) { // get selected key indices int $idxs[] = `keyframe -q -indexValue -sl $crv` ; int $idx ; // for each key (by index) for ($idx in $idxs) { // How many keys on this curve? int $total = `keyframe -q -keyframeCount $crv` ; // Figure current Time and Value // float $valCs[] = `keyframe -a -index $idx -q -valueChange $crv` ; float $timeCs[] = `keyframe -index $idx -q -timeChange $crv` ; float $valPs[] = $valCs ; float $valNs[] = $valCs ; float $timePs[] = $timeCs ; float $timeNs[] = $timeCs ; // Figure prev Time and Value // if ($idx > 0) { $valPs = `keyframe -a -index ($idx-1) -q -valueChange $crv` ; $timePs = `keyframe -index ($idx-1) -q -timeChange $crv` ; } else continue; // Figure next Time and Value // if ($idx < $total-1) { $valNs = `keyframe -a -index ($idx+1) -q -valueChange $crv` ; } else continue; float $valC = $valCs[0] ; float $valP = $valPs[0] ; float $valN = $valNs[0] ; float $timeC = $timeCs[0] ; float $timeP = $timePs[0] ; float $timeN = $timeNs[0] ; // if no value change between this key and prev and next then mark for delete // print $valC; if ($valC == $valP && $valC == $valN) { $idxDelete[size($idxDelete)] = $idx; // record index $crvDelete[size($crvDelete)] = $crv; // on this curve } } } // delete keys // selectKey -cl; // dump current selection so cutKeys can work // select them all for ($i=0;$i