PDA

View Full Version : Finding stepped keys


Tudor
02-20-2003, 09:48 AM
I have a problem.
Stepped keys does not work in our game engine.
Many cutscenes are done all the way to the exporting phase, where everything goes to hell because of this.

Is there a way to find stepped keys in a scene/object and remove them?
I cannot select all keys and turn them into splines, as they are carefully weighted.

sp0rk3d
02-20-2003, 04:56 PM
i am not that great at scripting but it seems to me that you can make a for loop and query the animation curves keframe tangents and delete the ones that are steped....
maybe someone could write that script really quick??... i might give it a go but it would take me a day to get it to work...

/me is slow at scripting... :/

Tudor
02-21-2003, 07:26 AM
ouch.. well.. I jsut suck at scripting, so there is no way I could do it :(

wrend
02-21-2003, 10:16 AM
yeah there is,

here, ill give you some ingredients:

ls (-sl -dag)
listConnections (-s 1 -type animCurve)
findKeyframe (-t x -w next)
keyTangent (-t x -q -ott)
cutKey (-t x -o keys)
and the flour: for, if.

... look up the commands, and check the flags i think you'll find relevant (in ()s).

you might find your animatn gets totally screwed when you moved the steps keys anyway...you'll have to experiment.

see how you go!

Tudor
02-21-2003, 11:23 AM
thanks! :)

I'll get one of the coders to take a look at it..

And I won't remove the keys, just change them to linear or something.

Doogie
02-21-2003, 05:24 PM
Done a bit of programming in the past, and am looking to work better in MEL so I wrote a lil code to get ya started. It lists all the keyframes and types for translate x, y, and z.

I think you need a keyframe at 1 for it to check if it's an animation curve.

just change the variable name to your object (a camera, i guess)


string $animObject = "pSphere1";
string $timeRange = "1.0:1.0";
float $key[] = `keyframe -at ty -q -timeChange $animCurve`;
string $inTangentType[], $outTangentType[];
string $orient;
string $objectOrient = $animObject + "." + $orient;

for ( $x = 1; $x < 4; $x++ )
{

if ($x == 1)
$orient = "translateX";
else if ($x == 2)
$orient = "translateY";
else if ($x == 3)
$orient = "translateZ";

if (`connectionInfo -isDestination $objectOrient`)
{
string $animCurve = `connectionInfo -sourceFromDestination $objectOrient`;
string $regularExpr = "\.output$";
$animCurve = `substitute $regularExpr $animCurve ""`;
string $query = `nodeType $animCurve`;

if (0 == (strcmp("animCurveTL", $query)))
{

if (`keyframe -t $timeRange -q -keyframeCount $objectOrient`)
{
$inTangentType = `keyTangent -t $timeRange -q -inTangentType $animCurve`;
$outTangentType = `keyTangent -q -outTangentType $animCurve`;

print ("\n" +$orient + "\n");
print $key;
print $outTangentType;

// MEL to change keys to spline keys //
//keyTangent -t $timeRange -ott spline pSphere1_translateZ;
}
}
}
}

Tudor
02-24-2003, 07:24 AM
thanks :)

I actually even understand the script. There should be no problems to get i to work!

CGTalk Moderation
01-14-2006, 11:00 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.