PDA

View Full Version : New To Code Help


kcpsychman
11-10-2007, 12:17 AM
Hello. Simple question here. I am just starting trying to learn code, so my appologies for the noob question. I have used the split polygon tool on 300 somthing objects and created an offset. I want that offset to be animated so I would like to make maybe two short scripts, one for the starting keyframe and one for the ending keyframe. My process would be selecting one of the 300 polygon models, setting the time slider at starting point, hit the first script button to set the key for the first frame, move time slider to end and hit second script button to set a key at the end. I'm sure that whole process could be automated, but I thought I would start as simple as possible.

//starting key
int $i
setAttr "polyCut$i.extractOffsetX" 0;
setKeyframe "polyCut$i.extractOffset";

//ending key
int $i
setAttr "polyCut$i.extractOffsetX" 7.874;
setKeyframe "polyCut$i.extractOffset";

GiantG
11-10-2007, 11:17 AM
You don't have to change the Timeslider to key on different times. You can set the keys directly.

Check this out...

{
select "polyCut*";
string $PolyCutNodes[] = `ls- sl`;

for ($i= 0; $i < size($PolyCutNodes); $i++)
{
setKeyframe -time 0 -value 0 -at "extractOffsetX";
setKeyframe -time 100 -value 7.874 -at "extractOffsetX";
}
}

Cheerz...

kcpsychman
11-12-2007, 06:24 AM
Thank you very much GiantG. I have a lot to learn in the way of code.

KC

CGTalk Moderation
11-12-2007, 06:24 AM
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.