Hey Man, I am really sorry. I wrote a very long description explaining to you how to write this script.
But after I tried to edit it, it got lost and It would take me too long to write it again.
So I only post you the script and I'm sure you will figure it out.
this script works on every object selected, and runs through the range slider assigning a pre-defined
value to the Z rotation at each frame. The rotate attribute will also be baked during the process.
float $newValue = 8.5;
//rotation value
string $attribute = ".rotateZ";
//attribute affected
string $selectedItems[] = `ls -sl`;
float $minTime = `playbackOptions -q -minTime`;
float $maxTime = `playbackOptions -q -maxTime`;
// get range slider
currentTime -edit $minTime;
//jumps to beginning of range slider before starting
for ($i = $minTime; $i <= $maxTime; $i++)
{
//for every frame within the range slider
float $time = `currentTime -q`;
//gets the current frame
for ($item in $selectedItems)
{
//for every selected objects
float $currentValue = `getAttr ($item + $attribute)`;
setAttr ($item + $attribute) ($currentValue + $newValue);
setKeyframe ($item + $attribute);
// process and bakes the rotation of the selected items
}
currentTime -edit ($time + 1);
//go to the next frame
}
Hope this helps,
Cheers
Dino