PDA

View Full Version : setKeyframe using a loop


richm
11-11-2004, 05:16 PM
hi guys!
Im having some trouble with this script i wrote. i want to be able to set keyframes at certain times by using an increment variable.
only problem is that the currentTime command doesnt seem to like the idea of using an increment variable, and each time i query the currentTime it always returns 0. The currentTime works in an array of numbers like so:


int $array[4] = { 1, 2, 3, 4, 5 };
currentTime -edit $array[0];
currentTime -edit $array[1];
currentTime -edit $array[2]; and so on ...


but it doesnt work here


string $current_selection[] = `ls -selection`;
string $selected = $current_selection[0];
int $increment_frame[];
int $increment = 10;
int $frame_count = 200;
int $i;

for( $i = 0; $i < $frame_count + $increment; $i += $increment )
{
select $selected;
setKeyframe;
currentTime -edit $increment_frame[$i];
}
};


i was thinking of creating a reference, but MEL doesnt seem to support that ?

I hope someone can help? :)
Any other solutions to the problem would be greatly appreciated, but im really hoping that someone can figure out how to increment the currentTime but using a increment variable as the element of a variable :)


currentTime -edit $ourVariable[$counterVariable];

cheers :)

failure
11-11-2004, 06:33 PM
You are overcomplicating it.
Select something and run:



int $increment = 10;
int $frame_count = 200;
int $i;

for( $i = 0; $i < $frame_count + $increment; $i += $increment ){
currentTime -edit $i;
setKeyframe;
}

richm
11-14-2004, 05:51 AM
hey sorry for the long reply :)
oh how obvious!!! how stupid of me! :)
thanks for helping :)
cheers :)

CGTalk Moderation
01-19-2006, 08:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.