Message 1 of 1
Maya 2022 keeps crashing when I run ackNegateKeys script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone!
My Maya 2022 keeps crashing without any error messages every time I try to run the ackNegateKeys script. Does anyone have any suggestions about what to do to fix it? Any other script works fine. Here is the code:
global proc ackNegateKeys() {
global string $ackSetup_pivot;
//set default value if variable doesn't exist
if ($ackSetup_pivot == ""){
$ackSetup_pivot = "left";
}
//only run if at least one key is selected
$keyCount = `keyframe -an keys -q -keyframeCount`;
if ($keyCount != 0) {
float $pivotTime;
float $pivotValue[];
if ($ackSetup_pivot == "last"){
$pivotValue = `keyframe -lastSelected -q -valueChange`;
}
//loop over selected curves and process independently
string $selectedCurves[] = `keyframe -selected -q -name`;
for ($c = 0; $c < size($selectedCurves); $c++){
//channel to use for this pass
$channel = $selectedCurves[$c];
//get array of key times in selection (to find closest match key)
$timeArray = `keyframe -selected -q -timeChange $channel`;
//find first frame time
$lastkey = `keyframe -q -lastSelected $channel`;
$firstKey = $lastkey[0];
for ($j = 0; $j < size($timeArray); $j++){
if ($timeArray[$j] < $firstKey){
$firstKey = $timeArray[$j];
}
}
switch ($ackSetup_pivot){
case "left":
$pivotTime = `findKeyframe -which "previous" -time $timeArray[0] $channel`;
$pivotValue = `keyframe -time $pivotTime -q -valueChange $channel`;
break;
case "right":
int $lastKey = size($timeArray) - 1;
$pivotTime = `findKeyframe -which "next" -time $timeArray[$lastKey] $channel`;
$pivotValue = `keyframe -time $pivotTime -q -valueChange $channel`;
break;
}
//flip it (selected only)
$selected = `keyframe -selected -q -indexValue $channel`;
for ($i = 0; $i < size($selected); $i++){
scaleKey -index $selected[$i] -valuePivot $pivotValue[0] -valueScale -1 $channel;
}
}
}
}
I attached a screenshot with the hotkey for this script. The application crashes right after hitting Alt+S